Пример #1
0
 public TransferenciaMaterialesGeneral ObtenerTransferenciaMaterialesGeneral(string Conexion, int IDReporte)
 {
     try
     {
         TransferenciaMaterialesGeneral Resultado = new TransferenciaMaterialesGeneral();
         DataSet Ds = SqlHelper.ExecuteDataset(Conexion, "Produccion.spCSLDB_get_TransferenciaMaterialesGeneralXID", IDReporte);
         if (Ds != null)
         {
             if (Ds.Tables.Count == 1)
             {
                 DataTableReader Dr = Ds.Tables[0].CreateDataReader();
                 while (Dr.Read())
                 {
                     Resultado.EmpleadoO = !Dr.IsDBNull(Dr.GetOrdinal("NombreOrigen")) ? Dr.GetString(Dr.GetOrdinal("NombreOrigen")) : string.Empty;
                     Resultado.EmpleadoD = !Dr.IsDBNull(Dr.GetOrdinal("NombreDestino")) ? Dr.GetString(Dr.GetOrdinal("NombreDestino")) : string.Empty;
                 }
                 Dr.Close();
             }
         }
         return(Resultado);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
        public override MenuItem LoadFromReader(DataTableReader reader)
        {
            var temp = new MenuItem();

            if (reader != null && !reader.IsClosed)
            {
                temp.MenuItemId = reader.GetInt32(0);
                if (!reader.IsDBNull(1))
                {
                    temp.MenuItemName = reader.GetString(1);
                }

                temp.Price          = reader.GetDecimal(2);
                temp.MenuItemCode   = reader.GetString(3);
                temp.MenuCategoryId = reader.GetInt32(4);
                if (!reader.IsDBNull(5))
                {
                    temp.MenuCategoryName = reader.GetString(5);
                }
                if (!reader.IsDBNull(6))
                {
                    temp.Description = reader.GetString(6);
                }
                if (!reader.IsDBNull(7))
                {
                    temp.FoodOrBeverage = reader.GetString(7);
                }
            }

            return(temp);
        }
        /// <summary>
        /// obtener reporte Ventas Por sucursal con detalle de ventas por caja
        /// </summary>
        /// <param name="Conexion"></param>
        /// <param name="IDReporte"></param>
        /// <returns></returns>
        public ReportesVentaXSucursal ObtenerDetalleReportesVentasXSucursal(string Conexion, int IDReporte)
        {
            try
            {
                ReportesVentaXSucursal Resultado = new ReportesVentaXSucursal();
                DataSet Ds = SqlHelper.ExecuteDataset(Conexion, "Reportes.spCSLDB_get_ReporteVentasXSucursalXID", IDReporte);
                if (Ds != null)
                {
                    if (Ds.Tables.Count == 3)
                    {
                        DataTableReader Dr = Ds.Tables[0].CreateDataReader();
                        while (Dr.Read())
                        {
                            Resultado.FechaInicio    = !Dr.IsDBNull(Dr.GetOrdinal("FechaInicio")) ? Dr.GetDateTime(Dr.GetOrdinal("FechaInicio")) : DateTime.MinValue;
                            Resultado.FechaFin       = !Dr.IsDBNull(Dr.GetOrdinal("FechaFin")) ? Dr.GetDateTime(Dr.GetOrdinal("FechaFin")) : DateTime.MinValue;
                            Resultado.NombreSucursal = !Dr.IsDBNull(Dr.GetOrdinal("NombreSucursal")) ? Dr.GetString(Dr.GetOrdinal("NombreSucursal")) : string.Empty;
                            break;
                        }
                        Dr.Close();

                        List <ReporteVentasXSucursalDetalleVentasXCaja> Lista1 = new List <ReporteVentasXSucursalDetalleVentasXCaja>();
                        ReporteVentasXSucursalDetalleVentasXCaja        Item;
                        DataTableReader Dr2 = Ds.Tables[1].CreateDataReader();
                        while (Dr2.Read())
                        {
                            Item                = new ReporteVentasXSucursalDetalleVentasXCaja();
                            Item.FechaInicio    = !Dr2.IsDBNull(Dr2.GetOrdinal("FechaInicio")) ? Dr2.GetDateTime(Dr2.GetOrdinal("FechaInicio")) : DateTime.MinValue;
                            Item.NombreCompleto = !Dr2.IsDBNull(Dr2.GetOrdinal("NombreCompleto")) ? Dr2.GetString(Dr2.GetOrdinal("NombreCompleto")) : string.Empty;
                            Item.TotalCobros    = !Dr2.IsDBNull(Dr2.GetOrdinal("TotalCobros")) ? Dr2.GetDecimal(Dr2.GetOrdinal("TotalCobros")) :0;


                            Lista1.Add(Item);
                        }
                        Dr2.Close();

                        List <ReporteVentasXSucursalDetalleXFormasPago> Lista2 = new List <ReporteVentasXSucursalDetalleXFormasPago>();
                        ReporteVentasXSucursalDetalleXFormasPago        Item2;
                        DataTableReader Dr3 = Ds.Tables[2].CreateDataReader();
                        while (Dr3.Read())
                        {
                            Item2             = new ReporteVentasXSucursalDetalleXFormasPago();
                            Item2.Descripcion = !Dr3.IsDBNull(Dr3.GetOrdinal("Descripcion")) ? Dr3.GetString(Dr3.GetOrdinal("Descripcion")) : string.Empty;
                            Item2.Monto       = !Dr3.IsDBNull(Dr3.GetOrdinal("Monto")) ? Dr3.GetDecimal(Dr3.GetOrdinal("Monto")) : 0;
                            Lista2.Add(Item2);
                        }
                        Dr2.Close();

                        Resultado.Detalle1 = Lista1;
                        Resultado.Detalle2 = Lista2;
                        Resultado.Completo = true;
                    }
                }
                return(Resultado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Se obtiene El reporte completo por medio del identificador del reporte
        /// </summary>
        /// <param name="Conexion"> Conexion a la base de datos</param>
        /// <param name="IDReporte"> Identificador del reporte</param>
        /// <returns></returns>
        public ReporteComprasPorProveedor ObtenerDetalleReporteComprasPorProveedor(string Conexion, int IDReporte)
        {
            try
            {
                ReporteComprasPorProveedor Resultado = new ReporteComprasPorProveedor();
                DataSet Ds = SqlHelper.ExecuteDataset(Conexion, "Reportes.spCSLDB_get_ReporteComprasProveedorXID", IDReporte);
                if (Ds != null)
                {
                    if (Ds.Tables.Count == 3)
                    {
                        DataTableReader Dr = Ds.Tables[0].CreateDataReader();
                        while (Dr.Read())
                        {
                            Resultado.FechaInicio = !Dr.IsDBNull(Dr.GetOrdinal("FechaInicio")) ? Dr.GetDateTime(Dr.GetOrdinal("FechaInicio")) : DateTime.MinValue;
                            Resultado.FechaFin    = !Dr.IsDBNull(Dr.GetOrdinal("FechaFin")) ? Dr.GetDateTime(Dr.GetOrdinal("FechaFin")) : DateTime.MinValue;
                            break;
                        }
                        Dr.Close();

                        List <ReporteComprasPorProveedorDetalle> Lista = new List <ReporteComprasPorProveedorDetalle>();
                        ReporteComprasPorProveedorDetalle        Item;
                        DataTableReader Dr2 = Ds.Tables[1].CreateDataReader();
                        while (Dr2.Read())
                        {
                            Item             = new ReporteComprasPorProveedorDetalle();
                            Item.IDProveedor = !Dr2.IsDBNull(Dr2.GetOrdinal("IDProveedor")) ? Dr2.GetString(Dr2.GetOrdinal("IDProveedor")) : string.Empty;
                            Item.Proveedor   = !Dr2.IsDBNull(Dr2.GetOrdinal("Proveedor")) ? Dr2.GetString(Dr2.GetOrdinal("Proveedor")) : string.Empty;
                            Item.Total       = !Dr2.IsDBNull(Dr2.GetOrdinal("Total")) ? Dr2.GetDecimal(Dr2.GetOrdinal("Total")) : 0;
                            Lista.Add(Item);
                        }
                        Dr2.Close();

                        List <ReporteComprasPorProveedorDetalle> ListaMob = new List <ReporteComprasPorProveedorDetalle>();
                        ReporteComprasPorProveedorDetalle        ItemMob;
                        DataTableReader Dr3 = Ds.Tables[2].CreateDataReader();
                        while (Dr3.Read())
                        {
                            ItemMob             = new ReporteComprasPorProveedorDetalle();
                            ItemMob.IDProveedor = !Dr3.IsDBNull(Dr3.GetOrdinal("IDProveedor")) ? Dr3.GetString(Dr3.GetOrdinal("IDProveedor")) : string.Empty;
                            ItemMob.Proveedor   = !Dr3.IsDBNull(Dr3.GetOrdinal("Proveedor")) ? Dr3.GetString(Dr3.GetOrdinal("Proveedor")) : string.Empty;
                            ItemMob.Total       = !Dr3.IsDBNull(Dr3.GetOrdinal("Total")) ? Dr3.GetDecimal(Dr3.GetOrdinal("Total")) : 0;
                            ListaMob.Add(ItemMob);
                        }
                        Dr3.Close();

                        Resultado.Detalle    = Lista;
                        Resultado.DetalleMob = ListaMob;
                        Resultado.Completo   = true;
                    }
                }
                return(Resultado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #5
0
        public Afiliados ObtenerAfiliadosAJAX(Afiliados _Datos)
        {
            try
            {
                List <Afiliados> Lista = new List <Afiliados>();
                Afiliados        Item;
                object[]         Parametros = { _Datos.Start,
                                                _Datos.Length,
                                                _Datos.SearchValue,
                                                _Datos.OrderBy,
                                                _Datos.OrderDirection ?? string.Empty,
                                                _Datos.TipoBusqueda,
                                                _Datos.Seccion,
                                                _Datos.FechaInicio,
                                                _Datos.FechaFin,
                                                _Datos.Ratificado,
                                                _Datos.DatosCompletados };
                DataSet          Ds = SqlHelper.ExecuteDataset(_Datos.Conexion, "spCSLDB_get_AfiliadosAjax", Parametros);

                if (Ds != null)
                {
                    if (Ds.Tables.Count == 2)
                    {
                        DataTableReader Dr2 = Ds.Tables[0].CreateDataReader();
                        while (Dr2.Read())
                        {
                            _Datos.RecordTotal  = !Dr2.IsDBNull(Dr2.GetOrdinal("TotalRecords")) ? Dr2.GetInt32(Dr2.GetOrdinal("TotalRecords")) : 0;
                            _Datos.RecordFilter = !Dr2.IsDBNull(Dr2.GetOrdinal("SearchRecords")) ? Dr2.GetInt32(Dr2.GetOrdinal("SearchRecords")) : 0;
                            break;
                        }

                        DataTableReader Dr = Ds.Tables[1].CreateDataReader();
                        while (Dr.Read())
                        {
                            Item                 = new Afiliados();
                            Item.IDAfiliado      = !Dr.IsDBNull(Dr.GetOrdinal("IDAfiliado")) ? Dr.GetString(Dr.GetOrdinal("IDAfiliado")) : string.Empty;
                            Item.Nombre          = !Dr.IsDBNull(Dr.GetOrdinal("Nombre")) ? Dr.GetString(Dr.GetOrdinal("Nombre")) : string.Empty;
                            Item.FechaAfiliacion = !Dr.IsDBNull(Dr.GetOrdinal("FechaAfiliacion")) ? Dr.GetDateTime(Dr.GetOrdinal("FechaAfiliacion")) : DateTime.Today;
                            Item.Ratificado      = !Dr.IsDBNull(Dr.GetOrdinal("Estatus")) ? Dr.GetBoolean(Dr.GetOrdinal("Estatus")) : false;
                            Item.Seccion         = !Dr.IsDBNull(Dr.GetOrdinal("Seccion")) ? Dr.GetInt32(Dr.GetOrdinal("Seccion")) : 0;
                            Item.ClaveElector    = !Dr.IsDBNull(Dr.GetOrdinal("ClaveElector")) ? Dr.GetString(Dr.GetOrdinal("ClaveElector")) : string.Empty;
                            Item.Operador        = !Dr.IsDBNull(Dr.GetOrdinal("Colaborador")) ? Dr.GetString(Dr.GetOrdinal("Colaborador")) : string.Empty;
                            Lista.Add(Item);
                        }
                        _Datos.ListaAfiliados = Lista;
                    }
                }
                return(_Datos);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
        // ----------------------------------------------
        // PRIVATE MEMBERS
        // ----------------------------------------------

        /// <summary>
        /// [PRIVATE] Fill a static from table reader
        /// </summary>
        /// <param name="oDT"></param>
        /// <returns></returns>
        private Static _FillStaticFromTableReader(DataTableReader oDT)
        {
            Static stc = new Static();

            stc.Tag     = (oDT.IsDBNull(oDT.GetOrdinal("tag")) ? "" : oDT["tag"].ToString());
            stc.Type    = (oDT.IsDBNull(oDT.GetOrdinal("type")) ? "" : oDT["type"].ToString());
            stc.Content = (oDT.IsDBNull(oDT.GetOrdinal("content")) ? "" : oDT["content"].ToString());
            stc.Value   = (oDT.IsDBNull(oDT.GetOrdinal("value")) ? "" : oDT["value"].ToString());
            stc.Length  = oDT.IsDBNull(oDT.GetOrdinal("length")) ? 0 : oDT.GetInt32(oDT.GetOrdinal("length"));

            return(stc);
        }
        public CajaChicaModelsResult ObtenerCajasChicasHistorial(DataTableParameters oDataTableParameters)
        {
            try
            {
                object[] Parametros = { oDataTableParameters.Draw, oDataTableParameters.SearchValue, oDataTableParameters.Length, oDataTableParameters.Start };
                DataSet  Ds         = SqlHelper.ExecuteDataset(_ConexionRepositorio.CadenaConexion, "cajachica.spCIDDB_ObtenerCajasHistorial", Parametros);
                if (Ds != null)
                {
                    if (Ds.Tables.Count == 2)
                    {
                        DataTableReader Dr0 = Ds.Tables[0].CreateDataReader();
                        int             TotalRows = 0, TotalRowsBusqueda = 0;
                        while (Dr0.Read())
                        {
                            TotalRows         = Dr0.IsDBNull(Dr0.GetOrdinal("TotalRows")) ? Dr0.GetInt32(Dr0.GetOrdinal("TotalRows")) : 0;
                            TotalRowsBusqueda = Dr0.IsDBNull(Dr0.GetOrdinal("TotalRowsBusqueda")) ? Dr0.GetInt32(Dr0.GetOrdinal("TotalRowsBusqueda")) : 0;
                            break;
                        }
                        Dr0.Close();

                        List <CajaChicaModels> Lista = new List <CajaChicaModels>();
                        DataTableReader        Dr    = Ds.Tables[1].CreateDataReader();
                        CajaChicaModels        Item;
                        while (Dr.Read())
                        {
                            Item = new CajaChicaModels
                            {
                                IdCaja         = !Dr.IsDBNull(Dr.GetOrdinal("IdCaja")) ? Dr.GetInt64(Dr.GetOrdinal("IdCaja")) : 0,
                                FechaApertura  = !Dr.IsDBNull(Dr.GetOrdinal("FechaApertura")) ? Dr.GetDateTime(Dr.GetOrdinal("FechaApertura")) : DateTime.MinValue,
                                NombreEmpleado = !Dr.IsDBNull(Dr.GetOrdinal("NombreEmpleado")) ? Dr.GetString(Dr.GetOrdinal("NombreEmpleado")) : string.Empty,
                                MontoApertura  = !Dr.IsDBNull(Dr.GetOrdinal("MontoApertura")) ? Dr.GetDecimal(Dr.GetOrdinal("MontoApertura")) : 0m,
                                Saldo          = !Dr.IsDBNull(Dr.GetOrdinal("Saldo")) ? Dr.GetDecimal(Dr.GetOrdinal("Saldo")) : 0m,
                                TotalArqueo    = !Dr.IsDBNull(Dr.GetOrdinal("Arqueo")) ? Dr.GetDecimal(Dr.GetOrdinal("Arqueo")) : 0m,
                                Diferencia     = !Dr.IsDBNull(Dr.GetOrdinal("Diferencia")) ? Dr.GetDecimal(Dr.GetOrdinal("Diferencia")) : 0m
                                                 //PersonaEntrega = !Dr.IsDBNull(Dr.GetOrdinal("PersonaEntrega")) ? Dr.GetString(Dr.GetOrdinal("PersonaEntrega")) : string.Empty
                            };
                            Lista.Add(Item);
                        }
                        Dr.Close();
                        return(new CajaChicaModelsResult {
                            TotalRecords = TotalRows, SearchRecords = TotalRowsBusqueda, Lista = Lista
                        });
                    }
                }

                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public MobiliarioResguardo ObtenerDetalleMobiliarios(MobiliarioResguardo Datos)
 {
     try
     {
         MobiliarioResguardo DatosGuardados = new MobiliarioResguardo();
         DatosGuardados.Completado = false;
         DataSet Ds = SqlHelper.ExecuteDataset(Datos.Conexion, "spCSLDB_get_Mobiliario_Detalle", Datos.IDMobiliarioResguardo);
         if (Ds != null)
         {
             if (Ds.Tables.Count == 2)
             {
                 if (Ds.Tables[0] != null)
                 {
                     DataTableReader Dr = Ds.Tables[0].CreateDataReader();
                     while (Dr.Read())
                     {
                         DatosGuardados.IDMobiliarioResguardo = Datos.IDMobiliarioResguardo;
                         DatosGuardados.IDSucursal            = !Dr.IsDBNull(Dr.GetOrdinal("IDSucursal")) ? Dr.GetString(Dr.GetOrdinal("IDSucursal")) : string.Empty;
                         DatosGuardados.IDStatusMobiliario    = (int)(!Dr.IsDBNull(Dr.GetOrdinal("Estatus")) ? Dr.GetInt32(Dr.GetOrdinal("Estatus")) : 0);
                     }
                     Dr.Close();
                 }
                 if (Ds.Tables[1] != null)
                 {
                     List <MobiliarioResguardo> Lista = new List <MobiliarioResguardo>();
                     MobiliarioResguardo        Item;
                     DataTableReader            Dr = Ds.Tables[1].CreateDataReader();
                     while (Dr.Read())
                     {
                         Item = new MobiliarioResguardo();
                         Item.IDMobiliarioDetalle = !Dr.IsDBNull(Dr.GetOrdinal("IDMobiliarioDetalle")) ? Dr.GetString(Dr.GetOrdinal("IDMobiliarioDetalle")) : string.Empty;
                         Item.IDMobiliario        = !Dr.IsDBNull(Dr.GetOrdinal("IDMobiliario")) ? Dr.GetString(Dr.GetOrdinal("IDMobiliario")) : string.Empty;
                         Item.Codigo      = !Dr.IsDBNull(Dr.GetOrdinal("Codigo")) ? Dr.GetString(Dr.GetOrdinal("Codigo")) : string.Empty;
                         Item.Descripcion = !Dr.IsDBNull(Dr.GetOrdinal("Descripcion")) ? Dr.GetString(Dr.GetOrdinal("Descripcion")) : string.Empty;
                         Item.Marca       = !Dr.IsDBNull(Dr.GetOrdinal("Marca")) ? Dr.GetString(Dr.GetOrdinal("Marca")) : string.Empty;
                         Item.Modelo      = !Dr.IsDBNull(Dr.GetOrdinal("Modelo")) ? Dr.GetString(Dr.GetOrdinal("Modelo")) : string.Empty;
                         Item.Cantidad    = (int)(!Dr.IsDBNull(Dr.GetOrdinal("Cantidad")) ? Dr.GetInt32(Dr.GetOrdinal("Cantidad")) : 0);
                         Lista.Add(Item);
                     }
                     DatosGuardados.ListaMobiliarioDetalle = Lista;
                     Dr.Close();
                 }
                 DatosGuardados.Completado = true;
             }
         }
         return(DatosGuardados);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public NominaModels ObtenerListasDeConceptosXID(NominaModels Datos)
        {
            try
            {
                object[] parametros = { Datos.IDEmpleado };
                DataSet  Ds         = SqlHelper.ExecuteDataset(Datos.Conexion, "spCSLDB_Nomina_get_ConceptosNomina", parametros);
                if (Ds != null)
                {
                    if (Ds.Tables.Count > 0)
                    {
                        List <NominaConceptosFijosModels> ListaFijo = new List <NominaConceptosFijosModels>();
                        NominaConceptosFijosModels        Item2;
                        DataTableReader Dr = Ds.Tables[0].CreateDataReader();
                        while (Dr.Read())
                        {
                            Item2 = new NominaConceptosFijosModels();
                            Item2.IDConceptosFijo = !Dr.IsDBNull(Dr.GetOrdinal("IDConceptoFijo")) ? Dr.GetString(Dr.GetOrdinal("IDConceptoFijo")) : string.Empty;
                            Item2.IDConcepto      = !Dr.IsDBNull(Dr.GetOrdinal("IDConcepto")) ? Dr.GetInt32(Dr.GetOrdinal("IDConcepto")) : 0;
                            Item2.NombreConcepto  = !Dr.IsDBNull(Dr.GetOrdinal("Concepto")) ? Dr.GetString(Dr.GetOrdinal("Concepto")) : string.Empty;
                            Item2.Monto           = !Dr.IsDBNull(Dr.GetOrdinal("Monto")) ? Dr.GetDecimal(Dr.GetOrdinal("Monto")) : 0;
                            Item2.Simbolo         = !Dr.IsDBNull(Dr.GetOrdinal("Simbolo")) ? Dr.GetString(Dr.GetOrdinal("Simbolo")) : string.Empty;
                            ListaFijo.Add(Item2);
                        }
                        Datos.ListaConceptosFijo = ListaFijo;
                        List <NominaConceptosEmpModels> ListaVariable = new List <NominaConceptosEmpModels>();
                        NominaConceptosEmpModels        Item;
                        DataTableReader DTR  = Ds.Tables[1].CreateDataReader();
                        DataTable       Tbl1 = Ds.Tables[1];
                        while (DTR.Read())
                        {
                            Item = new NominaConceptosEmpModels();
                            Item.IDC     Item.DiasDescuentoFaltas   = Dr2.GetInt16(Dr2.GetOrdinal("DiasDescuentoFaltas"));
                            Item.Retardos              = Dr2.GetInt16(Dr2.GetOrdinal("Retardos"));
                            Item.FaltasRetardo         = Dr2.GetInt16(Dr2.GetOrdinal("FaltasRetardos"));
                            Item.DiasDescuentoRetardos = Dr2.GetInt16(Dr2.GetOrdinal("DiasDescuentoRetardos"));
                            Item.DiasDescuentoTotales  = Dr2.GetInt16(Dr2.GetOrdinal("DiasDescuentoTotales"));
                            Item.DiasFestivos          = Dr2.GetInt16(Dr2.GetOrdinal("DiasFestivos"));
                            Item.DiasDomingo           = Dr2.GetInt16(Dr2.GetOrdinal("DiasDomingo"));
                            Item.DiasVacaciones        = Dr2.GetInt16(Dr2.GetOrdinal("DiasVacaciones"));
                            Lista.Add(Item);
                        }
                        Datos.ListaResumenDetalleNomina = Lista;

                        Datos.Completado = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Metodo con el cual se obtiene la infor referente a un reporte especifico
        /// </summary>
        /// <param name="Conexion">Cadena de conexion con la base de datos</param>
        /// <param name="IDReporte">identiicaador del reporte</param>
        /// <returns></returns>
        public ReporteConsumoMaterial ObtenerDetalleReporteConsumoMaterial(string Conexion, int IDReporte)
        {
            try
            {
                ReporteConsumoMaterial Resultado = new ReporteConsumoMaterial();
                DataSet Ds = SqlHelper.ExecuteDataset(Conexion, "Reportes.spCSLDB_get_ReporteConsumoMaterialXID", IDReporte);
                if (Ds != null)
                {
                    if (Ds.Tables.Count == 2)
                    {
                        DataTableReader Dr = Ds.Tables[0].CreateDataReader();
                        while (Dr.Read())
                        {
                            Resultado.FechaInicio = !Dr.IsDBNull(Dr.GetOrdinal("fechaInicio")) ? Dr.GetDateTime(Dr.GetOrdinal("fechaInicio")) : DateTime.MinValue;
                            Resultado.FechaFin    = !Dr.IsDBNull(Dr.GetOrdinal("fechaFin")) ? Dr.GetDateTime(Dr.GetOrdinal("fechaFin")) : DateTime.MinValue;
                            Resultado.Sucursal    = !Dr.IsDBNull(Dr.GetOrdinal("Sucursal")) ? Dr.GetString(Dr.GetOrdinal("Sucursal")) : string.Empty;
                            break;
                        }
                        Dr.Close();

                        List <ReporteConsumoMaterialDetalle> Lista = new List <ReporteConsumoMaterialDetalle>();
                        ReporteConsumoMaterialDetalle        Item;
                        DataTableReader Dr2 = Ds.Tables[1].CreateDataReader();
                        while (Dr2.Read())
                        {
                            Item                = new ReporteConsumoMaterialDetalle();
                            Item.Tipo           = !Dr2.IsDBNull(Dr2.GetOrdinal("Tipo")) ? Dr2.GetInt32(Dr2.GetOrdinal("Tipo")) :0;
                            Item.IDGeneral      = !Dr2.IsDBNull(Dr2.GetOrdinal("IDGeneral")) ? Dr2.GetString(Dr2.GetOrdinal("IDGeneral")) : string.Empty;
                            Item.Nombre         = !Dr2.IsDBNull(Dr2.GetOrdinal("Nombre")) ? Dr2.GetString(Dr2.GetOrdinal("Nombre")) : string.Empty;
                            Item.IDProducto     = !Dr2.IsDBNull(Dr2.GetOrdinal("IDProducto")) ? Dr2.GetString(Dr2.GetOrdinal("IDProducto")) : string.Empty;
                            Item.NombreProducto = !Dr2.IsDBNull(Dr2.GetOrdinal("Producto")) ? Dr2.GetString(Dr2.GetOrdinal("Producto")) : string.Empty;
                            Item.Clave          = !Dr2.IsDBNull(Dr2.GetOrdinal("Clave")) ? Dr2.GetString(Dr2.GetOrdinal("Clave")) : string.Empty;
                            Item.Fecha          = !Dr2.IsDBNull(Dr2.GetOrdinal("Fecha")) ? Dr2.GetDateTime(Dr2.GetOrdinal("Fecha")) : DateTime.MinValue;
                            Item.Produccion     = !Dr2.IsDBNull(Dr2.GetOrdinal("Produccion")) ? Dr2.GetBoolean(Dr2.GetOrdinal("Produccion")) : false;
                            Item.CumpleMetrica  = !Dr2.IsDBNull(Dr2.GetOrdinal("CumpleMetrica")) ? Dr2.GetBoolean(Dr2.GetOrdinal("CumpleMetrica")) : false;
                            Lista.Add(Item);
                        }
                        Dr2.Close();

                        Resultado.Detalle  = Lista;
                        Resultado.Completo = true;
                    }
                }
                return(Resultado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ReporteGarantias ObtenerDetalleReporteGarantias(string Conexion, int IDReporte)
        {
            try
            {
                ReporteGarantias Resultado = new ReporteGarantias();
                DataSet          Ds        = SqlHelper.ExecuteDataset(Conexion, "Reportes.spCSLDB_get_ReporteGarantiasXID", IDReporte);
                if (Ds != null)
                {
                    if (Ds.Tables.Count == 2)
                    {
                        DataTableReader Dr = Ds.Tables[0].CreateDataReader();
                        while (Dr.Read())
                        {
                            Resultado.FechaInicio = !Dr.IsDBNull(Dr.GetOrdinal("fechaInicio")) ? Dr.GetDateTime(Dr.GetOrdinal("fechaInicio")) : DateTime.MinValue;
                            Resultado.FechaFin    = !Dr.IsDBNull(Dr.GetOrdinal("fechaFin")) ? Dr.GetDateTime(Dr.GetOrdinal("fechaFin")) : DateTime.MinValue;
                            break;
                        }
                        Dr.Close();

                        List <ReporteGarantias> Lista = new List <ReporteGarantias>();
                        ReporteGarantias        Item;
                        DataTableReader         Dr2 = Ds.Tables[1].CreateDataReader();
                        while (Dr2.Read())
                        {
                            Item                = new ReporteGarantias();
                            Item.Fecha          = !Dr2.IsDBNull(Dr2.GetOrdinal("fecha")) ? Dr2.GetDateTime(Dr2.GetOrdinal("fecha")) : DateTime.MinValue;
                            Item.Id_sucursal    = !Dr2.IsDBNull(Dr2.GetOrdinal("id_sucursal")) ? Dr2.GetString(Dr2.GetOrdinal("id_sucursal")) : string.Empty;
                            Item.NombreSucursal = !Dr2.IsDBNull(Dr2.GetOrdinal("nombreSucursal")) ? Dr2.GetString(Dr2.GetOrdinal("nombreSucursal")) : string.Empty;
                            Item.NombreCompleto = !Dr2.IsDBNull(Dr2.GetOrdinal("nombreCompleto")) ? Dr2.GetString(Dr2.GetOrdinal("nombreCompleto")) : string.Empty;
                            Item.Observaciones  = !Dr2.IsDBNull(Dr2.GetOrdinal("observaciones")) ? Dr2.GetString(Dr2.GetOrdinal("observaciones")) : string.Empty;
                            Item.Nombre         = !Dr2.IsDBNull(Dr2.GetOrdinal("nombre")) ? Dr2.GetString(Dr2.GetOrdinal("nombre")) : string.Empty;
                            Item.Total          = !Dr2.IsDBNull(Dr2.GetOrdinal("total")) ? Dr2.GetDecimal(Dr2.GetOrdinal("total")) : 0;
                            Item.EmpleadoAplica = !Dr2.IsDBNull(Dr2.GetOrdinal("empleadoAplica")) ? Dr2.GetString(Dr2.GetOrdinal("empleadoAplica")) : string.Empty;

                            Lista.Add(Item);
                        }
                        Dr2.Close();

                        Resultado.Detalle    = Lista;
                        Resultado.Completado = true;
                    }
                }
                return(Resultado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #12
0
        private string getStudentSSN(DataTable currentSheet, DataTableReader reader, StudentCacheDTO cacheItem, List <string> recordErrors)
        {
            string Student_SSN;

            if (reader.IsDBNull(reader.GetOrdinal(FileHeaderDefinitions.StudentSSN)))
            {
                // generate SSN
                var random = new Random();
                Student_SSN = $"{random.Next(1, 999)}-{random.Next(1, 99)}-{random.Next(1, 9999)}";
                //chceck if in cache
                while (currentSheet.Select($"[{FileHeaderDefinitions.StudentSSN}] = '{Student_SSN}'").Any())
                {
                    Student_SSN = $"{random.Next(1, 999)}-{random.Next(1, 99)}-{random.Next(1, 9999)}";
                }
                // check that same Name,DOB and grade do not exist in the same school
                //Grade condition
                var gradeFilter           = cacheItem.Grade != null ? "Grade = " + cacheItem.Grade : "Grade Is Null";
                var duplicateStudentQuery = $"FirstName = '{cacheItem.FirstName}' AND LastName = '{cacheItem.LastName}' AND DOB = '{cacheItem.DOB}' AND {gradeFilter} AND SchoolCode = '{ cacheItem.SchoolCode }'";
                var hasMultipleEntires    = currentSheet.Select(duplicateStudentQuery).Count() > 1;

                if (hasMultipleEntires)
                {
                    recordErrors.Add($"Another student has the same record details in this school");
                }
            }
            else
            {
                Student_SSN = reader.GetString(reader.GetOrdinal(FileHeaderDefinitions.StudentSSN));
            }

            return(Student_SSN);
        }
        public int GuardarCalificacion(CatAlumnosXGrupoModels datos)
        {
            try
            {
                DataSet ds = SqlHelper.ExecuteDataset(datos.conexion, CommandType.StoredProcedure, "spCSLDB_V2_set_CalificacionesFinales",
                                                      new SqlParameter("@IDAsignatura", datos.IDAsignatura),

                                                      new SqlParameter("@tablaCalificacionesXAlumno", datos.TablaCalificaciones),
                                                      new SqlParameter("@usuario", datos.user));
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0] != null)
                        {
                            //datos.TablaNotificacion = ds.Tables[0];

                            DataTableReader DTR  = ds.Tables[0].CreateDataReader();
                            DataTable       Tbl1 = ds.Tables[0];
                            while (DTR.Read())
                            {
                                datos.Resultado = !DTR.IsDBNull(DTR.GetOrdinal("resultado")) ? DTR.GetInt32(DTR.GetOrdinal("resultado")) : 1;
                            }
                        }
                    }
                }
                return(Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()));
            }
            catch (Exception ex)
            {
                return(-1);
            }
        }
Пример #14
0
        public ReporteTrabajosRealizados ObtenerDetalleReporteTrabajosRealizados(string Conexion, int IDReporte)
        {
            try
            {
                ReporteTrabajosRealizados Resultado = new ReporteTrabajosRealizados();
                DataSet Ds = SqlHelper.ExecuteDataset(Conexion, "Reportes.spCSLDB_get_ReporteTrabajosRealizadosXID", IDReporte);
                if (Ds != null)
                {
                    if (Ds.Tables.Count == 2)
                    {
                        DataTableReader Dr = Ds.Tables[0].CreateDataReader();
                        while (Dr.Read())
                        {
                            Resultado.FechaInicio = !Dr.IsDBNull(Dr.GetOrdinal("FechaInicio")) ? Dr.GetDateTime(Dr.GetOrdinal("FechaInicio")) : DateTime.MinValue;
                            Resultado.FechaFin    = !Dr.IsDBNull(Dr.GetOrdinal("FechaFin")) ? Dr.GetDateTime(Dr.GetOrdinal("FechaFin")) : DateTime.MinValue;
                            break;
                        }
                        Dr.Close();

                        List <ReporteTrabajosRealizadosDetalle> Lista = new List <ReporteTrabajosRealizadosDetalle>();
                        ReporteTrabajosRealizadosDetalle        Item;
                        DataTableReader Dr2 = Ds.Tables[1].CreateDataReader();
                        while (Dr2.Read())
                        {
                            Item                   = new ReporteTrabajosRealizadosDetalle();
                            Item.IDSucursal        = !Dr2.IsDBNull(Dr2.GetOrdinal("IDSucursal")) ? Dr2.GetString(Dr2.GetOrdinal("IDSucursal")) : string.Empty;
                            Item.Sucursal          = !Dr2.IsDBNull(Dr2.GetOrdinal("Sucursal")) ? Dr2.GetString(Dr2.GetOrdinal("Sucursal")) : string.Empty;
                            Item.IDEmpleado        = !Dr2.IsDBNull(Dr2.GetOrdinal("IDEmpleado")) ? Dr2.GetString(Dr2.GetOrdinal("IDEmpleado")) : string.Empty;
                            Item.NombreEmpleado    = !Dr2.IsDBNull(Dr2.GetOrdinal("NombreEmpleado")) ? Dr2.GetString(Dr2.GetOrdinal("NombreEmpleado")) : string.Empty;
                            Item.IDServicio        = !Dr2.IsDBNull(Dr2.GetOrdinal("IDServicio")) ? Dr2.GetString(Dr2.GetOrdinal("IDServicio")) : string.Empty;
                            Item.NombreServicio    = !Dr2.IsDBNull(Dr2.GetOrdinal("NombreServicio")) ? Dr2.GetString(Dr2.GetOrdinal("NombreServicio")) : string.Empty;
                            Item.CantidadServicios = !Dr2.IsDBNull(Dr2.GetOrdinal("CantidadServicios")) ? Dr2.GetInt32(Dr2.GetOrdinal("CantidadServicios")) : 0;
                            Lista.Add(Item);
                        }
                        Dr2.Close();

                        Resultado.Detalle  = Lista;
                        Resultado.Completo = true;
                    }
                }
                return(Resultado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #15
0
        } //----------------------------------

        //this function gets the employee image path
        private String GetEmployeeImagePath(CommonExchange.SysAccess userInfo, String patientId, String startUp)
        {
            String imagePath = startUp + _imagePath;

            if (!Directory.Exists(imagePath))
            {
                //creates the directory
                DirectoryInfo dirInfo = new DirectoryInfo(imagePath);
                dirInfo.Create();
                dirInfo.Attributes = FileAttributes.Hidden;
            }

            DataTable imageTable;

            using (DatabaseLib.DbLibPatientManager dbLib = new DatabaseLib.DbLibPatientManager())
            {
                imageTable = dbLib.SelectImagePatientInformation(userInfo, patientId);
            }

            using (DataTableReader tableReader = new DataTableReader(imageTable))
            {
                if (tableReader.HasRows)
                {
                    Int32 picColumn = 2;

                    while (tableReader.Read())
                    {
                        if (!tableReader.IsDBNull(picColumn))
                        {
                            imagePath += "\\" + tableReader["sysid_patient"].ToString() + tableReader["extension_name"].ToString();

                            if (!File.Exists(imagePath))
                            {
                                Int64 len = tableReader.GetBytes(picColumn, 0, null, 0, 0);
                                // Create a buffer to hold the bytes, and then
                                // read the bytes from the DataTableReader.
                                Byte[] buffer = new Byte[len];
                                tableReader.GetBytes(picColumn, 0, buffer, 0, (Int32)len);

                                // Create a new Bitmap object, passing the array
                                // of bytes to the constructor of a MemoryStream.
                                using (Bitmap image = new Bitmap(new MemoryStream(buffer)))
                                {
                                    image.Save(imagePath);
                                }
                            }
                        }
                    }
                }
                else
                {
                    imagePath = null;
                }

                tableReader.Close();
            }

            return(imagePath);
        } //------------------------------
Пример #16
0
 public CompraAlmacenModels ObtenerGridComprasAJAX(string _Conexion, int _Start, int _Length, string _SearchValue, int _OrderBy, string _OrderDirection)
 {
     try
     {
         CompraAlmacenModels Resultado  = new CompraAlmacenModels();
         object[]            Parametros = { _Start, _Length, _SearchValue, _OrderBy, _OrderDirection };
         DataSet             Ds         = SqlHelper.ExecuteDataset(_Conexion, "spCSLDB_get_CompraAlmcen_DataTable", Parametros);
         if (Ds != null)
         {
             if (Ds.Tables.Count == 2)
             {
                 DataTableReader Dr = Ds.Tables[0].CreateDataReader();
                 while (Dr.Read())
                 {
                     Resultado.SearchRecords = !Dr.IsDBNull(Dr.GetOrdinal("SearchRecords")) ? Dr.GetInt32(Dr.GetOrdinal("SearchRecords")) : 0;
                     Resultado.TotalRecords  = !Dr.IsDBNull(Dr.GetOrdinal("TotalRecords")) ? Dr.GetInt32(Dr.GetOrdinal("TotalRecords")) : 0;
                     break;
                 }
                 Dr.Close();
                 List <CompraAlmacenModels> lista = new List <CompraAlmacenModels>();
                 DataTableReader            dr    = Ds.Tables[1].CreateDataReader();
                 CompraAlmacenModels        item;
                 while (dr.Read())
                 {
                     item = new CompraAlmacenModels();
                     item.IDCompraAlmacen = dr["id_compraAlmacen"].ToString();
                     //item.IDCompraAlmacen = !dr.IsDBNull(dr.GetOrdinal("id_compraAlmacen")) ? dr.GetString(dr.GetOrdinal("id_compraAlmacen")) : string.Empty;
                     item.NumFacturaNota            = !dr.IsDBNull(dr.GetOrdinal("numFacturaNota")) ? dr.GetString(dr.GetOrdinal("numFacturaNota")) : string.Empty;
                     item.Sucursal.NombreSucursal   = !dr.IsDBNull(dr.GetOrdinal("nombreSuc")) ? dr.GetString(dr.GetOrdinal("nombreSuc")) : string.Empty;
                     item.Proveedor.nombreProveedor = !dr.IsDBNull(dr.GetOrdinal("proveedor")) ? dr.GetString(dr.GetOrdinal("proveedor")) : string.Empty;
                     item.IDEstatusCompra           = !dr.IsDBNull(dr.GetOrdinal("id_estatusCompra")) ? dr.GetInt16(dr.GetOrdinal("id_estatusCompra")) : 0;
                     item.StatusCompra = !dr.IsDBNull(dr.GetOrdinal("estatus")) ? dr.GetString(dr.GetOrdinal("estatus")) : string.Empty;
                     item.MontoTotal   = !dr.IsDBNull(dr.GetOrdinal("montoTotal")) ? dr.GetDecimal(dr.GetOrdinal("montoTotal")) : 0;
                     lista.Add(item);
                 }
                 dr.Close();
                 Resultado.Lista = lista;
             }
         }
         return(Resultado);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #17
0
 public MoneyReceiptEntity(DataTableReader reader)
 {
     this.userAddedOn     = Convert.ToDateTime(reader["AddedOn"]);
     this.userEditedOn    = Convert.ToDateTime(reader["EditedOn"]);
     this.moneyReceiptId  = long.Parse(reader["MRId"].ToString());
     this.invoiceId       = long.Parse(reader["InvoiceId"].ToString());
     this.invoiceNo       = reader["InvoiceNo"].ToString();
     this.invoiceTypeId   = Convert.ToInt32(reader["InvoiceType"]);
     this.invoiceDate     = Convert.ToDateTime(reader["InvoiceDate"]);
     this.invoiceAmount   = Convert.ToDecimal(reader["InvoiceAmount"]);
     this.bLId            = long.Parse(reader["BLId"].ToString());
     this.bLNo            = reader["BLNumber"].ToString();
     this.locationId      = Convert.ToInt32(reader["LocationId"]);
     this.locationName    = reader["MRLocation"].ToString();
     this.locationAddress = reader["LocationAddress"].ToString();
     this.totReceipt      = Convert.ToDecimal(reader["TotReceipt"]);
     this.rstoWord        = reader["RsInWord"].ToString();
     this.nvoccId         = Convert.ToInt32(reader["NVOCCId"]);
     this.nvoccName       = reader["NVOCCName"].ToString();
     this.mrNo            = reader["MRNo"].ToString();
     this.mrDate          = Convert.ToDateTime(reader["MRDate"]);
     this.cashPayment     = Convert.ToDecimal(reader["CashPayment"]);
     this.chequePayment   = Convert.ToDecimal(reader["ChequePayment"]);
     this.tdsDeducted     = Convert.ToDecimal(reader["TDSDeducted"]);
     this.chequeBank      = reader["ChequeBank"].ToString();
     if (!reader.IsDBNull(reader.GetOrdinal("ChequeDate")))
     {
         this.chequeDate = Convert.ToDateTime(reader["ChequeDate"]);
     }
     if (!reader.IsDBNull(reader.GetOrdinal("fk_CreditorID")))
     {
         this.CreID = Convert.ToInt32(reader["CreditorID"]);
     }
     this.chequeNo     = reader["ChequeNo"].ToString();
     this.MRAmount     = Convert.ToDecimal(reader["MRAmount"]);
     this.userAddedId  = Convert.ToInt32(reader["UserAdded"]);
     this.userEditedId = Convert.ToInt32(reader["UserLastEdited"]);
     this.userAddedOn  = Convert.ToDateTime(reader["AddedOn"]);
     this.userEditedOn = Convert.ToDateTime(reader["EditedOn"]);
     this.voyageNo     = reader["VoyageNo"].ToString();
     this.vesselName   = reader["VesselName"].ToString();
     this.rcvdFrom     = reader["RcvdFrom"].ToString();
     this.cha          = reader["cha"].ToString();
     //this.totReceipt = Convert.ToDecimal(reader["TotReceipt"]);
 }
    private static void TestGetChars(DataTableReader reader, int bufferSize)
    {
        // The filename is in column 0, and the contents are in column 1.
        const int FILENAME_COLUMN = 0;
        const int DATA_COLUMN     = 1;

        char[] buffer;
        long   offset;
        int    charsRead = 0;
        string fileName;
        int    currentBufferSize = 0;

        while (reader.Read())
        {
            // Reinitialize the buffer size and the buffer itself.
            currentBufferSize = bufferSize;
            buffer            = new char[bufferSize];
            // For each row, write the data to the specified file.
            // First, verify that the FileName column isn't null.
            if (!reader.IsDBNull(FILENAME_COLUMN))
            {
                // Get the file name, and create a file with
                // the supplied name.
                fileName = reader.GetString(FILENAME_COLUMN);
                // Start at the beginning.
                offset = 0;

                using (StreamWriter outputStream =
                           new StreamWriter(fileName, false))
                {
                    try
                    {
                        // Loop through all the characters in the input field,
                        // incrementing the offset for the next time. If this
                        // pass through the loop reads characters, write them to
                        // the output stream.
                        do
                        {
                            charsRead = (int)reader.GetChars(DATA_COLUMN, offset,
                                                             buffer, 0, bufferSize);
                            if (charsRead > 0)
                            {
                                outputStream.Write(buffer, 0, charsRead);
                                offset += charsRead;
                            }
                        } while (charsRead > 0);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(fileName + ": " + ex.Message);
                    }
                }
            }
        }
        Console.WriteLine("Press Enter key to finish.");
        Console.ReadLine();
    }