Asp.net mvc 4 MVC4中的Dhtmlx调度程序
我正在MVC项目中使用dhtmlx调度程序。我的问题是我需要在调度程序中阻止前几天。例如,今天是星期一意味着星期一之前的前一天应该被阻止。有人能帮我吗? 提前谢谢 我在下面添加了我的代码Asp.net mvc 4 MVC4中的Dhtmlx调度程序,asp.net-mvc-4,Asp.net Mvc 4,我正在MVC项目中使用dhtmlx调度程序。我的问题是我需要在调度程序中阻止前几天。例如,今天是星期一意味着星期一之前的前一天应该被阻止。有人能帮我吗? 提前谢谢 我在下面添加了我的代码 public ActionResult CalendarView( int id , tblUser user ) { string val = System.Configuration.ConfigurationManager.AppSettings["U
public ActionResult CalendarView( int id , tblUser user )
{
string val = System.Configuration.ConfigurationManager.AppSettings["UserTypeId"];
int code = Convert.ToInt32(val);
Session["Butype"] = val;
var cal = (from s
in db.tblUsers
where s.UserTypeId == code && s.UserID == id
select new Appt
{
BusinessName = s.tblBusinessCategory.BusinessName,
StartTime = s.WorkingHour.StartTime
}).FirstOrDefault();
Session["BUName"] = cal.BusinessName.ToString();
var scheduler = new DHXScheduler(this);
scheduler.Skin = DHXScheduler.Skins.Flat;
scheduler.Data.Loader.PreventCache();
scheduler.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Week);
scheduler.Extensions.Add(SchedulerExtensions.Extension.Recurring);
//scheduler.Extensions.Add(SchedulerExtensions.Extension.ActiveLinks);
//scheduler.Extensions.Add(SchedulerExtensions.Extension.Collision);
//scheduler.Extensions.Add(SchedulerExtensions.Extension.Limit);
scheduler.LoadData = true;
scheduler.EnableDataprocessor = true;
scheduler.Config.show_loading = true;
// scheduler.BeforeInit.Add("schedulerClient.init()");
Session["BUId"] = id;
var parameter = new SqlParameter[1];
parameter[0] = new SqlParameter { ParameterName = "UserId", Value = id };
List<Appt> cm = new List<Appt>();
using (SYTEntities context = new SYTEntities())
{
cm = context.Database.SqlQuery<Appt>("exec spHoliday @UserId", parameter).ToList();
}
int iyear = 2015;
int imonth = 8;
int iday = 09;
foreach (var cp in cm)
{
iyear = cp.HolidayDate.Year;
imonth = cp.HolidayDate.Month;
iday = cp.HolidayDate.Day;
scheduler.TimeSpans.Add(new DHXMarkTime()
{
StartDate = new DateTime(iyear, imonth, iday), //new DateTime(2015, 8, 06), //hl.HolidayDate ?? default(DateTime),
EndDate = new DateTime(iyear, imonth, iday + 1),
// Day = DayOfWeek.Friday,
CssClass = "red_section",
HTML = "hos",
SpanType = DHXTimeSpan.Type.BlockEvents
});
}
scheduler.BeforeInit.Add("schedulerClient.init()");
return View(scheduler);
}
public ActionResult日历视图(int-id,tblUser用户)
{
字符串val=System.Configuration.ConfigurationManager.AppSettings[“UserTypeId”];
int code=Convert.ToInt32(val);
会话[“Butype”]=val;
var cal=(来自s)
在db.tblUsers中
其中s.UserTypeId==code&&s.UserID==id
选择新应用程序
{
BusinessName=s.tblBusinessCategory.BusinessName,
StartTime=s.WorkingHour.StartTime
}).FirstOrDefault();
会话[“BUName”]=cal.BusinessName.ToString();
var调度程序=新的DHXScheduler(此);
scheduler.Skin=DHXScheduler.Skins.Flat;
scheduler.Data.Loader.PreventCache();
scheduler.EnableDynamicLoading(SchedulerDataLoader.DynamicLoadingMode.Week);
scheduler.Extensions.Add(schedulerextension.Extension.recurtive);
//scheduler.Extensions.Add(schedulerextension.Extension.ActiveLinks);
//scheduler.Extensions.Add(schedulerextension.Extension.Collision);
//scheduler.Extensions.Add(schedulerextension.Extension.Limit);
scheduler.LoadData=true;
scheduler.EnableDataprocessor=true;
scheduler.Config.show_load=true;
//scheduler.BeforeInit.Add(“schedulerClient.init()”);
会话[“BUId”]=id;
var参数=新的SqlParameter[1];
参数[0]=newsqlparameter{ParameterName=“UserId”,Value=id};
列表cm=新列表();
使用(Sytenties上下文=新Sytenties())
{
cm=context.Database.SqlQuery(“exec spHoliday@UserId”,参数).ToList();
}
国际年=2015年;
int-imonth=8;
国际日=09;
foreach(var cp,单位为厘米)
{
iyear=cp.HolidayDate.Year;
imonth=cp.HolidayDate.Month;
iday=cp.HolidayDate.Day;
scheduler.TimeSpans.Add(新的DHXMarkTime()
{
StartDate=new DateTime(iyear,imonth,iday),//new DateTime(2015,8,06),//hl.HolidayDate??默认值(DateTime),
EndDate=新的日期时间(iyear、imonth、iday+1),
//Day=星期五,星期五,
CssClass=“红色部分”,
HTML=“hos”,
SpanType=DHXTimeSpan.Type.BlockEvents
});
}
scheduler.BeforeInit.Add(“schedulerClient.init()”);
返回视图(调度程序);
}