protected void btnSaveRefresh_Click(object sender, EventArgs e) { if (Request.QueryString["Type"] == "1") { //编辑保存 zlzw.Model.GeneralActivityModel generalActivityModel = new zlzw.Model.GeneralActivityModel(); generalActivityModel.ActivityTitle = txbActivityTitle.Text;//招聘会标题 generalActivityModel.ActivityAddress = txbActivityAddress.Text;//招聘会举行地点 generalActivityModel.ActivityDesc = FCKeditor1.Value;//招聘会简介 generalActivityModel.PublishDate = DateTime.Parse(ViewState["PublishDate"].ToString()); generalActivityModel.ActivityGuid = new Guid(ViewState["ActivityGuid"].ToString()); if (ckbIsDefaultShow.Checked) { generalActivityModel.SpecialType = 1; } else { generalActivityModel.SpecialType = 0; } generalActivityModel.CanUsable = 1; zlzw.BLL.GeneralActivityBLL generalActivityBLL = new zlzw.BLL.GeneralActivityBLL(); generalActivityModel.ActivityID = int.Parse(Get_ID(generalActivityBLL, Request.QueryString["value"])); generalActivityBLL.Update(generalActivityModel); } else { //添加保存 zlzw.Model.GeneralActivityModel generalActivityModel = new zlzw.Model.GeneralActivityModel(); generalActivityModel.ActivityTitle = txbActivityTitle.Text;//招聘会标题 generalActivityModel.ActivityAddress = txbActivityAddress.Text;//招聘会举行地点 generalActivityModel.ActivityDesc = FCKeditor1.Value;//招聘会简介 generalActivityModel.CreateUserKey = Request.Cookies["UserID"].Value;//创建者GUID generalActivityModel.CreateUserName = Get_UserName(Request.Cookies["UserID"].Value);//创建者姓名 generalActivityModel.CanUsable = 1; if (ckbIsDefaultShow.Checked) { generalActivityModel.SpecialType = 1; } else { generalActivityModel.SpecialType = 0; } generalActivityModel.PublishDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); zlzw.BLL.GeneralActivityBLL generalActivityBLL = new zlzw.BLL.GeneralActivityBLL(); generalActivityBLL.Add(generalActivityModel); } // 2. Close this window and Refresh parent window PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.GeneralActivityModel DataRowToModel(DataRow row) { zlzw.Model.GeneralActivityModel model = new zlzw.Model.GeneralActivityModel(); if (row != null) { if (row["ActivityID"] != null && row["ActivityID"].ToString() != "") { model.ActivityID = int.Parse(row["ActivityID"].ToString()); } if (row["ActivityGuid"] != null && row["ActivityGuid"].ToString() != "") { model.ActivityGuid = new Guid(row["ActivityGuid"].ToString()); } if (row["ActivityType"] != null && row["ActivityType"].ToString() != "") { model.ActivityType = int.Parse(row["ActivityType"].ToString()); } if (row["ActivityKind"] != null && row["ActivityKind"].ToString() != "") { model.ActivityKind = new Guid(row["ActivityKind"].ToString()); } if (row["ActivityCategory"] != null) { model.ActivityCategory = row["ActivityCategory"].ToString(); } if (row["ActivityDate"] != null && row["ActivityDate"].ToString() != "") { model.ActivityDate = DateTime.Parse(row["ActivityDate"].ToString()); } if (row["ActivityAreaCode"] != null) { model.ActivityAreaCode = row["ActivityAreaCode"].ToString(); } if (row["ActivityAreaDetails"] != null) { model.ActivityAreaDetails = row["ActivityAreaDetails"].ToString(); } if (row["ActivityAddress"] != null) { model.ActivityAddress = row["ActivityAddress"].ToString(); } if (row["ActivityAddressDetails"] != null) { model.ActivityAddressDetails = row["ActivityAddressDetails"].ToString(); } if (row["ActivityTitle"] != null) { model.ActivityTitle = row["ActivityTitle"].ToString(); } if (row["ActivityDesc"] != null) { model.ActivityDesc = row["ActivityDesc"].ToString(); } if (row["ActivitySummary"] != null) { model.ActivitySummary = row["ActivitySummary"].ToString(); } if (row["ActivityAddon"] != null) { model.ActivityAddon = row["ActivityAddon"].ToString(); } if (row["PublishDate"] != null && row["PublishDate"].ToString() != "") { model.PublishDate = DateTime.Parse(row["PublishDate"].ToString()); } if (row["CanUsable"] != null && row["CanUsable"].ToString() != "") { model.CanUsable = int.Parse(row["CanUsable"].ToString()); } if (row["CreateUserKey"] != null) { model.CreateUserKey = row["CreateUserKey"].ToString(); } if (row["CreateUserName"] != null) { model.CreateUserName = row["CreateUserName"].ToString(); } if (row["SpecialType"] != null && row["SpecialType"].ToString() != "") { model.SpecialType = int.Parse(row["SpecialType"].ToString()); } if (row["JoinUserCount"] != null && row["JoinUserCount"].ToString() != "") { model.JoinUserCount = int.Parse(row["JoinUserCount"].ToString()); } if (row["ActivityReviewDetails"] != null) { model.ActivityReviewDetails = row["ActivityReviewDetails"].ToString(); } if (row["ActivityReviewKey"] != null) { model.ActivityReviewKey = row["ActivityReviewKey"].ToString(); } if (row["ActivityReviewTarget"] != null) { model.ActivityReviewTarget = row["ActivityReviewTarget"].ToString(); } if (row["PropertyNames"] != null) { model.PropertyNames = row["PropertyNames"].ToString(); } if (row["PropertyValues"] != null) { model.PropertyValues = row["PropertyValues"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.GeneralActivityModel GetModel(int ActivityID) { SqlParameter[] parameters = { new SqlParameter("@ActivityID", SqlDbType.Int,4) }; parameters[0].Value = ActivityID; zlzw.Model.GeneralActivityModel model = new zlzw.Model.GeneralActivityModel(); DataSet ds = DbHelperSQL.RunProcedure("GeneralActivity_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }