/// <summary> /// 增加一条数据 /// </summary> public int Add(zlzw.Model.JobCategoryListModal model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@JobCategoryID", SqlDbType.Int, 4), new SqlParameter("@JobCategoryGUID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@JobCategoryName", SqlDbType.NVarChar, 50), new SqlParameter("@JobCount", SqlDbType.Int, 4), new SqlParameter("@PublishDate", SqlDbType.DateTime), new SqlParameter("@IsHot", SqlDbType.Int, 4), new SqlParameter("@IsEnable", SqlDbType.Int, 4), new SqlParameter("@Other01", SqlDbType.NVarChar, 50), new SqlParameter("@Other02", SqlDbType.NVarChar, 50) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = Guid.NewGuid(); parameters[2].Value = model.JobCategoryName; parameters[3].Value = model.JobCount; parameters[4].Value = model.PublishDate; parameters[5].Value = model.IsHot; parameters[6].Value = model.IsEnable; parameters[7].Value = model.Other01; parameters[8].Value = model.Other02; DbHelperSQL.RunProcedure("JobCategoryList_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }
protected void btnDel_Click(object sender, EventArgs e) { if (grid1.SelectedRowIndexArray != null && grid1.SelectedRowIndexArray.Length > 0) { string strSelectID = "0"; for (int i = 0, count = grid1.SelectedRowIndexArray.Length; i < count; i++) { int rowIndex = grid1.SelectedRowIndexArray[i]; foreach (object key in grid1.DataKeys[rowIndex]) { strSelectID = key.ToString(); } } #region 除逻辑 zlzw.BLL.JobCategoryListBLL jobCategoryListBLL = new zlzw.BLL.JobCategoryListBLL(); zlzw.Model.JobCategoryListModal jobCategoryListModal = jobCategoryListBLL.GetModel(int.Parse(Get_JobCategoryID(strSelectID))); jobCategoryListModal.IsEnable = 0; jobCategoryListBLL.Update(jobCategoryListModal); JobCategoryList_BindGrid(); #endregion } else { return; } }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { if (Request.QueryString["Type"] == "1") { //编辑保存 zlzw.Model.JobCategoryListModal jobCategoryListModal = new zlzw.Model.JobCategoryListModal(); jobCategoryListModal.JobCategoryName = txbJobCategoryName.Text; jobCategoryListModal.JobCategoryGUID = new Guid(ViewState["JobCategoryGUID"].ToString()); jobCategoryListModal.IsEnable = 1; if (ckbIsHot.Checked) { jobCategoryListModal.IsHot = 1; } else { jobCategoryListModal.IsHot = 0; } jobCategoryListModal.PublishDate = DateTime.Parse(ViewState["PublishDate"].ToString()); jobCategoryListModal.JobCategoryID = int.Parse(Get_JobCategoryID(Request.QueryString["value"])); zlzw.BLL.JobCategoryListBLL jobCategoryListBLL = new zlzw.BLL.JobCategoryListBLL(); jobCategoryListBLL.Update(jobCategoryListModal); } else { //添加保存 zlzw.Model.JobCategoryListModal jobCategoryListModal = new zlzw.Model.JobCategoryListModal(); jobCategoryListModal.JobCategoryName = txbJobCategoryName.Text; jobCategoryListModal.JobCategoryGUID = Guid.NewGuid(); jobCategoryListModal.IsEnable = 1; if (ckbIsHot.Checked) { jobCategoryListModal.IsHot = 1; } else { jobCategoryListModal.IsHot = 0; } jobCategoryListModal.PublishDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); zlzw.BLL.JobCategoryListBLL jobCategoryListBLL = new zlzw.BLL.JobCategoryListBLL(); jobCategoryListBLL.Add(jobCategoryListModal); } // 2. Close this window and Refresh parent window PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.JobCategoryListModal DataRowToModel(DataRow row) { zlzw.Model.JobCategoryListModal model = new zlzw.Model.JobCategoryListModal(); if (row != null) { if (row["JobCategoryID"] != null && row["JobCategoryID"].ToString() != "") { model.JobCategoryID = int.Parse(row["JobCategoryID"].ToString()); } if (row["JobCategoryGUID"] != null && row["JobCategoryGUID"].ToString() != "") { model.JobCategoryGUID = new Guid(row["JobCategoryGUID"].ToString()); } if (row["JobCategoryName"] != null) { model.JobCategoryName = row["JobCategoryName"].ToString(); } if (row["JobCount"] != null && row["JobCount"].ToString() != "") { model.JobCount = int.Parse(row["JobCount"].ToString()); } if (row["PublishDate"] != null && row["PublishDate"].ToString() != "") { model.PublishDate = DateTime.Parse(row["PublishDate"].ToString()); } if (row["IsHot"] != null && row["IsHot"].ToString() != "") { model.IsHot = int.Parse(row["IsHot"].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(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.JobCategoryListModal GetModel(int JobCategoryID) { SqlParameter[] parameters = { new SqlParameter("@JobCategoryID", SqlDbType.Int, 4) }; parameters[0].Value = JobCategoryID; zlzw.Model.JobCategoryListModal model = new zlzw.Model.JobCategoryListModal(); DataSet ds = DbHelperSQL.RunProcedure("JobCategoryList_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
private void LoadData(string strType) { if (strType == "1") { string strID = Request.QueryString["value"];//操作ID zlzw.BLL.JobCategoryListBLL jobCategoryListBLL = new zlzw.BLL.JobCategoryListBLL(); zlzw.Model.JobCategoryListModal jobCategoryListModal = jobCategoryListBLL.GetModel(int.Parse(Get_JobCategoryID(strID))); txbJobCategoryName.Text = jobCategoryListModal.JobCategoryName;//岗位名称 ViewState["PublishDate"] = jobCategoryListModal.PublishDate.ToString(); ViewState["JobCategoryGUID"] = jobCategoryListModal.JobCategoryGUID.ToString(); if (jobCategoryListModal.IsHot == 1) { ckbIsHot.Checked = true; } else { ckbIsHot.Checked = false; } ToolbarText2.Text = "编辑一个岗位类型"; } btnClose.OnClientClick = ActiveWindow.GetConfirmHideReference(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(zlzw.Model.JobCategoryListModal model) { int rowsAffected = 0; SqlParameter[] parameters = { new SqlParameter("@JobCategoryID", SqlDbType.Int, 4), new SqlParameter("@JobCategoryGUID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@JobCategoryName", SqlDbType.NVarChar, 50), new SqlParameter("@JobCount", SqlDbType.Int, 4), new SqlParameter("@PublishDate", SqlDbType.DateTime), new SqlParameter("@IsHot", SqlDbType.Int, 4), new SqlParameter("@IsEnable", SqlDbType.Int, 4), new SqlParameter("@Other01", SqlDbType.NVarChar, 50), new SqlParameter("@Other02", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.JobCategoryID; parameters[1].Value = model.JobCategoryGUID; parameters[2].Value = model.JobCategoryName; parameters[3].Value = model.JobCount; parameters[4].Value = model.PublishDate; parameters[5].Value = model.IsHot; parameters[6].Value = model.IsEnable; parameters[7].Value = model.Other01; parameters[8].Value = model.Other02; DbHelperSQL.RunProcedure("JobCategoryList_Update", parameters, out rowsAffected); if (rowsAffected > 0) { return(true); } else { return(false); } }