protected void Grid_Post_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit_Post") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Post.SelectedIndex = row.RowIndex; Clear(); Panel_NewPost.Visible = true; UpdatePanel_NewPost.Update(); LblState.Text = "Edit"; ////为Dropdownlist绑定值,否则会出错 Bind_Ddlst(DdlNewDep); id = new Guid(e.CommandArgument.ToString()); HRFilesMgtInfo hR = hRFilesMgtL.SearchByID_HRPost_BDOrganizationSheet(id)[0]; TxtNewPost.Text = hR.HRP_Post; DdlNewDep.SelectedValue = hR.BDOS_Code; UpdatePanel_NewPost.Update(); } if (e.CommandName == "Delete_Post") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Post.SelectedIndex = -1; Guid guid = new Guid(e.CommandArgument.ToString()); hRFilesMgtL.Delete_HRPost(guid); BindGridview("", ""); } }
public int Update_HRPost(HRFilesMgtInfo hr) { return(iHR.Update_HRPost(hr)); }
public int Insert_HRPost(HRFilesMgtInfo hr) { return(iHR.Insert_HRPost(hr)); }
public int Update_HRPost(HRFilesMgtInfo hr) { return((int)SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "Proc_U_HRPost", new SqlParameter("@HRP_ID", hr.HRP_ID), new SqlParameter("@BDOS_Code", hr.BDOS_Code), new SqlParameter("@HRP_Post", hr.HRP_Post))); }
protected void BtnSubmit_Click(object sender, EventArgs e) { if (LblState.Text == "New") { if (DdlNewDep.SelectedValue == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('请选择部门!')", true); return; } else { hRFilesMgtInfo.BDOS_Code = DdlNewDep.SelectedValue; } hRFilesMgtInfo.HRP_ID = Guid.NewGuid(); if (TxtNewPost.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('请输入岗位!')", true); return; } else { hRFilesMgtInfo.HRP_Post = TxtNewPost.Text; } hRFilesMgtInfo.HRP_IsDeleted = false; int i; try { i = hRFilesMgtL.Insert_HRPost(hRFilesMgtInfo); if (i <= 0) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('该部门下已存在的岗位,请核实!')", true); return; } else { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('新增成功!')", true); } } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('新增失败!" + ex + "')", true); } Clear(); if (LblRecordIsSearch.Text == "检索前") { BindGridview("", ""); } if (LblRecordIsSearch.Text == "检索后") { BindGridview(s, TxtPost.Text); } Panel_NewPost.Visible = false; UpdatePanel_Post.Update(); UpdatePanel_NewPost.Update(); } if (LblState.Text == "Edit") { HRFilesMgtInfo hr = new HRFilesMgtInfo(); if (DdlNewDep.SelectedValue == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('请选择部门!')", true); return; } else { hr.BDOS_Code = DdlNewDep.SelectedValue.ToString(); } if (TxtNewPost.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('请输入岗位!')", true); return; } else { hr.HRP_Post = TxtNewPost.Text; } hr.HRP_ID = id; int u; try { u = hRFilesMgtL.Update_HRPost(hr); if (u <= 0) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('该部门下已存在的岗位,请核实!')", true); return; } else { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('编辑成功')", true); } } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('编辑失败!" + ex + "')", true); } Clear(); if (LblRecordIsSearch.Text == "检索前") { BindGridview("", ""); } if (LblRecordIsSearch.Text == "检索后") { BindGridview(s, TxtPost.Text); } Panel_NewPost.Visible = false; UpdatePanel_Post.Update(); } }