Пример #1
0
 private void btnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         IList <CallBoxInfo> AllCallBox = bsDetail.List as IList <CallBoxInfo>;
         int NewBoxID = 1;
         if (AllCallBox != null && AllCallBox.Count > 0)
         {
             NewBoxID = AllCallBox.Max(p => p.CallBoxID) + 1;
         }
         CallBoxInfo NewBoxInfo = new CallBoxInfo();
         NewBoxInfo.CallBoxID = NewBoxID;
         NewBoxInfo.IsNew     = true;
         using (FrmCallBoxDetail frm = new FrmCallBoxDetail(AllCallBox, NewBoxInfo))
         {
             frm.ShowDialog();
             if (frm.DialogResult == DialogResult.OK)
             {
                 bsDetail.DataSource = AGVDAccess.AGVClientDAccess.LoadAllCallBoxs();
                 bsDetail.ResetBindings(false);
             }
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
Пример #2
0
 private void btnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         IList <CallBoxInfo> AllCallBox = bsDetail.List as IList <CallBoxInfo>;
         CallBoxInfo         NewBoxInfo = bsDetail.Current as CallBoxInfo;
         if (NewBoxInfo != null)
         {
             NewBoxInfo.IsNew          = false;
             NewBoxInfo.CallBoxDetails = AGVDAccess.AGVClientDAccess.LoadCallBoxDetails(NewBoxInfo);
             using (FrmCallBoxDetail frm = new FrmCallBoxDetail(AllCallBox, NewBoxInfo))
             {
                 frm.ShowDialog();
                 if (frm.DialogResult == DialogResult.OK)
                 {
                     bsDetail.DataSource = AGVDAccess.AGVClientDAccess.LoadAllCallBoxs();
                     bsDetail.ResetBindings(false);
                 }
             }
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }