public ActionResult getAdd(Jianli obj) { obj = new Jianli { jlId = obj.jlId, jlName = obj.jlName, jlPic = obj.jlPic, jlGender = obj.jlGender, jlage = obj.jlage, jlIC = obj.jlIC, jlEdu = obj.jlEdu, jlGw = obj.jlGw, jlPhone = obj.jlPhone, jlEmail = obj.jlEmail, jlXinzi = obj.jlXinzi, jlHunyin = obj.jlHunyin, jlWork = obj.jlWork, jlPingJia = obj.jlPingJia, userID = obj.userID, jl_peixun = obj.jl_peixun, jl_jiaoyu = obj.jl_jiaoyu }; int result = new JIanliBLL().Add(obj); return(Content("添加成功!")); }
public Jianli GetObjByUId(string id) { string sql = "select *,(select userName from User_Info where userId=Jl_info.userID) as userName from Jl_info where jlId='{0}'"; sql = string.Format(sql, id); SqlDataReader dr = SQLHelper.GetReader(sql); Jianli obj = null; if (dr.Read()) { obj = new Jianli { // jlWork = Convert.ToInt32(dr["jlWork "]), userID = Convert.ToInt32(dr["userID"]), jlXinzi = Convert.ToInt32(dr["jlXinzi"]), jlName = dr["jlName"].ToString(), jlPic = dr["jlPic"].ToString(), jlGender = dr["jlGender"].ToString(), jlage = dr["jlage"].ToString(), jlIC = dr["jlIC"].ToString(), jlEdu = dr["jlEdu"].ToString(), jlGw = dr["jlGw"].ToString(), jlPhone = dr["jlPhone"].ToString(), jlEmail = dr["jlEmail"].ToString(), jlPingJia = dr["jlPingJia"].ToString(), jl_peixun = dr["jl_peixun"].ToString(), jl_jiaoyu = dr["jl_jiaoyu"].ToString(), jlAddtime = Convert.ToDateTime(dr["jlAddtime"]), }; } return(obj); }
public ActionResult Import() { HttpPostedFileBase file = Request.Files["excel"]; var path = Path.Combine(Request.MapPath("/Upload"), file.FileName); file.SaveAs(path); //从NPOI读取到的Excel的数据 DataTable excelTable = new DataTable(); excelTable = ImportExcel.GetExcelDataTable(path); ImportExcel.RemoveEmpty(excelTable); int result = 0; foreach (DataRow dataRow in excelTable.Rows) { Jianli obj = new Jianli(); int userID = Convert.ToInt32(dataRow["用户编号"]); bool flag = new JIanliBLL().FindByUId(userID); //判断该用户是否存在,若不存在则添加 if (flag) { int ret = new JIanliBLL().ExDel(userID); } obj = new Jianli { userID = Convert.ToInt32(dataRow["用户编号"]), jlName = dataRow["姓名"].ToString(), jlPic = dataRow["头像"].ToString(), jlGender = dataRow["性别"].ToString(), jlage = dataRow["出生年月"].ToString(), jlIC = dataRow["身份证号"].ToString(), jlEdu = dataRow["学历"].ToString(), jlGw = dataRow["求职岗位"].ToString(), jlPhone = dataRow["联系方式"].ToString(), jlEmail = dataRow["电子邮件"].ToString(), jlXinzi = Convert.ToInt32(dataRow["期望薪资"]), jlHunyin = dataRow["婚姻情况"].ToString(), jlWork = Convert.ToInt32(dataRow["工作年限"]), jlPingJia = dataRow["工作经历"].ToString(), jl_peixun = dataRow["培训经历"].ToString(), jl_jiaoyu = dataRow["教育经历"].ToString() }; result += new JIanliBLL().Add(obj); } return (RedirectToAction("JlList", "Admin", new { info = "导入成功" })); }
public int Add(Jianli obj) { StringBuilder strb = new StringBuilder(); strb.Append("insert into jl_Info(jlName, jlPic, jlGender, jlage, jlIC, jlEdu, jlGw, jlPhone, jlEmail, jlXinzi, jlHunyin, jlWork, jlPingJia, jlAddtime, userID, jl_peixun, jl_jiaoyu)"); strb.Append("values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}',{9},'{10}',{11},'{12}','{13}',{14},'{15}','{16}')"); string sql = string.Format(strb.ToString(), obj.jlName, obj.jlPic, obj.jlGender, obj.jlage, obj.jlIC, obj.jlEdu, obj.jlGw, obj.jlPhone, obj.jlEmail, obj.jlXinzi, obj.jlHunyin, obj.jlWork, obj.jlPingJia, DateTime.Now, obj.userID, obj.jl_peixun, obj.jl_jiaoyu); try { return(SQLHelper.Update(sql)); } catch (SqlException ex) { throw new Exception("数据库操作出现异常!具体信息:\r\n" + ex.Message); } }
public int Add(Jianli obj) { return(new JianliDAL().Add(obj)); }