protected void ibtnDeleteAll_Click(object sender, ImageClickEventArgs e) { string delId = ""; //先遍历取得选中项 for (int i = 0; i < this.rpCompany.Items.Count; i++) { CheckBox cbx = (CheckBox)(rpCompany.Items[i].FindControl("cbx")); Label lbl = (Label)rpCompany.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++) { Factory factory = FactoryManager.getFactoryById(Convert.ToInt32(check[i])); if (factory != null) { FactBankManager.deleteFactBankByfactId(factory.Id); FactLinkmanManager.deleteFactLinkmanByfactId(factory.Id); FactoryManager.deleteFactory(Convert.ToInt32(check[i])); } } dataBind(); }
protected void rpCompany_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Delete") { int id = Convert.ToInt32(e.CommandArgument); FactBankManager.deleteFactBankByfactId(id); FactLinkmanManager.deleteFactLinkmanByfactId(id); int count = FactoryManager.deleteFactory(id); if (count <= 0) { ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('删除失败')", true); return; } } dataBind(); }
private void addlink() { string id = Request.QueryString["id"].ToString(); FactLinkmanManager.deleteFactLinkmanByfactId(Convert.ToInt32(id)); string strList = this.hidlink.Value; if (strList != "") { string[] row = null; string[] cell = null; EtNet_Models.FactLinkman 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.FactLinkman(); cell = row[i].Split('|'); cusLink.LinkName = cell[0]; cusLink.Duty = cell[1]; cusLink.Telephone = cell[2]; cusLink.Fax = cell[3]; cusLink.Mobile = cell[4]; cusLink.Email = cell[5]; cusLink.QQ = cell[6]; cusLink.Skype = cell[7]; cusLink.FactId = Convert.ToInt32(id); FactLinkmanManager.addFactLinkman(cusLink); } } }