protected void Btn_ClearBDOS_Click(object sender, EventArgs e) { Grid_BDOS.EditIndex = -1; DropDownList1.Items.Insert(0, new ListItem("请选择", "")); BindDropDownList1(); TextBDOScode.Text = ""; BindGrid_BDOS(""); UpdatePanel_BDOS.Update(); Panel_NewBDOS.Visible = false; UpdatePanel_NewBDOS.Update(); }
protected void Btn_SearchBDOS_Click(object sender, EventArgs e) { Grid_BDOS.EditIndex = -1; string condition = GetCondition(); BindGrid_BDOS(condition); Panel_BDOS.Visible = true; UpdatePanel_BDOS.Update(); Panel_NewBDOS.Visible = false; UpdatePanel_NewBDOS.Update(); }
//Gridview删除 protected void Grid_Third_RowCommand(object sender, GridViewCommandEventArgs e) { Panel_NewThird.Visible = false; UpdatePanel_NewThird.Update(); if (e.CommandName == "Delete_Third") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_BDOS.SelectedIndex = row.RowIndex; Guid CDTLC_ID = new Guid(Convert.ToString(e.CommandArgument)); basicCodeL.Delete_CDThirdLevelCode(CDTLC_ID); BindGrid_Third(""); UpdatePanel_BDOS.Update(); } }
//Gridview删除 protected void Grid_BDOS_RowCommand(object sender, GridViewCommandEventArgs e) { Panel_NewBDOS.Visible = false; UpdatePanel_NewBDOS.Update(); if (e.CommandName == "Delete_BDOS") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_BDOS.SelectedIndex = row.RowIndex; string BDOS_Code = Convert.ToString(e.CommandArgument); basicCodeL.Delete_BDOrganization_depcode(BDOS_Code); BindGrid_BDOS(""); UpdatePanel_BDOS.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 BtnOK_NewBDOS_Click(object sender, EventArgs e) { if (DropDownList2.SelectedValue.ToString() == "" || newBDOScode.Text.ToString() == "" || TextBox4.Text.ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox4.Text.Length != 3) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('必须为3位数!')", true); return; } string bDOS_Name = DropDownList2.SelectedValue.ToString(); string bDOS_DepCode = newBDOScode.Text.ToString(); string bDOS_No = TextBox4.Text.ToString().Trim(); basicCodeL.Insert_Update_BDOrganization_depcode(bDOS_Name, bDOS_DepCode, bDOS_No); BindGrid_BDOS(""); UpdatePanel_BDOS.Update(); Panel_NewBDOS.Visible = false; UpdatePanel_NewBDOS.Update(); }
//Gridview编辑 protected void Grid_BDOS_RowUpdating(object sender, GridViewUpdateEventArgs e) { string bDOS_Name = Convert.ToString(Grid_BDOS.Rows[e.RowIndex].Cells[1].Text.Trim().ToString()); //类型不为空 if (((TextBox)(Grid_BDOS.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim().ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('部门代码不能为空!')", true); return; } string bDOS_DepCode = Convert.ToString(((TextBox)(Grid_BDOS.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim()); if (((TextBox)(Grid_BDOS.Rows[e.RowIndex].FindControl("BDOS_No"))).Text.Trim().ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('编号随机码起点不能为空!')", true); return; } if (((TextBox)(Grid_BDOS.Rows[e.RowIndex].FindControl("BDOS_No"))).Text.Trim().ToString().Length != 3) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('必须为3位数!')", true); return; } string bDOS_No = Convert.ToString(((TextBox)(Grid_BDOS.Rows[e.RowIndex].FindControl("BDOS_No"))).Text.Trim()); //DataSet ds = basicCodeL.Search_BDOrganization_depcode("and BDOS_DepCode = '" + bDOS_DepCode + " '"); //DataTable dt = ds.Tables[0]; //if (dt.Rows.Count != 0) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "alert", "alert('已有此代码,不能重名!')", true); // return; //} Grid_BDOS.EditIndex = -1; basicCodeL.Insert_Update_BDOrganization_depcode(bDOS_Name, bDOS_DepCode, bDOS_No); BindGrid_BDOS(""); UpdatePanel_BDOS.Update(); }
//取消编辑 protected void Grid_BDOS_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { Grid_BDOS.EditIndex = -1; UpdatePanel_BDOS.Update(); BindGrid_BDOS(""); }