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.JobKindListBLL jobKindListBLL = new zlzw.BLL.JobKindListBLL(); zlzw.Model.JobKindListModel jobKindListModel = jobKindListBLL.GetModel(int.Parse(Get_JobCategoryID(strSelectID))); jobKindListModel.IsEnable = 0; jobKindListBLL.Update(jobKindListModel); JobKindList_BindGrid(); #endregion } else { return; } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(zlzw.Model.JobKindListModel model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@JobKindID", SqlDbType.Int, 4), new SqlParameter("@JobCategoryGUID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@JobKindGUID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@JobKindName", SqlDbType.NVarChar, 50), new SqlParameter("@JobCount", SqlDbType.Int, 4), new SqlParameter("@IsHot", SqlDbType.Int, 4), new SqlParameter("@IsEnable", SqlDbType.Int, 4), new SqlParameter("@IsShowDefaultPage", SqlDbType.Int, 4), new SqlParameter("@PublishDate", SqlDbType.DateTime), new SqlParameter("@Other01", SqlDbType.NVarChar, 50), new SqlParameter("@Other02", SqlDbType.NVarChar, 50), new SqlParameter("@Other03", SqlDbType.Int, 4) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = Guid.NewGuid(); parameters[2].Value = Guid.NewGuid(); parameters[3].Value = model.JobKindName; parameters[4].Value = model.JobCount; parameters[5].Value = model.IsHot; parameters[6].Value = model.IsEnable; parameters[7].Value = model.IsShowDefaultPage; parameters[8].Value = model.PublishDate; parameters[9].Value = model.Other01; parameters[10].Value = model.Other02; parameters[11].Value = model.Other03; DbHelperSQL.RunProcedure("JobKindList_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }
private void LoadData(string strType) { if (strType == "1") { string strID = Request.QueryString["value"];//操作ID zlzw.BLL.JobKindListBLL jobKindListBLL = new zlzw.BLL.JobKindListBLL(); zlzw.Model.JobKindListModel jobKindListModel = jobKindListBLL.GetModel(int.Parse(Get_JobKindID(strID))); txbNJobKindName.Text = jobKindListModel.JobKindName; //岗位名称 drpJobCategory.SelectedValue = jobKindListModel.JobCategoryGUID.ToString(); //岗位类型名称 if (jobKindListModel.IsHot == 1) { ckbIsHot.Checked = true; } else { ckbIsHot.Checked = false; } if (jobKindListModel.IsShowDefaultPage == 1) { ckbIsShowDefaultPage.Checked = true; } else { ckbIsShowDefaultPage.Checked = false; } ViewState["PublishDate"] = jobKindListModel.PublishDate.ToString(); ViewState["JobKindGUID"] = jobKindListModel.JobKindGUID; ViewState["JobCategoryGUID"] = jobKindListModel.JobCategoryGUID;//岗位分类 ToolbarText2.Text = "编辑一个岗位"; } btnClose.OnClientClick = ActiveWindow.GetConfirmHideReference(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(zlzw.Model.JobKindListModel model) { int rowsAffected = 0; SqlParameter[] parameters = { new SqlParameter("@JobKindID", SqlDbType.Int, 4), new SqlParameter("@JobCategoryGUID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@JobKindGUID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@JobKindName", SqlDbType.NVarChar, 50), new SqlParameter("@JobCount", SqlDbType.Int, 4), new SqlParameter("@IsHot", SqlDbType.Int, 4), new SqlParameter("@IsEnable", SqlDbType.Int, 4), new SqlParameter("@IsShowDefaultPage", SqlDbType.Int, 4), new SqlParameter("@PublishDate", SqlDbType.DateTime), new SqlParameter("@Other01", SqlDbType.NVarChar, 50), new SqlParameter("@Other02", SqlDbType.NVarChar, 50), new SqlParameter("@Other03", SqlDbType.Int, 4) }; parameters[0].Value = model.JobKindID; parameters[1].Value = model.JobCategoryGUID; parameters[2].Value = model.JobKindGUID; parameters[3].Value = model.JobKindName; parameters[4].Value = model.JobCount; parameters[5].Value = model.IsHot; parameters[6].Value = model.IsEnable; parameters[7].Value = model.IsShowDefaultPage; parameters[8].Value = model.PublishDate; parameters[9].Value = model.Other01; parameters[10].Value = model.Other02; parameters[11].Value = model.Other03; DbHelperSQL.RunProcedure("JobKindList_Update", parameters, out rowsAffected); if (rowsAffected > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.JobKindListModel GetModel(int JobKindID) { SqlParameter[] parameters = { new SqlParameter("@JobKindID", SqlDbType.Int, 4) }; parameters[0].Value = JobKindID; zlzw.Model.JobKindListModel model = new zlzw.Model.JobKindListModel(); DataSet ds = DbHelperSQL.RunProcedure("JobKindList_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["JobKindID"] != null && ds.Tables[0].Rows[0]["JobKindID"].ToString() != "") { model.JobKindID = int.Parse(ds.Tables[0].Rows[0]["JobKindID"].ToString()); } if (ds.Tables[0].Rows[0]["JobCategoryGUID"] != null && ds.Tables[0].Rows[0]["JobCategoryGUID"].ToString() != "") { model.JobCategoryGUID = new Guid(ds.Tables[0].Rows[0]["JobCategoryGUID"].ToString()); } if (ds.Tables[0].Rows[0]["JobKindGUID"] != null && ds.Tables[0].Rows[0]["JobKindGUID"].ToString() != "") { model.JobKindGUID = new Guid(ds.Tables[0].Rows[0]["JobKindGUID"].ToString()); } if (ds.Tables[0].Rows[0]["JobKindName"] != null && ds.Tables[0].Rows[0]["JobKindName"].ToString() != "") { model.JobKindName = ds.Tables[0].Rows[0]["JobKindName"].ToString(); } if (ds.Tables[0].Rows[0]["JobCount"] != null && ds.Tables[0].Rows[0]["JobCount"].ToString() != "") { model.JobCount = int.Parse(ds.Tables[0].Rows[0]["JobCount"].ToString()); } if (ds.Tables[0].Rows[0]["IsHot"] != null && ds.Tables[0].Rows[0]["IsHot"].ToString() != "") { model.IsHot = int.Parse(ds.Tables[0].Rows[0]["IsHot"].ToString()); } if (ds.Tables[0].Rows[0]["IsEnable"] != null && ds.Tables[0].Rows[0]["IsEnable"].ToString() != "") { model.IsEnable = int.Parse(ds.Tables[0].Rows[0]["IsEnable"].ToString()); } if (ds.Tables[0].Rows[0]["IsShowDefaultPage"] != null && ds.Tables[0].Rows[0]["IsShowDefaultPage"].ToString() != "") { model.IsShowDefaultPage = int.Parse(ds.Tables[0].Rows[0]["IsShowDefaultPage"].ToString()); } if (ds.Tables[0].Rows[0]["PublishDate"] != null && ds.Tables[0].Rows[0]["PublishDate"].ToString() != "") { model.PublishDate = DateTime.Parse(ds.Tables[0].Rows[0]["PublishDate"].ToString()); } if (ds.Tables[0].Rows[0]["Other01"] != null && ds.Tables[0].Rows[0]["Other01"].ToString() != "") { model.Other01 = ds.Tables[0].Rows[0]["Other01"].ToString(); } if (ds.Tables[0].Rows[0]["Other02"] != null && ds.Tables[0].Rows[0]["Other02"].ToString() != "") { model.Other02 = ds.Tables[0].Rows[0]["Other02"].ToString(); } if (ds.Tables[0].Rows[0]["Other03"] != null && ds.Tables[0].Rows[0]["Other03"].ToString() != "") { model.Other03 = int.Parse(ds.Tables[0].Rows[0]["Other03"].ToString()); } return(model); } else { return(null); } }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { if (Request.QueryString["Type"] == "1") { //编辑保存 zlzw.Model.JobKindListModel jobKindListModel = new zlzw.Model.JobKindListModel(); jobKindListModel.JobKindName = txbNJobKindName.Text; jobKindListModel.JobKindGUID = new Guid(ViewState["JobKindGUID"].ToString()); jobKindListModel.JobCategoryGUID = new Guid(drpJobCategory.SelectedValue); jobKindListModel.IsEnable = 1; if (ckbIsHot.Checked) { jobKindListModel.IsHot = 1; } else { jobKindListModel.IsHot = 0; } if (ckbIsShowDefaultPage.Checked) { jobKindListModel.IsShowDefaultPage = 1; } else { jobKindListModel.IsShowDefaultPage = 0; } jobKindListModel.PublishDate = DateTime.Parse(ViewState["PublishDate"].ToString()); jobKindListModel.JobKindID = int.Parse(Get_JobKindID(Request.QueryString["value"])); zlzw.BLL.JobKindListBLL jobKindListBLL = new zlzw.BLL.JobKindListBLL(); jobKindListBLL.Update(jobKindListModel); } else { //添加保存 zlzw.Model.JobKindListModel jobKindListModel = new zlzw.Model.JobKindListModel(); jobKindListModel.JobKindName = txbNJobKindName.Text; jobKindListModel.JobKindGUID = Guid.NewGuid(); jobKindListModel.JobCategoryGUID = new Guid(drpJobCategory.SelectedValue); jobKindListModel.IsEnable = 1; if (ckbIsHot.Checked) { jobKindListModel.IsHot = 1; } else { jobKindListModel.IsHot = 0; } if (ckbIsShowDefaultPage.Checked) { jobKindListModel.IsShowDefaultPage = 1; } else { jobKindListModel.IsShowDefaultPage = 0; } jobKindListModel.PublishDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); zlzw.BLL.JobKindListBLL jobKindListBLL = new zlzw.BLL.JobKindListBLL(); jobKindListBLL.Add(jobKindListModel); } // 2. Close this window and Refresh parent window PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }