?
Solved

passing string value to Data Access Layer

Posted on 2013-01-23
2
Medium Priority
?
422 Views
Last Modified: 2013-02-11
Hi All

Am just stuck to pass my string variable to my Data Access layer.

here is my main console

     class Program
    {
        static void Main(string[] args)
        {  
                String BookingTime="1000345";
                var BookingStart = new SchedSAPEntities.ResourceBookingEntity.ResourceBooking(string Bookingtime);
       }
}

SchedSAPEntities.ResourceBookingEntity.ResourceBooking(string Bookingtime);//Am trying to pass the string variable (1000345) to ResourceBooking method.

Here is my Data access Layer

     public class ResourceBookingEntity
    {
        public class ResourceBooking
        {
            private String _PRJ_ID;
                       
            public ResourceBooking(String APRJ_ID )
            {
                _PRJ_ID = APRJ_ID;
                
            }
            public String PRJ_ID { get { return _PRJ_ID; } }
            }
    }


      public class ResourceBookingList : List<SchedSAPEntities.ResourceBookingEntity.ResourceBooking>
        {
            public ResourceBookingList(SchedwinEntities db)
            {
                    var query =
                    (from PROJECTS in db.PROJECTS
                     join WOes in db.WOes on PROJECTS.PRJ_ID equals WOes.PRJ_ID
                     join SEVT_EX in db.SEVT_EX on SEVTs.SESID equals SEVT_EX.SESID into SEVT_EX_join
                     from SEVT_EX in SEVT_EX_join.DefaultIfEmpty()
                     where
                       (new string[] { "1", "2" }).Contains((PROJECTS.STAT.TrimEnd()).TrimStart()) &&
                       (WOes.STAT.TrimEnd()).TrimStart() == "6" &&
                       ((SEVTs.RESTYPE == 5 ||
                       SEVTs.RESTYPE == 0) &&
                       **SEVTs.T_START.TrimStart() == BookingStart**//Am trying to pass the value here
                     orderby
                       PROJECTS.PRJ_ID,
                       WOes.WONUM
                     select new
                     {
                         PROJECTS.PRJ_ID,
                                                 
                     }).Take(10);
                foreach (var r in query)
                    Add(new SchedSAPEntities.ResourceBookingEntity.ResourceBooking(
                        r.PRJ_ID, r.USER3, r.USER9, r.WONUM));
                        var ResourceBooking = query.ToList();
            }
        }

Open in new window

0
Comment
Question by:Sha1395
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38812935
Are you receiving an error of some sort?
0
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 2000 total points
ID: 38814059
You only specify the data type when you define the method, not when you call it.

Remove the string keyword:

var BookingStart = new SchedSAPEntities.ResourceBookingEntity.ResourceBooking(Bookingtime);

Open in new window

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question