//新增确认 protected void BtnOK_NewCDDep_Click(object sender, EventArgs e) { if (newCDdep.Text.ToString() == "" || newCDcode.Text.ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } //string bDOS_Name = this.DropDownList4.SelectedValue.ToString(); string cDDDCT_Dep = newCDdep.Text.ToString(); string cDDDCT_Code = newCDcode.Text.ToString(); //DataSet ds = basicCodeL.Search_BDOrganization_depcode("and BDOS_Name = '" + bDOS_Name + "' and BDOS_DepCode!=''"); DataSet ds = basicCodeL.Search_CDDepDistributeCodeT(" and (a.CDDDCT_Code='" + cDDDCT_Code + "' or a.CDDDCT_Dep='" + cDDDCT_Dep + "')"); DataTable dt = ds.Tables[0]; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('已有代码,不能重复!')", true); return; } basicCodeL.Insert_CDDepDistributeCodeT(cDDDCT_Dep, cDDDCT_Code); BindGrid_CDDep(""); UpdatePanel_CDDep.Update(); Panel_NewCDDep.Visible = false; UpdatePanel_NewCDDep.Update(); }
//Gridview编辑 protected void Grid_CDDep_RowUpdating(object sender, GridViewUpdateEventArgs e) { Guid cDDDCT_ID = new Guid(Grid_CDDep.DataKeys[e.RowIndex].Value.ToString()); //string bDOS_Name = Convert.ToString(Grid_CDDep.Rows[e.RowIndex].Cells[1].Text.Trim().ToString()); //string cDDDCT_Dep = Convert.ToString(((TextBox)(Grid_CDDep.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim()); string cDDDCT_Dep = Convert.ToString(Grid_CDDep.Rows[e.RowIndex].Cells[1].Text.Trim().ToString()); string cDDDCT_Code = Convert.ToString(((TextBox)(Grid_CDDep.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim()); //岗位不为空 //if (((TextBox)(Grid_CDDep.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim().ToString() == "") //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "alert", "alert('岗位不能为空!')", true); // return; //} //岗位代码不为空 if (((TextBox)(Grid_CDDep.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim().ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('岗位代码不能为空!')", true); return; } //DataSet ds = basicCodeL.Search_CDDepDistributeCodeT(" and( CDDDCT_Code='" + cDDDCT_Code + "' and BDOS_Name!='" + bDOS_Name + "') or (BDOS_Name='" + bDOS_Name + "' and CDDDCT_Dep = '" + cDDDCT_Dep + " ' and CDDDCT_Code='" + cDDDCT_Code + "') or (BDOS_Name!='" + bDOS_Name + "' and CDDDCT_Dep = '" + cDDDCT_Dep + " ')"); DataSet ds = basicCodeL.Search_CDDepDistributeCodeT(" and CDDDCT_Code='" + cDDDCT_Code + "' "); DataTable dt = ds.Tables[0]; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('已有此岗位及代码,不能重名!')", true); return; } Grid_CDDep.EditIndex = -1; basicCodeL.Update_CDDepDistributeCodeT(cDDDCT_ID, cDDDCT_Dep, cDDDCT_Code); BindGrid_CDDep(""); UpdatePanel_CDDep.Update(); }
protected void Btn_SearchCDDep_Click(object sender, EventArgs e) { Grid_CDDep.EditIndex = -1; string condition = GetCondition2(); BindGrid_CDDep(condition); Panel_CDDep.Visible = true; UpdatePanel_CDDep.Update(); Panel_NewCDDep.Visible = false; UpdatePanel_NewCDDep.Update(); }
protected void Btn_ClearCDDep_Click(object sender, EventArgs e) { Grid_CDDep.EditIndex = -1; //DropDownList3.Items.Insert(0, new ListItem("请选择", "")); //BindDropDownList3(); TextDep.Text = ""; TextCode.Text = ""; BindGrid_CDDep(""); UpdatePanel_CDDep.Update(); Panel_NewCDDep.Visible = false; UpdatePanel_NewCDDep.Update(); }
//Gridview删除 protected void Grid_CDDep_RowCommand(object sender, GridViewCommandEventArgs e) { Panel_NewCDDep.Visible = false; UpdatePanel_NewCDDep.Update(); if (e.CommandName == "Delete_CDDep") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_BDOS.SelectedIndex = row.RowIndex; Guid CDDDCT_ID = new Guid(Convert.ToString(e.CommandArgument)); basicCodeL.Delete_CDDepDistributeCodeT(CDDDCT_ID); BindGrid_CDDep(""); UpdatePanel_CDDep.Update(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Title = "受控文件基础数据维护"; BindGrid_BDOS(""); BindDropDownList1(); UpdatePanel_BDOS.Update(); BindGrid_CDDep(""); //BindDropDownList3(); UpdatePanel_CDDep.Update(); BindGrid_Third(""); UpdatePanel_Third.Update(); try { if (Request.QueryString["status"].ToString() != "") { Lab_Status.Text = Request.QueryString["status"].ToString(); } if (Lab_Status.Text == "BasicCode" && Session["UserRole"].ToString().Contains("受控文件基础数据维护")) { Title = "受控文件基础数据维护"; } if (Lab_Status.Text == "BasicLook" && Session["UserRole"].ToString().Contains("受控文件基础数据查看")) { Title = "受控文件基础数据查看"; Btn_NewBDOS.Visible = false; Grid_BDOS.Columns[4].Visible = false; Grid_BDOS.Columns[5].Visible = false; Btn_NewCDDep.Visible = false; Grid_CDDep.Columns[3].Visible = false; Grid_CDDep.Columns[4].Visible = false; Btn_NewThird.Visible = false; Grid_Third.Columns[3].Visible = false; Grid_Third.Columns[4].Visible = false; } } catch (Exception) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('可能您没有权限操作和查看本页面,请退出选择其他账号登陆,或联系管理员!')", true); Response.Redirect("~/Default.aspx"); } } }
//取消编辑 protected void Grid_CDDep_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { Grid_CDDep.EditIndex = -1; UpdatePanel_CDDep.Update(); BindGrid_CDDep(""); }