protected void BtnReset_Click(object sender, EventArgs e) { Grid_Post.SelectedIndex = -1;//如果Grid_Post存在行加黑,则取消加黑 TxtPost.Text = ""; DdlDep.ClearSelection(); BindGridview("", ""); LblRecordIsSearch.Text = "检索前"; s = ""; UpdatePanel_Post.Update(); }
protected void BtnSearch_Click(object sender, EventArgs e) { s = DdlDep.SelectedItem.ToString() == "请选择" ? "" : DdlDep.SelectedItem.ToString(); Grid_Post.DataSource = hRFilesMgtL.Search_HRPost(s, TxtPost.Text); Grid_Post.DataBind(); LblRecordIsSearch.Text = "检索后"; Grid_Post.SelectedIndex = -1;//如果Grid_Post存在行加黑,则取消加黑 UpdatePanel_Post.Update(); }
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(); } }