Exemplo n.º 1
0
        public string Post(Bodegas Bodega)
        {
            try
            {
                DataTable table = new DataTable();
                string    query = @"
                                insert into Bodegas (Nombre,Direccion,Origen) 
                                    Values('" + Bodega.Nombre + "' , '"
                                  + Bodega.Direccion + "' , '" + Bodega.Origen + "')";

                using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString))
                    using (var cmd = new SqlCommand(query, con))
                        using (var da = new SqlDataAdapter(cmd))
                        {
                            cmd.CommandType = CommandType.Text;
                            da.Fill(table);
                        }



                return("Bodega Agregada");
            }
            catch (Exception exe)
            {
                return("Se produjo un error" + exe);
            }
        }
Exemplo n.º 2
0
    public static Bodegas Get(System.Int32 bodegaID)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;
        Bodegas   instance;


        instance = new Bodegas();

        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspBodegas_SELECT";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, bodegaID);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0)
        {
            throw new ApplicationException("Could not get Bodegas ID:" + bodegaID.ToString() + " from Database.");
        }
        // Return results.
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
Exemplo n.º 3
0
        private void UiVistaBodegas_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
        {
            var edit = ActiveControl as DevExpress.XtraEditors.SearchLookUpEdit;

            if (edit == null)
            {
                return;
            }

            if (e.ControllerRow >= 0)
            {
                var bodega = (Bodega)UiVistaBodegas.GetRow(e.ControllerRow);
                bodega.IS_SELECTED = (e.Action == CollectionChangeAction.Add);
            }
            else
            {
                if (UsuarioSeleccionoListaBodegasCompleta)
                {
                    for (var i = 0; i < UiVistaBodegas.RowCount; i++)
                    {
                        var bodega = (Bodega)UiVistaBodegas.GetRow(i);
                        if (bodega == null)
                        {
                            continue;
                        }
                        bodega.IS_SELECTED = (UiVistaBodegas.SelectedRowsCount != 0);
                    }
                    UsuarioSeleccionoListaBodegasCompleta = false;
                }
            }



            edit.Text = string.Join(",", Bodegas.Where(bodega => bodega.IS_SELECTED).Select(bodega => bodega.NAME));
        }
Exemplo n.º 4
0
        public void deleteVenta(string codigo, int cant, int caja, int IdUsuario)
        {
            int cantidad = 0, existencia = 0;
            var ventatemp = TempoVentas.Where(t => t.Codigo.Equals(codigo) && t.Caja.Equals(caja) && t.IdUsuario.Equals(IdUsuario)).ToList();

            cantidad = ventatemp[0].Cantidad;

            var bodega = Bodegas.Where(b => b.Codigo.Equals(codigo)).ToList();

            existencia = bodega[0].Existencia;

            if (cant == 1)
            {
                existencia += cantidad;
                TempoVentas.Where(p => p.IdTempo == ventatemp[0].IdTempo && p.Caja.Equals(caja) && p.IdUsuario.Equals(IdUsuario)).Delete();
            }
            else
            {
                existencia++;
                saveVentasTempo(codigo, 1, caja, IdUsuario);
            }
            Bodegas.Where(b => b.Id.Equals(bodega[0].Id))
            .Set(b => b.Codigo, bodega[0].Codigo)
            .Set(b => b.Existencia, existencia)
            .Set(b => b.Fecha, bodega[0].Fecha)
            .Set(b => b.IdProducto, bodega[0].IdProducto)
            .Update();
        }
Exemplo n.º 5
0
        public string Put(Bodegas Bodega)
        {
            try
            {
                DataTable table = new DataTable();

                string query = @"update Bodegas set 
                               
                               Nombre = '" + Bodega.Nombre + @"',
                               Direccion = '" + Bodega.Direccion + @"',
                               Origen = '" + Bodega.Origen + "' where  IdBodega = " + Bodega.IdBodega + @"";

                using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString))
                    using (var cmd = new SqlCommand(query, con))
                        using (var da = new SqlDataAdapter(cmd))
                        {
                            cmd.CommandType = CommandType.Text;
                            da.Fill(table);
                        }

                return("Actualizacion Exitosa");
            }
            catch (Exception exe)
            {
                return("Se produjo un error" + exe);
            }
        }
