本文整理汇总了C#中DowntimeCollection_Demo.DB.AddToOptionInfoes方法的典型用法代码示例。如果您正苦于以下问题:C# DB.AddToOptionInfoes方法的具体用法?C# DB.AddToOptionInfoes怎么用?C# DB.AddToOptionInfoes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DowntimeCollection_Demo.DB
的用法示例。
在下文中一共展示了DB.AddToOptionInfoes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateOptionInfo
public string UpdateOptionInfo()
{
string op1Name = request.Params["opt1Name"];
string op1Required = request.Params["opt1Required"];
string op1Enabled = request.Params["opt1Enabled"];
string op2Name = request.Params["opt2Name"];
string op2Required = request.Params["opt2Required"];
string op2Enabled = request.Params["opt2Enabled"];
using (DB db = new DB(DBHelper.GetConnectionString(_currentClient)))
{
OptionInfo opt1 = (from o in db.OptionInfoes
where o.Number == 1
&& o.Client == _currentClient
select o).FirstOrDefault();
OptionInfo opt2 = (from o in db.OptionInfoes
where o.Number == 2
&& o.Client == _currentClient
select o).FirstOrDefault();
if (opt1 == null)
{
opt1 = new OptionInfo()
{
Client = _currentClient,
Number = 1
};
db.AddToOptionInfoes(opt1);
}
if (opt2 == null)
{
opt2 = new OptionInfo()
{
Client = _currentClient,
Number = 2
};
db.AddToOptionInfoes(opt2);
}
opt1.IsRequired = Convert.ToBoolean(op1Required);
opt1.Enabled = Convert.ToBoolean(op1Enabled);
opt1.Name = op1Name;
opt2.IsRequired = Convert.ToBoolean(op2Required);
opt2.Enabled = Convert.ToBoolean(op2Enabled);
opt2.Name = op2Name;
return (db.SaveChanges() > 0).ToString();
}
}