/// <summary> ///[ComLinkman]表查询实体的方法 /// </summary> public static ComLinkman getComLinkmanById(int id) { ComLinkman comlinkman = null; string sql = "select * from ComLinkman where id=@id"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@id", id) }; DataTable dt = DBHelper.GetDataSet(sql, sp); if (dt.Rows.Count > 0) { comlinkman = new ComLinkman(); foreach (DataRow dr in dt.Rows) { comlinkman.Id = Convert.ToInt32(dr["id"]); comlinkman.CompanyId = Convert.ToInt32(dr["companyId"]); comlinkman.LinkName = Convert.ToString(dr["linkName"]); comlinkman.Post = Convert.ToString(dr["post"]); comlinkman.Telephone = Convert.ToString(dr["telephone"]); comlinkman.Fax = Convert.ToString(dr["fax"]); comlinkman.Mobile = Convert.ToString(dr["mobile"]); comlinkman.Email = Convert.ToString(dr["email"]); comlinkman.Msn = Convert.ToString(dr["msn"]); comlinkman.Skype = Convert.ToString(dr["skype"]); } } return(comlinkman); }
/// <summary> ///根据SQL语句获取集合 /// </summary> public static IList <ComLinkman> getComLinkmansBySql(string sql) { IList <ComLinkman> list = new List <ComLinkman>(); DataTable dt = DBHelper.GetDataSet(sql); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { ComLinkman comlinkman = new ComLinkman(); comlinkman.Id = Convert.ToInt32(dr["id"]); comlinkman.CompanyId = Convert.ToInt32(dr["companyId"]); comlinkman.LinkName = Convert.ToString(dr["linkName"]); comlinkman.Post = Convert.ToString(dr["post"]); comlinkman.Telephone = Convert.ToString(dr["telephone"]); comlinkman.Fax = Convert.ToString(dr["fax"]); comlinkman.Mobile = Convert.ToString(dr["mobile"]); comlinkman.Email = Convert.ToString(dr["email"]); comlinkman.Msn = Convert.ToString(dr["msn"]); comlinkman.Skype = Convert.ToString(dr["skype"]); list.Add(comlinkman); } } return(list); }
/// <summary> ///[ComLinkman]表添加的方法 /// </summary> public static int addComLinkman(ComLinkman comlinkman) { string sql = "insert into ComLinkman([companyId],[linkName],[post],[telephone],[fax],[mobile],[email],[msn],[skype]) values (@companyId,@linkName,@post,@telephone,@fax,@mobile,@email,@msn,@skype)"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@companyId", comlinkman.CompanyId), new SqlParameter("@linkName", comlinkman.LinkName), new SqlParameter("@post", comlinkman.Post), new SqlParameter("@telephone", comlinkman.Telephone), new SqlParameter("@fax", comlinkman.Fax), new SqlParameter("@mobile", comlinkman.Mobile), new SqlParameter("@email", comlinkman.Email), new SqlParameter("@msn", comlinkman.Msn), new SqlParameter("@skype", comlinkman.Skype) }; return(DBHelper.ExecuteCommand(sql, sp)); }
/// <summary> ///[ComLinkman]表修改的方法 /// </summary> public static int updateComLinkmanById(ComLinkman comlinkman) { string sql = "update ComLinkman set companyId=@companyId,linkName=@linkName,post=@post,telephone=@telephone,fax=@fax,mobile=@mobile,email=@email,msn=@msn,skype=@skype where id=@id"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@id", comlinkman.Id), new SqlParameter("@companyId", comlinkman.CompanyId), new SqlParameter("@linkName", comlinkman.LinkName), new SqlParameter("@post", comlinkman.Post), new SqlParameter("@telephone", comlinkman.Telephone), new SqlParameter("@fax", comlinkman.Fax), new SqlParameter("@mobile", comlinkman.Mobile), new SqlParameter("@email", comlinkman.Email), new SqlParameter("@msn", comlinkman.Msn), new SqlParameter("@skype", comlinkman.Skype) }; return(DBHelper.ExecuteCommand(sql, sp)); }
/// <summary> /// 添加次要联系人 /// </summary> private void addcomlink() { string strList = this.hidlink.Value; //得到次要联系人信息 if (strList != "") { string[] row = null; string[] cell = null; EtNet_Models.ComLinkman comLink = null; if (strList.IndexOf(',') >= 0) { row = strList.Split(','); } //判断是否有多行数据 else { row = new string[1] { strList }; } for (int i = 0; i < row.Length; i++) { comLink = new ComLinkman(); cell = row[i].Split('|'); comLink.LinkName = cell[0]; //联系人 comLink.Post = cell[1]; //职务 comLink.Telephone = cell[2]; //联系电话 comLink.Fax = cell[3]; //联系传真 comLink.Mobile = cell[4]; //手机 comLink.Email = cell[5]; //电子邮件 comLink.Msn = cell[6]; //QQ comLink.Skype = cell[7]; //Skype comLink.CompanyId = CompanyManager.getLastOneID().Id; //得到公司信息中最后面的一个id数据,也就是刚刚添加的公司信息的id ComLinkmanManager.addComLinkman(comLink); //添加次要联系人 } } }
//添加次要联系人 private void addcomlink() { string strList = this.hidlink.Value; if (strList != "") { string[] row = null; string[] cell = null; EtNet_Models.ComLinkman comLink = null; if (strList.IndexOf(',') >= 0) { row = strList.Split(','); } else { row = new string[1] { strList }; } for (int i = 0; i < row.Length; i++) { comLink = new ComLinkman(); cell = row[i].Split('|'); comLink.LinkName = cell[0]; comLink.Post = cell[1]; comLink.Telephone = cell[2]; comLink.Fax = cell[3]; comLink.Mobile = cell[4]; comLink.Email = cell[5]; comLink.Msn = cell[6]; comLink.Skype = cell[7]; comLink.CompanyId = CompanyManager.getLastOneID().Id; ComLinkmanManager.addComLinkman(comLink); } } }
public static int addComLinkman(ComLinkman comlinkman) { return(ComLinkmanService.addComLinkman(comlinkman)); }
public static int updateComLinkman(ComLinkman comlinkman) { return(ComLinkmanService.updateComLinkmanById(comlinkman)); }