Exemplo n.º 6
0
 private void UiListaBodega_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
 {
     if (Bodegas == null)
     {
         return;
     }
     e.DisplayText = string.Join(",",
                                 Bodegas.Where(bodega => bodega.IS_SELECTED).Select(bodega => bodega.NAME));
 }
Exemplo n.º 7
0
        public void saveProducto(String producto, int cantidad, String precio, String departamento, String categoria,
                                 String accion, int IdProducto)
        {
            int     count1 = 0, cant, count2 = 0;
            Decimal precio1 = Convert.ToDecimal(precio);
            String  precio2 = "$" + String.Format("{0: #,###,###,##0.00####}", precio1);

            switch (accion)
            {
            case "Insert":

                var product1 = Producto.Where(p => p.Producto.Equals(producto) && p.Precio.Equals(precio2.Replace(" ", ""))).ToList();
                if (0 == product1.Count)
                {
                    Producto.Value(p => p.Codigo, codeBarra)
                    .Value(p => p.Producto, producto)
                    .Value(p => p.Precio, precio2.Replace(" ", ""))
                    .Value(p => p.Descuento, "%0.00")
                    .Value(p => p.Departamento, departamento)
                    .Value(p => p.Categoria, categoria)
                    .Insert();
                }
                var bodega = Bodegas.Where(b => b.Codigo.Equals(codeBarra)).ToList();

                if (0 < bodega.Count())
                {
                    cant = cantidad + bodega[0].Existencia;
                    Bodegas.Where(b => b.Id.Equals(bodega[0].Id))
                    .Set(b => b.IdProducto, bodega[0].IdProducto)
                    .Set(b => b.Codigo, codeBarra)
                    .Set(b => b.Existencia, cant)
                    .Set(b => b.Dia, Convert.ToInt16(dia))
                    .Set(b => b.Mes, mes)
                    .Set(b => b.Year, year)
                    .Set(b => b.Fecha, fecha)
                    .Update();
                }
                deleteProductos(IdProducto);
                break;

            case "Update":
                var product = Producto.Where(p => p.IdProducto.Equals(IdProducto)).ToList();
                Producto.Where(p => p.IdProducto.Equals(IdProducto))
                .Set(p => p.Codigo, codeBarra)
                .Set(p => p.Producto, producto)
                .Set(p => p.Precio, precio2.Replace(" ", ""))
                .Set(p => p.Descuento, product[0].Descuento)
                .Set(p => p.Departamento, departamento)
                .Set(p => p.Categoria, categoria)
                .Update();
                break;
            }
        }
Exemplo n.º 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (Session["ID"] == null || !roles.tienePermiso(1, int.Parse(Session["ID"].ToString())))
            {
                return(RedirectToAction("Index", "Home"));
            }
            Bodegas bodegas = db.bodegas.Find(id);

            db.bodegas.Remove(bodegas);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 9
