Exemple #1
0
        private void Guardar()
        {
            try
            {
                Sesion                 sesion        = (Sesion)Session["Sesion" + Session.SessionID];
                CN_CatAlmacen          cn_catalmacen = new CN_CatAlmacen();
                CapaEntidad.CatAlmacen alm           = new CapaEntidad.CatAlmacen();
                int Verificador = 0;

                LlenarObjetoAlmacen(ref alm);

                if (this.HdId_Alm.Value == "")
                {
                    cn_catalmacen.CatAlmacen_Insertar(alm, sesion, ref Verificador);

                    if (Verificador == -1)
                    {
                        Alerta("Los datos se guardaron correctamente");
                        Nuevo();
                    }
                    else if (Verificador == -2)
                    {
                        Alerta("Ya existe un almacén con la misma clave");
                    }
                    else
                    {
                        Alerta("Error inesperado al guardar almacén");
                    }
                }
                else
                {
                    cn_catalmacen.CatAlmacen_Modificar(alm, sesion, ref Verificador);


                    if (Verificador == -1)
                    {
                        Alerta("Los datos se modificaron correctamente");
                        Nuevo();
                    }
                    else
                    {
                        Alerta("Error inesperado al guardar almacén");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        private List <CapaEntidad.CatAlmacen> GetList()
        {
            try
            {
                Sesion        sesion               = (Sesion)Session["Sesion" + Session.SessionID];
                CN_CatAlmacen cn_catalmacen        = new CN_CatAlmacen();
                List <CapaEntidad.CatAlmacen> list = new List <CapaEntidad.CatAlmacen>();

                cn_catalmacen.CatAlmacen_ConsultaLista(ref list, sesion);

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
        private void Buscar()
        {
            try
            {
                Sesion                 sesion        = (Sesion)Session["Sesion" + Session.SessionID];
                CN_CatAlmacen          cn_catalmacen = new CN_CatAlmacen();
                CapaEntidad.CatAlmacen alm           = new CapaEntidad.CatAlmacen();
                if (this.TxtAlm_Clave.Text == "")
                {
                    this.RfvTxtAlm_Clave.IsValid = false;
                }
                else
                {
                    int Alm_Clave = int.Parse(this.TxtAlm_Clave.Text);

                    cn_catalmacen.CatAlmacen_Consulta(ref alm, Alm_Clave, sesion);

                    if (alm.Id_Alm != 0)
                    {
                        this.HdId_Alm.Value             = alm.Id_Alm.ToString();
                        this.TxtAlm_Nombre.Text         = alm.Alm_Nombre;
                        this.TxtAlm_Cuenta.Text         = alm.Alm_CuentaStr.Trim();
                        this.TxtAlm_SubCuenta.Text      = alm.Alm_SubcuentaStr.Trim();
                        this.TxtAlm_CtaCenCosto.Text    = alm.Alm_CtaCenCosto.Trim();
                        this.TxtAlm_SubCtaCenCosto.Text = alm.Alm_SubCtaCenCosto.Trim();
                        this.ChkAlm_Activo.Checked      = alm.Alm_Activo;
                        this.TxtAlm_Clave.Enabled       = false;
                    }
                    else
                    {
                        Alerta("No existe ningun almacén con la clave proporcionada");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }