////更新供应商 //protected void Gridview_SupplyInfo_RowUpdating(object sender, GridViewUpdateEventArgs e) //{ // Guid PMSI_ID = new Guid(Gridview_SupplyInfo.DataKeys[e.RowIndex].Value.ToString()); // string PMSI_SupplyName = Convert.ToString(((TextBox)(Gridview_SupplyInfo.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim().ToString()); // string PMSI_SupplySort = Convert.ToString(((TextBox)(Gridview_SupplyInfo.Rows[e.RowIndex].Cells[3].Controls[0])).Text.Trim().ToString()); // string PMSI_Remark = Convert.ToString(((TextBox)(Gridview_SupplyInfo.Rows[e.RowIndex].Cells[4].Controls[0])).Text.Trim().ToString());//设置成TextBook // Gridview_SupplyInfo.EditIndex = -1; // BindGridView_Supplyinfo(" "); // pms.UpdatePMSupplyInfo(PMSI_ID, PMSI_SupplyName, PMSI_SupplySort, PMSI_Remark); // BindGridView_Supplyinfo(" "); // this.UpdatePanel_SupplyInfo.Update(); // this.Panel_SupplyInfo.Visible = true; // this.UpdatePanel_PMSupplyInfo.Update(); //} ////编辑供应商 //protected void Gridview_SupplyInfo_RowEditing(object sender, GridViewEditEventArgs e) //{ // Gridview_SupplyInfo.EditIndex = e.NewEditIndex; // BindGridView_Supplyinfo(" "); //} ////取消编辑供应商 //protected void Gridview_SupplyInfo_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) //{ // Gridview_SupplyInfo.EditIndex = -1; // BindGridView_Supplyinfo(" "); //} //新增供应商确定 protected void ConfirmSupply(object sender, EventArgs e) { try { string Supplyname = ""; string Supplysort = ""; if (TextBox2.Text.ToString() == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel_PMSupplyInfo, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } else { Supplyname = TextBox2.Text.ToString(); } if (DropDownList3.SelectedValue.ToString() == "请选择") { ScriptManager.RegisterClientScriptBlock(UpdatePanel_PMSupplyInfo, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } else { Supplysort = DropDownList3.SelectedValue.ToString(); } string Remark = TextBox1.Text.ToString(); int PaymentTime = Convert.ToInt16(TextBox3.Text.ToString()); if (Label_Supply.Text == "新增供应商") { DataSet dss = pms.SelectPMSupply_Same(TextBox2.Text); DataTable dtt = dss.Tables[0]; if (dtt.Rows.Count > 0) { ScriptManager.RegisterClientScriptBlock(UpdatePanel_PMSupplyInfo, GetType(), "alert", "alert('该供应商已存在!')", true); return; } else { pms.InsertPMSupplyInfo(Supplyname, Supplysort, Remark, PaymentTime); ScriptManager.RegisterClientScriptBlock(UpdatePanel_PMSupplyInfo, GetType(), "alert", "alert('新增成功!')", true); } } if (Label_Supply.Text == "编辑供应商") { Guid PMSI_ID = new Guid(label_supplytypeid.Text.ToString()); pms.UpdatePMSupplyInfo(PMSI_ID, Supplyname, Supplysort, Remark, PaymentTime); ScriptManager.RegisterClientScriptBlock(UpdatePanel_PMSupplyInfo, GetType(), "alert", "alert('修改成功!')", true); } BindGridView_Supplyinfo(""); UpdatePanel_SupplyInfo.Update(); Panel_PMSupplyInfo.Visible = false; UpdatePanel_PMSupplyInfo.Update(); } catch (Exception) { throw; } }
protected void Gridview_SupplyInfo_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Look1")//点击查看联系方式 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview_SupplyInfo.SelectedIndex = row.RowIndex; label_supplytypeid.Text = Convert.ToString(e.CommandArgument); Label_SupplyContact_Source.Text = "Gridview数据源"; string sid = e.CommandArgument.ToString(); Guid ls = new Guid(sid); DataSet ds = pms.SelectPMSupply_One(ls); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { label_SNum.Text = dt.Rows[0][1].ToString(); label_SName.Text = dt.Rows[0][0].ToString(); } Label_SupplyContact_Source.Text = label_SNum.Text + " " + label_SName.Text; Panel_PMSupplyContact.Visible = true; BindGridView_SupplyContact_Gridview(sid); Panel_PMSupplyContact.Visible = true; UpdatePanel_PMSupplyContact.Update(); label1_BasicID.Text = sid; } if (e.CommandName == "Edit1") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview_SupplyInfo.SelectedIndex = row.RowIndex; Label_Supply.Text = "编辑供应商"; label_supplytypeid.Text = Convert.ToString(e.CommandArgument); Guid supplyid = new Guid(Convert.ToString(e.CommandArgument)); DataSet ds = pms.SelectPMSupply_One(supplyid); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { TextBox2.Text = dt.Rows[0][0].ToString(); DropDownList3.SelectedValue = dt.Rows[0][4].ToString(); TextBox1.Text = dt.Rows[0][3].ToString(); TextBox3.Text = dt.Rows[0][5].ToString(); } Panel_PMSupplyInfo.Visible = true; UpdatePanel_PMSupplyInfo.Update(); } if (e.CommandName == "Delete1")//删除供应商 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview_SupplyInfo.SelectedIndex = row.RowIndex; Guid supplyid = new Guid(Convert.ToString(e.CommandArgument)); pms.DeletePMSupplyInfo(supplyid); BindGridView_Supplyinfo(""); UpdatePanel_SupplyInfo.Update(); ScriptManager.RegisterClientScriptBlock(UpdatePanel_SupplyInfo, GetType(), "alert", "alert('删除成功!')", true); return; } }
//重置 protected void Button3_Reset(object sender, EventArgs e) { try { DropDownList1.SelectedValue = "选择供应商类别"; SupplyName.Text = ""; PMSI_SupplyNum.Text = ""; BindGridView_Supplyinfo(""); UpdatePanel_SupplyInfo.Update(); UpdatePanel_PMSupplyContact.Update(); } catch (Exception) { throw; } }
//检索 protected void Button1_Sh(object sender, EventArgs e) { try { string Condition = GetCondition(); BindGridView_Supplyinfo(Condition); Panel_SupplyInfo.Visible = true; UpdatePanel_SupplyInfo.Update(); Panel_PMSupplyContact.Visible = false; UpdatePanel_PMSupplyContact.Update(); Panel_PMSupplyInfo.Visible = false; UpdatePanel_PMSupplyInfo.Update(); Panel_SupplyContactNew.Visible = false; UpdatePanel_SupplyContactNew.Update(); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { label_pagestate.Text = Request.QueryString["state"]; string state = label_pagestate.Text; if (state == "Look") { Button8.Visible = false; Gridview_SupplyInfo.Columns[7].Visible = false; Gridview_SupplyInfo.Columns[8].Visible = false; Button2.Visible = false; GridView_PMSupplyContact.Columns[9].Visible = false; GridView_PMSupplyContact.Columns[10].Visible = false; Button8.Enabled = false; UpdatePanel_SupplySearch.Update(); UpdatePanel_SupplyInfo.Update(); UpdatePanel_PMSupplyContact.Update(); Title = "供应商信息查看"; } else { Title = "供应商信息维护"; } if (!((Session["UserRole"].ToString().Contains("供应商信息查看")) || (Session["UserRole"].ToString().Contains("供应商信息维护")))) { Response.Redirect("~/Default.aspx"); } DropDownList1.Items.Insert(0, new ListItem("选择供应商类别", "选择供应商类别")); UpdatePanel_SupplySearch.Visible = true; BindGridView_Supplyinfo(""); UpdatePanel_SupplyInfo.Update(); UpdatePanel_PMSupplyContact.Update(); } }