예제 #1
0
        private ClienteActivo getClienteFromReader(IDataReader Reader, CamposLibres xCP)
        {
            ClienteActivo Temporal = null;

            try
            {
                int ID = (int)(Reader["ID"]);
                if (xCP == null)
                {
                    xCP = new CamposLibres(ID);
                }
                string nombre = (string)(Reader["NOMBRE"]);
                string Cedula = (string)(Reader["CEDULA"] is DBNull ? string.Empty : Reader["CEDULA"]);
                Temporal = new ClienteActivo(ID, nombre, xCP, Cedula);


                Temporal.Nombre               = nombre;
                Temporal.IsBloqueo            = getDBoolean((string)(Reader["NOBLOQUEAR"] is DBNull ? bool.FalseString : Reader["NOBLOQUEAR"]));
                Temporal.DIC                  = getDBoolean((string)(Reader["DIC"] is DBNull ? bool.FalseString : Reader["DIC"]));
                Temporal.isActivo             = getDBoolean((string)(Reader["ACTIVO"] is DBNull ? bool.TrueString : Reader["ACTIVO"]));
                Temporal.isActivoDia          = getDBoolean((string)(Reader["ACTIVOCDIA"] is DBNull ? bool.TrueString : Reader["ACTIVOCDIA"]));
                Temporal.isFidelizado         = getDBoolean((string)(Reader["FIDELIZADO"] is DBNull ? bool.TrueString : Reader["FIDELIZADO"]));
                Temporal.isMonedaUnica        = getDBoolean((string)(Reader["SOLOPESOS"] is DBNull ? bool.TrueString : Reader["SOLOPESOS"]));
                Temporal.isOrden              = getDBoolean((string)(Reader["SOLOCONORDEN"] is DBNull ? bool.TrueString : Reader["SOLOCONORDEN"]));
                Temporal.NombreComercial      = (string)(Reader["NOMBRECOMERCIAL"] is DBNull ? string.Empty : Reader["NOMBRECOMERCIAL"]);
                Temporal.Rut                  = (string)(Reader["RUT"] is DBNull ? string.Empty : Reader["RUT"]);
                Temporal.Telefono             = (string)(Reader["TELEFONO"] is DBNull ? string.Empty : Reader["TELEFONO"]);
                Temporal.Celular              = (string)(Reader["CELULAR"] is DBNull ? string.Empty : Reader["CELULAR"]);
                Temporal.Pais                 = (string)(Reader["PAIS"] is DBNull ? string.Empty : Reader["PAIS"]);
                Temporal.Dpto                 = (string)(Reader["DPTO"] is DBNull ? string.Empty : Reader["DPTO"]);
                Temporal.Cobrador             = (string)(Reader["COBRADOR"] is DBNull ? string.Empty : Reader["COBRADOR"]);
                Temporal.Postal               = (string)(Reader["POSTAL"] is DBNull ? string.Empty : Reader["POSTAL"]);
                Temporal.Direccion            = (string)(Reader["DIRECCION"] is DBNull ? string.Empty : Reader["DIRECCION"]);
                Temporal.DireccionAlternativa = (string)(Reader["DIRECCIONOPCIONAL"] is DBNull ? string.Empty : Reader["DIRECCIONOPCIONAL"]);
                Temporal.Type                 = Convert.ToInt32((Reader["TIPO"] is DBNull ? 0 : Reader["TIPO"]));
                Temporal.Tope                 = Convert.ToDecimal((Reader["TOPE"] is DBNull ? 1 : Reader["TOPE"]));
                Temporal.Lineacredito         = Convert.ToDecimal((Reader["LINEA"] is DBNull ? 1 : Reader["LINEA"]));
                Temporal.Cierre               = Convert.ToByte((Reader["CIERRE"] is DBNull ? 0 : Reader["CIERRE"]));
                Temporal.Observaciones        = (string)(Reader["OBS"] is DBNull ? string.Empty : Reader["OBS"]);
                Temporal.Descatalogado        = Convert.ToBoolean((Reader["DESCATALOGADO"] as string == "T") ? true : false);
                Temporal.Fax                  = (string)(Reader["FAX"] is DBNull ? string.Empty : Reader["FAX"]);
                Temporal.Fecha                = Convert.ToDateTime((Reader["FECHAN"] is DBNull ? DateTime.MinValue : Reader["FECHAN"]));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Temporal);
        }
