예제 #1
0
 public CommandResult Update(Shift info)
 {
     Shift original = ProviderFactory.Create<IShiftProvider>(_RepoUri).GetByID(info.ID).QueryObject;
     if (original != null)
     {
         if (info.Items != null && info.Items.Count > 0) info.Items.ForEach(item => item.ShiftID = info.ID);
         return ProviderFactory.Create<IShiftProvider>(_RepoUri).Update(info, original);
     }
     else
     {
         return new CommandResult(ResultCode.NoRecord, ResultCodeDecription.GetDescription(ResultCode.NoRecord));
     }
 }
예제 #2
0
 public CommandResult Add(Shift info)
 {
     string id = ProviderFactory.Create<IStringIDCreater>(_RepoUri).CreateID("S", 3, "Shift");
     if (!string.IsNullOrEmpty(id))
     {
         info.ID = id;
         if (info.Items != null && info.Items.Count > 0) info.Items.ForEach(item => item.ShiftID = id);
         return ProviderFactory.Create<IShiftProvider>(_RepoUri).Insert(info);
     }
     else
     {
         return new CommandResult(ResultCode.Fail, "创建ID失败");
     }
 }
예제 #3
0
 public CommandResult Delete(Shift info)
 {
     return ProviderFactory.Create<IShiftProvider>(_RepoUri).Delete(info);
 }
예제 #4
0
 protected override object GetItemFromInput()
 {
     Shift shift = UpdatingItem as Shift;
     if (shift == null)
     {
         shift = new Shift();
     }
     shift.Name = txtName.Text;
     shift.ShortName = txtShortName.Text;
     if (shift.Items == null) shift.Items = new List<ShiftItem>();
     shift.Items.Clear();
     foreach (DataGridViewRow row in this.dataGridView1.Rows)
     {
         shift.Items.Add(row.Tag as ShiftItem);
     }
     return shift;
 }