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(); }
/// <summary> /// 加载联系人信息 /// </summary> private void loadLink() { string witch = Request.QueryString["witch"]; //用于判断是查看收款单位还是付款单位的联系人 string linkId = Request.QueryString["linkid"]; //联系人id string payid = Request.QueryString["payid"]; //付款单位id if (linkId == "0") { Factory model = FactoryManager.getFactoryById(int.Parse(payid)); linkName.Value = model.LinkeName; //联系人名称 linkPost.Value = model.Duty; //职位 linkMobile.Value = model.Mobile; //手机号码 linkTel.Value = model.Telephone; //联系电话 linkFax.Value = model.Fax; //联系传真 linkEmail.Value = model.Email; //邮箱地址 linkMsn.Value = model.QQ; //qq linkSkype.Value = model.Skype; //skype } else { FactLinkman model = FactLinkmanManager.getFactLinkmanById(int.Parse(linkId)); linkName.Value = model.LinkName; //联系人名称 linkPost.Value = model.Duty; //职位 linkMobile.Value = model.Mobile; //手机号码 linkTel.Value = model.Telephone; //联系电话 linkFax.Value = model.Fax; //联系传真 linkEmail.Value = model.Email; //邮箱地址 linkMsn.Value = model.QQ; //qq linkSkype.Value = model.Skype; //skype } }
//读取其他联系人信息 private void loadOtherBank() { string id = Request.QueryString["id"].ToString(); DataTable dt = FactLinkmanManager.getList(Convert.ToInt32(id)); if (dt.Rows.Count > 0) { HtmlTableRow row = null; HtmlTableCell cell = null; for (int i = 0; i < dt.Rows.Count; i++) { row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.InnerHtml = dt.Rows[i]["linkName"].ToString(); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = dt.Rows[i]["duty"].ToString(); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = dt.Rows[i]["telephone"].ToString(); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = dt.Rows[i]["fax"].ToString(); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = dt.Rows[i]["mobile"].ToString(); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = dt.Rows[i]["email"].ToString(); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = dt.Rows[i]["qq"].ToString(); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = dt.Rows[i]["skype"].ToString(); row.Controls.Add(cell); // this.tablelanguage.Controls.Add(row); this.tablelink.Controls.Add(row); } } }
//获取次要联系人 private void getCuslink() { string id = Request.QueryString["id"].ToString(); IList <FactLinkman> factLinkman = FactLinkmanManager.getFactLinkmanByFactId(Convert.ToInt32(id)); if (factLinkman.Count == 0) { tip.InnerHtml = "<div style='line-height:60px;height:60px;width:100%;text-align:center;'><p style='color:gray;width:200px;margin:0 auto;background:#FFFFFF;border:solid 0px #ccc; text-algin:center'><p></div>"; } else { cuslinklist.DataSource = factLinkman; } cuslinklist.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); } } }
//次要联系人 private void addlink() { string strList = this.hidlink.Value; if (strList != "") { string[] row = null; string[] cell = null; EtNet_Models.FactLinkman factLink = null; if (strList.IndexOf(',') >= 0) { row = strList.Split(','); } else { row = new string[1] { strList }; } for (int i = 0; i < row.Length; i++) { factLink = new EtNet_Models.FactLinkman(); cell = row[i].Split('|'); factLink.LinkName = cell[0]; factLink.Duty = cell[1]; factLink.Telephone = cell[2]; factLink.Fax = cell[3]; factLink.Mobile = cell[4]; factLink.Email = cell[5]; factLink.QQ = cell[6]; factLink.Skype = cell[7]; factLink.FactId = FactoryManager.getLastOneID().Id; FactLinkmanManager.addFactLinkman(factLink); } } }
//加载联系人信息 private void loadlink() { string id = Request.QueryString["id"].ToString(); DataTable tbl = FactLinkmanManager.getList(Convert.ToInt32(id)); if (tbl.Rows.Count >= 1) { HtmlTableRow row = null; HtmlTableCell cell = null; for (int i = 0; i < tbl.Rows.Count; i++) { if (i == 0) { row = this.tablelink.Controls[1] as HtmlTableRow; cell = row.Controls[0] as HtmlTableCell; cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["linkName"] + "' class='clsblurtxt clsedit' />"; cell = row.Controls[1] as HtmlTableCell; cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["duty"] + "' class='clsblurtxt clsedit' />"; cell = row.Controls[2] as HtmlTableCell; cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["telephone"] + "' class='clsblurtxt clsedit' />"; cell = row.Controls[3] as HtmlTableCell; cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["fax"] + "' class='clsblurtxt clsedit' />"; cell = row.Controls[4] as HtmlTableCell; cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["mobile"] + "' class='clsblurtxt clsedit' />"; cell = row.Controls[5] as HtmlTableCell; cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["email"] + "' class='clsblurtxt clsedit' />"; cell = row.Controls[6] as HtmlTableCell; cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["qq"] + "' class='clsblurtxt clsedit' />"; cell = row.Controls[7] as HtmlTableCell; cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["skype"] + "' class='clsblurtxt clsedit' />"; } else { row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["linkName"] + "' class='clsblurtxt clsedit' />"; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["duty"] + "' class='clsblurtxt clsedit' />"; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["telephone"] + "' class='clsblurtxt clsedit' />"; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["fax"] + "' class='clsblurtxt clsedit' />"; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["mobile"] + "' class='clsblurtxt clsedit' />"; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["email"] + "' class='clsblurtxt clsedit' />"; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["qq"] + "' class='clsblurtxt clsedit' />"; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<input type='text' value='" + tbl.Rows[i]["skype"] + "' class='clsblurtxt clsedit' />"; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<div title='删除' class='clsimgdel'> </div>"; row.Controls.Add(cell); this.tablelink.Controls.Add(row); } } } }