예제 #2
0
        private CamposLibres getCLFromReader(IDataReader Reader, int xCodCliente)
        {
            CamposLibres Temporal = null;
            int          ID       = xCodCliente;

            Temporal                    = new CamposLibres(ID);
            Temporal.Actividad          = (string)(Reader["ACTIVIDAD"] is DBNull ? string.Empty : Reader["ACTIVIDAD"]);
            Temporal.Comerciales        = (string)(Reader["REF_COMERCIALES"] is DBNull ? string.Empty : Reader["REF_COMERCIALES"]);
            Temporal.Antiguedad         = (string)(Reader["ANTIGUEDAD"] is DBNull ? string.Empty : Reader["ANTIGUEDAD"]);
            Temporal.OtrasObservaciones = (string)(Reader["OBSERVACIONES_"] is DBNull ? string.Empty : Reader["OBSERVACIONES_"]);
            Temporal.Plasticos          = (string)(Reader["TARJ_CREDITO"] is DBNull ? string.Empty : Reader["TARJ_CREDITO"]);
            Temporal.Email              = (string)(Reader["MAIL"] is DBNull ? string.Empty : Reader["MAIL"]);
            Temporal.Vehiculos          = (string)(Reader["VEHICULOS"] is DBNull ? string.Empty : Reader["VEHICULOS"]);
            Temporal.Bienes             = (string)(Reader["BIENES"] is DBNull ? string.Empty : Reader["BIENES"]);
            Temporal.Civil              = (string)(Reader["ESTADO_CIVIL"] is DBNull ? string.Empty : Reader["ESTADO_CIVIL"]);
            Temporal.Alquiler           = (string)(Reader["ALQUILER"] is DBNull ? string.Empty : Reader["ALQUILER"]);
            Temporal.ConyugeIngresos    = (int)(Reader["INGRESOS1"] is DBNull ? 0 : Reader["INGRESOS1"]);
            Temporal.ConyugeActividad   = (string)(Reader["ACTIVIDAD1"] is DBNull ? string.Empty : Reader["ACTIVIDAD1"]);
            Temporal.Cargo              = (string)(Reader["CARGO"] is DBNull ? string.Empty : Reader["CARGO"]);
            Temporal.Ingresos           = (int)(Reader["INGRESOS"] is DBNull ? 0 : Reader["INGRESOS"]);
            return(Temporal);
        }
