示例#1
0
        /// <summary>
        /// 删除
        /// </summary>
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            bool deleted = false;

            try
            {
                using (ContractProvider contProvider = new ContractProvider())
                {
                    foreach (GridViewRow row in List.Rows)
                    {
                        HtmlInputCheckBox rowCheckControl = (HtmlInputCheckBox)row.FindControl("RowCheck");
                        if (rowCheckControl.Checked)
                        {
                            string custNo = List.DataKeys[row.RowIndex]["rccust"].ToString().Trim();

                            contProvider.DeleteCustomer(custNo);

                            //有项被删除
                            deleted = true;
                        }
                    }
                }
            }
            catch (Exception error)
            {
                this.ShowErrorMessage(this.GetGlobalResourceString("DeleteErrorMessage") + error.Message);
                return;
            }

            if (deleted)
            {
                this.BindList();
            }
            else
            {
                this.ShowInfoMessage(this.GetGlobalResourceString("NotSelectMessage"));
            }
        }