Пример #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();
        }
Пример #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();
        }
Пример #3
0
        private void addlink()
        {
            string id = Request.QueryString["id"].ToString();

            CusLinkmanManager.deleteCusLinkmanByCusId(Convert.ToInt32(id));

            string strList = this.hidlink.Value;

            if (strList != "")
            {
                string[] row  = null;
                string[] cell = null;
                EtNet_Models.CusLinkman cusLink = null;
                if (strList.IndexOf(',') >= 0)
                {
                    row = strList.Split(',');
                }
                else
                {
                    row = new string[1] {
                        strList
                    };
                }
                for (int i = 0; i < row.Length; i++)
                {
                    cusLink            = new EtNet_Models.CusLinkman();
                    cell               = row[i].Split('|');
                    cusLink.LinkName   = cell[0];
                    cusLink.Post       = cell[1];
                    cusLink.Telephone  = cell[2];
                    cusLink.Fax        = cell[3];
                    cusLink.Mobile     = cell[4];
                    cusLink.Email      = cell[5];
                    cusLink.Msn        = cell[6];
                    cusLink.Skype      = cell[7];
                    cusLink.CustomerId = Convert.ToInt32(id);
                    CusLinkmanManager.addCusLinkman(cusLink);
                }
            }
        }