Beispiel #1
0
 private void btn_addressdel_Click(object sender, EventArgs e)
 {
     try
     {
         if (gvaddress.DataRowCount > 0)
         {
             int idx       = (int)gvaddress.GetFocusedRowCellValue("id");
             var ds        = (List <T_Customer_address>)gvaddress.DataSource;
             var addressid = gvaddress.FocusedRowHandle;
             if (idx <= 0)
             {
                 ds.RemoveAt(addressid);
                 gvaddress.RefreshData();
             }
             else
             {
                 if (XtraMessageBox.Show("是否删除选中的收货地址", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
                     var address = ds.Find(a => a.id == idx);
                     var client  = new CRMServiceClient();
                     client.DelCustomerAddress(address);
                     ds.RemoveAt(addressid);
                     gvaddress.RefreshData();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
 private void btn_addressdel_Click(object sender, EventArgs e)
 {
     try
     {
         if (gvaddress.DataRowCount > 0)
         {
             int idx = (int)gvaddress.GetFocusedRowCellValue("id");
             var ds = (List<T_Customer_address>)gvaddress.DataSource;
             var addressid = gvaddress.FocusedRowHandle;
             if (idx <= 0)
             {
                 ds.RemoveAt(addressid);
                 gvaddress.RefreshData();
             }
             else
             {
                 if (XtraMessageBox.Show("是否删除选中的收货地址", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
                     var address = ds.Find(a => a.id == idx);
                     var client = new CRMServiceClient();
                     client.DelCustomerAddress(address);
                     ds.RemoveAt(addressid);
                     gvaddress.RefreshData();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }