//检索 protected void Button1_Sh(object sender, EventArgs e) { try { string Condition = GetCondition(); if (DDList1.SelectedValue == "是") { BindGridView_PMPApplyRuleinfo_One(Condition); } else { if (DDList1.SelectedValue == "否") { BindGridView_PMPApplyRuleinfo(Condition); } } Panel_PMPApplyRuleInfo.Visible = true; UpdatePanel_PMPApplyRuleInfo.Update(); } catch (Exception) { throw; } }
//提交采购规则 protected void ConfirmRuleInfo(object sender, EventArgs e) { try { if (label_Rule.Text == "编辑") { Guid RuleID = new Guid(label_RuleID.Text.ToString()); pmp.UpdatePMPurchaseingApplyRule(RuleID, TextBox2.Text.ToString()); Panel_PMPApplyRuleInfo.Visible = true; UpdatePanel_PMPApplyRuleInfo.Update(); Panel_PMPAR_RuleInfo.Visible = false; } else { DataSet ds = pl.SelectPMPurchaseingApplyRule(); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { ScriptManager.RegisterClientScriptBlock(UpdatePanel_PMPAR_RuleInfo, GetType(), "alert", "alert('请先删除正在使用的采购规则!')", true); return; } else { //DateTime.Now; if (TextBox2.Text.ToString() == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel_PMPAR_RuleInfo, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } else { if (label_Rule.Text == "新增") { string name = Session["UserName"].ToString().Trim(); pmp.InsertPMPurchaseingApplyRule(name, TextBox2.Text.ToString());//获取用户名 BindGridView_PMPApplyRuleinfo_One(""); } Panel_PMPApplyRuleInfo.Visible = true; UpdatePanel_PMPApplyRuleInfo.Update(); Panel_PMPAR_RuleInfo.Visible = false; } } } } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { if (!((Session["UserRole"].ToString().Contains("采购申请规则制定")))) { Response.Redirect("~/Default.aspx"); } if (!IsPostBack) { Title = "采购规则制定"; UpdatePanel_PMPApplyRuleSearch.Visible = true; BindGridView_PMPApplyRuleinfo_One(""); UpdatePanel_PMPApplyRuleInfo.Update(); } }
//删除采购规则 protected void Gridview_PMPApplyRule_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Delete1") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview_PMPApplyRuleInfo.SelectedIndex = row.RowIndex; Guid supplyid = new Guid(Convert.ToString(e.CommandArgument)); pmp.DeletePMPurchaseingApplyRule(supplyid); BindGridView_PMPApplyRuleinfo_One(""); UpdatePanel_PMPApplyRuleInfo.Update(); ScriptManager.RegisterClientScriptBlock(UpdatePanel_PMPApplyRuleInfo, GetType(), "alert", "alert('删除成功!')", true); return; } if (e.CommandName == "Edit1")//编辑 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview_PMPApplyRuleInfo.SelectedIndex = row.RowIndex; label_Rule.Text = "编辑"; Button4.Visible = false; Button6.Visible = true; Button7.Visible = true; TextBox2.Enabled = true; label_RuleID.Text = e.CommandArgument.ToString(); string condition = " and PMPAR_ID='" + label_RuleID.Text + "'"; Guid supplyid = new Guid(Convert.ToString(e.CommandArgument)); DataSet ds = pmp.SelectPMPurchaseingApplyRule_One(condition); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { TextBox2.Text = dt.Rows[0][3].ToString(); } Panel_PMPAR_RuleInfo.Visible = true; UpdatePanel_PMPAR_RuleInfo.Update(); } if (e.CommandName == "Look1")//查看 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview_PMPApplyRuleInfo.SelectedIndex = row.RowIndex; Button4.Visible = true; Button6.Visible = false; Button7.Visible = false; TextBox2.Enabled = false; Guid supplyid = new Guid(Convert.ToString(e.CommandArgument)); if (DDList1.SelectedValue == "否") { string condition = " and PMPAR_ID='" + supplyid + "'"; DataSet ds = pmp.SelectPMPurchaseingApplyRule(condition); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { TextBox2.Text = dt.Rows[0][3].ToString(); } } if (DDList1.SelectedValue == "是") { string condition = " and PMPAR_ID='" + supplyid + "'"; DataSet ds = pmp.SelectPMPurchaseingApplyRule_One(condition); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { TextBox2.Text = dt.Rows[0][3].ToString(); } } Panel_PMPAR_RuleInfo.Visible = true; UpdatePanel_PMPAR_RuleInfo.Update(); } } catch (Exception) { throw; } }