예제 #3
0
        private ClienteActivo getClienteFromReader(IDataReader Reader)
        {
            ClienteActivo Temporal = null;

            try
            {
                CamposLibres CL     = null;
                int          ID     = (int)(Reader["ID"]);
                string       nombre = (string)(Reader["NOMBRE"]);
                string       Cedula = (string)(Reader["CEDULA"] is DBNull ? string.Empty : Reader["CEDULA"]);
                using (SqlConnection Con = new SqlConnection(GlobalConnectionString))
                {
                    Con.Open();
                    using (SqlCommand Com = new SqlCommand("SELECT top 1 ACTIVIDAD,REF_COMERCIALES,ANTIGUEDAD,OBSERVACIONES_,OBSERVACIONES1,TARJ_CREDITO,MAIL,VEHICULOS,BIENES,ESTADO_CIVIL,ALQUILER,INGRESOS1,ACTIVIDAD1,CARGO,INGRESOS,CONYUGE FROM CLIENTESCAMPOSLIBRES WHERE CODCLIENTE = @CODCLIENTE", Con))
                    {
                        Com.Parameters.Add(new SqlParameter("@CODCLIENTE", ID));
                        using (IDataReader R = ExecuteReader(Com))
                        {
                            while (R.Read())
                            {
                                CL = getCLFromReader(R, ID);
                            }
                        }
                    }
                }
                Temporal = new ClienteActivo(ID, nombre, CL, Cedula);


                Temporal.Nombre               = nombre;
                Temporal.IsBloqueo            = getDBoolean((string)(Reader["NOBLOQUEAR"] is DBNull ? bool.FalseString : Reader["NOBLOQUEAR"]));
                Temporal.DIC                  = getDBoolean((string)(Reader["DIC"] is DBNull ? bool.FalseString : Reader["DIC"]));
                Temporal.isActivo             = getDBoolean((string)(Reader["ACTIVO"] is DBNull ? bool.TrueString : Reader["ACTIVO"]));
                Temporal.isActivoDia          = getDBoolean((string)(Reader["ACTIVOCDIA"] is DBNull ? bool.TrueString : Reader["ACTIVOCDIA"]));
                Temporal.isFidelizado         = getDBoolean((string)(Reader["FIDELIZADO"] is DBNull ? bool.TrueString : Reader["FIDELIZADO"]));
                Temporal.isMonedaUnica        = getDBoolean((string)(Reader["SOLOPESOS"] is DBNull ? bool.TrueString : Reader["SOLOPESOS"]));
                Temporal.isOrden              = getDBoolean((string)(Reader["SOLOCONORDEN"] is DBNull ? bool.TrueString : Reader["SOLOCONORDEN"]));
                Temporal.NombreComercial      = (string)(Reader["NOMBRECOMERCIAL"] is DBNull ? string.Empty : Reader["NOMBRECOMERCIAL"]);
                Temporal.Rut                  = (string)(Reader["RUT"] is DBNull ? string.Empty : Reader["RUT"]);
                Temporal.Telefono             = (string)(Reader["TELEFONO"] is DBNull ? string.Empty : Reader["TELEFONO"]);
                Temporal.Celular              = (string)(Reader["CELULAR"] is DBNull ? string.Empty : Reader["CELULAR"]);
                Temporal.Pais                 = (string)(Reader["PAIS"] is DBNull ? string.Empty : Reader["PAIS"]);
                Temporal.Dpto                 = (string)(Reader["DPTO"] is DBNull ? string.Empty : Reader["DPTO"]);
                Temporal.Cobrador             = (string)(Reader["COBRADOR"] is DBNull ? string.Empty : Reader["COBRADOR"]);
                Temporal.Postal               = (string)(Reader["POSTAL"] is DBNull ? string.Empty : Reader["POSTAL"]);
                Temporal.Direccion            = (string)(Reader["DIRECCION"] is DBNull ? string.Empty : Reader["DIRECCION"]);
                Temporal.DireccionAlternativa = (string)(Reader["DIRECCIONOPCIONAL"] is DBNull ? string.Empty : Reader["DIRECCIONOPCIONAL"]);
                Temporal.Type                 = Convert.ToInt32((Reader["TIPO"] is DBNull ? 0 : Reader["TIPO"]));
                Temporal.Tope                 = Convert.ToDecimal((Reader["TOPE"] is DBNull ? 1 : Reader["TOPE"]));
                Temporal.Lineacredito         = Convert.ToDecimal((Reader["LINEA"] is DBNull ? 1 : Reader["LINEA"]));
                Temporal.Cierre               = Convert.ToByte((Reader["CIERRE"] is DBNull ? 0 : Reader["CIERRE"]));
                Temporal.Observaciones        = (string)(Reader["OBS"] is DBNull ? string.Empty : Reader["OBS"]);
                Temporal.Descatalogado        = Convert.ToBoolean((Reader["DESCATALOGADO"] as string == "T") ? true : false);
                Temporal.Fax                  = (string)(Reader["FAX"] is DBNull ? string.Empty : Reader["FAX"]);
                Temporal.Fecha                = Convert.ToDateTime((Reader["FECHAN"] is DBNull ? DateTime.MinValue : Reader["FECHAN"]));
                Temporal.Tarifa               = (Tarifa)getTarifaByCliente(ID);
                Temporal.SubCuentas           = getSubCuentasByCliente(ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Temporal);
        }