0
        public ActionResult DeleteConfirmed(int id)
        {
            Bodegas   bodegas   = db.Bodegas.Find(id);
            UsuarioTO usuarioTO = Cache.DiccionarioUsuariosLogueados[User.Identity.Name];

            bodegas.id_usuario_eliminacion = usuarioTO.usuario.id_usuario;
            bodegas.fecha_eliminacion      = DateTime.Now;
            bodegas.eliminado       = true;
            bodegas.activo          = false;
            db.Entry(bodegas).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 10
0
        public void EliminarBodega(int idBodega)
        {
            try
            {
                Bodegas bodega = _context.Bodegas.Where(i => i.IdBodega == idBodega).FirstOrDefault();
                bodega.Estado = 0;

                _context.SaveChanges();
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 11
0
 public ActionResult Edit([Bind(Include = "BodegasID,nombre,ubicacion")] Bodegas bodegas)
 {
     if (Session["ID"] == null || !roles.tienePermiso(1, int.Parse(Session["ID"].ToString())))
     {
         return(RedirectToAction("Index", "Home"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(bodegas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bodegas));
 }
Exemplo n.º 12
0
        // GET: Inventario/Bodegas/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Bodegas bodegas = db.Bodegas.Find(id);

            if (bodegas == null)
            {
                return(HttpNotFound());
            }
            return(View(bodegas));
        }
Exemplo n.º 13
0
        public void ActualizarBodega(Bodega model)
        {
            try
            {
                Bodegas bodega = _context.Bodegas.Where(i => i.IdBodega == model.IdBodega).FirstOrDefault();
                bodega.Nombre      = model.Nombre;
                bodega.Descripcion = model.Descripcion;

                _context.SaveChanges();
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 14
0
        protected void btnguardar_Click(object sender, ImageClickEventArgs e)
        {
            if (this.IsValid)
            {
                bod = new Bodegas();
                bod.Codigo = long.Parse(txtcodigo.Text.Trim());
                bod.Descripcion = txtdescripcion.Text.Trim();

                bodDLL.Guardar(bod);
                LLenarGrilla();
                txtcodigo.Text = "";
                txtdescripcion.Text = "";
                txtcodigo.Focus();
            }
        }
Exemplo n.º 15
0
    public static Bodegas[] Search(System.Int32?bodegaID, System.String bodega)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspBodegas_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, bodegaID, bodega);

        ds = db.ExecuteDataSet(dbCommand);
        ds.Tables[0].TableName = TABLE_NAME;
        return(Bodegas.MapFrom(ds));
    }
 private void UiListaBodega_Properties_Closed(object sender, DevExpress.XtraEditors.Controls.ClosedEventArgs e)
 {
     try
     {
         if (!Bodegas.ToList().Exists(b => b.IS_SELECTED))
         {
             Materiales = new List <Material>();
             return;
         }
         UsuarioDeseaObtenerMateriales?.Invoke(null, null);
     }
     catch (Exception ex)
     {
         InteraccionConUsuarioServicio.Mensaje(ex.Message);
     }
 }
Exemplo n.º 17
0
        // GET: Inventario/Bodegas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Bodegas bodegas = db.Bodegas.Find(id);

            if (bodegas == null)
            {
                return(HttpNotFound());
            }
            ViewBag.id_usuario_creacion     = new SelectList(db.Usuarios, "id_usuario", "email", bodegas.id_usuario_creacion);
            ViewBag.id_usuario_eliminacion  = new SelectList(db.Usuarios, "id_usuario", "email", bodegas.id_usuario_eliminacion);
            ViewBag.id_usuario_modificacion = new SelectList(db.Usuarios, "id_usuario", "email", bodegas.id_usuario_modificacion);
            return(View(bodegas));
        }
Exemplo n.º 18
0
 private void UiBotonAceptarFiltro_Click(object sender, EventArgs e)
 {
     if (Bodegas == null)
     {
         return;
     }
     UsuarioDeseaObtenerSolicitudesDeTrasladoPorBodegaEstadoYFecha?.Invoke(sender, new ReporteDeSolicitudDeTrasladoArgumento
     {
         FechaInicial = UiFechaInicial.DateTime
         ,
         FechaFinal = UiFechaFinal.DateTime
         ,
         Estado = UiSwitchAbiertas.IsOn ? Enums.GetStringValue(EstadoSolicitudDeTraslado.OPEN) : Enums.GetStringValue(EstadoSolicitudDeTraslado.CLOSED)
         ,
         Bodegas = string.Join("|", Bodegas.Where(bodega => bodega.IS_SELECTED).Select(bodega => bodega.WAREHOUSE_ID))
     });
 }
Exemplo n.º 19
0
        public void GuardarBodega(Bodega model)
        {
            try
            {
                var bodega = new Bodegas();

                bodega.Nombre      = model.Nombre;
                bodega.Descripcion = model.Descripcion;
                bodega.Estado      = 1;

                _context.Bodegas.Add(bodega);
                _context.SaveChanges();
            }
            catch (System.Exception e)
            {
                throw e;
            }
        }
        private string ObtenerTextoAMostrarListaBodegas()
        {
            if (Bodegas == null)
            {
                return("");
            }
            var cadena = new StringBuilder();

            foreach (var documento in Bodegas.Where(doc => doc.IS_SELECTED))
            {
                if (cadena.Length > 0)
                {
                    cadena.Append(",");
                }
                cadena.Append(documento.WAREHOUSE_ID);
            }
            return(cadena.ToString());
        }
        private string PrepararBodegas()
        {
            if (Bodegas == null)
            {
                return(null);
            }
            var cadena = new StringBuilder();

            foreach (var objeto in Bodegas.Where(doc => doc.IS_SELECTED))
            {
                if (cadena.Length > 0)
                {
                    cadena.Append("|");
                }
                cadena.Append(objeto.WAREHOUSE_ID);
            }
            return(cadena.ToString());
        }
Exemplo n.º 22
0
        // GET: Bodegas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["ID"] == null || !roles.tienePermiso(1, int.Parse(Session["ID"].ToString())))
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Bodegas bodegas = db.bodegas.Find(id);

            if (bodegas == null)
            {
                return(HttpNotFound());
            }
            return(View(bodegas));
        }
Exemplo n.º 23
0
        public ActionResult Create([Bind(Include = "id_bodega,descripcion,activo,eliminado,id_usuario_creacion,id_usuario_modificacion,id_usuario_eliminacion,fecha_creacion,fecha_modificacion,fecha_eliminacion")] Bodegas bodegas)
        {
            if (ModelState.IsValid)
            {
                UsuarioTO usuarioTO = Cache.DiccionarioUsuariosLogueados[User.Identity.Name];
                bodegas.id_usuario_creacion = usuarioTO.usuario.id_usuario;
                bodegas.fecha_creacion      = DateTime.Now;
                bodegas.activo    = true;
                bodegas.eliminado = false;
                db.Bodegas.Add(bodegas);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.id_usuario_creacion     = new SelectList(db.Usuarios, "id_usuario", "email", bodegas.id_usuario_creacion);
            ViewBag.id_usuario_eliminacion  = new SelectList(db.Usuarios, "id_usuario", "email", bodegas.id_usuario_eliminacion);
            ViewBag.id_usuario_modificacion = new SelectList(db.Usuarios, "id_usuario", "email", bodegas.id_usuario_modificacion);
            return(View(bodegas));
        }
Exemplo n.º 24
0
    public static Bodegas[] MapFrom(DataSet ds)
    {
        List <Bodegas> objects;


        // Initialise Collection.
        objects = new List <Bodegas>();

        // Validation.
        if (ds == null)
        {
            throw new ApplicationException("Cannot map to dataset null.");
        }
        else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
        {
            return(objects.ToArray());
        }

        if (ds.Tables[TABLE_NAME] == null)
        {
            throw new ApplicationException("Cannot find table [dbo].[Bodegas] in DataSet.");
        }

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        {
            throw new ApplicationException("Table [dbo].[Bodegas] is empty.");
        }

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            Bodegas instance = new Bodegas();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return(objects.ToArray());
    }
 private void UiVistaBodegas_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
 {
     try
     {
         if (Bodegas == null)
         {
             return;
         }
         if (e.ControllerRow < 0)
         {
             Bodegas.ForEach(b => b.IS_SELECTED = !_todasLasBodegasSeleccionadas);
             _todasLasBodegasSeleccionadas      = !_todasLasBodegasSeleccionadas;
         }
         else
         {
             Bodegas[e.ControllerRow].IS_SELECTED = !Bodegas[e.ControllerRow].IS_SELECTED;
         }
     }
     catch (Exception ex)
     {
         InteraccionConUsuarioServicio.MensajeErrorDialogo(ex.Message);
     }
 }
Exemplo n.º 26
0
        private void UiBarButtonCerrarSolicitudes_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (SolicitudesDeTraslado == null)
            {
                return;
            }
            UsuarioDeseaCerrarSolicitudesDeTraslado?.Invoke(sender, new ReporteDeSolicitudDeTrasladoArgumento
            {
                IdsSolicitudesDeTraslado = string.Join("|", SolicitudesDeTraslado.Where(solicitud => solicitud.IS_SELECTED).Select(solicitud => solicitud.TRANSFER_REQUEST_ID))
                ,
                MaterialesSolicitudDeTraslado = string.Join("|", SolicitudesDeTraslado.Where(solicitud => solicitud.IS_SELECTED).Select(solicitud => solicitud.MATERIAL_ID))
            });

            UsuarioDeseaObtenerSolicitudesDeTrasladoPorBodegaEstadoYFecha?.Invoke(sender, new ReporteDeSolicitudDeTrasladoArgumento
            {
                FechaInicial = UiFechaInicial.DateTime
                ,
                FechaFinal = UiFechaFinal.DateTime
                ,
                Estado = UiSwitchAbiertas.IsOn ? Enums.GetStringValue(EstadoSolicitudDeTraslado.OPEN) : Enums.GetStringValue(EstadoSolicitudDeTraslado.CLOSED)
                ,
                Bodegas = string.Join("|", Bodegas.Where(bodega => bodega.IS_SELECTED).Select(bodega => bodega.WAREHOUSE_ID))
            });
        }
Exemplo n.º 27
0
        public void saveVentasTempo(string codigo, int funcion, int caja, int IdUsuario)
        {
            string  importe, precios;
            int     idTempo, cantidad = 1, existencia;
            Decimal descuento, precio, importes;

            var ventatemp = TempoVentas.Where(t => t.Codigo.Equals(codigo) && t.Caja.Equals(caja) &&
                                              t.IdUsuario.Equals(IdUsuario)).ToList();
            var product = Producto.Where(p => p.Codigo.Equals(codigo)).ToList();

            descuento = Convert.ToDecimal(product[0].Descuento.Replace("%", ""));
            precio    = Convert.ToDecimal(product[0].Precio.Replace("$", ""));
            descuento = descuento / 100;
            descuento = precio * descuento;
            precio    = precio - descuento;
            precios   = String.Format("${0:#,###,###,##0.00####}", precio);

            if (0 < ventatemp.Count())
            {
                cantidad = ventatemp[0].Cantidad;
                if (funcion == 0)
                {
                    cantidad += 1;
                }

                else
                {
                    cantidad--;
                }
                importes = precio * cantidad;
                importe  = String.Format("${0:#,###,###,##0.00####}", importes);
                TempoVentas.Where(b => b.IdTempo.Equals(ventatemp[0].IdTempo) && b.Caja.Equals(caja) && b.IdUsuario.Equals(IdUsuario))
                .Set(b => b.Codigo, product[0].Codigo)
                .Set(b => b.Descripcion, product[0].Producto)
                .Set(b => b.Precio, product[0].Precio)
                .Set(b => b.Cantidad, cantidad)
                .Set(b => b.Importe, importe)
                .Set(b => b.Caja, caja)
                .Set(b => b.IdUsuario, IdUsuario)
                .Update();
            }
            else
            {
                TempoVentas.Value(b => b.Codigo, product[0].Codigo)
                .Value(b => b.Descripcion, product[0].Producto)
                .Value(b => b.Precio, precios)
                .Value(b => b.Cantidad, 1)
                .Value(b => b.Importe, precios)
                .Value(b => b.Caja, caja)
                .Value(b => b.IdUsuario, IdUsuario)
                .Insert();
            }

            var bodega = Bodegas.Where(b => b.Codigo.Equals(codigo)).ToList();

            existencia = bodega[0].Existencia;

            if (existencia == 1)
            {
                Bodegas.Where(b => b.Id.Equals(bodega[0].Id)).Delete();
            }
            else
            {
                existencia--;

                Bodegas.Where(b => b.Id.Equals(bodega[0].Id))
                .Set(b => b.Codigo, bodega[0].Codigo)
                .Set(b => b.Existencia, existencia)
                .Set(b => b.Fecha, bodega[0].Fecha)
                .Set(b => b.IdProducto, bodega[0].IdProducto)
                .Update();
            }
        }
Exemplo n.º 28
0
 public List <Bodega> searchBodega(string codigo)
 {
     return(Bodegas.Where(b => b.Codigo.Equals(codigo)).ToList());
 }
Exemplo n.º 29
0
 private void BuscarBodega(string pCodigo)
 {
     bod = new Bodegas();
     bod = bodDLL.BuscarBodega(pCodigo);
     txtcodigo.Text = bod.Codigo.ToString();
     txtdescripcion.Text = bod.Descripcion;
 }
 private void UiSearchLookUpBodegas_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
 {
     e.DisplayText = Bodegas == null ? string.Empty : string.Join(",", Bodegas.Where(b => b.IS_SELECTED).Select(b => b.NAME));
 }
 private string ObtenerBodegasSeleccionadas()
 {
     return(Bodegas == null ? string.Empty : string.Join("|", Bodegas.Where(b => b.IS_SELECTED).Select(b => b.WAREHOUSE_ID)));
 }
        public HttpResponseMessage ValidaExisteEmpresariaNombre(ClienteInfo ObjClienteInfoNit)
        {
            SessionEmpresariaInfo ObjSessionEmpresariaInfo = new SessionEmpresariaInfo();

            Cliente     objCliente     = new Cliente("conexion");
            ClienteInfo objClienteInfo = new ClienteInfo();



            objClienteInfo = objCliente.ListClienteSVDNxNitxVendedorxLider(ObjClienteInfoNit.Nit, ObjClienteInfoNit.Vendedor, ObjClienteInfoNit.Lider);

            if (objClienteInfo != null)
            {
                //MRG: Variables que se utilizan al momento de hacer un pedido.
                ObjSessionEmpresariaInfo.DocumentoEmpresaria      = ObjClienteInfoNit.Nit;
                ObjSessionEmpresariaInfo.NombreEmpresariaCompleto = ComponerNombreCompleto(objClienteInfo);
                ObjSessionEmpresariaInfo.TipoPedidoMinimo         = objClienteInfo.TipoPedidoMinimo.ToString();
                ObjSessionEmpresariaInfo.CodCiudadCliente         = objClienteInfo.CodCiudad;
                ObjSessionEmpresariaInfo.PremioBienvenida         = objClienteInfo.Premio.ToString();
                ObjSessionEmpresariaInfo.TipoEnvioCliente         = objClienteInfo.TipoEnvio.ToString();
                ObjSessionEmpresariaInfo.Empresaria_Lider         = objClienteInfo.Lider; //GAVL Lider para Fletes por Lider
                ObjSessionEmpresariaInfo.IdZona              = objClienteInfo.Zona;
                ObjSessionEmpresariaInfo.Email               = objClienteInfo.Email;
                ObjSessionEmpresariaInfo.Vendedor            = objClienteInfo.Vendedor;
                ObjSessionEmpresariaInfo.Clasificacion       = objClienteInfo.Clasificacion;
                ObjSessionEmpresariaInfo.Telefono1           = objClienteInfo.Telefono1;
                ObjSessionEmpresariaInfo.Celular1            = objClienteInfo.Celular1;
                ObjSessionEmpresariaInfo.CodigoRegional      = objClienteInfo.CodigoRegional.ToString();
                ObjSessionEmpresariaInfo.Usuario             = objClienteInfo.Usuario;
                ObjSessionEmpresariaInfo.Whatsapp            = objClienteInfo.Whatsapp;
                ObjSessionEmpresariaInfo.TipoCliente         = objClienteInfo.TipoCliente;
                ObjSessionEmpresariaInfo.TallaPrendaSuperior = objClienteInfo.TallaPrendaSuperior;
                ObjSessionEmpresariaInfo.TallaPrendaInferior = objClienteInfo.TallaPrendaInferior;
                ObjSessionEmpresariaInfo.TallaCalzado        = objClienteInfo.TallaCalzado;


                ObjSessionEmpresariaInfo.GrupoDescuento = objClienteInfo.GrupoDescuentoCliente;

                //..........................................................................
                //Bodegas

                Bodegas     objBodegas     = new Bodegas("conexion");
                BodegasInfo objBodegasInfo = new BodegasInfo();

                ObjSessionEmpresariaInfo.Bodegas = new BodegasInfo();
                objBodegasInfo = objBodegas.ListxBodega(objClienteInfo.Bodega);

                if (objBodegasInfo != null)
                {
                    ObjSessionEmpresariaInfo.Bodegas.Bodega   = objBodegasInfo.Bodega;
                    ObjSessionEmpresariaInfo.Bodegas.Nombre   = objBodegasInfo.Nombre;
                    ObjSessionEmpresariaInfo.BodegaEmpresaria = objBodegasInfo.Bodega + "- " + objBodegasInfo.Nombre;
                }
                else
                {
                    ObjSessionEmpresariaInfo.Bodegas.Bodega   = "";
                    ObjSessionEmpresariaInfo.Bodegas.Nombre   = "";
                    ObjSessionEmpresariaInfo.BodegaEmpresaria = "";
                }
                //..........................................................................


                //Se obtiene la campaña de la fecha actual.
                Campana     ObjCampana     = new Campana("conexion");
                CampanaInfo ObjCampanaInfo = new CampanaInfo();
                //ObjCampanaInfo = ObjCampana.ListxGetDate();


                ObjCampanaInfo = ObjCampana.ListxGetDate();
                //Se valida que exista una campaña activa.
                if (ObjCampanaInfo != null)
                {
                    ObjSessionEmpresariaInfo.Campana  = ObjCampanaInfo.Campana.Trim();
                    ObjSessionEmpresariaInfo.Catalogo = ObjCampanaInfo.Catalogo.Trim().ToUpper();
                }
                else
                {
                    ObjSessionEmpresariaInfo.Error               = new Error();
                    ObjSessionEmpresariaInfo.Error.Id            = -1;
                    ObjSessionEmpresariaInfo.Error.Descripcion   = "La campaña se encuentra cerrada o no existe.";
                    ObjSessionEmpresariaInfo.DocumentoEmpresaria = ObjClienteInfoNit.Nit;
                }


                //........................................................................................
                //Path de imagenes

                ParametrosInfo ObjParametrosInfo = new ParametrosInfo();
                Parametros     ObjParametros     = new Parametros("conexion");
                ObjParametrosInfo = ObjParametros.ListxId((int)ParametrosEnum.CarpetaImagenesSAVED);

                string CarpetaImagenes = "";

                if (ObjParametrosInfo != null)
                {
                    CarpetaImagenes = ObjParametrosInfo.Valor;
                }
                else
                {
                    CarpetaImagenes = "../../../../assets/imagesAplicacion/";
                }

                ObjSessionEmpresariaInfo.CarpetaImagenes = CarpetaImagenes;
                //........................................................................................
                //Consulta los puntos efectivos de una empresaria.
                ObjSessionEmpresariaInfo.PuntosEmpresaria = ConsultarPuntosEfectivosEmpresaria(ObjClienteInfoNit.Nit);

                PuntosBo bo = new PuntosBo("conexion");
                ObjSessionEmpresariaInfo.ValorPuntos = bo.getvalorPuntoEnSoles();

                //[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][
                //Se valida si la ciudad del cliente es exento de iva.
                Ciudad     ObjCiudad     = new Ciudad("conexion");
                CiudadInfo ObjCiudadInfo = new CiudadInfo();

                ObjCiudadInfo = ObjCiudad.ListCiudadxId(objClienteInfo.CodCiudad);

                if (ObjCiudadInfo != null)
                {
                    if (ObjCiudadInfo.ExcluidoIVA == 1)
                    {
                        ObjSessionEmpresariaInfo.ExcentoIVA = "true";
                    }
                    else
                    {
                        ObjSessionEmpresariaInfo.ExcentoIVA = "false";
                    }
                }
                //[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][
            }
            else
            {
                ObjSessionEmpresariaInfo.Error               = new Error();
                ObjSessionEmpresariaInfo.Error.Id            = -1;
                ObjSessionEmpresariaInfo.Error.Descripcion   = "No existe la empresaria: " + ObjClienteInfoNit.Nit + ". Por favor realice el registro.";
                ObjSessionEmpresariaInfo.DocumentoEmpresaria = ObjClienteInfoNit.Nit;
            }

            var response = Request.CreateResponse <SessionEmpresariaInfo>(HttpStatusCode.OK, ObjSessionEmpresariaInfo);

            response.Headers.Add("Token", "");
            response.Headers.Add("TokenExpiry", ConfigurationManager.AppSettings["AuthTokenExpiry"]);
            response.Headers.Add("Access-Control-Expose-Headers", "Token,TokenExpiry");

            return(response);
        }