Example #1
0
        public void Insert(SchedulerHistory history)
        {
            using (var model = new gb_dvsstagingEntities())
            {
                var newHistory = new dvs_schedulershistory
                {
                    CreatedBy = history.CreatedBy,
                    CreatedOn = history.CreatedOn,

                    StartedOn  = history.StartedOn,
                    FinishedOn = history.FinishedOn,

                    IsByError    = history.IsByError,
                    ErrorMessage = history.ErrorMessage,

                    AdditionalInfo = history.AdditionalInfo,

                    ArrivalMessageId = history.ArrivalMessageId,
                    ProductId        = history.ProductId,

                    Type = history.Type,

                    IsActive = true
                };

                model.dvs_schedulershistory.Add(newHistory);
                model.SaveChanges();
            }
        }
Example #2
0
 public override void Excute(string args)
 {
     // create history
     _schedulerHistory = SchedulerHistoryServices.Create(Id, Name.ToUpper(), false, string.Empty, string.Empty, DateTime.Now, DateTime.MaxValue);
     // start process
     if (_schedulerHistory == null)
     {
         return;
     }
     // log start
     SchedulerLogServices.Create(_schedulerHistory.Id, "START");
     try
     {
         // progress
         DoTaskSample("TaskSample InProgress");
     }
     catch (Exception ex)
     {
         // log exception
         SchedulerLogServices.Create(_schedulerHistory.Id, "EXCEPTION: {0}".FormatWith(ex.ToString()));
     }
     finally
     {
         // log end
         SchedulerLogServices.Create(_schedulerHistory.Id, "END");
     }
 }
Example #3
0
 private void Insert()
 {
     try
     {
         var util             = new Util();
         var schedulerHistory = new SchedulerHistory();
         int schedulerId;
         if (int.TryParse(cbxScheduler.SelectedItem.Value, out schedulerId))
         {
             schedulerHistory.SchedulerId = schedulerId;
         }
         if (!string.IsNullOrEmpty(txtDescription.Text))
         {
             schedulerHistory.Description = txtDescription.Text.Trim();
         }
         schedulerHistory.HasError = chkHasError.Checked;
         if (!string.IsNullOrEmpty(txtErrorMessage.Text))
         {
             schedulerHistory.ErrorMessage = txtErrorMessage.Text.Trim();
         }
         if (!string.IsNullOrEmpty(txtErrorDescription.Text))
         {
             schedulerHistory.ErrorDescription = txtErrorDescription.Text.Trim();
         }
         if (!util.IsDateNull(txtStartTime.SelectedDate))
         {
             schedulerHistory.StartTime = txtStartTime.SelectedDate;
         }
         if (!util.IsDateNull(txtEndTime.SelectedDate))
         {
             schedulerHistory.EndTime = txtEndTime.SelectedDate;
         }
         SchedulerHistoryServices.Create(schedulerHistory);
     }
     catch (Exception ex)
     {
         Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(ex.Message));
     }
 }