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); } } }
//次要联系人 private void addlink(int cusid) { 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.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]; cusLink.Skype = cell[7]; cusLink.CustomerId = cusid; CusLinkmanManager.addCusLinkman(cusLink); } } }
/// <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); } }