Esempio n. 1
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("customer_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.Customer bll = new BLL.Customer();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除客户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
                       Utils.CombUrlTxt("customer_list.aspx", "typeName={0}&categoryName={1}&keywords={2}", _typeName, _categoryName, this.keywords), "Success");
        }
Esempio n. 2
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     if (data.Id != 0)
     {
         if (!BLL.UserAccount.AllowDelete(FormName))
         {
             MessageBox.Show(string.Format(Message.PL.DenyDelete, FormName));
         }
         else
         {
             if (MessageBox.Show("Do you want to Delete this record?", "DELETE", MessageBoxButton.YesNo) != MessageBoxResult.No)
             {
                 if (data.Delete() == true)
                 {
                     MessageBox.Show("Deleted");
                     data.Clear();
                 }
                 ;
             }
         }
     }
     else
     {
         MessageBox.Show("No Records to Delete");
     }
 }
 /// <summary>
 /// Deleting from Elastic
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDeleting_Click(object sender, EventArgs e)
 {
     try
     {
         if (_customerBll.Delete(mskId.Text))
         {
             MessageBox.Show("Index deleted!", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("Index wasn't deleted!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Esempio n. 4
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("sys_customer_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.Customer bll = new BLL.Customer();
            logmodel = new Model.business_log();
            string idstr = string.Empty;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    idstr += id.ToString() + ",";
                }
            }
            string[]      idlist = idstr.TrimEnd(',').Split(',');
            string        result = "";
            int           success = 0, error = 0;
            StringBuilder sb = new StringBuilder();

            manager = GetAdminInfo();
            foreach (string id in idlist)
            {
                result = bll.Delete(Convert.ToInt32(id), manager);
                if (result == "")
                {
                    success++;
                }
                else
                {
                    error++;
                    sb.Append(result + "<br/>");
                }
            }
            JscriptMsg("共选择" + idlist.Length + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString(), Utils.CombUrlTxt("customer_list.aspx", "page={0}&txtCusName={1}&hCusId={2}&ddlcheck1={3}&ddltype={4}&ddlisUse={5}&txtOwner1={6}", "__id__", _cusName, _cid, _check1, _type, _isUse, _owner1));
        }