Solved

passing string value to Data Access Layer

Posted on 2013-01-23
2
415 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
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 500 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
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…

786 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