Ejemplo n.º 1
0
        public static Cortina_disponible cortinaVerificarByUsuario()
        {
            Cortina_disponible oC = new Cortina_disponible();

            try
            {
                Cortina_disponibleMng oMng = new Cortina_disponibleMng();
                oMng.fillLst();
                List <Cortina_disponible> lst = oMng.Lst;
                if (lst.Exists(p => p.Inicio != default(DateTime) && p.Fin == default(DateTime)))
                {
                    oC = lst.Find(p => p.Fin == default(DateTime));

                    Cortina o = new Cortina()
                    {
                        Id = oC.Id_cortina
                    };
                    CortinaMng oCMng = new CortinaMng()
                    {
                        O_Cortina = o
                    };
                    oCMng.selById();
                }
            }
            catch
            {
                throw;
            }
            return(oC);
        }
Ejemplo n.º 2
0
        public Cortina RegistrarCortina(string nombre)
        {
            var cortina = new Cortina(nombre);

            Cortinas[nombre] = cortina;
            return(cortina);
        }
Ejemplo n.º 3
0
        public static List <Cortina> cortinaDispobleByBodega(int id_bodega)
        {
            List <Cortina> lst = new List <Cortina>();

            try
            {
                Cortina oC = new Cortina();
                lst = CatalogoCtrl.catalogGetAllLst(oC).Cast <Cortina>().ToList();
                lst = lst.FindAll(p => p.Id_bodega == id_bodega && p.IsActive == true);
                Cortina_disponibleMng oCDMng = new Cortina_disponibleMng();
                oCDMng.fillLst();
                List <Cortina_disponible> lstCD = oCDMng.Lst;
                lstCD = lstCD.FindAll(p => p.Inicio != default(DateTime) && p.Fin == default(DateTime));
                foreach (Cortina itemC in lst)
                {
                    if (lstCD.Exists(p => p.Id_cortina == itemC.Id))
                    {
                        itemC.IsActive = false;
                    }
                }
                lst = lst.FindAll(p => p.IsActive == true);
            }
            catch
            {
                throw;
            }
            return(lst);
        }
Ejemplo n.º 4
0
        protected void lnk_change_status_click(object sender, CommandEventArgs args)
        {
            try
            {
                int Id = 0;
                int.TryParse(args.CommandName, out Id);
                bool status = false;
                bool.TryParse(args.CommandArgument.ToString(), out status);

                Cortina oC = new Cortina();
                oC.Id = Id;
                CortinaMng oCMng = new CortinaMng();
                oCMng.O_Cortina = oC;
                if (status)
                {
                    oCMng.dlt();
                }
                else
                {
                    oCMng.reactive();
                }

                ddlBodega_Changed(null, null);
            }
            catch (Exception e)
            {
                ((MstCasc)this.Master).setError = e.Message;
            }
        }
Ejemplo n.º 5
0
        private Entrada addEntradaValuesCompartida()
        {
            Entrada oE = new Entrada();

            oE.Folio = hfFolio.Value.ToString();

            try
            {
                oE = getEntradaCompartida(oE.Folio);
                setFormValuesCompartida(oE);

                EntradaCtrl.AddEntradaCompartida(oE);

                oE.PUsuario = ((MstCasc)this.Master).getUsrLoged();

                DocumentoMng oDocMng = new DocumentoMng();
                foreach (Entrada_documento itemSD in VSLstED)
                {
                    Documento oDoc = new Documento();
                    oDoc.Id             = itemSD.Id_documento;
                    oDocMng.O_Documento = oDoc;
                    oDocMng.selById();
                    itemSD.PDocumento = oDoc;
                }
                oE.PLstEntDoc = VSLstED;

                Bodega oB = new Bodega();
                oB.Id = oE.Id_bodega;
                BodegaMng oBMng = new BodegaMng();
                oBMng.O_Bodega = oB;
                oBMng.selById();
                oE.PBodega = oB;

                Cortina oCor = new Cortina();
                oCor.Id        = oE.Id_cortina;
                oCor.Nombre    = ddlCortina.SelectedItem.Text;
                oCor.Id_bodega = oE.Id_bodega;
                oE.PCortina    = oCor;

                oE.PCliente = CatalogCtrl.Cliente_GetById(oE.Id_cliente);

                Cuenta_tipoMng oCTMng = new Cuenta_tipoMng();
                Cuenta_tipo    oCT    = new Cuenta_tipo();
                oCT.Id = oE.PCliente.Id_cuenta_tipo;
                oCTMng.O_Cuenta_tipo = oCT;
                oCTMng.selById();
                oE.PCliente.cuenta_tipo = oCT.Nombre;

                Custodia oCdia = new Custodia();
                oCdia.Id     = oE.Id_custodia;
                oCdia.Nombre = ddlCustodia.SelectedItem.Text;
                oE.PCustodia = oCdia;
            }
            catch (Exception)
            {
                throw;
            }
            return(oE);
        }
