我是 dhtmlx 调度程序的初学者,我使用 dbfirst 和 mvc4 razor 语法。所以请任何人都可以帮我设置我从数据库中获取的开始时间和结束时间值:这是我的代码:
控制器:
sched.Config.first_hour = 8;
sched.Config.last_hour = 19;
public string GetDbValues()
{
string strState = "";
List<tblSettings> settings = new List<tblSettings>();
settings = _config.GetSettings();
var defaultState = from setting in settings
where (setting.Desc == "start time"
|| setting.Desc == "end time")
// starttime as 08 and end time as 20 from database
select setting.Settings;
foreach (var oState in defaultState)
{strState += oState + "|";
}
strState = strState.Remove(strState.Length - 1);
return strState;
}
我从输出中获取 first_hour 和 last_hour 的值作为字符串。如何将此字符串值分配给 first_hour 和 last_hour?
//由于表结构,我使用linq获取db值:ID(int),Settings(nvarchar),Desc(nvarchar)