/// <summary> /// 更新一条数据 /// </summary> public bool Update(ZhongLi.Model.ServerUser_Post model) { int rowsAffected = 0; SqlParameter[] parameters = { new SqlParameter("@SerUserPostID", SqlDbType.Int, 4), new SqlParameter("@SerUserID", SqlDbType.Int, 4), new SqlParameter("@Company", SqlDbType.NVarChar, 50), new SqlParameter("@Trade", SqlDbType.NVarChar, 50), new SqlParameter("@Scale", SqlDbType.NVarChar, 50), new SqlParameter("@Nature", SqlDbType.NVarChar, 50), new SqlParameter("@PostName", SqlDbType.NVarChar, 50), new SqlParameter("@PostDuty", SqlDbType.NVarChar, -1), new SqlParameter("@Salary", SqlDbType.NVarChar, 500), new SqlParameter("@DevelopProspect", SqlDbType.NVarChar, -1), new SqlParameter("@DirectLeader", SqlDbType.NVarChar, 50), new SqlParameter("@WorkAdress", SqlDbType.NVarChar, 50), new SqlParameter("@Address", SqlDbType.NVarChar, 200), new SqlParameter("@WelfareTag", SqlDbType.NVarChar, 100), new SqlParameter("@CompanyMatching", SqlDbType.NVarChar, 500), new SqlParameter("@OtherPoint", SqlDbType.NVarChar, 500), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Colvalue", SqlDbType.NVarChar, 50), new SqlParameter("@IsSole", SqlDbType.Int, 4), new SqlParameter("@ComImg", SqlDbType.NVarChar, 500), new SqlParameter("@SeeCount", SqlDbType.Int, 4) }; parameters[0].Value = model.SerUserPostID; parameters[1].Value = model.SerUserID; parameters[2].Value = model.Company; parameters[3].Value = model.Trade; parameters[4].Value = model.Scale; parameters[5].Value = model.Nature; parameters[6].Value = model.PostName; parameters[7].Value = model.PostDuty; parameters[8].Value = model.Salary; parameters[9].Value = model.DevelopProspect; parameters[10].Value = model.DirectLeader; parameters[11].Value = model.WorkAdress; parameters[12].Value = model.Address; parameters[13].Value = model.WelfareTag; parameters[14].Value = model.CompanyMatching; parameters[15].Value = model.OtherPoint; parameters[16].Value = model.CreateTime; parameters[17].Value = model.Colvalue; parameters[18].Value = model.IsSole; parameters[19].Value = model.ComImg; parameters[20].Value = model.SeeCount; DbHelperSQL.RunProcedure("ServerUser_Post_Update", parameters, out rowsAffected); if (rowsAffected > 0) { return(true); } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["SerUserPostID"] != null) { ZhongLi.Model.ServerUser_Post post = bll.GetModel(Convert.ToInt32(Request.QueryString["SerUserPostID"])); txtSerUserID.Text = post.SerUserID + ""; txtCompany.Text = post.Company; ddlTrade.SelectedValue = post.Trade; txtPostName.Text = post.PostName; ddlSalary.SelectedValue = post.Salary; txtWorkAdress.Text = post.WorkAdress; imgcom.ImageUrl = post.ComImg; ddlScale.SelectedValue = post.Scale; ddlNature.SelectedValue = post.Nature; txtDirectLeader.Text = post.DirectLeader; txtPostDuty.Text = post.PostDuty; txtDevelopProspect.Text = post.DevelopProspect; txtCreateTime.Text = post.CreateTime.Value.ToString("yyyy-MM-dd"); txtSeeCount.Text = post.SeeCount + ""; txtAdress.Text = post.Address; string html = "<div class='mat'>"; string[] ms = { "地铁周边", "提供午餐", "周末双休", "带薪年假", "年度旅游", "提供住宿", "五险一金", "加班补助" }; if (post.CompanyMatching != "") { txtCompanyMatching.Value = post.CompanyMatching; string[] m = post.CompanyMatching.Split(','); foreach (string str in ms) { if (m.Contains(str)) { html += "<span onclick='search(this)' class='search' s='1'>" + str + "</span>"; } else { html += "<span onclick='search(this)' s='0'>" + str + "</span>"; } } html += "</div>"; ltlCompanyMatching.Text = html; } else { foreach (string str in ms) { html += "<span onclick='search(this)' s='0'>" + str + "</span>"; } html += "</div>"; ltlCompanyMatching.Text = html; } txtOtherPoint.Text = post.OtherPoint; } } }
/// <summary> /// 得到一个对象实体 /// </summary> public ZhongLi.Model.ServerUser_Post GetModel(int SerUserPostID) { SqlParameter[] parameters = { new SqlParameter("@SerUserPostID", SqlDbType.Int, 4) }; parameters[0].Value = SerUserPostID; ZhongLi.Model.ServerUser_Post model = new ZhongLi.Model.ServerUser_Post(); DataSet ds = DbHelperSQL.RunProcedure("ServerUser_Post_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
protected void Page_Load(object sender, EventArgs e) { if (!Utils.CheckRole("10")) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('权限信息','没有权限!','/Systestcomjun/index.aspx',2)</script>"); return; } if (!IsPostBack) { if (Request.QueryString["SerUserPostID"] != null) { int SerUserPostID = Convert.ToInt32(Request.QueryString["SerUserPostID"]); ZhongLi.BLL.ServerUser_Post bll = new ZhongLi.BLL.ServerUser_Post(); ZhongLi.Model.ServerUser_Post sp = bll.GetModel(SerUserPostID); DataTable dt = new ZhongLi.BLL.ServerUser().findField("RealName", sp.SerUserID.Value); if (dt.Rows.Count > 0) { ltlRealName.Text = dt.Rows[0][0].ToString(); } ltlCompany.Text = sp.Company; ltlTrade.Text = sp.Trade; ltlScale.Text = sp.Scale; ltlNature.Text = sp.Nature; ltlPostName.Text = sp.PostName; ltlPostDuty.Text = sp.PostDuty; ltlSalary.Text = sp.Salary; ltlDevelopProspect.Text = sp.DevelopProspect; ltlDirectLeader.Text = sp.DirectLeader; ltlWorkAdress.Text = sp.WorkAdress; ltlAdress.Text = sp.WorkAdress; ltlWelfareTag.Text = sp.WelfareTag; ltlCompanyMatching.Text = sp.CompanyMatching; ltlOtherPoint.Text = sp.OtherPoint; } } }
/// <summary> /// 得到一个对象实体 /// </summary> public ZhongLi.Model.ServerUser_Post DataRowToModel(DataRow row) { ZhongLi.Model.ServerUser_Post model = new ZhongLi.Model.ServerUser_Post(); if (row != null) { if (row["SerUserPostID"] != null && row["SerUserPostID"].ToString() != "") { model.SerUserPostID = int.Parse(row["SerUserPostID"].ToString()); } if (row["SerUserID"] != null && row["SerUserID"].ToString() != "") { model.SerUserID = int.Parse(row["SerUserID"].ToString()); } if (row["Company"] != null) { model.Company = row["Company"].ToString(); } if (row["Trade"] != null) { model.Trade = row["Trade"].ToString(); } if (row["Scale"] != null) { model.Scale = row["Scale"].ToString(); } if (row["Nature"] != null) { model.Nature = row["Nature"].ToString(); } if (row["PostName"] != null) { model.PostName = row["PostName"].ToString(); } if (row["PostDuty"] != null) { model.PostDuty = row["PostDuty"].ToString(); } if (row["Salary"] != null) { model.Salary = row["Salary"].ToString(); } if (row["DevelopProspect"] != null) { model.DevelopProspect = row["DevelopProspect"].ToString(); } if (row["DirectLeader"] != null) { model.DirectLeader = row["DirectLeader"].ToString(); } if (row["WorkAdress"] != null) { model.WorkAdress = row["WorkAdress"].ToString(); } if (row["Address"] != null) { model.Address = row["Address"].ToString(); } if (row["WelfareTag"] != null) { model.WelfareTag = row["WelfareTag"].ToString(); } if (row["CompanyMatching"] != null) { model.CompanyMatching = row["CompanyMatching"].ToString(); } if (row["OtherPoint"] != null) { model.OtherPoint = row["OtherPoint"].ToString(); } if (row["CreateTime"] != null && row["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(row["CreateTime"].ToString()); } if (row["Colvalue"] != null) { model.Colvalue = row["Colvalue"].ToString(); } if (row["IsSole"] != null && row["IsSole"].ToString() != "") { model.IsSole = int.Parse(row["IsSole"].ToString()); } if (row["ComImg"] != null) { model.ComImg = row["ComImg"].ToString(); } if (row["SeeCount"] != null && row["SeeCount"].ToString() != "") { model.SeeCount = int.Parse(row["SeeCount"].ToString()); } } return(model); }
protected void btnsave_Click(object sender, EventArgs e) { if (Request.QueryString["SerUserPostID"] != null) { ZhongLi.Model.ServerUser_Post post = bll.GetModel(Convert.ToInt32(Request.QueryString["SerUserPostID"])); post.SerUserID = Convert.ToInt32(txtSerUserID.Text); post.Company = txtCompany.Text; post.Trade = ddlTrade.SelectedValue; post.PostName = txtPostName.Text; post.Salary = ddlSalary.SelectedValue; post.WorkAdress = txtWorkAdress.Text; if (upImgCom.HasFile) { string fileExt = Utils.GetFileExt(upImgCom.FileName); string newname = DateTime.Now.ToString("yyyyMMddHHmmssffff") + "." + fileExt; string filePath = Utils.GetMapPath("/upload/seruser/post/") + newname; upImgCom.SaveAs(filePath); post.ComImg = "/upload/seruser/post/" + newname; } post.Scale = ddlScale.SelectedValue; post.Nature = ddlNature.SelectedValue; post.DirectLeader = txtDirectLeader.Text; post.PostDuty = txtPostDuty.Text; post.DevelopProspect = txtDevelopProspect.Text; post.CreateTime = DateTime.Parse(txtCreateTime.Text); post.SeeCount = Convert.ToInt32(txtSeeCount.Text); post.Address = txtAdress.Text; post.CompanyMatching = txtCompanyMatching.Value; post.OtherPoint = txtOtherPoint.Text; if (bll.Update(post)) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('编辑职位信息','保存成功!','',1)</script>"); } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('编辑职位信息','保存失败','',2);</script>"); } } else { ZhongLi.Model.ServerUser_Post post = new ZhongLi.Model.ServerUser_Post(); post.SerUserID = Convert.ToInt32(txtSerUserID.Text); post.Company = txtCompany.Text; post.Trade = ddlTrade.SelectedValue; post.PostName = txtPostName.Text; post.Salary = ddlSalary.SelectedValue; post.WorkAdress = txtWorkAdress.Text; if (upImgCom.HasFile) { string fileExt = Utils.GetFileExt(upImgCom.FileName); string newname = DateTime.Now.ToString("yyyyMMddHHmmssffff") + "." + fileExt; string filePath = Utils.GetMapPath("/upload/seruser/post/") + newname; upImgCom.SaveAs(filePath); post.ComImg = "/upload/seruser/post/" + newname; } post.Scale = ddlScale.SelectedValue; post.Nature = ddlNature.SelectedValue; post.DirectLeader = txtDirectLeader.Text; post.PostDuty = txtPostDuty.Text; post.DevelopProspect = txtDevelopProspect.Text; post.CreateTime = DateTime.Parse(txtCreateTime.Text); post.SeeCount = Convert.ToInt32(txtSeeCount.Text); post.Address = txtAdress.Text; post.CompanyMatching = txtCompanyMatching.Value; post.OtherPoint = txtOtherPoint.Text; post.Colvalue = "0"; if (bll.Add(post) > 0) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('添加职位信息','保存成功!','',1)</script>"); } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('添加职位信息','保存失败','',2);</script>"); } } }