我只是坚持将我的字符串变量传递给我的数据访问层。
这是我的主控制台
class Program
{
static void Main(string[] args)
{
String BookingTime="1000345";
var BookingStart = new SchedSAPEntities.ResourceBookingEntity.ResourceBooking(string Bookingtime);
}
}
SchedSAPEntities.ResourceBookingEntity.ResourceBooking(string Bookingtime);//Am 尝试将字符串变量 (1000345) 传递给 ResourceBooking 方法。
这是我的数据访问层
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();
}
}
不需要将类型传递到方法中,请记住 C# 区分大小写。
static void Main(string[] args)
{
String BookingTime="1000345";
var BookingStart = new SchedSAPEntities.ResourceBookingEntity.ResourceBooking(BookingTime);
}