protected void btnSaveRefresh_Click(object sender, EventArgs e) { if (Request.QueryString["Type"] == "1") { //编辑保存 zlzw.BLL.jjzpListBLL jjzpListBLL = new zlzw.BLL.jjzpListBLL(); zlzw.Model.jjzpListModel jjzpListModel = jjzpListBLL.GetModel(int.Parse(Get_ID(jjzpListBLL, Request.QueryString["value"]))); jjzpListModel.jjzpContent = labContent.Text;//紧急招聘内容 if (Request.Cookies["UserID"] != null) { jjzpListModel.PublishID = new Guid(Request.Cookies["UserID"].Value); } jjzpListModel.PublishDate = DateTime.Parse(ViewState["CreateDate"].ToString()); jjzpListBLL.Update(jjzpListModel); } else { //添加保存 zlzw.BLL.jjzpListBLL jjzpListBLL = new zlzw.BLL.jjzpListBLL(); zlzw.Model.jjzpListModel jjzpListModel = new zlzw.Model.jjzpListModel(); jjzpListModel.jjzpContent = labContent.Text;//紧急招聘内容 jjzpListModel.PublishDate = DateTime.Now; if (Request.Cookies["UserID"] != null) { jjzpListModel.PublishID = new Guid(Request.Cookies["UserID"].Value); } jjzpListBLL.Add(jjzpListModel); } // 2. Close this window and Refresh parent window PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.jjzpListModel DataRowToModel(DataRow row) { zlzw.Model.jjzpListModel model = new zlzw.Model.jjzpListModel(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["SysGUID"] != null && row["SysGUID"].ToString() != "") { model.SysGUID = new Guid(row["SysGUID"].ToString()); } if (row["PublishID"] != null && row["PublishID"].ToString() != "") { model.PublishID = new Guid(row["PublishID"].ToString()); } if (row["jjzpContent"] != null) { model.jjzpContent = row["jjzpContent"].ToString(); } if (row["PublishDate"] != null && row["PublishDate"].ToString() != "") { model.PublishDate = DateTime.Parse(row["PublishDate"].ToString()); } if (row["IsEnable"] != null && row["IsEnable"].ToString() != "") { model.IsEnable = int.Parse(row["IsEnable"].ToString()); } if (row["Other01"] != null) { model.Other01 = row["Other01"].ToString(); } if (row["Other02"] != null) { model.Other02 = row["Other02"].ToString(); } if (row["Other03"] != null) { model.Other03 = row["Other03"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.jjzpListModel GetModel(int id) { SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4) }; parameters[0].Value = id; zlzw.Model.jjzpListModel model = new zlzw.Model.jjzpListModel(); DataSet ds = DbHelperSQL.RunProcedure("jjzpList_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }