本文整理汇总了C#中DowntimeCollection_Demo.DB.AddToCaseCountSet方法的典型用法代码示例。如果您正苦于以下问题:C# DB.AddToCaseCountSet方法的具体用法?C# DB.AddToCaseCountSet怎么用?C# DB.AddToCaseCountSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DowntimeCollection_Demo.DB
的用法示例。
在下文中一共展示了DB.AddToCaseCountSet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCaseCount
public bool CreateCaseCount(DateTime? eventStart, DateTime? eventStop, int caseCount, string line, string client)
{
try
{
using (DB db = new DB())
{
int id;
if (!eventStart.HasValue || !eventStop.HasValue)
return false;
CaseCount count = new CaseCount();
count.CaseCount1 = caseCount;
count.Client = client;
count.EventStart = eventStart;
count.EventStop = eventStop;
count.Line = line;
db.AddToCaseCountSet(count);
db.SaveChanges();
id = count.Id;
bool result = id > 0;
if (result)
{
DBHelper.UpdateAscommPing(client, DateTime.Now, line, true);
}
return result;
}
}
catch (Exception ex)
{
String fileName = this.Server.MapPath("~/App_Data/log.txt");
File.AppendAllText(fileName, ex.ToString());
throw;
}
}
示例2: InsertCaseCount
public bool InsertCaseCount(string str_eventStart, string str_eventStop, int caseCount, string line, string client)
{
try
{
using (DB db = new DB())
{
DateTime eventStart, eventStop;
if (!DateTime.TryParse(str_eventStart, out eventStart) || !DateTime.TryParse(str_eventStop, out eventStop))
{
return false;
}
CaseCount count = new CaseCount();
count.CaseCount1 = caseCount;
count.Client = client;
count.EventStart = eventStart;
count.EventStop = eventStop;
count.Line = line;
db.AddToCaseCountSet(count);
bool result = db.SaveChanges() > 0;
if (result == true)
{
DBHelper.UpdateAscommPing(client, DateTime.Now, line, true);
}
return result;
}
}
catch (Exception ex)
{
String fileName = this.Server.MapPath("~/App_Data/log.txt");
File.AppendAllText(fileName, ex.ToString());
throw ex;
}
}
示例3: CreateTComCaseCount
public int CreateTComCaseCount(string eStart, string eStop, int caseCount, string line, string client)
{
try
{
int result;
if (string.IsNullOrEmpty(eStart) || string.IsNullOrEmpty(eStop))
return -1;
DateTime eventStart;
DateTime eventStop;
if (!DateTime.TryParse(eStart, out eventStart))
return -1;
if (!DateTime.TryParse(eStop, out eventStop))
return -1;
if (eventStop < eventStart)
return -1;
using (DB db = new DB())
{
int id;
CaseCount count = new CaseCount();
count.CaseCount1 = caseCount;
count.Client = client;
count.EventStart = eventStart;
count.EventStop = eventStop;
count.Line = line;
db.AddToCaseCountSet(count);
db.SaveChanges();
id = count.Id;
result = id;
if (result > 0)
{
DBHelper.UpdateAscommPing(client, DateTime.Now, line, true);
}
return result;
}
}
catch (Exception ex)
{
String fileName = this.Server.MapPath("~/App_Data/log.txt");
File.AppendAllText(fileName, ex.ToString());
return -1;
}
}