Beispiel #1
0
 private void btn_contactdel_Click(object sender, EventArgs e)
 {
     try
     {
         if (gvcontacts.DataRowCount > 0)
         {
             var ds        = (List <T_Customer_contacts>) this.gvcontacts.DataSource;
             int idx       = (int)gvcontacts.GetFocusedRowCellValue("id");
             var contactid = gvcontacts.FocusedRowHandle;
             if (idx <= 0)
             {
                 ds.RemoveAt(contactid);
                 gvcontacts.RefreshData();
             }
             else
             {
                 if (XtraMessageBox.Show("是否删除已保存的联系人", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                 {
                     T_Customer_contacts contacts = ds.Find(c => c.id == idx);
                     var client = new CRMServiceClient();
                     client.DelCustomerContact(contacts);
                     ds.RemoveAt(contactid);
                     gvcontacts.RefreshData();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
 private void btn_contactdel_Click(object sender, EventArgs e)
 {
     try
     {
         if (gvcontacts.DataRowCount > 0)
         {
             var ds = (List<T_Customer_contacts>)this.gvcontacts.DataSource;
             int idx = (int)gvcontacts.GetFocusedRowCellValue("id");
             var contactid = gvcontacts.FocusedRowHandle;
             if (idx <= 0)
             {
                 ds.RemoveAt(contactid);
                 gvcontacts.RefreshData();
             }
             else
             {                        
                 if (XtraMessageBox.Show("是否删除已保存的联系人", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                 {
                     T_Customer_contacts contacts = ds.Find(c => c.id == idx);
                     var client = new CRMServiceClient();
                     client.DelCustomerContact(contacts);
                     ds.RemoveAt(contactid);
                     gvcontacts.RefreshData();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }