//退料表--删除、修改 protected void Gridview3_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Mole")//修改 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview3.SelectedIndex = row.RowIndex; label_CopperRT.Text = "修改"; label_CopperReturnID.Text = e.CommandArgument.ToString(); Panel_CopperReturn.Visible = true; TextBox13.Text = Gridview3.Rows[Gridview3.SelectedIndex].Cells[1].Text.ToString(); TextBox14.Text = Gridview3.Rows[Gridview3.SelectedIndex].Cells[2].Text.ToString(); TextBox18.Text = Gridview3.Rows[Gridview3.SelectedIndex].Cells[5].Text.ToString(); TextBox13.Enabled = false; TextBox14.Enabled = false; UpdatePane_CopperReturn.Update(); } if (e.CommandName == "Dani")//删除 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview3.SelectedIndex = row.RowIndex; label_CopperReturnID.Text = e.CommandArgument.ToString(); PMCopperFoundryinfo.PMCR_ID = new Guid(e.CommandArgument.ToString()); PMCopperFoundryinfo.PMCF_ID = new Guid(label_CopperID.Text); PMCopperFoundryinfo.PMCR_NetNum = Convert.ToDecimal(Gridview3.Rows[Gridview3.SelectedIndex].Cells[4].Text.ToString()); pf.DeletePMCopperReturn(PMCopperFoundryinfo); BindGridview3(PMCopperFoundryinfo); BindGridview1(""); UpdatePanel_Copper.Update(); Panel1.Visible = true; UpdatePanel1.Update(); ScriptManager.RegisterClientScriptBlock(UpdatePanel1, GetType(), "aa", "alert('删除成功!')", true); return; } }
//提交铜材代工表 protected void Button1_Com1(object sender, EventArgs e) { if (TextBox4.Text != "") { PMCopperFoundryinfo.PMCF_MaterialName = TextBox4.Text; } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperNew, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox3.Text != "") { PMCopperFoundryinfo.PMCF_ReturnTotalNum = Convert.ToDecimal(TextBox3.Text); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperNew, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox5.Text != "") { PMCopperFoundryinfo.PMCF_InTotalNum = Convert.ToDecimal(TextBox5.Text); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperNew, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox6.Text != "") { PMCopperFoundryinfo.PMSI_ID = new Guid(label_SupplyID.Text); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperNew, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } if (label_New.Text == "新增铜材代工表") { pf.InsertPMCopperFoundry(PMCopperFoundryinfo); } else { PMCopperFoundryinfo.PMCF_ID = new Guid(label_CopperID.Text); pf.UpdatePMCopperFoundry(PMCopperFoundryinfo); } TextBox4.Text = ""; TextBox3.Text = ""; TextBox6.Text = ""; TextBox5.Text = ""; Panel_CopperNew.Visible = false; UpdatePanel_CopperNew.Update(); BindGridview1(""); UpdatePanel_Copper.Update(); }
//重置 protected void Button3_Reset(object sender, EventArgs e) { BindGridview1(""); UpdatePanel_Copper.Update(); TextBox_Factory.Text = ""; TextBox1.Text = ""; TextBox2.Text = ""; TextBox_Time1.Text = ""; TextBox_Time2.Text = ""; UpdatePanel_CopperFoundrySearch.Update(); }
protected void Page_Load(object sender, EventArgs e) { Title = "铜材代工"; if (!((Session["UserRole"].ToString().Contains("铜材代工")))) { Response.Redirect("~/Default.aspx"); } if (!IsPostBack) { BindGridview1(""); UpdatePanel_Copper.Update(); } }
//提交退料 protected void Button_Rois(object sender, EventArgs e) { if (TextBox13.Text != "") { PMCopperFoundryinfo.PMCR_Num = Convert.ToDecimal(TextBox13.Text); } else { ScriptManager.RegisterClientScriptBlock(UpdatePane_CopperReturn, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox14.Text != "") { PMCopperFoundryinfo.PMCR_DeductRate = Convert.ToDecimal(TextBox14.Text); } else { ScriptManager.RegisterClientScriptBlock(UpdatePane_CopperReturn, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox18.Text != "") { PMCopperFoundryinfo.PMCR_Remark = TextBox18.Text; } else { ScriptManager.RegisterClientScriptBlock(UpdatePane_CopperReturn, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } PMCopperFoundryinfo.PMCF_ID = new Guid(label_CopperID.Text.ToString()); if (label_CopperRT.Text == "新增") { pf.InsertPMCopperReturn(PMCopperFoundryinfo); } if (label_CopperRT.Text == "修改") { PMCopperFoundryinfo.PMCR_ID = new Guid(label_CopperReturnID.Text); pf.UpdatePMCopperReturn(PMCopperFoundryinfo); } TextBox13.Text = ""; TextBox14.Text = ""; TextBox18.Text = ""; Panel_CopperReturn.Visible = false; UpdatePane_CopperReturn.Update(); PMCopperFoundryinfo.PMCF_ID = new Guid(label_CopperID.Text); BindGridview3(PMCopperFoundryinfo); UpdatePanel1.Update(); BindGridview1(""); UpdatePanel_Copper.Update(); }
//铜材正料--修改、删除 protected void Gridview2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Merry")//修改 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview2.SelectedIndex = row.RowIndex; label_CopperIn.Text = "修改"; label_CopperInID.Text = e.CommandArgument.ToString(); TextBox7.Text = Gridview2.Rows[Gridview2.SelectedIndex].Cells[2].Text.ToString(); TextBox8.Text = Gridview2.Rows[Gridview2.SelectedIndex].Cells[3].Text.ToString(); TextBox9.Text = Gridview2.Rows[Gridview2.SelectedIndex].Cells[4].Text.ToString(); TextBox11.Text = Gridview2.Rows[Gridview2.SelectedIndex].Cells[5].Text.ToString(); TextBox12.Text = Gridview2.Rows[Gridview2.SelectedIndex].Cells[7].Text.ToString(); DropDownList4.SelectedValue = Gridview2.Rows[Gridview2.SelectedIndex].Cells[9].Text.ToString(); TextBox10.Text = Gridview2.Rows[Gridview2.SelectedIndex].Cells[8].Text.ToString(); TextBox22.Text = Gridview2.Rows[Gridview2.SelectedIndex].Cells[1].Text.ToString(); TextBox7.Enabled = false; TextBox8.Enabled = false; TextBox22.Enabled = false; Panel_CopperInNew.Visible = true; UpdatePanel_CopperInNew.Update(); } if (e.CommandName == "Denol")//删除 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview2.SelectedIndex = row.RowIndex; label_CopperInID.Text = e.CommandArgument.ToString(); PMCopperFoundryinfo.PMCI_ID = new Guid(e.CommandArgument.ToString()); PMCopperFoundryinfo.PMCF_ID = new Guid(label_CopperID.Text); PMCopperFoundryinfo.PMCI_ExpendNum = Convert.ToDecimal(Gridview2.Rows[Gridview2.SelectedIndex].Cells[6].Text.ToString()); pf.DeletePMCopperIn(PMCopperFoundryinfo); BindGridview2(PMCopperFoundryinfo); BindGridview1(""); UpdatePanel_Copper.Update(); Panel_CopperIn.Visible = true; UpdatePanel_CopperIn.Update(); ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperIn, GetType(), "aa", "alert('删除成功!')", true); return; } }
//检索 protected void Button1_Sh(object sender, EventArgs e) { string condition = GetCondition(); BindGridview1(condition); UpdatePanel_Copper.Update(); Panel_CopperNew.Visible = false; UpdatePanel_CopperNew.Update(); Panel_Supply.Visible = false; UpdatePanel_Supply.Update(); Panel_CopperIn.Visible = false; UpdatePanel_CopperIn.Update(); Panel1.Visible = false; UpdatePanel1.Update(); Panel2.Visible = false; UpdatePanel2.Update(); Panel_CopperInNew.Visible = false; UpdatePanel_CopperInNew.Update(); Panel_CopperReturn.Visible = false; UpdatePane_CopperReturn.Update(); Panel_CopperPrice.Visible = false; UpdatePanel_CopperPrice.Update(); }
//提交正料 protected void Button_Rocky(object sender, EventArgs e) { if (TextBox7.Text != "") { PMCopperFoundryinfo.PMCI_ProductNum = Convert.ToDecimal(TextBox7.Text.ToString()); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperInNew, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox8.Text != "") { PMCopperFoundryinfo.PMCI_ProPrice = Convert.ToDecimal(TextBox8.Text.ToString()); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperInNew, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox9.Text != "") { PMCopperFoundryinfo.PMCI_BillTotalPrice = Convert.ToDecimal(TextBox9.Text.ToString()); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperInNew, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox11.Text != "") { PMCopperFoundryinfo.PMCI_AccountRate = Convert.ToDecimal(TextBox11.Text.ToString()); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperInNew, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox12.Text != "") { PMCopperFoundryinfo.PMCI_BillNum = TextBox12.Text.ToString(); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperInNew, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (DropDownList4.SelectedValue != "请选择") { PMCopperFoundryinfo.PMCI_Pay = DropDownList4.SelectedValue.ToString(); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperInNew, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox10.Text != "") { PMCopperFoundryinfo.PMCI_Remark = TextBox10.Text.ToString(); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperInNew, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox22.Text != "") { PMCopperFoundryinfo.PMCI_Model = TextBox22.Text.ToString(); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_CopperInNew, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } PMCopperFoundryinfo.PMCF_ID = new Guid(label_CopperID.Text.ToString()); if (label_CopperIn.Text == "新增") { pf.InsertPMCopperIn(PMCopperFoundryinfo); } if (label_CopperIn.Text == "修改") { PMCopperFoundryinfo.PMCI_ID = new Guid(label_CopperInID.Text.ToString()); pf.UpdatePMCopperIn(PMCopperFoundryinfo); } TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; TextBox11.Text = ""; TextBox12.Text = ""; TextBox10.Text = ""; TextBox22.Text = ""; DropDownList4.SelectedValue = "请选择"; Panel_CopperInNew.Visible = false; UpdatePanel_CopperInNew.Update(); PMCopperFoundryinfo.PMCF_ID = new Guid(label_CopperID.Text); BindGridview2(PMCopperFoundryinfo); UpdatePanel_CopperIn.Update(); BindGridview1(""); UpdatePanel_Copper.Update(); }