コード例 #1
0
ファイル: DSCWS.asmx.cs プロジェクト: bsimp6983/BackupDashes
        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
0
ファイル: DSCWS.asmx.cs プロジェクト: bsimp6983/BackupDashes
        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
0
ファイル: DSCWS.asmx.cs プロジェクト: bsimp6983/BackupDashes
        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;
            }
        }