protected void SummitReturnNG_Click(object sender, EventArgs e) { if (TextBox8.Text == "" || Label15.Text == "请选择供应商" || TextBox45.Text == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('数量未填写或退货去向未选择!')", true); } else { decimal renum = Decimal.Parse(TextBox8.Text); Guid copperid = new Guid(CopperID.Text); Guid pid = new Guid(Label17.Text); string note = TextBox10.Text; DateTime backDateTime = Convert.ToDateTime(TextBox45.Text); int a = pmc.Insert_CopperNG(renum, copperid, pid, note, Session["UserName"].ToString(), backDateTime); if (a > 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('提交成功!')", true); Panel8.Visible = false; UpdatePanel8.Update(); Bind1(); Bind(4); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('提交失败!')", true); Panel8.Visible = false; UpdatePanel8.Update(); } } }
protected void CloseReturnNG_Click(object sender, EventArgs e) { Panel7.Visible = false; Panel8.Visible = false; UpdatePanel7.Update(); UpdatePanel8.Update(); }
private void limpiarFormularioSalida() { LbMensajeSalida.Text = string.Empty; TxBusqueda.Text = string.Empty; LbAprobacion.Text = string.Empty; LbIdEntrada.Text = string.Empty; LbNombreEntrada.Text = string.Empty; LbArticuloEntrada.Text = string.Empty; LbSerieEntrada.Text = string.Empty; LbInventarioEntrada.Text = string.Empty; LbFechaEntrada.Text = string.Empty; DivEntradas.Visible = false; TxNombreSalida.Text = string.Empty; DDLArticuloSalida.SelectedIndex = -1; TxSerieSalida.Text = string.Empty; TxInventarioSalida.Text = string.Empty; DDLMotivoSalida.SelectedIndex = -1; TxObservacionesSalida.Text = string.Empty; //DDLAutorizado.SelectedIndex = -1; UpdatePanel6.Update(); UpdatePanel7.Update(); UpdatePanel8.Update(); UpdatePanel10.Update(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Panel4.Visible = false; Panel3.Visible = false; Panel5.Visible = false; Panel6.Visible = false; Panel7.Visible = false; Panel8.Visible = false; Panel9.Visible = false; Panel10.Visible = false; GridView1.DataSource = pmc.Query_Copper(); GridView1.DataBind(); UpdatePanel2.Update(); UpdatePanel3.Update(); UpdatePanel4.Update(); UpdatePanel5.Update(); UpdatePanel6.Update(); UpdatePanel7.Update(); UpdatePanel8.Update(); UpdatePanel9.Update(); UpdatePanel10.Update(); } }
protected void SummitPercent_Click(object sender, EventArgs e) { decimal sum = 0; foreach (GridViewRow row in GridView8.Rows) { if (row.RowType == DataControlRowType.DataRow) { TextBox tb = (TextBox)(row.Cells[8].FindControl("bl")); try { if (tb.Text == "") { tb.Text = "0"; } sum += decimal.Parse(tb.Text); } catch { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('输入格式不对!')", true); } } } if (sum == 1) { foreach (GridViewRow row in GridView8.Rows) { if (row.RowType == DataControlRowType.DataRow) { TextBox tb = (TextBox)(row.Cells[8].FindControl("bl")); string man = Session["UserName"].ToString(); int a = bom.Update_BOMDetailPercent(new Guid(row.Cells[0].Text), decimal.Parse(tb.Text), man); if (a == 1) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('比例分配成功!')", true); Panel8.Visible = false; UpdatePanel8.Update(); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('操作失败!')", true); Panel8.Visible = false; UpdatePanel8.Update(); } } } } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('比重加起来不等于1哦!')", true); } }
//确认编辑详细表 protected void ConfirmDetailUpdate(object sender, EventArgs e) { string request = TextBox1.Text.ToString(); string remark = TextBox5.Text.ToString(); Guid id = new Guid(label25.Text.ToString()); pp.Update_PlanDetail_Edit(id, remark, request); ScriptManager.RegisterClientScriptBlock(Page, GetType(), "alert", "alert('修改成功!')", true); BindDetail(); Panel9.Visible = false; UpdatePanel8.Update(); }
protected void txtnoinst1_TextChanged(object sender, EventArgs e) { try { Txteach.Text = Convert.ToString(Convert.ToDouble(txtfinpay.Text) / Convert.ToDouble(txtnoinst1.Text)); UpdatePanel8.Update(); } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Details") { var row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView3.SelectedIndex = row.RowIndex; ReportID.Text = e.CommandArgument.ToString(); GridView4.DataSource = hd.QueryDetail(Guid.Empty, new Guid(ReportID.Text)); GridView4.DataBind(); Panel5.Visible = true; UpdatePanel5.Update(); } if (e.CommandName == "De") { int a = hd.DeleteReport(new Guid(e.CommandArgument.ToString())); if (a > 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除成功!');", true); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('失败了诶...');", true); } GridView3.DataSource = hd.QueryReport(new Guid(VersionID.Text)); GridView3.DataBind(); GridView2.DataSource = hd.QueryVersion(new Guid(HSFID.Text)); GridView2.DataBind(); UpdatePanel3.Update(); } if (e.CommandName == "Modify") { var row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView3.SelectedIndex = row.RowIndex; ReportID.Text = e.CommandArgument.ToString(); GridView9.DataSource = hd.QueryDetail(new Guid(VersionID.Text), Guid.Empty); GridView9.DataBind(); Panel9.Visible = true; UpdatePanel9.Update(); } if (e.CommandName == "ED") { var row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView3.SelectedIndex = row.RowIndex; ReportID.Text = e.CommandArgument.ToString(); Label1.Text = "编辑"; Panel8.Visible = true; UpdatePanel8.Update(); } }
protected void ibtnAgregarEmailDeudor_Click(object sender, ImageClickEventArgs e) { try { proveedorUbicabilidad(); //comuna(); lblUsuarioEmail.Text = Session["variableUsuario"].ToString(); txtCorreo.Text = string.Empty; ScriptManager.RegisterStartupScript(UpdatePanel8, UpdatePanel8.GetType(), "show", "$(function () { $('#" + Panel7.ClientID + "').modal('show'); });", true); UpdatePanel8.Update(); } catch (Exception ex) { divAlerta.Visible = true; lblInfo.Text = ex.Message; } }
protected void Gridview_Detail_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); if (e.CommandName == "Delete2") { pp.Delete_Plan_Detail(new Guid(e.CommandArgument.ToString())); ScriptManager.RegisterClientScriptBlock(Page, GetType(), "alert", "alert('删除成功!')", true); BindDetail(); } if (e.CommandName == "Edit2") { Panel9.Visible = true; label25.Text = e.CommandArgument.ToString(); TextBox1.Text = Gridview_DetailPlan.Rows[gvr.RowIndex].Cells[10].Text.ToString().Replace(" ", ""); TextBox5.Text = Gridview_DetailPlan.Rows[gvr.RowIndex].Cells[9].Text.ToString().Replace(" ", ""); UpdatePanel8.Update(); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "History") { var row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView1.SelectedIndex = row.RowIndex; HSFID.Text = e.CommandArgument.ToString(); GridView2.DataSource = hd.QueryVersion(new Guid(e.CommandArgument.ToString())); GridView2.DataBind(); Panel3.Visible = true; Panel4.Visible = false; Panel5.Visible = false; Panel6.Visible = false; Panel7.Visible = false; Panel8.Visible = false; Panel9.Visible = false; UpdatePanel2.Update(); UpdatePanel3.Update(); UpdatePanel4.Update(); UpdatePanel5.Update(); UpdatePanel6.Update(); UpdatePanel7.Update(); UpdatePanel8.Update(); UpdatePanel9.Update(); } if (e.CommandName == "Details") { var row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView1.SelectedIndex = row.RowIndex; HSFID.Text = e.CommandArgument.ToString(); GridView5.DataSource = hd.QueryDetailAI(new Guid(HSFID.Text)); GridView5.DataBind(); Panel6.Visible = true; UpdatePanel2.Update(); UpdatePanel6.Update(); } }
protected void img01_Click(object sender, ImageClickEventArgs e) { ImageButton img = (ImageButton)(sender); if (img.CommandName.ToLower() == "p") { grdconfirm.DataSource = DCDetails.Idv_Get_DCDetails_By_DocNo(Convert.ToInt32(img.CommandArgument.Trim()), "helpdesk", Convert.ToInt32(0)).Tables[1]; grdconfirm.DataBind(); ModalPopUpDocNum.Show(); UpdatePanel7.Update(); } else { stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(img.CommandArgument.Trim()), "helpdesk", Convert.ToInt32(0)); RepDetailsApprove.DataSource = stDS.Tables[0]; RepDetailsApprove.DataBind(); ModalPopupExtender1.Show(); UpdatePanel8.Update(); } }
protected void AddDefectType_Click(object sender, EventArgs e) { Panel8.Visible = true; UpdatePanel8.Update(); TextBox31.Text = ""; }
protected void CloseDetailUpdate(object sender, EventArgs e) { Panel9.Visible = false; UpdatePanel8.Update(); }
protected void NewCopperNG_Click(object sender, EventArgs e) { Panel8.Visible = true; UpdatePanel8.Update(); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Details") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView1.SelectedIndex = row.RowIndex; if (row.Cells[10].Text != "最新版本") { GridView2.Columns[5].Visible = false; GridView2.Columns[7].Visible = false; GridView2.Columns[8].Visible = false; GridView3.Columns[20].Visible = false; GridView3.Columns[15].Visible = false; GridView3.Columns[19].Visible = false; GridView3.Columns[16].Visible = false; GridView3.Columns[17].Visible = false; GridView3.Columns[18].Visible = false; Button21.Visible = false; Button31.Visible = false; } else { if (Labelstate.Text == "manage") { GridView2.Columns[5].Visible = true; GridView2.Columns[7].Visible = true; GridView2.Columns[8].Visible = true; GridView3.Columns[20].Visible = true; GridView3.Columns[15].Visible = true; GridView3.Columns[19].Visible = true; GridView3.Columns[16].Visible = true; GridView3.Columns[17].Visible = true; GridView3.Columns[18].Visible = true; Button21.Visible = true; Button31.Visible = true; UpdatePanel2.Update(); UpdatePanel3.Update(); } Guid id = new Guid(e.CommandArgument.ToString()); GridView2.DataSource = bom.Query_BOM(id); GridView2.DataBind(); Panel3.Visible = true; Panel31.Visible = false; Panel4.Visible = false; Panel41.Visible = false; Panel5.Visible = false; Panel51.Visible = false; Panel6.Visible = false; Panel8.Visible = false; UpdatePanel8.Update(); Label1.Text = e.CommandArgument.ToString(); Label2.Text = row.Cells[1].Text; UpdatePanel3.Update(); UpdatePanel4.Update(); UpdatePanel5.Update(); UpdatePanel6.Update(); GridView2.SelectedIndex = -1; } } }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Details") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView2.SelectedIndex = row.RowIndex; Guid id = new Guid(e.CommandArgument.ToString()); GridView3.DataSource = bom.Query_BOMDetail(id); GridView3.DataBind(); Label3.Text = id.ToString(); Label4.Text = row.Cells[1].Text; Panel4.Visible = true; Panel31.Visible = false; Panel41.Visible = false; Panel5.Visible = false; Panel51.Visible = false; Panel6.Visible = false; Panel8.Visible = false; UpdatePanel8.Update(); UpdatePanel4.Update(); GridView3.SelectedIndex = -1; UpdatePanel3.Update(); UpdatePanel5.Update(); UpdatePanel6.Update(); } if (e.CommandName == "Modify") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView2.SelectedIndex = row.RowIndex; Label13.Text = e.CommandArgument.ToString(); Label12.Text = row.Cells[1].Text; TextBox10.Text = Label12.Text; DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf(DropDownList2.Items.FindByText(row.Cells[2].Text)); Label11.Text = "修改"; Panel4.Visible = false; Panel31.Visible = true; Panel41.Visible = false; Panel5.Visible = false; Panel51.Visible = false; Panel6.Visible = false; Panel8.Visible = false; UpdatePanel8.Update(); UpdatePanel6.Update(); UpdatePanel4.Update(); UpdatePanel5.Update(); } if (e.CommandName == "Delete") { Guid id = new Guid(e.CommandArgument.ToString()); bom.Delete_BOM(id); Guid BDF = new Guid(Label1.Text); GridView2.DataSource = bom.Query_BOM(BDF); GridView2.DataBind(); Panel31.Visible = false; Panel4.Visible = false; Panel41.Visible = false; Panel5.Visible = false; Panel51.Visible = false; Panel6.Visible = false; Panel8.Visible = false; UpdatePanel8.Update(); UpdatePanel6.Update(); UpdatePanel5.Update(); UpdatePanel4.Update(); } if (e.CommandName == "Copy") { Guid id = new Guid(e.CommandArgument.ToString()); Label3.Text = id.ToString(); Guid BDF = new Guid(Label1.Text); GridView2.DataSource = bom.Query_BOM(BDF); GridView2.DataBind(); Panel31.Visible = false; Panel4.Visible = false; Panel41.Visible = false; Panel5.Visible = false; Panel51.Visible = false; Panel6.Visible = true; GridView7.DataSource = bom.SeachBom(TextBox11.Text); GridView7.DataBind(); Panel8.Visible = false; UpdatePanel8.Update(); UpdatePanel6.Update(); UpdatePanel5.Update(); UpdatePanel4.Update(); } }
protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Modify") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView3.SelectedIndex = row.RowIndex; Guid bdid = new Guid(e.CommandArgument.ToString()); Label32.Text = Label4.Text; Label34.Text = row.Cells[12].Text; Label35.Text = row.Cells[3].Text; Label36.Text = row.Cells[1].Text; Label37.Text = row.Cells[2].Text; Label38.Text = row.Cells[11].Text; Label33.Text = bdid.ToString(); TextBox14.Text = row.Cells[4].Text; TextBox15.Text = row.Cells[5].Text; DropDownList3.Items.Clear(); FuseText.Visible = false; DropDownList4.Visible = false; SqlDataReader myReader = bom.Query_MUnit(new Guid(Label38.Text)); UnitCheck.Visible = true; while (myReader.Read()) { DropDownList3.Items.Add(new ListItem(myReader["UnitName"].ToString(), myReader["UnitID"].ToString()));//增加Item } DropDownList3.SelectedIndex = DropDownList3.Items.IndexOf(DropDownList3.Items.FindByText(row.Cells[6].Text)); TextBox17.Text = row.Cells[9].Text; try { Guid CraID = bom.Query_PBCID(row.Cells[3].Text); Label34.Text = CraID.ToString(); Label35.Text = row.Cells[3].Text; } catch { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('工序名有重复,请手动选择工序!')", true); } Label31.Text = "修改"; Panel41.Visible = true; Panel5.Visible = false; Panel51.Visible = false; Panel52.Visible = false; Panel53.Visible = false; Panel6.Visible = false; Panel8.Visible = false; UpdatePanel8.Update(); UpdatePanel6.Update(); UpdatePanel5.Update(); UpdatePanel4.Update(); } if (e.CommandName == "AddMate") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView3.SelectedIndex = row.RowIndex; Guid bdid = new Guid(e.CommandArgument.ToString()); Label33.Text = bdid.ToString(); Label34.Text = row.Cells[12].Text; Label35.Text = row.Cells[3].Text; Label36.Text = "请选择物料"; Label37.Text = "请选择物料"; TextBox14.Text = ""; TextBox15.Text = ""; TextBox17.Text = ""; TextBox21.Text = row.Cells[1].Text; FuseText.Visible = true; DropDownList4.Visible = true; DropDownList4.SelectedIndex = DropDownList4.Items.IndexOf(DropDownList4.Items.FindByText("否")); DropDownList4.Enabled = true; DropDownList3.SelectedIndex = DropDownList3.Items.IndexOf(DropDownList3.Items.FindByText(row.Cells[6].Text)); Label31.Text = "新增可替用物料"; Panel41.Visible = true; Panel5.Visible = false; Panel51.Visible = false; Panel52.Visible = false; Panel53.Visible = false; Panel6.Visible = false; Panel8.Visible = false; UpdatePanel8.Update(); UpdatePanel6.Update(); UpdatePanel5.Update(); UpdatePanel4.Update(); } if (e.CommandName == "AddFuse") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView3.SelectedIndex = row.RowIndex; FuseText.Visible = true; DropDownList4.Visible = true; DropDownList4.SelectedIndex = DropDownList4.Items.IndexOf(DropDownList4.Items.FindByText("是")); DropDownList4.Enabled = false; Guid bdid = new Guid(e.CommandArgument.ToString()); Label33.Text = bdid.ToString(); Label34.Text = row.Cells[12].Text; Label35.Text = row.Cells[3].Text; Label36.Text = "请选择物料"; Label37.Text = "请选择物料"; TextBox14.Text = ""; TextBox15.Text = ""; TextBox17.Text = ""; TextBox21.Text = row.Cells[1].Text; FuseID.Text = row.Cells[14].ToolTip; MateID.Text = row.Cells[19].Text; DropDownList3.SelectedIndex = DropDownList3.Items.IndexOf(DropDownList3.Items.FindByText(row.Cells[6].Text)); Label31.Text = "新增组合物料成员"; Panel41.Visible = true; Panel5.Visible = false; Panel51.Visible = false; Panel52.Visible = false; Panel53.Visible = false; Panel6.Visible = false; Panel8.Visible = false; UpdatePanel8.Update(); UpdatePanel6.Update(); UpdatePanel5.Update(); UpdatePanel4.Update(); } if (e.CommandName == "Delete") { Guid id = new Guid(e.CommandArgument.ToString()); bom.Delete_BOMDetail(id); Guid BOM_ID = new Guid(Label3.Text); GridView3.DataSource = bom.Query_BOMDetail(BOM_ID); GridView3.DataBind(); Panel41.Visible = false; Panel5.Visible = false; Panel51.Visible = false; Panel6.Visible = false; Panel8.Visible = false; UpdatePanel8.Update(); UpdatePanel6.Update(); UpdatePanel5.Update(); UpdatePanel4.Update(); } if (e.CommandName == "AddPercent") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView3.SelectedIndex = row.RowIndex; Panel8.Visible = true; GridView8.DataSource = bom.Query_MatePercent(new Guid(e.CommandArgument.ToString())); GridView8.DataBind(); Panel41.Visible = false; Panel5.Visible = false; Panel51.Visible = false; Panel52.Visible = false; Panel53.Visible = false; Panel6.Visible = false; UpdatePanel6.Update(); UpdatePanel5.Update(); UpdatePanel4.Update(); UpdatePanel8.Update(); } if (e.CommandName == "history") { GridView10.DataSource = bom.Query_BOMDetailHistory(new Guid(e.CommandArgument.ToString())); GridView10.DataBind(); Panel10.Visible = true; UpdatePanel10.Update(); } }
protected void CloseUpload_Click(object sender, EventArgs e) { Panel8.Visible = false; UpdatePanel8.Update(); }
protected void Summit_Report_Click(object sender, EventArgs e) { if (TextBox21.Text == "" || TextBox22.Text == "" || TextBox23.Text == "" || TextBox25.Text == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('除备注之外其他都是必填的哦!');", true); Console.Write(""); } else { if (Label1.Text == "新增") { string filePath = ""; string extension = Path.GetExtension(FileUpload1.FileName); if (extension == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel8, GetType(), "alert", "alert('未选择上传的报告!');", true); } if (extension != null) { string fileExrensio = extension.ToLower(); //ToLower转化为小写,获得扩展名 string uploadUrl = Server.MapPath("~/file/"); //上传的目录 string fullname = FileUpload1.FileName; //上传文件的原名 string newname = DateTime.Now.ToString("yyyyMMddhhmmss"); //上传文件重命名 if (fileExrensio == ".doc" || fileExrensio == ".docx" || fileExrensio == ".pdf" || fileExrensio == ".xls" || fileExrensio == ".jpg" || fileExrensio == ".png" || fileExrensio == ".bmp" || fileExrensio == ".xlsx" || fileExrensio == ".txt" || fileExrensio == ".ppt" || fileExrensio == ".pptx") //判断文件扩展名 { try { if (!Directory.Exists(uploadUrl)) //判断文件夹是否已经存在 { Directory.CreateDirectory(uploadUrl); //创建文件夹 } FileUpload1.PostedFile.SaveAs(uploadUrl + newname + fullname); //保存上传的文件 } catch { ScriptManager.RegisterClientScriptBlock(UpdatePanel8, GetType(), "aa", "alert('上传失败!');", true); return; } } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel8, GetType(), "alert", "alert('不支持此文件格式!');", true); return; } filePath = "file/" + newname + fullname; //存储上传的路径 } string num = TextBox21.Text; string ins = TextBox22.Text; DateTime dateTime = Convert.ToDateTime(TextBox23.Text); string note = TextBox24.Text; string type = TextBox25.Text; int a = hd.InsertReport(new Guid(VersionID.Text), num, ins, dateTime, filePath, type, note, Session["UserName"].ToString()); if (a == 2) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('新增成功!');", true); Panel8.Visible = false; UpdatePanel8.Update(); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('有相同报告编号的啦!');", true); Panel8.Visible = false; UpdatePanel8.Update(); } GridView2.DataSource = hd.QueryVersion(new Guid(HSFID.Text)); GridView2.DataBind(); UpdatePanel3.Update(); } else { string filePath = ""; string extension = Path.GetExtension(FileUpload1.FileName); if (extension == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel8, GetType(), "alert", "alert('!');", true); } if (extension != null) { string fileExrensio = extension.ToLower(); //ToLower转化为小写,获得扩展名 string uploadUrl = Server.MapPath("~/file/"); //上传的目录 string fullname = FileUpload1.FileName; //上传文件的原名 string newname = DateTime.Now.ToString("yyyyMMddhhmmss"); //上传文件重命名 if (fileExrensio == ".doc" || fileExrensio == ".docx" || fileExrensio == ".pdf" || fileExrensio == ".xls" || fileExrensio == ".xlsx" || fileExrensio == ".txt" || fileExrensio == ".ppt" || fileExrensio == ".png" || fileExrensio == ".jpg" || fileExrensio == ".bmp" || fileExrensio == ".pptx") //判断文件扩展名 { try { if (!Directory.Exists(uploadUrl)) //判断文件夹是否已经存在 { Directory.CreateDirectory(uploadUrl); //创建文件夹 } FileUpload1.PostedFile.SaveAs(uploadUrl + newname + fullname); //保存上传的文件 } catch { ScriptManager.RegisterClientScriptBlock(UpdatePanel8, GetType(), "aa", "alert('上传失败!');", true); return; } } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel8, GetType(), "alert", "alert('不支持此文件格式!');", true); return; } filePath = "file/" + newname + fullname; //存储上传的路径 } string num = TextBox21.Text; string ins = TextBox22.Text; DateTime dateTime = Convert.ToDateTime(TextBox23.Text); string note = TextBox24.Text; string type = TextBox25.Text; int a = hd.UpdateReport(new Guid(ReportID.Text), num, ins, dateTime, filePath, type, note, Session["UserName"].ToString()); if (a == 1) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('修改成功!');", true); Panel8.Visible = false; UpdatePanel8.Update(); GridView3.DataSource = hd.QueryReport(new Guid(VersionID.Text)); GridView3.DataBind(); UpdatePanel4.Update(); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('修改失败了诶...');", true); Panel8.Visible = false; UpdatePanel8.Update(); } GridView2.DataSource = hd.QueryVersion(new Guid(HSFID.Text)); GridView2.DataBind(); UpdatePanel3.Update(); } } }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ED") { var row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView2.SelectedIndex = row.RowIndex; VersionID.Text = e.CommandArgument.ToString(); addedit.Text = "修改"; TextBox4.Text = row.Cells[1].Text; TextBox10.Text = row.Cells[3].Text; Panel7.Visible = true; UpdatePanel7.Update(); UpdatePanel2.Update(); UpdatePanel3.Update(); } if (e.CommandName == "Copy") { var row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView2.SelectedIndex = row.RowIndex; VersionID.Text = e.CommandArgument.ToString(); GridView6.DataSource = hd.QueryReportDue(TextBox60.Text, TextBox61.Text, TextBox62.Text); GridView6.DataBind(); Panel10.Visible = true; UpdatePanel10.Update(); } if (e.CommandName == "De") { int a = hd.DeleteVersion(new Guid(e.CommandArgument.ToString())); if (a > 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除成功!');", true); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('失败了诶...');", true); } GridView2.DataSource = hd.QueryVersion(new Guid(e.CommandArgument.ToString())); GridView2.DataBind(); UpdatePanel3.Update(); } if (e.CommandName == "up") { var row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView2.SelectedIndex = row.RowIndex; Console.Write(""); Label1.Text = "新增"; VersionID.Text = e.CommandArgument.ToString(); Panel8.Visible = true; UpdatePanel8.Update(); UpdatePanel2.Update(); UpdatePanel3.Update(); } if (e.CommandName == "report") { var row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView2.SelectedIndex = row.RowIndex; VersionID.Text = e.CommandArgument.ToString(); GridView3.DataSource = hd.QueryReport(new Guid(VersionID.Text)); GridView3.DataBind(); Panel4.Visible = true; UpdatePanel4.Update(); } if (e.CommandName == "detail") { var row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView2.SelectedIndex = row.RowIndex; VersionID.Text = e.CommandArgument.ToString(); GridView5.DataSource = hd.QueryDetail(new Guid(VersionID.Text), Guid.Empty); GridView5.DataBind(); Panel6.Visible = true; UpdatePanel6.Update(); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Session["UserRole"].ToString().Contains("BOM维护")) { GridView2.Columns[6].Visible = false; GridView2.Columns[8].Visible = false; GridView2.Columns[9].Visible = false; GridView3.Columns[20].Visible = false; GridView3.Columns[15].Visible = false; GridView3.Columns[19].Visible = false; GridView3.Columns[16].Visible = false; GridView3.Columns[17].Visible = false; GridView3.Columns[18].Visible = false; UpdatePanel2.Update(); if (!Session["UserRole"].ToString().Contains("BOM查看")) { Response.Redirect("~/Default.aspx"); } } } catch { Response.Redirect("~/Default.aspx"); } if (!Page.IsPostBack) { Panel3.Visible = false; Panel31.Visible = false; Panel4.Visible = false; Panel41.Visible = false; Panel5.Visible = false; Panel51.Visible = false; Panel6.Visible = false; Panel8.Visible = false; GridView1.DataSource = bom.Query_ControlledDocApp(); GridView1.DataBind(); UpdatePanel1.Update(); UpdatePanel2.Update(); UpdatePanel3.Update(); UpdatePanel4.Update(); UpdatePanel5.Update(); UpdatePanel8.Update(); } if (Request.QueryString["state"] == null) { Labelstate.Text = "look"; Title = "BOM查看"; } else { Labelstate.Text = Request.QueryString["state"]; } string pstate = Labelstate.Text; if (pstate == "look") { Title = "BOM查看"; GridView2.Columns[6].Visible = false; GridView2.Columns[8].Visible = false; GridView2.Columns[9].Visible = false; GridView3.Columns[20].Visible = false; GridView3.Columns[15].Visible = false; GridView3.Columns[19].Visible = false; GridView3.Columns[16].Visible = false; GridView3.Columns[17].Visible = false; GridView3.Columns[18].Visible = false; Button21.Visible = false; Button31.Visible = false; UpdatePanel2.Update(); UpdatePanel3.Update(); } if (pstate == "manage") { Title = "BOM维护"; } }
protected void TxBusquedaSalida_TextChanged(object sender, EventArgs e) { try{ if (TxBusquedaSalida.Text != "" || TxBusquedaSalida.Text != string.Empty) { String vQuery = "[RSP_Seguridad] 16,'" + TxBusquedaSalida.Text + "'"; DataTable vVerificacion = vConexion.obtenerDataTable(vQuery); if (vVerificacion.Rows.Count > 0) { TxBusquedaSalida.Focus(); limpiarFormularioSalida(); Mensaje("El número de serie tiene una entrada pendiente. Favor ingrese otro.", WarningType.Warning); } else { vQuery = "[RSP_Seguridad] 21,'" + TxBusquedaSalida.Text + "'"; DataTable vDatos1 = vConexion.obtenerDataTable(vQuery); if (vDatos1.Rows.Count > 0) { LbAprobacion.Text = "Aprobado!"; LbAprobacion.Attributes.CssStyle.Value = "color:Green; margin-top:100px; margin-left:20px;"; Session["SEC_APROBACION_SALIDA"] = vDatos1; } else { LbAprobacion.Text = "No Aprobado!"; LbAprobacion.Attributes.CssStyle.Value = "color:Tomato; margin-bottom:10px; margin-left:20px;"; } LbAprobacion.Visible = true; vQuery = "[RSP_Seguridad] 6,'" + TxBusquedaSalida.Text + "'"; DataTable vDatos = vConexion.obtenerDataTable(vQuery); if (vDatos.Rows.Count > 0) { Session["ID_ENTRADA"] = vDatos.Rows[0]["id"].ToString(); DivEntradas.Visible = true; LbIdEntrada.Text = vDatos.Rows[0]["id"].ToString(); LbNombreEntrada.Text = vDatos.Rows[0]["nombre"].ToString(); LbArticuloEntrada.Text = vDatos.Rows[0]["articulo"].ToString(); LbSerieEntrada.Text = vDatos.Rows[0]["serie"].ToString(); LbInventarioEntrada.Text = vDatos.Rows[0]["inventario"].ToString(); LbFechaEntrada.Text = vDatos.Rows[0]["fechaEntrada"].ToString(); TxInventarioSalida.Text = vDatos.Rows[0]["inventario"].ToString(); DDLArticuloSalida.SelectedValue = vDatos.Rows[0]["idArticulo"].ToString(); DivBodySalida.Visible = true; LbMensajeSalida.Text = ""; LbMensajeSalida.Visible = false; UpdatePanel7.Update(); } else { TxInventarioSalida.Text = string.Empty; DDLArticuloSalida.SelectedIndex = -1; Session["ID_ENTRADA"] = null; DivEntradas.Visible = false; DivBodySalida.Visible = false; LbMensajeSalida.Visible = true; LbMensajeSalida.Text = LbAprobacion.Text == "Aprobado!" ? "Cree un nuevo registro." : string.Empty; UpdatePanel7.Update(); } TxNombreSalida.Focus(); TxSerieSalida.Text = TxBusquedaSalida.Text; } UpdatePanel8.Update(); } else { limpiarFormulario(); } }catch (Exception ex) { Mensaje(ex.Message, WarningType.Danger); } }