Solved

passing string value to Data Access Layer

Posted on 2013-01-23
2
413 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 74

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now