Ejemplo n.º 6
0
 private void istCortina(Cortina oC)
 {
     try
     {
         CortinaMng oCMng = new CortinaMng();
         oCMng.O_Cortina = oC;
         oCMng.add();
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 7
0
        private void dgPago_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Cortina af = new Cortina();

            af = (Cortina)dgPago.SelectedItem;
            if (af != null)
            {
                txtPrecio.Text      = af.Valor.ToString();
                txtAbono.Text       = af.abono.ToString();
                txtSaldoActual.Text = af.saldo.ToString();
                Properties.Settings.Default.idCortina = af.Id;
            }
        }
Ejemplo n.º 8
0
        public static void fillCortinaByBodega(DropDownList ddlCortina, int Id_bodega)
        {
            CortinaMng oMng = new CortinaMng();
            Cortina    o    = new Cortina();

            o.Id_bodega    = Id_bodega;
            oMng.O_Cortina = o;
            oMng.selByIdBodega();
            ddlCortina.DataSource     = oMng.Lst;
            ddlCortina.DataTextField  = "nombre";
            ddlCortina.DataValueField = "id";
            ddlCortina.DataBind();
        }
Ejemplo n.º 9
0
 private void fillCortina(int IdBodega)
 {
     try
     {
         CortinaMng oCMng = new CortinaMng();
         Cortina    oC    = new Cortina();
         oC.Id_bodega    = IdBodega;
         oCMng.O_Cortina = oC;
         oCMng.selByIdBodegaAll();
         fillCatalog(oCMng.Lst);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 10
0
        private Cortina getFormValues()
        {
            Cortina oC     = new Cortina();
            int     entero = 0;

            int.TryParse(hfId.Value, out entero);
            oC.Id  = entero;
            entero = 0;

            int.TryParse(ddlBodega.SelectedValue, out entero);
            oC.Id_bodega = entero;
            entero       = 0;

            oC.Nombre = txt_nombre.Text.Trim();

            return(oC);
        }
Ejemplo n.º 11
0
        private string asn(HttpContext context)
        {
            option = context.Request["opt"].ToString();
            //int id_cliente = 0;
            //string folio_aplicada = string.Empty;
            //DateTime corte_ini = default(DateTime);
            //DateTime corte_fin = default(DateTime);
            Asn o = null;

            switch (option)
            {
            case "sltById":
                response = JsonConvert.SerializeObject(ProcessCtrl.asnGetAllById(Convert.ToInt32(context.Request["key"])));
                break;

            case "lst":
                o = new Asn();
                List <Asn> lstAsn = ProcessCtrl.asnLst();
                foreach (Asn item in lstAsn)
                {
                    item.PCortinaAsignada = RecepcionCtrl.cortinaGetByAsn(item.Id);
                    if (item.PCortinaAsignada.Id_cortina > 0)
                    {
                        Cortina oCortina = new Cortina()
                        {
                            Id = item.PCortinaAsignada.Id_cortina
                        };
                        CatalogoCtrl.catalogSelById(oCortina);
                        item.CortinaNombre = oCortina.Nombre;
                    }
                }
                response = JsonConvert.SerializeObject(lstAsn);
                break;

            case "add":
                jsonData = new StreamReader(context.Request.InputStream).ReadToEnd();
                o        = JsonConvert.DeserializeObject <Asn>(jsonData);
                ProcessCtrl.asnAdd(o);
                response = JsonConvert.SerializeObject(true);
                break;

            default:
                break;
            }
            return(response);
        }
Ejemplo n.º 12
0
        private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Cortina af = new Cortina();

            af = (Cortina)dataGrid.SelectedItem;
            if (af != null)
            {
                txtUbicacion.Text       = af.Ubicacion;
                txtPosicion.Text        = af.Posicion;
                txtTela.Text            = af.Tela;
                txtAlto.Text            = af.Alto.ToString();
                txtAncho.Text           = af.Ancho.ToString();
                txtCodigo.Text          = af.Id.ToString();
                ddlCortina.SelectedItem = af.TipoCortina.ToString();
                ddlPago.SelectedItem    = af.TipoPago.ToString();
                txtDescripcion.Text     = af.Descripcion;
                txtPrecio.Text          = af.Valor.ToString();
            }
        }
Ejemplo n.º 13
0
        private void btn_Abono_Click(object sender, RoutedEventArgs e)
        {
            if (txtNuevoAbono.Text.Length == 0)
            {
                MessageBox.Show("Debe ingresar un abono");
                return;
            }

            if (int.Parse(txtNuevoAbono.Text) == 0)
            {
                MessageBox.Show("Abono debe ser mayor a 0");
                return;
            }

            if (int.Parse(txtNuevoAbono.Text) > int.Parse(txtSaldoActual.Text))
            {
                MessageBox.Show("Abono no puede ser mayor a saldo actual");
                return;
            }

            Cortina c = new Cortina();

            c.Id            = Properties.Settings.Default.idCortina;
            c.abono         = int.Parse(txtAbono.Text) + int.Parse(txtNuevoAbono.Text);
            c.saldo         = int.Parse(txtSaldoActual.Text) - int.Parse(txtNuevoAbono.Text);
            c.ClienteCodigo = Properties.Settings.Default.Codigo;

            if (c.abonar())
            {
                MessageBox.Show("Abono realizado");
                CargarLista();
                txtNuevoAbono.Text  = string.Empty;
                txtAbono.Text       = string.Empty;
                txtPrecio.Text      = string.Empty;
                txtSaldoActual.Text = string.Empty;
            }
            else
            {
                MessageBox.Show("Abono no realizado");
            }
        }
Ejemplo n.º 14
0
        private void fillForm()
        {
            int Id = 0;

            int.TryParse(hfId.Value, out Id);

            try
            {
                CortinaMng oCMng = new CortinaMng();
                Cortina    oC    = new Cortina();
                oC.Id           = Id;
                oCMng.O_Cortina = oC;
                oCMng.selById();

                txt_nombre.Text         = oC.Nombre;
                ddlBodega.SelectedValue = oC.Id_bodega.ToString();
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 15
0
        private void eliminar()
        {
            if (txtCodigo.Text.Length == 0)
            {
                MessageBox.Show("Debe seleccionar un pedido");
                txtCodigo.Text = string.Empty;
                return;
            }

            Cortina c = new Cortina();

            c.Id = int.Parse(txtCodigo.Text);

            if (c.Delete())
            {
                MessageBox.Show("Pedido eliminado");
            }
            else
            {
                MessageBox.Show("Pedido no existe en la base de datos");
            }
        }
Ejemplo n.º 16
0
        private void btn_Pagartodo_Click(object sender, RoutedEventArgs e)
        {
            Cortina c = new Cortina();

            c.Id            = Properties.Settings.Default.idCortina;
            c.abono         = int.Parse(txtPrecio.Text);
            c.saldo         = 0;
            c.ClienteCodigo = Properties.Settings.Default.Codigo;

            if (c.abonar())
            {
                MessageBox.Show("Pedido pagado completamente");
                CargarLista();
                txtNuevoAbono.Text  = string.Empty;
                txtAbono.Text       = string.Empty;
                txtPrecio.Text      = string.Empty;
                txtSaldoActual.Text = string.Empty;
            }
            else
            {
                MessageBox.Show("Pago no realizado");
            }
        }
Ejemplo n.º 17
0
        private Entrada getEntradaFormValues()
        {
            Entrada o = new Entrada();
            int     numero;

            //Usuario
            o.PUsuario = ((MstCasc)this.Master).getUsrLoged();

            //Bodega
            int.TryParse(ddlBodega.SelectedValue, out numero);
            o.Id_bodega = numero;
            numero      = 0;

            //Fecha
            o.Fecha = DateTime.Today;

            //Hora
            o.Hora = txt_hora_llegada.Text;

            //Cortina
            int.TryParse(ddlCortina.SelectedValue, out numero);
            o.Id_cortina = numero;
            numero       = 0;

            //Cliente
            int.TryParse(ddlCliente.SelectedValue, out numero);
            o.Id_cliente = numero;
            numero       = 0;

            //Referencia
            if (rfvReferencia.Enabled)
            {
                o.Referencia = txt_referencia.Text;
            }
            else
            {
                o.Referencia = string.Empty;
            }

            //Origen
            o.Origen = txt_origen.Text;

            //Mercancia
            o.Mercancia = txt_mercancia.Text;

            //Listado de transportes de la entrada
            o.PLstEntTrans = VSLstET;

            //Sello
            o.Sello = txt_sello.Text;

            //Talon
            o.Talon = txt_talon.Text;

            //Custodia
            int.TryParse(ddlCustodia.SelectedValue, out numero);
            o.Id_custodia = numero;
            numero        = 0;

            //Tipo Carga
            int.TryParse(ddlTipoCarga.SelectedValue, out numero);
            o.Id_tipo_carga = numero;
            numero          = 0;

            //Operador de la custodia
            o.Operador = txt_operador.Text;

            //Numero de pallet
            int.TryParse(txt_no_pallet.Text, out numero);
            o.No_pallet = numero;
            numero      = 0;

            //Numero de bultos danados
            int.TryParse(txt_no_bulto_danado.Text, out numero);
            o.No_bulto_danado = numero;
            numero            = 0;

            //Numero de bultos abiertos
            int.TryParse(txt_no_bulto_abierto.Text, out numero);
            o.No_bulto_abierto = numero;
            numero             = 0;

            //Numero de bultos declarados
            int.TryParse(txt_no_bulto_declarado.Text, out numero);
            o.No_bulto_declarado = numero;
            numero = 0;

            //Numero de piezas declaradas
            int.TryParse(txt_no_pieza_declarada.Text, out numero);
            o.No_pieza_declarada = numero;
            numero = 0;

            //Numero de piezas recibidas
            int.TryParse(txt_no_pieza_recibida.Text, out numero);
            o.No_pieza_recibida = numero;
            numero = 0;

            //Numero de bultos recibidos
            int.TryParse(txt_no_bulto_recibido.Text, out numero);
            o.No_bulto_recibido = numero;
            numero = 0;

            //int.TryParse(txt_no_pieza_recibida.Text, out numero);
            //Numero de piezas recibidas
            o.No_pieza_recibida = o.No_pieza_declarada;
            numero = 0;

            //Hora de descarga
            o.Hora_descarga = txt_hora_descarga.Text;

            //Listado de documentos en la entrada
            o.PLstEntDoc = VSLstED;

            DocumentoMng oDocMng = new DocumentoMng();

            foreach (Entrada_documento itemED in o.PLstEntDoc)
            {
                Documento oDoc = new Documento();
                oDoc.Id             = itemED.Id_documento;
                oDocMng.O_Documento = oDoc;
                oDocMng.selById();
                itemED.PDocumento = oDoc;
            }

            //Listado de pedimentos compartidos
            o.PLstEntComp = new List <Entrada_compartida>();
            foreach (ListItem liPC in lst_pedimentos_consolidados.Items)
            {
                Entrada_compartida oEC = new Entrada_compartida();
                oEC.Referencia = liPC.Value;
                oEC.Id_usuario = o.PUsuario.Id;
                o.PLstEntComp.Add(oEC);
            }

            //Vigilante
            o.Vigilante = txt_vigilante.Text.Trim();

            //Observaciones
            o.Observaciones = txt_observaciones.Text.Trim();

            //Bodega
            Bodega oB = new Bodega();

            oB.Id = Convert.ToInt32(ddlBodega.SelectedValue);
            BodegaMng oBMng = new BodegaMng();

            oBMng.O_Bodega = oB;
            oBMng.selById();
            o.PBodega = oB;

            //Cortina
            Cortina oCor = new Cortina();

            oCor.Id        = o.Id_cortina;
            oCor.Nombre    = ddlCortina.SelectedItem.Text;
            oCor.Id_bodega = o.Id_bodega;
            o.PCortina     = oCor;

            //Cliente
            o.PCliente = CatalogCtrl.Cliente_GetById(o.Id_cliente);

            //Custodia
            Custodia oCdia = new Custodia();

            oCdia.Id     = o.Id_custodia;
            oCdia.Nombre = ddlCustodia.SelectedItem.Text;
            o.PCustodia  = oCdia;

            //Es consolidada
            o.EsConsolidada = Convert.ToBoolean(hfConsolidada.Value);

            //Es parcial
            o.Es_unica = true;
            if (!chk_tipo_entrada.Checked)
            {
                Entrada_parcial oEP = new Entrada_parcial();
                oEP.Referencia = o.Referencia;
                oEP.Es_ultima  = chk_ultima.Checked;
                oEP.Id_usuario = o.PUsuario.Id;
                o.PEntPar      = oEP;
                o.Es_unica     = false;
            }

            //tipo carga
            Tipo_carga oTipoCarga = new Tipo_carga();

            oTipoCarga.Id     = o.Id_tipo_carga;
            oTipoCarga.Nombre = ddlTipoCarga.SelectedItem.Text;
            o.PTipoCarga      = oTipoCarga;

            return(o);
        }
Ejemplo n.º 18
0
        private Entrada getEntradaFormValues(bool EsCompartida = false)
        {
            Entrada o = new Entrada();

            try
            {
                List <Entrada_documento>  lstEntDoc  = JsonConvert.DeserializeObject <List <Entrada_documento> >(hf_entradaDocumento.Value);
                List <Entrada_compartida> lstEntComp = JsonConvert.DeserializeObject <List <Entrada_compartida> >(hf_arribo_compartido.Value);
                List <Entrada_transporte> lstEntTran = JsonConvert.DeserializeObject <List <Entrada_transporte> >(hf_entradaTransporte.Value);
                if (lstEntTran.Count == 0)
                {
                    throw new Exception("Es necesario agregar al menos un trasporte");
                }

                if (lstEntDoc == null)
                {
                    lstEntDoc = new List <Entrada_documento>();
                }

                if (lstEntComp == null)
                {
                    lstEntComp = new List <Entrada_compartida>();
                }

                int numero;

                //Usuario
                o.PUsuario = ((MstCasc)this.Master).getUsrLoged();

                //Bodega
                o.Id_bodega = ((MstCasc)this.Master).getUsrLoged().Id_bodega;
                numero      = 0;

                //Fecha
                o.Fecha = DateTime.Today;

                //Hora
                o.Hora = txt_hora_llegada.Text;

                //Cortina
                int.TryParse(ddlCortina.SelectedValue, out numero);
                o.Id_cortina = numero;
                numero       = 0;

                //Cliente
                o.Id_cliente = 1; //Avon 1
                numero       = 0;

                //Referencia
                o.Referencia = txt_referencia.Text;

                //Origen
                o.Origen = txt_origen.Text;

                //Mercancia
                o.Mercancia = txt_mercancia.Text;

                //Listado de transportes de la entrada
                o.PLstEntTrans = lstEntTran;

                //Sello
                o.Sello = txt_sello.Text;

                //Talon
                o.Talon = txt_talon.Text;

                //Custodia
                int.TryParse(ddlCustodia.SelectedValue, out numero);
                o.Id_custodia = numero;
                numero        = 0;

                //Tipo Carga
                int.TryParse(ddlTipoCarga.SelectedValue, out numero);
                o.Id_tipo_carga = numero;
                numero          = 0;

                //Operador de la custodia
                o.Operador = txt_operador.Text;

                //Numero de pallet
                int.TryParse(txt_no_pallet.Text, out numero);
                o.No_pallet = numero;
                numero      = 0;

                //Numero de bultos danados
                int.TryParse(txt_no_bulto_danado.Text, out numero);
                o.No_bulto_danado = numero;
                numero            = 0;

                //Numero de bultos abiertos
                int.TryParse(txt_no_bulto_abierto.Text, out numero);
                o.No_bulto_abierto = numero;
                numero             = 0;

                //Numero de bultos declarados
                int.TryParse(txt_no_bulto_declarado.Text, out numero);
                o.No_bulto_declarado = numero;
                numero = 0;

                //Numero de piezas declaradas
                int.TryParse(txt_no_pieza_declarada.Text, out numero);
                o.No_pieza_declarada = numero;
                numero = 0;

                //Numero de piezas recibidas
                int.TryParse(txt_no_pieza_recibida.Text, out numero);
                o.No_pieza_recibida = numero;
                numero = 0;

                //Numero de bultos recibidos
                int.TryParse(txt_no_bulto_recibido.Text, out numero);
                o.No_bulto_recibido = numero;
                numero = 0;

                //Hora de descarga
                o.Hora_descarga = txt_hora_descarga.Text;

                //Listado de documentos en la entrada
                o.PLstEntDoc = lstEntDoc;

                DocumentoMng oDocMng = new DocumentoMng();
                foreach (Entrada_documento itemED in o.PLstEntDoc)
                {
                    Documento oDoc = new Documento();
                    oDoc.Id             = itemED.Id_documento;
                    oDocMng.O_Documento = oDoc;
                    oDocMng.selById();
                    itemED.PDocumento = oDoc;
                }

                //Listado de pedimentos compartidos
                foreach (Entrada_compartida itemEC in lstEntComp)
                {
                    itemEC.Id_usuario = o.PUsuario.Id;
                }

                o.PLstEntComp = lstEntComp;
                //foreach (ListItem liPC in lst_pedimentos_consolidados.Items)
                //{
                //    Entrada_compartida oEC = new Entrada_compartida();
                //    oEC.Referencia = liPC.Value;
                //    oEC.Id_usuario = o.PUsuario.Id;
                //    o.PLstEntComp.Add(oEC);
                //}

                //Vigilante
                o.Vigilante = txt_vigilante.Text.Trim();

                //Observaciones
                o.Observaciones = txt_observaciones.Text.Trim();

                //Bodega
                Bodega oB = new Bodega();
                oB.Id = ((MstCasc)this.Master).getUsrLoged().Id_bodega;
                BodegaMng oBMng = new BodegaMng();
                oBMng.O_Bodega = oB;
                oBMng.selById();
                o.PBodega = oB;

                //Cortina
                Cortina oCor = new Cortina();
                oCor.Id        = o.Id_cortina;
                oCor.Nombre    = ddlCortina.SelectedItem.Text;
                oCor.Id_bodega = o.Id_bodega;
                o.PCortina     = oCor;

                //Cliente
                o.PCliente = CatalogCtrl.Cliente_GetById(o.Id_cliente);

                //Custodia
                Custodia oCdia = new Custodia();
                oCdia.Id     = o.Id_custodia;
                oCdia.Nombre = ddlCustodia.SelectedItem.Text;
                o.PCustodia  = oCdia;

                //Es consolidada
                o.EsConsolidada = lstEntComp.Count > 0;

                //Es parcial
                o.Es_unica = true;
                if (rb_parcial.Checked)
                {
                    Entrada_parcial oEP = new Entrada_parcial();
                    oEP.Referencia = o.Referencia;
                    oEP.Es_ultima  = chk_ultima.Checked;
                    oEP.Id_usuario = o.PUsuario.Id;
                    o.PEntPar      = oEP;
                    o.Es_unica     = false;
                }

                //tipo carga
                Tipo_carga oTipoCarga = new Tipo_carga();
                oTipoCarga.Id     = o.Id_tipo_carga;
                oTipoCarga.Nombre = ddlTipoCarga.SelectedItem.Text;
                o.PTipoCarga      = oTipoCarga;
            }
            catch
            {
                throw;
            }

            return(o);
        }
Ejemplo n.º 19
0
        public void Editar()
        {
            if (txtCodigo.Text.Length == 0)
            {
                MessageBox.Show("Debe seleccionar un Código");
                txtCodigo.Text = string.Empty;
                return;
            }

            if (txtUbicacion.Text.Length == 0)
            {
                MessageBox.Show("Debe ingresar una ubicación");
                txtUbicacion.Text = string.Empty;
                return;
            }

            try
            {
                float.Parse(txtAlto.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("El alto de la cortina debe ser un número");
            }

            if (txtAlto.Text.Length == 0)
            {
                MessageBox.Show("Debe ingresar un alto");
                txtAlto.Text = string.Empty;
                return;
            }

            try
            {
                float.Parse(txtAncho.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("El ancho de la cortina debe ser un número");
            }

            if (txtAncho.Text.Length == 0)
            {
                MessageBox.Show("Debe ingresar un Ancho");
                txtAncho.Text = string.Empty;
                return;
            }

            if (txtPrecio.Text.Length == 0)
            {
                MessageBox.Show("Debe ingresar un precio");
                txtPosicion.Text = string.Empty;
                return;
            }

            try
            {
                float.Parse(txtPrecio.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("El campo precio debe ser numérico");
            }

            if (ddlCortina.SelectedItem.Equals("Seleccione"))
            {
                MessageBox.Show("Debe seleccionar un tipo de cortina");
                return;
            }

            if (ddlPago.SelectedItem.Equals("Seleccione"))
            {
                MessageBox.Show("Debe seleccionar un medio de pago");
                return;
            }

            Cortina c = new Cortina();

            c.Id                 = int.Parse(txtCodigo.Text);
            c.Ubicacion          = txtUbicacion.Text;
            c.Ancho              = float.Parse(txtAncho.Text);
            c.Alto               = float.Parse(txtAlto.Text);
            c.Tela               = txtTela.Text;
            c.Posicion           = txtPosicion.Text;
            c.MetrosCuadrados    = this.metroCuadrado();
            c.Valor              = int.Parse(txtPrecio.Text);
            c.Descripcion        = txtDescripcion.Text;
            c.abono              = 0;
            c.saldo              = int.Parse(txtPrecio.Text);
            c.FechaCreacion      = c.FechaCreacion;
            c.FechaActualizacion = DateTime.Now;
            c.TipoPago           = ddlPago.SelectedItem.ToString();
            c.TipoCortina        = ddlCortina.SelectedItem.ToString();
            c.ClienteCodigo      = Properties.Settings.Default.Codigo;

            if (c.Update())
            {
                MessageBox.Show("Pedido actualizado");
            }
            else
            {
                MessageBox.Show("Pedido no actualizado");
            }
        }
Ejemplo n.º 20
0
        private Entrada getEntradaFormValues()
        {
            Entrada o = new Entrada();

            try
            {
                List <Entrada_transporte> lstEntTran = JsonConvert.DeserializeObject <List <Entrada_transporte> >(hf_entradaTransporte.Value);
                if (lstEntTran == null || lstEntTran.Count == 0)
                {
                    throw new Exception("Es necesario agregar al menos un trasporte");
                }

                //Condiciones del transporte
                List <Entrada_transporte_condicion> lstEntTranCond = JsonConvert.DeserializeObject <List <Entrada_transporte_condicion> >(hf_condiciones_transporte.Value);

                //Restos
                //o.PLstTarAlm = JsonConvert.DeserializeObject<List<Tarima_almacen>>(hf_restos.Value);
                //if (o.PLstTarAlm == null)
                //    o.PLstTarAlm = new List<Tarima_almacen>();
                //for (int iResto = 0; iResto < o.PLstTarAlm.Count; iResto++)
                //{
                //    Tarima_almacen oTAResto = o.PLstTarAlm[iResto];
                //    oTAResto.Estandar = oTAResto.Estandar + " " + (iResto + 1).ToString();
                //}

                int numero;

                //Usuario
                o.PUsuario = ((MstCasc)this.Master).getUsrLoged();

                //Bodega
                Int32.TryParse(ddlBodega.SelectedItem.Value, out numero);
                o.Id_bodega = numero;
                numero      = 0;

                //Fecha
                o.Fecha = Convert.ToDateTime(txt_fecha.Text);

                //Hora
                o.Hora = txt_hora_llegada.Text;

                //Cortina
                int.TryParse(ddlCortina.SelectedValue, out numero);
                o.Id_cortina = numero;
                numero       = 0;

                //Cliente
                o.Id_cliente = 1; //Avon 1
                numero       = 0;

                //Referencia
                o.Referencia = txt_rr.Text;

                //Mercancia
                o.Mercancia = txt_mercancia_codigo.Text;

                //Vendor
                o.Origen = hf_vendor.Value;

                //Listado de transportes de la entrada
                o.PLstEntTrans = lstEntTran;

                //Condiciones de transporte de la entrada
                o.PLstEntTransCond = lstEntTranCond;

                //Sello
                o.Sello = txt_sello.Text;

                //Talon
                o.Talon = txt_talon.Text;

                //Custodia
                int.TryParse(ddlCustodia.SelectedValue, out numero);
                o.Id_custodia = numero;
                numero        = 0;

                //Operador de la custodia
                o.Operador = txt_operador.Text;

                //Folio cita transporte
                o.Codigo = txt_folio_cita_transporte.Text;

                //Numero de pallet
                //int.TryParse(txt_no_pallet.Text, out numero);
                o.No_pallet = numero;
                numero      = 0;

                //Numero de bultos danados
                //int.TryParse(txt_no_bulto_danado.Text, out numero);
                o.No_bulto_danado = 0;
                numero            = 0;

                //Numero de bultos abiertos
                //int.TryParse(txt_no_bulto_abierto.Text, out numero);
                o.No_bulto_abierto = 0;
                numero             = 0;

                //Numero de bultos declarados
                int.TryParse(txt_no_bulto_declarado.Text, out numero);
                o.No_bulto_declarado = numero;
                numero = 0;

                //Numero de bultos recibidos
                int.TryParse(txt_no_bulto_recibido.Text, out numero);
                o.No_bulto_recibido = numero;
                numero = 0;

                //Numero de bultos recibidos
                int.TryParse(txt_pza_x_bulto.Text, out numero);
                o.No_pieza_recibida = numero * o.No_bulto_recibido;
                numero = 0;

                o.PTarAlmEstd = new Tarima_almacen_estandar();
                //Piezas por bulto se guarda en numero de cajas con cinta aduanal
                int.TryParse(txt_pza_x_bulto.Text, out numero);
                o.PTarAlmEstd.Piezasxcaja = numero;
                numero = 0;

                //Bultos por tarima se guarda en piezas declaradas
                int.TryParse(txt_bto_x_pallet.Text, out numero);
                o.PTarAlmEstd.Cajasxtarima = numero;
                numero = 0;

                //Cliente vendor
                o.PTarAlmEstd.Proveedor = o.Origen;

                //Proveedor de origen
                o.PTarAlmEstd.Id_tarima_almacen_proveedor = Convert.ToInt32(ddl_proveedor_origen.SelectedValue);

                //Piezas declaradas
                int.TryParse(txt_no_pieza_declarada.Text, out numero);
                o.No_pieza_declarada = numero;
                numero = 0;

                int piezasDeclaradas = o.No_pieza_declarada - ((o.No_bulto_declarado - o.No_bulto_recibido) * o.PTarAlmEstd.Piezasxcaja);

                o.PLstTarAlm = AlmacenCtrl.tarimaAlacenCalcTar(o.PTarAlmEstd.Cajasxtarima, o.PTarAlmEstd.Piezasxcaja, o.No_bulto_recibido, piezasDeclaradas, Convert.ToInt32(h_ubica_resto.Value));

                o.No_pieza_recibida = o.PLstTarAlm.Sum(p => p.Piezas);

                o.Hora_descarga = txt_hora_descarga.Text;

                o.No_pallet = o.PLstTarAlm.Count;

                //Vigilante
                o.Vigilante = txt_vigilante.Text.Trim();

                //Observaciones
                o.Observaciones = txt_observaciones.Text.Trim();

                //Bodega
                Bodega oB = new Bodega();
                Int32.TryParse(ddlBodega.SelectedItem.Value, out numero);
                oB.Id  = numero;
                numero = 0;
                BodegaMng oBMng = new BodegaMng();
                oBMng.O_Bodega = oB;
                oBMng.selById();
                o.PBodega = oB;

                //Cortina
                Cortina oCor = new Cortina();
                oCor.Id        = o.Id_cortina;
                oCor.Nombre    = ddlCortina.SelectedItem.Text;
                oCor.Id_bodega = o.Id_bodega;
                o.PCortina     = oCor;

                //Cliente
                o.PCliente = CatalogCtrl.Cliente_GetById(o.Id_cliente);

                //
                Cliente_mercancia oCM = new Cliente_mercancia()
                {
                    Codigo = o.Mercancia
                };
                oCM = CatalogCtrl.cliente_mercanciaFindByCode(oCM);
                o.PCliente.PClienteMercancia = oCM;

                //Custodia
                Custodia oCdia = new Custodia();
                oCdia.Id     = o.Id_custodia;
                oCdia.Nombre = ddlCustodia.SelectedItem.Text;
                o.PCustodia  = oCdia;

                o.PLstEntComp = new List <Entrada_compartida>();
                o.PLstEntDoc  = new List <Entrada_documento>();

                o.Id_tipo_carga = 2;
            }
            catch
            {
                throw;
            }

            return(o);
        }
Ejemplo n.º 21
0
        public static Asn asnGetAllById(int id_asn)
        {
            Asn o = new Asn()
            {
                Id = id_asn
            };

            try
            {
                CatalogoCtrl.catalogSelById(o);
                Cliente oC = new Cliente()
                {
                    Id = o.Id_cliente
                };
                CatalogoCtrl.catalogSelById(oC);
                o.ClienteNombre = oC.Nombre;
                if (o.Id_bodega != null)
                {
                    Bodega oB = new Bodega()
                    {
                        Id = (int)o.Id_bodega
                    };
                    CatalogoCtrl.catalogSelById(oB);
                    o.BodegaNombre = oB.Nombre;
                }
                if (o.Id_transporte != null)
                {
                    Transporte oT = new Transporte()
                    {
                        Id = (int)o.Id_transporte
                    };
                    CatalogoCtrl.catalogSelById(oT);
                    o.TransporteNombre = oT.Nombre;
                }
                if (o.Id_bodega != null)
                {
                    Bodega oB = new Bodega()
                    {
                        Id = (int)o.Id_bodega
                    };
                    CatalogoCtrl.catalogSelById(oB);
                    o.BodegaNombre = oB.Nombre;
                }
                o.PCortinaAsignada = RecepcionCtrl.cortinaGetByAsn(o.Id);
                if (o.PCortinaAsignada.Id_cortina > 0)
                {
                    Cortina oCDisp = new Cortina()
                    {
                        Id = o.PCortinaAsignada.Id_cortina
                    };
                    CatalogoCtrl.catalogSelById(oCDisp);
                    o.CortinaNombre = oCDisp.Nombre;
                }
                o.PLstPartida = ProcessCtrl.AsnPartidaLstByAsn(o.Id);
                foreach (Asn_partida itemAP in o.PLstPartida)
                {
                    itemAP.PMercancia = CatalogoCtrl.mercanciaBySkuCliente(itemAP.Sku, o.Id_cliente);
                }
                o.PLstTranSello = ProcessCtrl.AsnTranspSelloLstByAsn(o.Id);
            }
            catch
            {
                throw;
            }
            return(o);
        }
Ejemplo n.º 22
0
        private Salida getSalidaFormValues()
        {
            Salida oS = new Salida();
            int    numero;
            double doble;

            //Usuario
            oS.PUsuario = ((MstCasc)this.Master).getUsrLoged();

            //Bodega
            int.TryParse(ddlBodega.SelectedValue, out numero);
            oS.Id_bodega = numero;
            numero       = 0;

            //Fecha
            oS.Fecha = DateTime.Today;

            //Hora
            oS.Hora_salida = txt_hora_salida.Text;

            //Cortina
            int.TryParse(ddlCortina.SelectedValue, out numero);
            oS.Id_cortina = numero;
            numero        = 0;

            //Cliente
            int.TryParse(ddlCliente.SelectedValue, out numero);
            oS.Id_cliente = numero;
            numero        = 0;

            //Referencia
            if (rfvReferencia.Enabled)
            {
                oS.Referencia = txt_referencia.Text;
            }
            else
            {
                oS.Referencia = string.Empty;
            }

            //Destino
            oS.Destino = txt_destino.Text;

            //Mercancia
            oS.Mercancia = txt_mercancia.Text;

            //Linea de Transporte
            int.TryParse(ddlTransporte.SelectedValue, out numero);
            oS.Id_transporte = numero;
            numero           = 0;

            //Tipo de transporte
            int.TryParse(ddlTipo_Transporte.SelectedValue, out numero);
            oS.Id_transporte_tipo = numero;
            numero = 0;

            //Placa
            oS.Placa = txt_placa.Text;

            //Caja
            oS.Caja = txt_caja.Text;

            //Caja1
            oS.Caja1 = txt_caja_1.Text;

            //Caja2
            oS.Caja2 = txt_caja_2.Text;

            //Sello
            oS.Sello = txt_sello.Text;

            //Talon
            oS.Talon = txt_talon.Text;

            //Custodia
            int.TryParse(ddlCustodia.SelectedValue, out numero);
            oS.Id_custodia = numero;
            numero         = 0;

            //Operador de la custodia
            oS.Operador = txt_operador.Text;

            //Numero de pallet
            int.TryParse(txt_no_pallet.Text, out numero);
            oS.No_pallet = numero;
            numero       = 0;

            //Numero de bulto
            int.TryParse(txt_no_bulto.Text, out numero);
            oS.No_bulto = numero;
            numero      = 0;

            //Numero de pieza
            int.TryParse(txt_no_pieza.Text, out numero);
            oS.No_pieza = numero;
            numero      = 0;

            //Peso unitario
            double.TryParse(txt_peso_unitario.Text, out doble);
            oS.Peso_unitario = doble;
            doble            = 0;

            //Total de carga
            double.TryParse(txt_total_carga.Text, out doble);
            oS.Total_carga = doble;
            doble          = 0;

            //Es consolidada
            oS.EsCompartida = Convert.ToBoolean(hfConsolidada.Value);

            //Es parcial
            oS.Es_unica = true;
            if (!chk_tipo_salida.Checked)
            {
                Salida_parcial oSP = new Salida_parcial();
                oSP.Referencia = oS.Referencia;
                oSP.Es_ultima  = chk_ultima.Checked;
                oSP.Id_usuario = oS.PUsuario.Id;
                oS.PSalPar     = oSP;
                oS.Es_unica    = false;
            }

            //Hora carga
            oS.Hora_carga = txt_hora_carga.Text;

            //Observaciones
            oS.Observaciones = txt_observaciones.Text;

            //Documentos asociados a la salida
            oS.PLstSalDoc = VSLstSD;

            //Se obtiene la descripcion de los tipos de documento
            DocumentoMng oDocMng = new DocumentoMng();

            foreach (Salida_documento itemSD in oS.PLstSalDoc)
            {
                Documento oDoc = new Documento();
                oDoc.Id             = itemSD.Id_documento;
                oDocMng.O_Documento = oDoc;
                oDocMng.selById();
                itemSD.PDocumento = oDoc;
            }

            //Salida compartida
            oS.PLstSalComp = new List <Salida_compartida>();
            foreach (ListItem liPC in lst_pedimentos_consolidados.Items)
            {
                Salida_compartida oSC = new Salida_compartida();
                oSC.Referencia = liPC.Value;
                oSC.Id_usuario = oS.PUsuario.Id;
                oS.PLstSalComp.Add(oSC);
            }

            //Vigilante
            oS.Vigilante = ddlVigilante.SelectedItem.Text.Trim();

            //Bodega
            Bodega oB = new Bodega();

            oB.Id = Convert.ToInt32(ddlBodega.SelectedValue);
            BodegaMng oBMng = new BodegaMng();

            oBMng.O_Bodega = oB;
            oBMng.selById();
            oS.PBodega = oB;

            //Cortina
            Cortina oCor = new Cortina();

            oCor.Id        = oS.Id_cortina;
            oCor.Nombre    = ddlCortina.SelectedItem.Text;
            oCor.Id_bodega = oS.Id_bodega;
            oS.PCortina    = oCor;

            //Cliente
            oS.PCliente = CatalogCtrl.Cliente_GetById(oS.Id_cliente);

            //Transporte
            Transporte oT = new Transporte();

            oT.Id          = oS.Id_transporte;
            oT.Nombre      = ddlTransporte.SelectedItem.Text;
            oS.PTransporte = oT;

            //Transporte tipo
            Transporte_tipo oTT = new Transporte_tipo();

            oTT.Id             = oS.Id_transporte_tipo;
            oTT.Nombre         = ddlTipo_Transporte.SelectedItem.Text;
            oS.PTransporteTipo = oTT;

            //Custodia
            Custodia oCdia = new Custodia();

            oCdia.Id     = oS.Id_custodia;
            oCdia.Nombre = ddlCustodia.SelectedItem.Text;
            oS.PCustodia = oCdia;

            return(oS);
        }
Ejemplo n.º 23
0
 public ComandoCerrarCortina(Cortina cortina)
 {
     _cortina = cortina;
 }
Ejemplo n.º 24
0
        private string cortina(HttpContext context)
        {
            option = context.Request["opt"].ToString();
            Cortina o = new Cortina();

            switch (option)
            {
            case "sltById":
                if (context.Request["key"] != null)
                {
                    int.TryParse(context.Request["key"], out id);
                }
                o.Id = id;
                CatalogoCtrl.catalogSelById(o);
                response = JsonConvert.SerializeObject(o);
                break;

            case "add":
                jsonData = new StreamReader(context.Request.InputStream).ReadToEnd();
                o        = JsonConvert.DeserializeObject <Cortina>(jsonData);
                o.Id     = CatalogoCtrl.catalogAdd(o);
                response = JsonConvert.SerializeObject(o);
                break;

            case "udt":
                jsonData = new StreamReader(context.Request.InputStream).ReadToEnd();
                o        = JsonConvert.DeserializeObject <Cortina>(jsonData);
                CatalogoCtrl.catalogUdt(o);
                response = JsonConvert.SerializeObject(o);
                break;

            case "lstAll":
                List <Cortina> lst = CatalogoCtrl.catalogGetAllLst(o).Cast <Cortina>().ToList();
                if (context.Request["key"] != null)
                {
                    key = context.Request["key"].ToString();
                    lst = lst.FindAll(p => p.Id_bodega == Convert.ToInt32(key));
                }
                response = JsonConvert.SerializeObject(lst);
                break;

            case "enb":
                if (context.Request["key"] != null)
                {
                    int.TryParse(context.Request["key"], out id);
                }
                o.Id = id;
                CatalogoCtrl.catalogEnabled(o);
                o.IsActive = true;
                response   = JsonConvert.SerializeObject(o);
                break;

            case "dsb":
                if (context.Request["key"] != null)
                {
                    int.TryParse(context.Request["key"], out id);
                }
                o.Id = id;
                CatalogoCtrl.catalogDisabled(o);
                o.IsActive = false;
                response   = JsonConvert.SerializeObject(o);
                break;

            default:
                break;
            }
            return(response);
        }
Ejemplo n.º 25
0
 public ComandoAbrirCortina(Cortina cortina)
 {
     _cortina = cortina;
 }
Ejemplo n.º 26
0
        private Salida addSalidaValuesCompartida()
        {
            Salida oS = new Salida();

            oS.Folio = hfFolio.Value.ToString();

            try
            {
                oS = getSalidaCompartida(oS.Folio);
                setFormValuesCompartida(oS);

                SalidaCtrl.AddSalidaCompartida(oS);

                oS.PUsuario = ((MstCasc)this.Master).getUsrLoged();

                DocumentoMng oDocMng = new DocumentoMng();
                foreach (Salida_documento itemSD in VSLstSD)
                {
                    Documento oDoc = new Documento();
                    oDoc.Id             = itemSD.Id_documento;
                    oDocMng.O_Documento = oDoc;
                    oDocMng.selById();
                    itemSD.PDocumento = oDoc;
                }
                oS.PLstSalDoc = VSLstSD;

                Bodega oB = new Bodega();
                oB.Id = oS.Id_bodega;
                BodegaMng oBMng = new BodegaMng();
                oBMng.O_Bodega = oB;
                oBMng.selById();
                oS.PBodega = oB;

                Cortina oCor = new Cortina();
                oCor.Id        = oS.Id_cortina;
                oCor.Nombre    = ddlCortina.SelectedItem.Text;
                oCor.Id_bodega = oS.Id_bodega;
                oS.PCortina    = oCor;

                Cliente oC = CatalogCtrl.Cliente_GetById(oS.Id_cliente);
                oS.PCliente = oC;

                Cuenta_tipoMng oCTMng = new Cuenta_tipoMng();
                Cuenta_tipo    oCT    = new Cuenta_tipo();
                oCT.Id = oC.Id_cuenta_tipo;
                oCTMng.O_Cuenta_tipo = oCT;
                oCTMng.selById();
                oS.PCliente.cuenta_tipo = oCT.Nombre;

                Transporte oT = new Transporte();
                oT.Id          = oS.Id_transporte;
                oT.Nombre      = ddlTransporte.SelectedItem.Text;
                oS.PTransporte = oT;

                Transporte_tipo oTT = new Transporte_tipo();
                oTT.Id             = oS.Id_transporte_tipo;
                oTT.Nombre         = ddlTipo_Transporte.SelectedItem.Text;
                oS.PTransporteTipo = oTT;

                Custodia oCdia = new Custodia();
                oCdia.Id     = oS.Id_custodia;
                oCdia.Nombre = ddlCustodia.SelectedItem.Text;
                oS.PCustodia = oCdia;
            }
            catch
            {
                throw;
            }
            return(oS);
        }