/// <summary> /// 加载营业部信息 /// </summary> private void loadDepart() { string departid = Request.QueryString["departid"]; //营业部id CusLinkman model = CusLinkmanManager.getCusLinkmanById(int.Parse(departid)); departName.Value = model.DepartName; //营业部名称 linkTel.Value = model.Telephone; //电话 linkFax.Value = model.Fax; //传真 linkEmail.Value = model.Email; //邮箱 linkMsn.Value = model.Msn; //qq linkSkype.Value = model.Skype; //skype }
/// <summary> /// 更新营业部信息 /// </summary> 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; if (strList.IndexOf(',') >= 0) { row = strList.Split(','); } else { row = new string[1] { strList }; } if (row.Count() > 0) { for (int i = 0; i < row.Length; i++) { cell = row[i].Split('|'); int linkid = 0; int.TryParse(cell[8], out linkid); EtNet_Models.CusLinkman cusLink = CusLinkmanManager.getCusLinkmanById(linkid); if (cusLink == null) //如果没有就新增 { cusLink = new EtNet_Models.CusLinkman(); cusLink.DepartName = cell[0]; //营业部名称 cusLink.LinkName = cell[1]; //联系人 cusLink.Telephone = cell[2]; //电话 cusLink.Fax = cell[3]; //传真 cusLink.Mobile = cell[4]; //手机 cusLink.Email = cell[5]; //邮箱 cusLink.Msn = cell[6]; //msn cusLink.Skype = cell[7]; //skype cusLink.CustomerId = Convert.ToInt32(id); CusLinkmanManager.addCusLinkman(cusLink); } else { cusLink.DepartName = cell[0]; cusLink.LinkName = cell[1]; cusLink.Telephone = cell[2]; //电话 cusLink.Fax = cell[3]; //传真 cusLink.Mobile = cell[4]; //手机 cusLink.Email = cell[5]; //邮箱 cusLink.Msn = cell[6]; //msn cusLink.Skype = cell[7]; //skype cusLink.CustomerId = Convert.ToInt32(id); CusLinkmanManager.updateCusLinkman(cusLink); } } } } string ids = this.hidlinkdelid.Value.TrimEnd(','); //删除数据 if (ids != "") { string sql = " id in (" + ids + ")"; CusLinkmanManager.deleteCusLinkmanBySql(sql); } }