Exemplo n.º 1
0
        protected void ibtnDeleteAll_Click(object sender, ImageClickEventArgs e)
        {
            string delId = "";

            //先遍历取得选中项

            for (int i = 0; i < this.rpCustomer.Items.Count; i++)
            {
                CheckBox cbx = (CheckBox)(rpCustomer.Items[i].FindControl("cbx"));
                Label    lbl = (Label)rpCustomer.Items[i].FindControl("lbl");
                if (cbx != null || cbx.Text != "")
                {
                    if (cbx.Checked)
                    {
                        delId += lbl.Text + ",";
                    }
                }
            }
            //去掉最后一个,
            delId = (delId + ")").Replace(",)", "");
            IList check = delId.Split(',');

            for (int i = 0; i < check.Count; i++)
            {
                Customer customer = CustomerManager.getCustomerById(Convert.ToInt32(check[i]));
                if (customer != null)
                {
                    CusBankManager.deleteCusBankByCusId(customer.Id);
                    CusLinkmanManager.deleteCusLinkmanByCusId(customer.Id);
                    CustomerManager.deleteCustomer(customer.Id);
                }
            }
            dataBind();
        }
Exemplo n.º 2
0
        protected void rpCustomer_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int id = Convert.ToInt32(e.CommandArgument);
                EtNet_Models.Customer model = EtNet_BLL.CustomerManager.getCustomerById(id);
                if (model != null)
                {
                    CusBankManager.deleteCusBankByCusId(model.Id);
                    CusLinkmanManager.deleteCusLinkmanByCusId(model.Id);
                    int count = CustomerManager.deleteCustomer(model.Id);

                    if (count <= 0)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('删除失败')", true);
                        return;
                    }
                }
            }
            dataBind();
        }
Exemplo n.º 3
0
        private void addbank()
        {
            string id = Request.QueryString["id"].ToString();

            CusBankManager.deleteCusBankByCusId(Convert.ToInt32(id));

            string banklist = this.hidbank.Value;

            if (banklist != "")
            {
                string[]             row     = null;
                string[]             cell    = null;
                EtNet_Models.CusBank cusbank = null;
                if (banklist.IndexOf(',') >= 0)
                {
                    row = banklist.Split(',');
                }
                else
                {
                    row = new string[1] {
                        banklist
                    };
                }
                for (int i = 0; i < row.Length; i++)
                {
                    cusbank            = new EtNet_Models.CusBank();
                    cell               = row[i].Split('|');
                    cusbank.Bank       = cell[0];
                    cusbank.CardId     = cell[1];
                    cusbank.CardName   = cell[2];
                    cusbank.Remark     = cell[3];
                    cusbank.CustomerId = Convert.ToInt32(id);
                    CusBankManager.addCusBank(cusbank);
                }
            }
        }