/// <summary>
        /// Lista de Forma Pago
        /// </summary>
        /// <returns>Colección de Forma Pago</returns>
        public CmpObservableCollection <ESGR_FormaPago> GetCollectionFormaPago()
        {
            try
            {
                var objCmpSql           = new CmpSql(SGRVariables.ConectionString);
                var CollectionFormaPago = new CmpObservableCollection <ESGR_FormaPago>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetFormaPago");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, SGRVariables.ESGR_Usuario.ESGR_Empresa.IdEmpresa);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionFormaPago.Add(new ESGR_FormaPago
                    {
                        IdFormaPago  = (dt.Rows[x]["IdFormaPago"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdFormaPago"]) : Convert.ToInt16(0),
                        FormaPago    = (dt.Rows[x]["FormaPago"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["FormaPago"]) : string.Empty,
                        ESGR_Empresa = new ESGR_Empresa()
                        {
                            IdEmpresa = (dt.Rows[x]["IdEmpresa"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdEmpresa"]) : Convert.ToInt16(0),
                        },
                    });
                }

                return(CollectionFormaPago);
            }

            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Lista de Cierre Caja
        /// </summary>
        /// <returns>Colección de Cierre Caja</returns>
        public CmpObservableCollection <ESGR_CierreCaja> GetCollectionCierreCaja()
        {
            try
            {
                var objCmpSql            = new CmpSql(SGRVariables.ConectionString);
                var CollectionCierreCaja = new CmpObservableCollection <ESGR_CierreCaja>();

                objCmpSql.CommandProcedure("spSGR_GET_CierreCaja");
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionCierreCaja.Add(new ESGR_CierreCaja
                    {
                        IdCaja          = (dt.Rows[x]["IdCaja"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdCaja"]) : Convert.ToInt16(0),
                        Ajuste_SOL      = (dt.Rows[x]["Ajuste_SOL"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Ajuste_SOL"]) : Convert.ToDecimal(0),
                        Ajuste_USD      = (dt.Rows[x]["Ajuste_USD"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Ajuste_USD"]) : Convert.ToDecimal(0),
                        SaldoF_SOL      = (dt.Rows[x]["SaldoF_SOL"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["SaldoF_SOL"]) : Convert.ToDecimal(0),
                        SaldoF_USD      = (dt.Rows[x]["SaldoF_USD"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["SaldoF_USD"]) : Convert.ToDecimal(0),
                        FechaCierre     = (dt.Rows[x]["FechaCierre"] != DBNull.Value) ? Convert.ToDateTime(dt.Rows[x]["FechaCierre"]) : DateTime.Now,
                        IdUsuarioCierre = (dt.Rows[x]["IdUsuarioCierre"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdUsuarioCierre"]) : Convert.ToInt16(0),
                        IdUsuarioSuper  = (dt.Rows[x]["IdUsuarioSuper"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdUsuarioSuper"]) : Convert.ToInt16(0),
                    });
                }

                return(CollectionCierreCaja);
            }

            catch (Exception)
            {
                throw;
            }
        }
 public CmpObservableCollection <ESGR_MovimientoCajaDetalle> CollectionESGR_MovimientoCajaDetalle(ESGR_MovimientoCaja ESGR_MovimientoCaja)
 {
     try
     {
         var CollectionESGR_MovimientoCajaDetalle = new CmpObservableCollection <ESGR_MovimientoCajaDetalle>();
         ObjCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
         ObjCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetMovimientoCajaDetalle");
         ObjCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "%");
         ObjCmpSql.AddParameter("@ParameterId", SqlDbType.Int, ESGR_MovimientoCaja.IdMovimientoCaja);
         DataTable dt = ObjCmpSql.ExecuteDataTable();
         for (int x = 0; x < dt.Rows.Count; x++)
         {
             CollectionESGR_MovimientoCajaDetalle.Add(new ESGR_MovimientoCajaDetalle()
             {
                 ConceptoDescripcion = (dt.Rows[x]["ConceptoDescripcion"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["ConceptoDescripcion"]) : string.Empty,
                 Monto = (dt.Rows[x]["Monto"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Monto"]) : Convert.ToDecimal(0)
             });
         }
         return(CollectionESGR_MovimientoCajaDetalle);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #4
0
        /// <summary>
        /// Lista de Log
        /// </summary>
        /// <returns>Colección de Log</returns>
        public CmpObservableCollection <ESGR_Log> GetCollectionLog()
        {
            try
            {
                var objCmpSql     = new CmpSql(SGRVariables.ConectionString);
                var CollectionLog = new CmpObservableCollection <ESGR_Log>();

                objCmpSql.CommandProcedure("spSGR_GET_Log");
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionLog.Add(new ESGR_Log
                    {
                        Item       = (dt.Rows[x]["Item"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Item"]) : Convert.ToInt16(0),
                        IdRegistro = (dt.Rows[x]["IdRegistro"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdRegistro"]) : Convert.ToInt16(0),
                        IdUsuario  = (dt.Rows[x]["IdUsuario"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdUsuario"]) : Convert.ToInt16(0),
                        Operacion  = (dt.Rows[x]["Operacion"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Operacion"]) : string.Empty,
                        Tabla      = (dt.Rows[x]["Tabla"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Tabla"]) : string.Empty,
                    });
                }

                return(CollectionLog);
            }

            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Lista de Perfil
        /// </summary>
        /// <returns>Colección de los Perfiles</returns>
        public CmpObservableCollection <ESGR_Perfil> GetCollectionPerfil()
        {
            try
            {
                var objCmpSql        = new CmpSql(SGRVariables.ConectionString);
                var CollectionPerfil = new CmpObservableCollection <ESGR_Perfil>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetPerfil");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "%");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, 0);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionPerfil.Add(new ESGR_Perfil
                    {
                        IdPerfil     = (dt.Rows[x]["IdPerfil"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdPerfil"]) : Convert.ToInt16(0),
                        Descripcion  = (dt.Rows[x]["Descripcion"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Descripcion"]) : string.Empty,
                        NombrePerfil = (dt.Rows[x]["NombrePerfil"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["NombrePerfil"]) : string.Empty,
                        ESGR_Modulo  = new ESGR_Modulo()
                        {
                            IdModulo = (dt.Rows[x]["IdModulo"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdModulo"]) : Convert.ToInt16(0),
                        },
                    });
                }

                return(CollectionPerfil);
            }

            catch (Exception)
            {
                throw;
            }
        }
Пример #6
0
        /// <summary>
        /// Lista de Contrasenia_Hist
        /// </summary>
        /// <returns>Colección de Contrasenia_Hist</returns>
        public CmpObservableCollection <ESGR_Contrasenia_Hist> GetCollectionContrasenia_Hist()
        {
            try
            {
                var objCmpSql = new CmpSql(SGRVariables.ConectionString);
                var CollectionContrasenia_Hist = new CmpObservableCollection <ESGR_Contrasenia_Hist>();

                objCmpSql.CommandProcedure("spSGR_GET_Contrasenia_Hist");
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionContrasenia_Hist.Add(new ESGR_Contrasenia_Hist
                    {
                        Contrasenia  = (dt.Rows[x]["Contrasenia"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Contrasenia"]) : string.Empty,
                        Fecha        = (dt.Rows[x]["Contrasenia"] != DBNull.Value) ? Convert.ToDateTime(dt.Rows[x]["Contrasenia"]) : DateTime.Now,
                        ESGR_Usuario = new ESGR_Usuario()
                        {
                            IdUsuario = (dt.Rows[x]["Contrasenia"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Contrasenia"]) : Convert.ToInt16(0),
                        },
                    });
                }

                return(CollectionContrasenia_Hist);
            }

            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Lista de Estado
        /// </summary>
        /// <returns>Colección de Estado</returns>
        public CmpObservableCollection <ESGR_Estado> GetCollectionEstado(string Filtro = "%")
        {
            try
            {
                var objCmpSql        = new CmpSql(SGRVariables.ConectionString);
                var CollectionEstado = new CmpObservableCollection <ESGR_Estado>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "FiltrarEstado");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, (Filtro == null || Filtro.Trim().Length == 0) ? "%" : Filtro);
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, 0);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionEstado.Add(new ESGR_Estado
                    {
                        CodEstado = (dt.Rows[x]["CodEstado"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodEstado"]) : string.Empty,
                        Campo     = (dt.Rows[x]["Campo"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Campo"]) : string.Empty,
                        Estado    = (dt.Rows[x]["Estado"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Estado"]) : string.Empty,
                        Tabla     = (dt.Rows[x]["Tabla"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Tabla"]) : string.Empty,
                    });
                }

                return(CollectionEstado);
            }

            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Lista de Reporte por Estado
        /// </summary>
        /// <returns>Colección de Reporte por Estado</returns>
        public CmpObservableCollection <ESGR_Estado> GetReportCollectionEstado(int ParameterId)
        {
            try
            {
                var objCmpSql        = new CmpSql(SGRVariables.ConectionString);
                var CollectionEstado = new CmpObservableCollection <ESGR_Estado>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetTotalEstado");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "%");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, ParameterId);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionEstado.Add(new ESGR_Estado
                    {
                        CodEstado = (dt.Rows[x]["CodEstado"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodEstado"]) : string.Empty,
                        Estado    = (dt.Rows[x]["Estado"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Estado"]) : string.Empty,
                        Total     = (dt.Rows[x]["Total"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Total"]) : 0
                    });
                }

                return(CollectionEstado);
            }

            catch (Exception)
            {
                throw;
            }
        }
Пример #9
0
        private CmpObservableCollection <ESGR_CartaDiaDetalle> MethodCartaDia()
        {
            var CollectionESGR_Carta = new CmpObservableCollection <ESGR_CartaDiaDetalle>();

            CollectionVMSGR_CartaDiaDetalleCategoria.ToList().ForEach(x =>
            {
                x.CollectionVMSGR_CartaDiaDetalleSubCategoria.ToList().ForEach(z =>
                {
                    z.CollectionESGR_CartaDiaDetalle.ToList().ForEach(s =>
                    {
                        if (s.CartaDia)
                        {
                            CollectionESGR_Carta.Add(new ESGR_CartaDiaDetalle()
                            {
                                Cantidad      = s.Cantidad,
                                Precio        = s.Precio,
                                Stock         = s.Stock,
                                ESGR_Producto = s.ESGR_Producto,
                                Producto      = s.ESGR_Producto.Producto,
                                SubCategoria  = s.ESGR_Producto.ESGR_ProductoSubCategoria.SubCategoria,
                                Categoria     = s.ESGR_Producto.ESGR_ProductoSubCategoria.ESGR_ProductoCategoria.Categoria
                            });
                        }
                    });
                });
            });
            return(CollectionESGR_Carta);
        }
        /// <summary>
        /// Lista de Cierre Caja Detalle
        /// </summary>
        /// <returns>Colección de Cierre Caja Detalle</returns>
        public CmpObservableCollection <ESGR_CierreCaja_Detalle> GetCollectionCierreCajaDetalle()
        {
            try
            {
                var objCmpSql = new CmpSql(SGRVariables.ConectionString);
                var CollectionCierreCaja_Detalle = new CmpObservableCollection <ESGR_CierreCaja_Detalle>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Parametro", SqlDbType.VarChar, "CierreCaja_Detalle");
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionCierreCaja_Detalle.Add(new ESGR_CierreCaja_Detalle
                    {
                        Item            = (dt.Rows[x]["Item"] != DBNull.Value) ? Convert.ToByte(dt.Rows[x]["Item"]) : Convert.ToByte(0),
                        TipoPago        = (dt.Rows[x]["TipoPago"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["TipoPago"]) : string.Empty,
                        TipoTarjeta     = (dt.Rows[x]["TipoTarjeta"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["TipoTarjeta"]) : string.Empty,
                        Total           = (dt.Rows[x]["Total"] != DBNull.Value) ? Convert.ToByte(dt.Rows[x]["Total"]) : Convert.ToByte(0),
                        MndCodMnd       = (dt.Rows[x]["MndCodMnd"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["MndCodMnd"]) : string.Empty,
                        ESGR_CierreCaja = new ESGR_CierreCaja()
                        {
                            IdCaja = (dt.Rows[x]["IdCaja"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdCaja"]) : Convert.ToInt16(0),
                        },
                    });
                }

                return(CollectionCierreCaja_Detalle);
            }

            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Lista de Carta Dia
        /// </summary>
        /// <returns>Colección de las Cartas Dia</returns>
        public CmpObservableCollection <ESGR_CartaDia> CollectionCartaDia()
        {
            try
            {
                var objCmpSql          = new CmpSql(SGRVariables.ConectionString);
                var CollectionCartaDia = new CmpObservableCollection <ESGR_CartaDia>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "FiltrarCartaDiaSucursal");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, 0);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionCartaDia.Add(new ESGR_CartaDia
                    {
                        IdCartaDia           = (dt.Rows[x]["IdCartaDia"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdCartaDia"]) : Convert.ToInt16(0),
                        Fecha                = (dt.Rows[x]["Fecha"] != DBNull.Value) ? Convert.ToDateTime(dt.Rows[x]["Fecha"]) : DateTime.Now,
                        ESGR_EmpresaSucursal = new ESGR_EmpresaSucursal()
                        {
                            IdEmpSucursal = (dt.Rows[x]["IdEmpSucursal"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdEmpSucursal"]) : Convert.ToInt16(0),
                            Sucursal      = (dt.Rows[x]["Sucursal"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Sucursal"]) : string.Empty
                        },
                    });
                }
                return(CollectionCartaDia);
            }

            catch (Exception)
            {
                throw;
            }
        }
Пример #12
0
        public CmpObservableCollection <ESGR_ProductoSubCategoria> GetCollectionProductoSubCategoriaCartaDia(ESGR_ProductoCategoria ESGR_ProductoCategoria)
        {
            try
            {
                var objCmpSql = new CmpSql(SGRVariables.ConectionString);
                var CollectionProductoSubCategoriaCartaDia = new CmpObservableCollection <ESGR_ProductoSubCategoria>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetCartaDiaSubCatProducto");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "%");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, ESGR_ProductoCategoria.IdCategoria);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionProductoSubCategoriaCartaDia.Add(new ESGR_ProductoSubCategoria
                    {
                        IdSubCategoria         = (dt.Rows[x]["IdSubCategoria"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdSubCategoria"]) : Convert.ToInt16(0),
                        SubCategoria           = (dt.Rows[x]["SubCategoria"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["SubCategoria"]) : string.Empty,
                        ESGR_ProductoCategoria = new ESGR_ProductoCategoria()
                        {
                            IdCategoria = (dt.Rows[x]["IdCategoria"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdCategoria"]) : Convert.ToInt16(0),
                        },
                    });
                }

                return(CollectionProductoSubCategoriaCartaDia);
            }

            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Lista de Formulario
        /// </summary>
        /// <returns>Colección de Formulario</returns>
        public CmpObservableCollection <ESGR_Formulario> GetCollectionFormulario()
        {
            try
            {
                var objCmpSql            = new CmpSql(SGRVariables.ConectionString);
                var CollectionFormulario = new CmpObservableCollection <ESGR_Formulario>();

                objCmpSql.CommandProcedure("spSGR_GET_Formulario");
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionFormulario.Add(new ESGR_Formulario
                    {
                        CodFormulario    = (dt.Rows[x]["CodFormulario"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodFormulario"]) : string.Empty,
                        Descripcion      = (dt.Rows[x]["CodFormulario"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodFormulario"]) : string.Empty,
                        NombreFormulario = (dt.Rows[x]["CodFormulario"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodFormulario"]) : string.Empty,
                        ESGR_Modulo      = new ESGR_Modulo()
                        {
                            IdModulo = (dt.Rows[x]["CodFormulario"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["CodFormulario"]) : Convert.ToInt16(0),
                        },
                    });
                }

                return(CollectionFormulario);
            }

            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Lista de Producto Categoria
        /// </summary>
        /// <returns>Colección de los Producto Categoria</returns>
        public CmpObservableCollection <ESGR_ProductoCategoria> GetCollectionProductoCategoria(string Filtro = "%")
        {
            try
            {
                var objCmpSql = new CmpSql(SGRVariables.ConectionString);
                var CollectionProductoCategoria = new CmpObservableCollection <ESGR_ProductoCategoria>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetCategoria");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, (Filtro == string.Empty || Filtro == null) ? "%" : Filtro);
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, 0);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionProductoCategoria.Add(new ESGR_ProductoCategoria
                    {
                        IdCategoria = (dt.Rows[x]["IdCategoria"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdCategoria"]) : Convert.ToInt16(0),
                        Categoria   = (dt.Rows[x]["Categoria"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Categoria"]) : string.Empty,
                        Impresora   = (dt.Rows[x]["Impresora"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Impresora"]) : string.Empty,
                        ValidaStock = (dt.Rows[x]["ValidaStock"] != DBNull.Value) ? Convert.ToBoolean(dt.Rows[x]["ValidaStock"]) : false,
                    });
                }

                return(CollectionProductoCategoria);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #15
0
        /// <summary>
        /// Lista de Moneda
        /// </summary>
        /// <returns>Colección de Moneda</returns>
        public CmpObservableCollection <ESGR_Moneda> GetCollectionMoneda()
        {
            try
            {
                var objCmpSql        = new CmpSql(SGRVariables.ConectionString);
                var CollectionMoneda = new CmpObservableCollection <ESGR_Moneda>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetMoneda");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, "");
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionMoneda.Add(new ESGR_Moneda
                    {
                        Abreviacion = (dt.Rows[x]["Abreviacion"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Abreviacion"]) : string.Empty,
                        CodMoneda   = (dt.Rows[x]["CodMoneda"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodMoneda"]) : string.Empty,
                        Defecto     = (dt.Rows[x]["Defecto"] != DBNull.Value) ? Convert.ToBoolean(dt.Rows[x]["Defecto"]) : false,
                        Descripcion = (dt.Rows[x]["Descripcion"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Descripcion"]) : string.Empty,
                        Simbolo     = (dt.Rows[x]["Simbolo"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Simbolo"]) : string.Empty,
                    });
                }

                return(CollectionMoneda);
            }

            catch (Exception)
            {
                throw;
            }
        }
 public CmpObservableCollection <ESGR_ListadoVentaDia> CollectionESGR_ListadoVentaDia(int IdCategoria, int IdSubCategoria, int IdProducto, DateTime FechaIni, DateTime FechaFin, int IdUsuario)
 {
     try
     {
         var ObjCmpSql = new CmpSql(SGRVariables.ConectionString);
         var CollectionESGR_ListadoVentaDia = new CmpObservableCollection <ESGR_ListadoVentaDia>();
         ObjCmpSql.CommandProcedure("spSGR_GET_ListaVentaPorFecha");
         ObjCmpSql.AddParameter("@IdCategoria", SqlDbType.Int, IdCategoria);
         ObjCmpSql.AddParameter("@IdSubCategoria", SqlDbType.Int, IdSubCategoria);
         ObjCmpSql.AddParameter("@IdProducto", SqlDbType.Int, IdProducto);
         ObjCmpSql.AddParameter("@FechaDesde", SqlDbType.SmallDateTime, FechaIni.ToShortDateString());
         ObjCmpSql.AddParameter("@FechaHasta", SqlDbType.SmallDateTime, FechaFin.ToShortDateString());
         ObjCmpSql.AddParameter("@Usuario", SqlDbType.Int, IdUsuario);
         DataTable dt = ObjCmpSql.ExecuteDataTable();
         for (int x = 0; x < dt.Rows.Count; x++)
         {
             CollectionESGR_ListadoVentaDia.Add(new ESGR_ListadoVentaDia()
             {
                 Fecha     = (dt.Rows[x]["Fecha"] != DBNull.Value) ? Convert.ToDateTime(dt.Rows[x]["Fecha"]) : DateTime.Now,
                 Producto  = (dt.Rows[x]["Producto"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Producto"]) : string.Empty,
                 Cantidad  = (dt.Rows[x]["Cantidad"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Cantidad"]) : 0,
                 Precio    = (dt.Rows[x]["Precio"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Precio"]) : 0,
                 Descuento = (dt.Rows[x]["Descuento"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Descuento"]) : 0,
                 Importe   = (dt.Rows[x]["Importe"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Importe"]) : 0,
                 Mozo      = (dt.Rows[x]["Mozo"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Mozo"]) : string.Empty,
             });
         }
         return(CollectionESGR_ListadoVentaDia);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #17
0
        /// <summary>
        /// Lista de Empresa Sucursal
        /// </summary>
        /// <returns>Colección de Empresa Sucursal</returns>
        public CmpObservableCollection <ESGR_EmpresaSucursal> GetCollectionEmpresaSucursal(ESGR_Empresa ESGR_Empresa)
        {
            try
            {
                var objCmpSql = new CmpSql(SGRVariables.ConectionString);
                var CollectionEmpresaSucursal = new CmpObservableCollection <ESGR_EmpresaSucursal>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetEmpSucursal");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, ESGR_Empresa.IdEmpresa);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionEmpresaSucursal.Add(new ESGR_EmpresaSucursal
                    {
                        IdEmpSucursal = (dt.Rows[x]["IdEmpSucursal"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdEmpSucursal"]) : Convert.ToInt16(0),
                        Principal     = (dt.Rows[x]["Principal"] != DBNull.Value) ? Convert.ToBoolean(dt.Rows[x]["Principal"]) : false,
                        Sucursal      = (dt.Rows[x]["Sucursal"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Sucursal"]) : string.Empty,
                        ESGR_Empresa  = new ESGR_Empresa()
                        {
                            IdEmpresa = (dt.Rows[x]["IdEmpresa"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdEmpresa"]) : Convert.ToInt16(0),
                        },
                    });
                }

                return(CollectionEmpresaSucursal);
            }

            catch (Exception)
            {
                throw;
            }
        }
Пример #18
0
        /// <summary>
        /// Lista de Tipo Cambio
        /// </summary>
        /// <returns>Colección de los Tipo Cambio</returns>
        public CmpObservableCollection <ESGR_TipoCambio> GetCollectionTipoCambio()
        {
            try
            {
                var objCmpSql            = new CmpSql(SGRVariables.ConectionString);
                var CollectionTipoCambio = new CmpObservableCollection <ESGR_TipoCambio>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetTipoCambio");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.VarChar, "");
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionTipoCambio.Add(new ESGR_TipoCambio
                    {
                        ESGR_Moneda = new ESGR_Moneda()
                        {
                            CodMoneda = (dt.Rows[x]["CodMoneda"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodMoneda"]) : string.Empty,
                        },
                        SelRate  = (dt.Rows[x]["SelRate"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["SelRate"]) : Convert.ToDecimal(0),
                        BuyRate  = (dt.Rows[x]["BuyRate"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["BuyRate"]) : Convert.ToDecimal(0),
                        FechaTcb = (dt.Rows[x]["FechaTcb"] != DBNull.Value) ? Convert.ToDateTime(dt.Rows[x]["FechaTcb"]) : DateTime.Now,
                    });
                }

                return(CollectionTipoCambio);
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Lista de Mesa Area
        /// </summary>
        /// <returns>Colección de Mesa Area</returns>
        public CmpObservableCollection <ESGR_MesaArea> GetCollectionMesaArea()
        {
            try
            {
                var objCmpSql          = new CmpSql(SGRVariables.ConectionString);
                var CollectionMesaArea = new CmpObservableCollection <ESGR_MesaArea>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetMesaArea");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "%");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, 0);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionMesaArea.Add(new ESGR_MesaArea
                    {
                        IdMesaArea = (dt.Rows[x]["IdMesaArea"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdMesaArea"]) : Convert.ToInt16(0),
                        MesaArea   = (dt.Rows[x]["MesaArea"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["MesaArea"]) : string.Empty,
                    });
                }

                return(CollectionMesaArea);
            }

            catch (Exception)
            {
                throw;
            }
        }
Пример #20
0
        public CmpObservableCollection <ESGR_Venta> GetTotalPorPedido(int ParameterId)
        {
            try
            {
                var objCmpSql       = new CmpSql(SGRVariables.ConectionString);
                var CollectionVenta = new CmpObservableCollection <ESGR_Venta>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetTotalPedido");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "%");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.VarChar, ParameterId);
                DataTable dt = objCmpSql.ExecuteDataTable();
                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionVenta.Add(new ESGR_Venta()
                    {
                        ESGR_Pedido = new ESGR_Pedido()
                        {
                            IdPedido = (dt.Rows[x]["IdPedido"] != DBNull.Value) ? Convert.ToInt32(dt.Rows[x]["IdPedido"]) : 0,
                            Cubierto = (dt.Rows[x]["Cubierto"] != DBNull.Value) ? (short)Convert.ToInt32(dt.Rows[x]["Cubierto"]) : (short)0
                        }
                    });
                }

                return(CollectionVenta);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #21
0
 public CmpObservableCollection <ESGR_Documento> CollectionESGR_DocumentoSerieNumero()
 {
     try
     {
         var ObjCmpSql = new CmpSql(SGRVariables.ConectionString);
         var CollectionESGR_DocumentoSerie = new CmpObservableCollection <ESGR_Documento>();
         ObjCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
         ObjCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetEmpSucursalDocumentoSerie");
         ObjCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "");
         ObjCmpSql.AddParameter("@ParameterId", SqlDbType.Int, 1);
         DataTable dt = ObjCmpSql.ExecuteDataTable();
         for (int x = 0; x < dt.Rows.Count; x++)
         {
             CollectionESGR_DocumentoSerie.Add(new ESGR_Documento
             {
                 ESGR_EmpresaSucursal = new ESGR_EmpresaSucursal
                 {
                     IdEmpSucursal = (dt.Rows[x]["IdEmpSucursal"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdEmpSucursal"]) : Convert.ToInt16(0),
                 },
                 CodDocumento = (dt.Rows[x]["CodDocumento"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodDocumento"]) : string.Empty,
                 Correlativo  = (dt.Rows[x]["Correlativo"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Correlativo"]) : string.Empty,
                 Descripcion  = (dt.Rows[x]["Descripcion"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Descripcion"]) : string.Empty,
                 Longitud     = (dt.Rows[x]["Longitud"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Longitud"]) : Convert.ToInt16(0),
                 Serie        = (dt.Rows[x]["Serie"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Serie"]) : string.Empty,
                 Sunat        = (dt.Rows[x]["Sunat"] != DBNull.Value) ? Convert.ToBoolean(dt.Rows[x]["Sunat"]) : false,
             });
         }
         return(CollectionESGR_DocumentoSerie);
     }
     catch (Exception)
     {
         throw;
     }
 }
 public CmpObservableCollection <ESGR_MovimientoCaja> CollectionESGR_MovimientoCaja(string CodMotivo, DateTime FechaIni, DateTime FechaFin, bool ValidaFecha, ESGR_Caja ESGR_Caja)
 {
     try
     {
         var CollectionESGR_MovimientoCaja = new CmpObservableCollection <ESGR_MovimientoCaja>();
         ObjCmpSql.CommandProcedure("spSGR_GET_MovimientoCaja");
         ObjCmpSql.AddParameter("@CodMotivo", SqlDbType.VarChar, CodMotivo);
         ObjCmpSql.AddParameter("@FechaIni", SqlDbType.SmallDateTime, FechaIni.ToShortDateString());
         ObjCmpSql.AddParameter("@FechaFin", SqlDbType.SmallDateTime, FechaFin.ToShortDateString());
         ObjCmpSql.AddParameter("@IdCaja", SqlDbType.SmallInt, (ESGR_Caja == null) ? 0 : ESGR_Caja.IdCaja);
         ObjCmpSql.AddParameter("@ValidaFecha", SqlDbType.Bit, ValidaFecha);
         DataTable dt = ObjCmpSql.ExecuteDataTable();
         for (int x = 0; x < dt.Rows.Count; x++)
         {
             CollectionESGR_MovimientoCaja.Add(new ESGR_MovimientoCaja()
             {
                 IdMovimientoCaja = (dt.Rows[x]["IdMovimiento"] != DBNull.Value) ? Convert.ToInt32(dt.Rows[x]["IdMovimiento"]) : 0,
                 ESGR_Motivo      = new ESGR_Motivo()
                 {
                     CodMotivo = (dt.Rows[x]["CodMotivo"] != DBNull.Value)? Convert.ToString(dt.Rows[x]["CodMotivo"]):string.Empty,
                     Motivo    = (dt.Rows[x]["Motivo"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Motivo"]) : string.Empty,
                 },
                 ESGR_EmpresaSucursal = new ESGR_EmpresaSucursal()
                 {
                     IdEmpSucursal = (dt.Rows[x]["IdEmpSucursal"] != DBNull.Value) ? (short)(dt.Rows[x]["IdEmpSucursal"]):Convert.ToInt16(0),
                     Sucursal      = (dt.Rows[x]["Sucursal"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Sucursal"]) : string.Empty,
                 },
                 ESGR_Moneda = new ESGR_Moneda()
                 {
                     CodMoneda = (dt.Rows[x]["CodMoneda"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodMoneda"]) : string.Empty
                 },
                 ESGR_Documento = new ESGR_Documento()
                 {
                     CodDocumento = (dt.Rows[x]["CodDocumento"] != DBNull.Value)? Convert.ToString(dt.Rows[x]["CodDocumento"]):string.Empty,
                     Serie        = (dt.Rows[x]["Serie"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Serie"]) : string.Empty,
                     Correlativo  = (dt.Rows[x]["Correlativo"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Correlativo"]) : string.Empty,
                 },
                 ESGR_Estado = new ESGR_Estado()
                 {
                     CodEstado = (dt.Rows[x]["CodEstado"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodEstado"]) : string.Empty,
                     Estado    = (dt.Rows[x]["Estado"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Estado"]) : string.Empty
                 },
                 ESGR_Caja = new ESGR_Caja()
                 {
                     IdCaja      = (dt.Rows[x]["IdCaja"] != DBNull.Value) ? Convert.ToInt32(dt.Rows[x]["IdCaja"]) : 0,
                     Descripcion = (dt.Rows[x]["Descripcion"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Descripcion"]) : string.Empty
                 },
                 Fecha        = (dt.Rows[x]["Fecha"] != DBNull.Value) ? Convert.ToDateTime(dt.Rows[x]["Fecha"]) : DateTime.Now,
                 CodOperacion = (dt.Rows[x]["CodOperacion"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodOperacion"]) : string.Empty,
                 Glosa        = (dt.Rows[x]["Glosa"] != DBNull.Value)? Convert.ToString(dt.Rows[x]["Glosa"]):string.Empty,
             });
         }
         return(CollectionESGR_MovimientoCaja);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #23
0
        /// <summary>
        /// Lista de Venta Detalle
        /// </summary>-
        /// <returns>Colección de las Venta Detalle</returns>
        public CmpObservableCollection <ESGR_VentaDetalle> GetCollectionVentaDetalle(int ParameterId, string Filtro = "%")
        {
            try
            {
                var objCmpSql = new CmpSql(SGRVariables.ConectionString);
                var CollectionVentaDetalle = new CmpObservableCollection <ESGR_VentaDetalle>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetVentaDetalle");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, (Filtro != null || Filtro.Trim().Length == 0) ? Filtro : "%");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, ParameterId);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionVentaDetalle.Add(new ESGR_VentaDetalle
                    {
                        Item             = (dt.Rows[x]["Item"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Item"]) : Convert.ToInt16(0),
                        ESGR_VentaCuenta = new ESGR_VentaCuenta()
                        {
                            IdCuenta   = (dt.Rows[x]["IdCuenta"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdCuenta"]) : Convert.ToInt16(0),
                            Adicional  = (dt.Rows[x]["Adicional"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Adicional"]) : 0m,
                            Descuento  = (dt.Rows[x]["Descuento"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Descuento"]) : 0m,
                            ESGR_Venta = new ESGR_Venta()
                            {
                                IdVenta = (dt.Rows[x]["IdVenta"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdVenta"]) : Convert.ToInt16(0),
                                Fecha   = (dt.Rows[x]["Fecha"] != DBNull.Value) ? Convert.ToDateTime(dt.Rows[x]["Fecha"]) : DateTime.Now
                            },
                            ESGR_MedioPago = new ESGR_MedioPago()
                            {
                                IdMedioPago = (dt.Rows[x]["IdMedioPago"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdMedioPago"]) : Convert.ToInt16(0),
                            },
                            ESGR_Moneda = new ESGR_Moneda()
                            {
                                CodMoneda = (dt.Rows[x]["CodMoneda"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodMoneda"]) : string.Empty,
                            }
                        },
                        CantidadPagar = (dt.Rows[x]["Cantidad"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Cantidad"]) : Convert.ToInt16(0),
                        Descuento     = (dt.Rows[x]["Descuento"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Descuento"]) : Convert.ToDecimal(0),
                        Importe       = (dt.Rows[x]["Importe"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Importe"]) : Convert.ToDecimal(0),
                        Precio        = (dt.Rows[x]["Precio"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Precio"]) : Convert.ToDecimal(0),
                        ESGR_Producto = new ESGR_Producto()
                        {
                            IdProducto = (dt.Rows[x]["IdProducto"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdProducto"]) : Convert.ToInt16(0),
                            Producto   = (dt.Rows[x]["Producto"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Producto"]) : string.Empty,
                            Precio     = (dt.Rows[x]["Precio"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Precio"]) : Convert.ToDecimal(0)
                        },
                    });
                }

                return(CollectionVentaDetalle);
            }

            catch (Exception)
            {
                throw;
            }
        }
        private CmpObservableCollection <ESGR_Item> MethodLoaditem()
        {
            CmpObservableCollection <ESGR_Item> CollectionItemOpciones = new CmpObservableCollection <ESGR_Item>();

            CollectionItemOpciones.Add(new ESGR_Item {
                ValueMemberPath = "Fecha", ValueValuePath = "Fecha"
            });
            return(CollectionItemOpciones);
        }
Пример #25
0
        /// <summary>
        /// Lista de Pedido
        /// </summary>
        /// <returns>Colección de las Pedido</returns>
        public CmpObservableCollection <ESGR_Pedido> GetCollectionPedido()
        {
            try
            {
                var objCmpSql        = new CmpSql(SGRVariables.ConectionString);
                var CollectionPedido = new CmpObservableCollection <ESGR_Pedido>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "FiltrarPedidoUsuario");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "%");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, SGRVariables.ESGR_Usuario.IdUsuario);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionPedido.Add(new ESGR_Pedido
                    {
                        IdPedido        = (dt.Rows[x]["IdPedido"] != DBNull.Value) ? Convert.ToInt32(dt.Rows[x]["IdPedido"]) : Convert.ToInt32(0),
                        ESGR_PedidoTipo = new ESGR_PedidoTipo()
                        {
                            IdPedidoTipo = (dt.Rows[x]["IdPedidoTipo"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdPedidoTipo"]) : Convert.ToInt16(0),
                            PedidoTipo   = (dt.Rows[x]["PedidoTipo"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["PedidoTipo"]) : string.Empty,
                        },
                        ESGR_EmpresaSucursal = new ESGR_EmpresaSucursal()
                        {
                            IdEmpSucursal = (dt.Rows[x]["IdEmpSucursal"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdEmpSucursal"]) : Convert.ToInt16(0),
                        },
                        ESGR_Usuario = new ESGR_Usuario()
                        {
                            IdUsuario   = (dt.Rows[x]["IdUsuarioPedido"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdUsuarioPedido"]) : Convert.ToInt16(0),
                            Nombres     = (dt.Rows[x]["Nombres"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Nombres"]) : string.Empty,
                            Apellidos   = (dt.Rows[x]["Apellidos"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Apellidos"]) : string.Empty,
                            ESGR_Perfil = new ESGR_Perfil()
                            {
                                IdPerfil     = (dt.Rows[x]["IdPerfil"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdPerfil"]) : Convert.ToInt16(0),
                                NombrePerfil = (dt.Rows[x]["NombrePerfil"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["NombrePerfil"]) : string.Empty
                            }
                        },
                        ESGR_Estado = new ESGR_Estado()
                        {
                            CodEstado = (dt.Rows[x]["CodEstado"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CodEstado"]) : string.Empty,
                            Estado    = (dt.Rows[x]["Estado"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Estado"]) : string.Empty,
                        },
                        Identificador = (dt.Rows[x]["Identificador"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Identificador"]).Trim() : string.Empty,
                        CadenaMesa    = (dt.Rows[x]["CadenaMesa"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["CadenaMesa"]).Trim() : string.Empty,
                        Cubierto      = (dt.Rows[x]["Cubierto"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Cubierto"]) : Convert.ToInt16(0),
                    });
                }

                return(CollectionPedido);
            }

            catch (Exception)
            {
                throw;
            }
        }
Пример #26
0
        /// <summary>
        /// Lista de Usuario
        /// </summary>
        /// <returns>Colección de los Usuarios</returns>
        public CmpObservableCollection <ESGR_Usuario> GetCollectionUsuario(string Filtro = "%")
        {
            try
            {
                var objCmpSql         = new CmpSql(SGRVariables.ConectionString);
                var CollectionUsuario = new CmpObservableCollection <ESGR_Usuario>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetUsuario");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, (Filtro == string.Empty) ? "%" : Filtro);
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, 0);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionUsuario.Add(new ESGR_Usuario
                    {
                        IdUsuario    = (dt.Rows[x]["IdUsuario"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdUsuario"]) : Convert.ToInt16(0),
                        Apellidos    = (dt.Rows[x]["Apellidos"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Apellidos"]) : string.Empty,
                        Contrasenia  = (dt.Rows[x]["Contrasenia"] != DBNull.Value) ? CmpCifrarObjecto.Desencriptar(Convert.ToString(dt.Rows[x]["Contrasenia"])) : "ysr260915",
                        Correo       = (dt.Rows[x]["Correo"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Correo"]) : string.Empty,
                        Nick         = (dt.Rows[x]["Nick"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Nick"]) : string.Empty,
                        Estado       = (dt.Rows[x]["Estado"] != DBNull.Value) ? Convert.ToByte(dt.Rows[x]["Estado"]) : Convert.ToByte(0),
                        Nombres      = (dt.Rows[x]["Nombres"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Nombres"]) : string.Empty,
                        Usuario      = (dt.Rows[x]["Usuario"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Usuario"]) : string.Empty,
                        Fallido      = (dt.Rows[x]["Fallido"] != DBNull.Value) ? Convert.ToByte(dt.Rows[x]["Fallido"]) : Convert.ToByte(0),
                        FlgConectado = (dt.Rows[x]["FlgConectado"] != DBNull.Value) ? Convert.ToBoolean(dt.Rows[x]["FlgConectado"]) : false,
                        FlgEliminado = (dt.Rows[x]["FlgEliminado"] != DBNull.Value) ? Convert.ToBoolean(dt.Rows[x]["FlgEliminado"]) : false,
                        ESGR_Empresa = new ESGR_Empresa()
                        {
                            IdEmpresa       = (dt.Rows[x]["IdEmpresa"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdEmpresa"]) : Convert.ToInt16(0),
                            RazonSocial     = (dt.Rows[x]["RazonSocial"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["RazonSocial"]) : string.Empty,
                            Telefono        = (dt.Rows[x]["Telefono"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Telefono"]) : string.Empty,
                            Ruc             = (dt.Rows[x]["Ruc"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Ruc"]) : string.Empty,
                            DireccionFiscal = (dt.Rows[x]["DireccionFiscal"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["DireccionFiscal"]) : string.Empty
                        },
                        ESGR_EmpresaSucursal = new ESGR_EmpresaSucursal()
                        {
                            IdEmpSucursal = (dt.Rows[x]["IdEmpSucursal"] != DBNull.Value) ? (short)Convert.ToInt32(dt.Rows[x]["IdEmpSucursal"]) : (short)0
                        },
                        ESGR_Perfil = new ESGR_Perfil()
                        {
                            IdPerfil     = (dt.Rows[x]["IdPerfil"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdPerfil"]) : Convert.ToInt16(0),
                            NombrePerfil = (dt.Rows[x]["NombrePerfil"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["NombrePerfil"]) : string.Empty,
                        },
                    });
                }

                return(CollectionUsuario);
            }

            catch (Exception)
            {
                throw;
            }
        }
Пример #27
0
        /// <summary>
        /// Lista de Carta Dia Detalle
        /// </summary>
        /// <returns>Colección de las Cartas Dia Detalle</returns>
        public CmpObservableCollection <ESGR_CartaDiaDetalle> GetCollectionCartaDiaDetalle(ESGR_CartaDia ESGR_CartaDia)
        {
            try
            {
                var objCmpSql = new CmpSql(SGRVariables.ConectionString);
                var CollectionCartaDiaDetalle = new CmpObservableCollection <ESGR_CartaDiaDetalle>();

                objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral");
                objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "FiltrarCartaDiaDetalle");
                objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, "");
                objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, ESGR_CartaDia.IdCartaDia);
                DataTable dt = objCmpSql.ExecuteDataTable();

                for (int x = 0; x < dt.Rows.Count; x++)
                {
                    CollectionCartaDiaDetalle.Add(new ESGR_CartaDiaDetalle
                    {
                        IdCartaDia    = (dt.Rows[x]["IdCartaDia"] != DBNull.Value) ? Convert.ToInt32(dt.Rows[x]["IdCartaDia"]) : 0,
                        Item          = (dt.Rows[x]["Item"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Item"]) : Convert.ToInt16(0),
                        Cantidad      = (dt.Rows[x]["Cantidad"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Cantidad"]) : Convert.ToInt16(0),
                        TempCantidad  = (dt.Rows[x]["Cantidad"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Cantidad"]) : Convert.ToInt16(0),
                        Precio        = (dt.Rows[x]["Precio"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Precio"]) : 0,
                        Stock         = (dt.Rows[x]["Stock"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Stock"]) : Convert.ToInt16(0),
                        TempStock     = (dt.Rows[x]["Stock"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Stock"]) : Convert.ToInt16(0),
                        Observacion   = (dt.Rows[x]["Observacion"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Observacion"]) : string.Empty,
                        ESGR_CartaDia = new ESGR_CartaDia()
                        {
                            IdCartaDia = (dt.Rows[x]["IdCartaDia"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdCartaDia"]) : Convert.ToInt16(0),
                        },
                        ESGR_Producto = new ESGR_Producto()
                        {
                            IdProducto = (dt.Rows[x]["IdProducto"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdProducto"]) : Convert.ToInt16(0),
                            Producto   = (dt.Rows[x]["Producto"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Producto"]) : string.Empty,
                            ESGR_ProductoSubCategoria = new ESGR_ProductoSubCategoria()
                            {
                                IdSubCategoria         = (dt.Rows[x]["IdSubCategoria"] != DBNull.Value) ? Convert.ToInt32(dt.Rows[x]["IdSubCategoria"]) : 0,
                                SubCategoria           = (dt.Rows[x]["SubCategoria"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["SubCategoria"]) : string.Empty,
                                ESGR_ProductoCategoria = new ESGR_ProductoCategoria()
                                {
                                    IdCategoria = (dt.Rows[x]["IdCategoria"] != DBNull.Value) ? Convert.ToInt32(dt.Rows[x]["IdCategoria"]) : 0,
                                    Categoria   = (dt.Rows[x]["Categoria"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Categoria"]) : string.Empty,
                                }
                            }
                        },
                    });
                }
                return(CollectionCartaDiaDetalle);
            }

            catch (Exception)
            {
                throw;
            }
        }
Пример #28
0
        private CmpObservableCollection <ESGR_Item> GetOpciones()
        {
            CmpObservableCollection <ESGR_Item> CollectionItemOpciones = new CmpObservableCollection <ESGR_Item>();

            CollectionItemOpciones.Add(new ESGR_Item {
                ValueMemberPath = "PRODUCTO", ValueValuePath = "PRODUCTO"
            });
            CollectionItemOpciones.Add(new ESGR_Item {
                ValueMemberPath = "CATEGORIA Y SUBCATEGORIA", ValueValuePath = "CATEGORIAYSUB"
            });
            return(CollectionItemOpciones);
        }
Пример #29
0
        private CmpObservableCollection <ESGR_Item> MethodLoadDocIdentidad()
        {
            CmpObservableCollection <ESGR_Item> CollectionItemOpciones = new CmpObservableCollection <ESGR_Item>();

            CollectionItemOpciones.Add(new ESGR_Item {
                ValueMemberPath = "DNI", ValueValuePath = "DNI"
            });
            CollectionItemOpciones.Add(new ESGR_Item {
                ValueMemberPath = "RUC", ValueValuePath = "RUC"
            });
            return(CollectionItemOpciones);
        }
        private void MethodQuitar()
        {
            var vrCollectionESGR_CartiaDiaDetalle = new CmpObservableCollection <ESGR_CartaDiaDetalle>();
            var vrCollectionESGR_VMSubCategoria   = new CmpObservableCollection <VMSGR_CartaDiaDetalleSubCategoria>();
            var vrCollectionESGR_VMCategoria      = new CmpObservableCollection <VMSGR_CartaDiaDetalleCategoria>();

            foreach (var item in CollectionVMSGR_CartaDiaDetalleCategoria)
            {
                foreach (var items in item.CollectionVMSGR_CartaDiaDetalleSubCategoria)
                {
                    vrCollectionESGR_CartiaDiaDetalle = new CmpObservableCollection <ESGR_CartaDiaDetalle>(items.CollectionESGR_CartaDiaDetalle);
                    foreach (ESGR_CartaDiaDetalle vrItems in vrCollectionESGR_CartiaDiaDetalle)
                    {
                        if (vrItems.Stock < vrItems.Cantidad && vrItems.ESGR_Producto.IsCheckeQuitar && ESGR_CartaDia.Opcion == "U")
                        {
                            CmpMessageBox.Show(SGRMessage.AdministratorCartaDia, "No se puede quitar algunos Producto debido a que ya existen Pedidos", CmpButton.Aceptar);
                            vrItems.ESGR_Producto.IsCheckeQuitar = false;
                        }
                        else
                        {
                            if (vrItems.ESGR_Producto.IsCheckeQuitar)
                            {
                                items.CollectionESGR_CartaDiaDetalle.Remove(vrItems);
                            }
                        }
                    }
                }
            }

            #region  QUITA CATEGORIA Y SUBCATEGORIA

            vrCollectionESGR_VMCategoria = new CmpObservableCollection <VMSGR_CartaDiaDetalleCategoria>(CollectionVMSGR_CartaDiaDetalleCategoria);
            foreach (var item in vrCollectionESGR_VMCategoria)
            {
                vrCollectionESGR_VMSubCategoria = new CmpObservableCollection <VMSGR_CartaDiaDetalleSubCategoria>(item.CollectionVMSGR_CartaDiaDetalleSubCategoria);
                foreach (VMSGR_CartaDiaDetalleSubCategoria items in vrCollectionESGR_VMSubCategoria)
                {
                    if (items.CollectionESGR_CartaDiaDetalle.Count() == 0)
                    {
                        item.CollectionVMSGR_CartaDiaDetalleSubCategoria.Remove(items);
                    }
                }

                if (item.CollectionVMSGR_CartaDiaDetalleSubCategoria.Count() == 0)
                {
                    CollectionVMSGR_CartaDiaDetalleCategoria.Remove(item);
                }
            }
            MethodContador();
            #endregion
        }