示例#1
0
 private void sbtnDel_Click(object sender, System.EventArgs e)
 {
     if (this.dataGrid1.CurrentRowIndex >= 0)
     {
         string       strGoodsID = dataGrid1[dataGrid1.CurrentRowIndex, 0].ToString();
         DialogResult strRes     = MessageBox.Show("确定要删除“" + strGoodsID + "”吗?", "请确认", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
         if (strRes == DialogResult.Yes)
         {
             err = null;
             cs.DeleteGoods(strGoodsID, out err);
             if (err != null)
             {
                 MessageBox.Show("删除商品信息失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                 clog.WriteLine(err);
                 this.DgBind();
             }
             else
             {
                 MessageBox.Show("删除商品信息成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                 err = null;
                 SysInitial.CreatDS(out err);
                 if (err != null)
                 {
                     MessageBox.Show("系统出错,将自动关闭,稍后请重新登录系统!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                     Application.Exit();
                 }
                 this.DgBind();
             }
         }
     }
 }