protected void printLabel_Click(object sender, EventArgs e) { InterfazDAL_tticol118 idal = new InterfazDAL_tticol118(); Ent_tticol118 obj = new Ent_tticol118(); string strError = string.Empty; obj.item = txtItem.Text; obj.clot = txtLot.Text; lblResult.Text = string.Empty; DataTable resultado = idal.listaRegistros_Param(ref obj, ref strError); Session["resultado"] = resultado; StringBuilder paramurl = new StringBuilder(); paramurl.Append("?"); paramurl.Append("valor1=" + Request.QueryString[0].ToString() + "&"); paramurl.Append("valor2=" + Request.QueryString[1].ToString() + "&"); paramurl.Append("valor3=" + Request.QueryString[2].ToString()); Session["IsPreviousPage"] = ""; StringBuilder script = new StringBuilder(); script.Append("ventanaImp = window.open('../Labels/whInvLabelMaterialRejectedD.aspx', "); script.Append("'ventanaImp', 'menubar=0,resizable=0,width=580,height=450');"); script.Append("ventanaImp.moveTo(30, 0);"); //script.Append("setTimeout (ventanaImp.close(), 20000);"); ScriptManager.RegisterStartupScript(this, this.GetType(), "printTag", script.ToString(), true); }
protected void grdRecords_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Verificar que si la cantidad es igual a 0, el control "toReturn" se deshabilite string stock = ((HiddenField)e.Row.Cells[4].FindControl("actualqty")).Value.Trim(); string stritem = ((DataRowView)e.Row.DataItem).DataView.Table.Rows[e.Row.RowIndex]["Item"].ToString(); if (Convert.ToInt32(stock) == 0) { ((TextBox)e.Row.Cells[6].FindControl("toReturn")).Enabled = false; ((TextBox)e.Row.Cells[6].FindControl("toReturn")).Attributes.Add("onfocus", "limpiar(this);"); } // Verificar que si el lote es nulo o vacio string strLote = ((DataRowView)e.Row.DataItem).DataView.Table.Rows[e.Row.RowIndex]["LOT"].ToString(); DataRow drv = ((DataRowView)e.Row.DataItem).Row; var fila = drv.ItemArray.ToArray(); var serializador = new JavaScriptSerializer(); var FilaSerializada = serializador.Serialize(fila); ((RangeValidator)e.Row.Cells[6].FindControl("validateQuantity")).MinimumValue = "0"; ((RangeValidator)e.Row.Cells[6].FindControl("validateQuantity")).MaximumValue = ((DataRowView)e.Row.DataItem).DataView.Table.Rows[e.Row.RowIndex]["stock"].ToString(); //Llenar Stock Warehouse Dropdownlist InterfazDAL_tticol118 idalp = new InterfazDAL_tticol118(); Ent_tticol118 obj = new Ent_tticol118(); obj.item = stritem; DataTable proveedor = idalp.listaProveedores_Param(ref obj, ref strError); DropDownList listproveedor = (DropDownList)e.Row.Cells[9].FindControl("Supplier"); listproveedor.DataSource = proveedor; listproveedor.DataTextField = "nombre"; listproveedor.DataValueField = "proveedor"; listproveedor.DataBind(); listproveedor.Items.Insert(0, new ListItem("Select Supplier here...", string.Empty)); //Llenar Reason Dropdownlist InterfazDAL_tticol118 idal = new InterfazDAL_tticol118(); DataTable reason = idal.listaReason_Param(ref strError); DropDownList listreason = (DropDownList)e.Row.Cells[10].FindControl("Reasonid"); listreason.DataSource = reason; listreason.DataTextField = "descr"; listreason.DataValueField = "reason"; listreason.DataBind(); listreason.Items.Insert(0, new ListItem("Select Reason here...", string.Empty)); //Llenar Disposition Dropdownlist desde el webconfig ////if (ConfigurationManager.AppSettings.AllKeys.Contains("Disposition")) ////{ //// string listdisposition = ConfigurationManager.AppSettings["Disposition"]; //// var dispositionarray = listdisposition.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToList<string>(); //// dispositionarray.Insert(0, "-- Select Disposition --"); //// DropDownList dispoid = (DropDownList)e.Row.Cells[11].FindControl("Dispositionid"); //// dispoid.DataSource = dispositionarray; //// dispoid.DataBind(); ////} ////else { lblResult.Visible = true; lblResult.Text = "Disposition List not found"; } //Llenar Stock Warehouse Dropdownlist InterfazDAL_tticol118 idalsw = new InterfazDAL_tticol118(); DataTable stockw = idalsw.listaStockw_Param(ref strError); DropDownList liststockw = (DropDownList)e.Row.Cells[11].FindControl("Stockwareh"); liststockw.DataSource = stockw; liststockw.DataTextField = "descrw"; liststockw.DataValueField = "warehouse"; liststockw.DataBind(); liststockw.Items.Insert(0, new ListItem("Select Stock Warehouse here...", string.Empty)); //Llenar Stock Warehouse Dropdownlist InterfazDAL_tticol118 idalr = new InterfazDAL_tticol118(); DataTable regrind = idalr.listaRegrind_Param(ref strError); DropDownList listregrind = (DropDownList)e.Row.Cells[12].FindControl("Regrind"); listregrind.DataSource = regrind; listregrind.DataTextField = "descrc"; listregrind.DataValueField = "item"; listregrind.DataBind(); listregrind.Items.Insert(0, new ListItem("Select Item here...", string.Empty)); } }
protected void Dispoid_SelectedIndexChanged(object sender, EventArgs e) { // dispoc = (GridViewRow)sender; DropDownList listdispo = (DropDownList)sender; GridViewRow contenedor = (GridViewRow)listdispo.Parent.DataItemContainer; DropDownList liststock = (DropDownList)grdRecords.Rows[0].Cells[0].FindControl("Stockwareh"); DropDownList listregrind = (DropDownList)grdRecords.Rows[0].Cells[1].FindControl("Regrind"); DropDownList listproveedor = (DropDownList)grdRecords.Rows[0].Cells[2].FindControl("Supplier"); btnSave.Visible = true; btnSave.Enabled = true; if (listdispo.SelectedValue == "2") { listregrind.Enabled = false; liststock.Enabled = false; listproveedor.Enabled = true; } if (listdispo.SelectedValue == "3") { listregrind.Enabled = false; listproveedor.Enabled = false; liststock.Enabled = true; } if (listdispo.SelectedValue == "4") { liststock.Enabled = false; listproveedor.Enabled = false; listregrind.Enabled = true; if (listregrind.Items.Count > 1) { btnSave.Visible = true; btnSave.Enabled = true; } else { btnSave.Visible = false; btnSave.Enabled = false; } } if (listdispo.SelectedValue == "5") { liststock.Enabled = false; listproveedor.Enabled = false; listregrind.Enabled = false; } if (listdispo.SelectedItem.Text == "Return to Vendor") { InterfazDAL_tticol118 idalp = new InterfazDAL_tticol118(); Ent_tticol118 obj = new Ent_tticol118(); obj.item = Session["txtItem"].ToString().Trim(); DataTable proveedor = idalp.ListaProveedoresProducto(ref obj, ref strError); listproveedor.DataSource = proveedor; listproveedor.DataBind(); listproveedor.Items.Insert(0, new ListItem(_idioma == "INGLES" ? "Select Supplier here..." : "Seleccione un proveedor...", string.Empty)); } else { InterfazDAL_tticol118 idalp = new InterfazDAL_tticol118(); Ent_tticol118 obj = new Ent_tticol118(); obj.item = Session["txtItem"].ToString().Trim(); listproveedor.DataSource = idalp.listaProveedores_Param(ref obj, ref strError); listproveedor.DataBind(); listproveedor.Items.Insert(0, new ListItem(_idioma == "INGLES" ? "Select Supplier here..." : "Seleccione un proveedor...", string.Empty)); } }
protected void btnSave_Click(object sender, EventArgs e) { List <Ent_tticol118> parameterCollection = new List <Ent_tticol118>(); Ent_tticol118 obj = new Ent_tticol118(); //Recorrer filas con valores en los textos string disposition = String.Empty; string reason = String.Empty; string stockw = String.Empty; string orden = String.Empty; foreach (GridViewRow row in grdRecords.Rows) { string toreturn = ((TextBox)row.Cells[7].FindControl("toReturn")).Text; string lote = ((TextBox)row.Cells[7].FindControl("toReturn")).Text; reason = ((DropDownList)row.Cells[10].FindControl("Reasonid")).SelectedValue; disposition = ((DropDownList)row.Cells[11].FindControl("Dispoid")).SelectedValue; stockw = ((DropDownList)row.Cells[12].FindControl("Stockwareh")).SelectedValue; if (stockw == String.Empty) { stockw = "NA"; } string regrind = ((DropDownList)row.Cells[13].FindControl("Regrind")).SelectedValue; if (regrind == String.Empty) { regrind = "NA"; } string obse = ((TextBox)row.Cells[14].FindControl("Comments")).Text; if (obse.Length > 255) { obse = ((TextBox)row.Cells[14].FindControl("Comments")).Text.Substring(1, 255); } string supplier = ((DropDownList)row.Cells[11].FindControl("Supplier")).SelectedValue; if (supplier == string.Empty) { supplier = " "; } if (Session["Lote"].ToString() == " ") { Session["Lote"] = " "; } if (!toreturn.Equals(string.Empty)) { obj = new Ent_tticol118(); obj.item = " " + txtItem.Text.Trim().ToUpperInvariant(); obj.cwar = row.Cells[2].Text.ToUpperInvariant(); //obj.clot = row.Cells[3].Text.ToUpperInvariant(); obj.clot = Session["Lote"].ToString(); obj.qtyr = Convert.ToInt32(toreturn); obj.cdis = reason; obj.obse = obse; obj.logr = Session["user"].ToString(); obj.disp = Convert.ToInt32(disposition); obj.stoc = stockw; obj.ritm = regrind; obj.proc = 2; obj.mess = " "; obj.suno = supplier; obj.refcntd = 0; obj.refcntu = 0; parameterCollection.Add(obj); } } InterfazDAL_tticol118 idal = new InterfazDAL_tticol118(); int actualizar = idal.actualizarRegistro_Param(ref parameterCollection, ref strError); if (actualizar < 1) { idal.insertarRegistro(ref parameterCollection, ref strError); } if (strError != string.Empty) { lblResult.Text = strError; } else { printResult.Visible = true; if (Convert.ToInt32(disposition) == 4) { DataTable resultado = idal.invLabel_registroImprimir_Param(ref obj, ref strError); DataRow reg = resultado.Rows[0]; Session["FilaImprimir"] = reg; printLabel.Visible = true; } lblResult.Text = strError; lblResult.Text = "Material Rejection Inside Warehouse was updated succesfully."; this.HeaderGrid.Visible = false; } grdRecords.DataSource = ""; grdRecords.DataBind(); if (strError != string.Empty) { lblResult.Text = strError; throw new System.InvalidOperationException(strError); } }
protected void btnSave_Click(object sender, EventArgs e) { List <Ent_tticol118> parameterCollection = new List <Ent_tticol118>(); Ent_tticol118 obj = new Ent_tticol118(); //Recorrer filas con valores en los textos string disposition = String.Empty; string reason = String.Empty; string stockw = String.Empty; string orden = String.Empty; //var Regrind; foreach (GridViewRow row in grdRecords.Rows) { string toreturn = ((TextBox)row.Cells[7].FindControl("toReturn")).Text; string lote = ((TextBox)row.Cells[7].FindControl("toReturn")).Text; reason = ((DropDownList)row.Cells[9].FindControl("Reasonid")).SelectedValue; disposition = ((DropDownList)row.Cells[8].FindControl("Dispoid")).SelectedValue; stockw = ((DropDownList)grdRecords.Rows[0].Cells[1].FindControl("Stockwareh")).SelectedValue; DataTable DTMyRegrind = new DataTable(); Session["MyRegrind"] = ((DropDownList)grdRecords.Rows[0].Cells[1].FindControl("Regrind")).SelectedValue.ToString().Trim(); if (stockw == String.Empty) { stockw = "NA"; } string regrind = ((DropDownList)grdRecords.Rows[0].Cells[2].FindControl("Regrind")).SelectedValue; if (regrind == String.Empty) { regrind = "NA"; } string obse = ((TextBox)grdRecords.Rows[0].Cells[3].FindControl("Comments")).Text; if (obse.Length > 255) { obse = ((TextBox)grdRecords.Rows[0].Cells[3].FindControl("Comments")).Text.Substring(1, 255); } string supplier = ((DropDownList)grdRecords.Rows[0].Cells[0].FindControl("Supplier")).SelectedValue; if (supplier == string.Empty) { supplier = " "; } if (Session["Lote"].ToString() == "" || Session["Lote"].ToString() == " ") { Session["Lote"] = " "; } if (!toreturn.Equals(string.Empty)) { obj = new Ent_tticol118(); obj.item = Session["txtItem"].ToString().Trim().ToUpperInvariant(); obj.cwar = row.Cells[2].Text.ToUpperInvariant(); //obj.clot = row.Cells[3].Text.ToUpperInvariant(); obj.clot = Session["Lote"].ToString(); obj.qtyr = Double.Parse(toreturn, System.Globalization.CultureInfo.InvariantCulture);//Convert.ToDecimal(toreturn); obj.cdis = reason; obj.obse = obse; obj.logr = Session["user"].ToString(); obj.disp = Convert.ToInt32(disposition); obj.stoc = stockw; obj.ritm = regrind; obj.proc = 2; obj.mess = " "; obj.suno = supplier; obj.refcntd = 0; obj.refcntu = 0; parameterCollection.Add(obj); } } InterfazDAL_tticol118 idal = new InterfazDAL_tticol118(); //int actualizar = idal.actualizarRegistro_Param(ref parameterCollection, ref strError); //if (actualizar < 1) if (string.IsNullOrEmpty(reason) || string.IsNullOrWhiteSpace(reason)) { corregible = true; strError = _textoLabels.readStatement(formName, _idioma, "lblReasoNull"); } else { idal.insertarRegistro(ref parameterCollection, ref strError); } if (strError != string.Empty) { lblResult.Text = mensajes("errorsave"); } else { printResult.Visible = true; if (Convert.ToInt32(disposition) == 4 || Convert.ToInt32(disposition) == 5) { DataTable resultado = idal.invLabel_registroImprimir_Param(ref obj, ref strError); resultado.Columns.Add("USER", typeof(String)); DataRow reg = resultado.Rows[0]; resultado.Rows[0]["USER"] = Session["user"].ToString().ToUpper(); Session["FilaImprimir"] = reg; //printLabel.Visible = true; } lblResult.Text = strError; lblResult.Text = mensajes("msjupdt"); this.HeaderGrid.Visible = false; } if (corregible == false) { grdRecords.DataSource = ""; grdRecords.DataBind(); grdRecords.DataSource = ""; grdRecords.DataBind(); } if (strError != string.Empty) { lblResult.Text = strError; //throw new System.InvalidOperationException(strError); } else { //Print Label Inmmediatly if (Convert.ToInt32(disposition) == 4 || Convert.ToInt32(disposition) == 5) { //obj.item = txtItem.Text; //obj.clot = txtLot.Text; lblResult.Text = string.Empty; DataTable resultadop = idal.listaRegistros_Param(ref obj, ref strError); resultadop.Columns.Add("FactorKG", typeof(string)); resultadop.Rows[0]["FactorKG"] = FactorKG.Trim(); Session["resultadop"] = resultadop; StringBuilder paramurl = new StringBuilder(); paramurl.Append("?"); paramurl.Append("valor1=" + Request.QueryString[0].ToString() + "&"); paramurl.Append("valor2=" + Request.QueryString[1].ToString() + "&"); paramurl.Append("valor3=" + Request.QueryString[2].ToString()); Session["IsPreviousPage"] = ""; StringBuilder script = new StringBuilder(); script.Append("ventanaImp = window.open('../Labels/whInvLabelMaterialRejectedD.aspx', "); script.Append("'ventanaImp', 'menubar=0,resizable=0,width=580,height=450');"); script.Append("ventanaImp.moveTo(30, 0);"); //script.Append("setTimeout (ventanaImp.close(), 20000);"); ScriptManager.RegisterStartupScript(this, this.GetType(), "printTag", script.ToString(), true); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Notify", "alert('Information Saved Successfully.');", true); lblResult.Text = mensajes("msjupdt"); lblResult.Visible = true; } } }