private string transporteCondicion(HttpContext context) { string response = string.Empty; string option = context.Request["opt"].ToString(); string key = string.Empty; switch (option) { case "condCli": int id_cliente; bool es_entrada; bool es_salida; int.TryParse(context.Request["id_cliente"].ToString(), out id_cliente); bool.TryParse(context.Request["es_entrada"].ToString(), out es_entrada); bool.TryParse(context.Request["es_salida"].ToString(), out es_salida); response = JsonConvert.SerializeObject(TransporteCtrl.TransCondCliFill(id_cliente, es_entrada, es_salida)); break; } return(response); }
private void saveSalida() { try { int numero; Salida_orden_carga oSOC = new Salida_orden_carga(); oSOC.Id = Convert.ToInt32(hf_id_salida_orden_carga.Value); List <Salida> lstSalidas = new List <Salida>(); int.TryParse(ddlCliente.SelectedValue, out numero); List <Salida_orden_carga_tc> lstSalTranCond = JsonConvert.DeserializeObject <List <Salida_orden_carga_tc> >(hf_condiciones_transporte.Value); numero = TransporteCtrl.TransCondCliGetNumCond(numero, false, true); if (lstSalTranCond.Count != numero) { throw new Exception("Es necesario proporcionar TODAS LAS CONDICIONES del transporte."); } oSOC.PLstSalOCTransCond = lstSalTranCond; oSOC.Observaciones_tranpsorte = txt_comentarios.Text.Trim(); Salida oS = getFormValues(); List <Salida_compartida> lstSalComp = new List <Salida_compartida>(); bool cumpleCondTran = lstSalTranCond.Count(p => p.Si_no == false) == 0; numero = 0; for (int iRow = 0; iRow < grd_rem.Rows.Count; iRow++) { GridViewRow row = grd_rem.Rows[iRow]; Salida o = new Salida(); o = (Salida)oS.Clone(); o.Referencia = row.Cells[0].Text; o.PLstSalTransCond = new List <Salida_transporte_condicion>(); HiddenField hfJsonDoc = row.FindControl("hf_JsonDocumentos") as HiddenField; o.PLstSalDoc = JsonConvert.DeserializeObject <List <Salida_documento> >(hfJsonDoc.Value); if (o.PLstSalDoc == null) { o.PLstSalDoc = new List <Salida_documento>(); } //Numero de pallet //TextBox txt_no_pallet = row.FindControl("txt_no_pallet") as TextBox; int.TryParse(CommonFunctions.NumbersOnly(row.Cells[2].Text), out numero); o.No_pallet = numero; numero = 0; //Numero de bulto int.TryParse(CommonFunctions.NumbersOnly(row.Cells[3].Text), out numero); o.No_bulto = numero; numero = 0; //Numero de pieza int.TryParse(CommonFunctions.NumbersOnly(row.Cells[4].Text), out numero); o.No_pieza = numero; numero = 0; //Mercancia TextBox txt_mercancia = row.FindControl("txt_mercancia") as TextBox; o.Mercancia = txt_mercancia.Text; //observaciones //Mercancia TextBox txt_observaciones = row.FindControl("txt_observaciones") as TextBox; o.Observaciones = txt_observaciones.Text.Trim(); //Forma (única o parcial) HiddenField hf_forma = row.FindControl("hf_forma") as HiddenField; Salida_parcial oSP = new Salida_parcial(); switch (Convert.ToInt32(hf_forma.Value)) { case 0: o.Es_unica = true; break; case 1: oSP.Referencia = o.Referencia; oSP.Es_ultima = false; oSP.Id_usuario = o.PUsuario.Id; o.PSalPar = oSP; o.Es_unica = false; break; case -1: oSP.Referencia = o.Referencia; oSP.Es_ultima = true; oSP.Id_usuario = o.PUsuario.Id; o.PSalPar = oSP; o.Es_unica = false; break; } //Compartida Salida_compartida oSC = new Salida_compartida(); oSC.Id_usuario = o.PUsuario.Id; oSC.Capturada = false; oSC.Referencia = o.Referencia; lstSalComp.Add(oSC); lstSalidas.Add(o); } if (lstSalComp.Count > 1) { foreach (Salida itemS in lstSalidas) { itemS.PLstSalComp = lstSalComp.FindAll(p => string.Compare(p.Referencia, itemS.Referencia) != 0); } } oSOC.LstSalida = lstSalidas; if (cumpleCondTran) { SalidaCtrl.salidaAddFromLst(oSOC); Response.Redirect("frmEmbarqueOC.aspx?_kp=" + hf_id_salida_orden_carga.Value); } else { Salida oSTmp = oSOC.LstSalida.First(); oSTmp.PCliente = CatalogCtrl.Cliente_GetById(oSTmp.Id_cliente); if (oSTmp.PLstSalComp == null) { oSTmp.PLstSalComp = new List <Salida_compartida>(); } oSTmp.PTransporteTipo = CatalogCtrl.Transporte_tipo_getyById(oSTmp.Id_transporte_tipo); SSalidaOC = oSOC; Response.Redirect("frmEmbarqueOC.aspx?_octc=" + hf_id_salida_orden_carga.Value); } } catch { throw; } }
private void validarTipo(int IdTransporteTipo) { try { //if (IdTransporteTipo > 0 && string.Compare(hf_click_save.Value, "1") != 0) if (IdTransporteTipo > 0) { Transporte_tipo o = CatalogCtrl.Transporte_tipo_getyById(IdTransporteTipo); //rv_total_carga_max.MinimumValue = "0"; //rv_total_carga_max.MaximumValue = o.Peso_maximo.ToString(); //rv_total_carga_max.ErrorMessage = "El peso excede los " + o.Peso_maximo.ToString() + " Kg, para el tipo de transrpote selecccionado"; txt_placa.Text = string.Empty; txt_placa.ReadOnly = (!o.Requiere_placa); txt_caja.Text = string.Empty; txt_caja.ReadOnly = (!o.Requiere_caja); txt_caja_1.Text = string.Empty; txt_caja_1.ReadOnly = (!o.Requiere_caja1); txt_caja_2.Text = string.Empty; txt_caja_2.ReadOnly = (!o.Requiere_caja2); if (txt_placa.ReadOnly) { txt_placa.Text = "N.A."; } if (txt_caja.ReadOnly) { txt_caja.Text = "N.A."; } if (txt_caja_1.ReadOnly) { txt_caja_1.Text = "N.A."; } if (txt_caja_2.ReadOnly) { txt_caja_2.Text = "N.A."; } hf_cond_trans.Value = Newtonsoft.Json.JsonConvert.SerializeObject(TransporteCtrl.TransCondByTransporteTipo(IdTransporteTipo, false, true)); } } catch { throw; } }