Пример #1
0
        public static DateTime?ExtractDT()
        {
            DateTime?FechaHora = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("System_DateTimeServer");
                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        reader.Read();

                        FechaHora = (DateTime?)reader["HourDate"];
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                return(FechaHora);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
        public List <Investment> SelectByUserId(int userId, out LogError logError)
        {
            logError = null;
            List <Investment> _investmentList = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("Investments_SelectByUser_Id");
                DataAccessEnterprise.AddParameter(_command, "@user_id", userId, SqlDbType.Int, 1, ParameterDirection.Input);

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        _investmentList = new List <Investment>();
                        while (reader.Read())
                        {
                            int      inve_id                = (int)reader["inve_id"];
                            int      user_id                = (int)reader["user_id"];
                            decimal  inve_amount            = (decimal)reader["inve_amount"];
                            DateTime inve_date              = (DateTime)reader["inve_date"];
                            string   inve_observation       = (string)reader["inve_observation"];
                            int      inve_costeffectiveness = (int)reader["inve_costeffectiveness"];
                            char     inve_state             = Convert.ToChar(reader["inve_state"]);
                            string   audi_usercrea          = (string)reader["audi_usercrea"];
                            DateTime audi_fechcrea          = (DateTime)reader["audi_fechcrea"];
                            string   audi_usermodi          = reader["audi_usermodi"] == DBNull.Value ? null : (string)reader["audi_usermodi"];
                            DateTime?audi_fechmodi          = reader["audi_fechmodi"] == DBNull.Value ? null : (DateTime?)reader["audi_fechmodi"];

                            var _investment = new Investment()
                            {
                                INVE_ID                = inve_id,
                                USER_ID                = user_id,
                                INVE_Amount            = inve_amount,
                                INVE_Date              = inve_date,
                                INVE_Observation       = inve_observation,
                                INVE_CostEffectiveness = inve_costeffectiveness,
                                INVE_State             = inve_state,
                                AUDI_UserCrea          = audi_usercrea,
                                AUDI_FechCrea          = audi_fechcrea,
                                AUDI_UserModi          = audi_usermodi,
                                AUDI_FechModi          = audi_fechmodi
                            };
                            _investmentList.Add(_investment);
                        }
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_investmentList == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registros no encontrados",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_investmentList);
        }
Пример #3
0
        public List <Media> SelectByIdTypeMED(string tabMED, string codMED, out LogError logError)
        {
            logError = null;
            List <Media> _mediaList = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("Media_SelectAllByTypeMED");
                DataAccessEnterprise.AddParameter(_command, "TYPE_TabMED", tabMED, SqlDbType.VarChar, 3, ParameterDirection.Input);
                DataAccessEnterprise.AddParameter(_command, "TYPE_CodMED", codMED, SqlDbType.VarChar, 3, ParameterDirection.Input);

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        _mediaList = new List <Media>();
                        while (reader.Read())
                        {
                            int      ID          = (int)reader["MEDI_ID"];
                            int      IDPROJ      = (int)reader["PROJ_ID"];
                            int      IDEVEN      = (int)reader["EVEN_ID"];
                            bool     Event       = (bool)reader["MEDI_Event"];
                            string   Title       = (string)reader["MEDI_Title"];
                            string   Description = (string)reader["MEDI_Description"];
                            string   Url         = (string)reader["MEDI_Url"];
                            string   TabMED      = (string)reader["TYPE_TabMED"];
                            string   CodMED      = (string)reader["TYPE_CodMED"];
                            string   Usercrea    = (string)reader["audi_usercrea"];
                            DateTime Fechcrea    = (DateTime)reader["audi_fechcrea"];
                            string   Usermodi    = reader["audi_usermodi"] == DBNull.Value ? null : (string)reader["audi_usermodi"];
                            DateTime?Fechmodi    = reader["audi_fechmodi"] == DBNull.Value ? null : (DateTime?)reader["audi_fechmodi"];

                            var _media = new Media()
                            {
                                MEDI_ID          = ID,
                                PROJ_ID          = IDPROJ,
                                EVEN_ID          = IDEVEN,
                                MEDI_Event       = Event,
                                MEDI_Title       = Title,
                                MEDI_Description = Description,
                                MEDI_Url         = Url,
                                TYPE_TabMED      = TabMED,
                                TYPE_CodMED      = CodMED,
                                AUDI_UserCrea    = Usercrea,
                                AUDI_FechCrea    = Fechcrea,
                                AUDI_UserModi    = Usermodi,
                                AUDI_FechModi    = Fechmodi
                            };
                            _mediaList.Add(_media);
                        }
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_mediaList == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registros no encontrados",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_mediaList);
        }
Пример #4
0
        public List <User> SelectByIdPerson(int PERS_ID, out LogError logError)
        {
            logError = null;
            List <User> _userList = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("Users_SelectAllByPERS_ID");
                DataAccessEnterprise.AddParameter(_command, "@PERS_ID", PERS_ID, SqlDbType.Int, 1, ParameterDirection.Input);

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        _userList = new List <User>();
                        while (reader.Read())
                        {
                            int      ID            = (int)reader["USER_ID"];
                            int      IDPers        = (int)reader["PERS_ID"];
                            string   Email         = (string)reader["USER_Email"];
                            string   Password      = (string)reader["USER_Password"];
                            bool     Admin         = (bool)reader["USER_Admin"];
                            char     Status        = Convert.ToChar(reader["USER_Status"]);
                            string   audi_usercrea = (string)reader["audi_usercrea"];
                            DateTime audi_fechcrea = (DateTime)reader["audi_fechcrea"];
                            string   audi_usermodi = reader["audi_usermodi"] == DBNull.Value ? null : (string)reader["audi_usermodi"];
                            DateTime?audi_fechmodi = reader["audi_fechmodi"] == DBNull.Value ? null : (DateTime?)reader["audi_fechmodi"];

                            var _user = new User()
                            {
                                USER_ID       = ID,
                                PERS_ID       = IDPers,
                                USER_Email    = Email,
                                USER_Password = Password,
                                USER_Admin    = Admin,
                                USER_Status   = Status,
                                AUDI_UserCrea = audi_usercrea,
                                AUDI_FechCrea = audi_fechcrea,
                                AUDI_UserModi = audi_usermodi,
                                AUDI_FechModi = audi_fechmodi
                            };
                            _userList.Add(_user);
                        }
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_userList == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registros no encontrados",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_userList);
        }
Пример #5
0
        public List <Event> SelectByProjectId(int project_id, out LogError logError)
        {
            logError = null;
            List <Event> _eventList = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("Events_SelectProj_id");
                DataAccessEnterprise.AddParameter(_command, "@proj_id", project_id, SqlDbType.Int, 1, ParameterDirection.Input);

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        _eventList = new List <Event>();
                        while (reader.Read())
                        {
                            int      even_id          = (int)reader["even_id"];
                            int      proj_id          = (int)reader["proj_id"];
                            DateTime even_startdate   = (DateTime)reader["even_startdate"];
                            DateTime even_endingdate  = (DateTime)reader["even_endingdate"];
                            char     even_state       = Convert.ToChar(reader["even_state"]);
                            string   even_title       = (string)reader["even_title"];
                            string   even_description = (string)reader["even_description"];
                            string   audi_usercrea    = (string)reader["audi_usercrea"];
                            DateTime audi_fechcrea    = (DateTime)reader["audi_fechcrea"];
                            string   audi_usermodi    = reader["audi_usermodi"] == DBNull.Value ? null : (string)reader["audi_usermodi"];
                            DateTime?audi_fechmodi    = reader["audi_fechmodi"] == DBNull.Value ? null : (DateTime?)reader["audi_fechmodi"];
                            var      _event           = new Event()

                            {
                                EVEN_ID          = even_id,
                                PROJ_ID          = proj_id,
                                EVEN_StartDate   = even_startdate,
                                EVEN_EndingDate  = even_endingdate,
                                EVEN_State       = even_state,
                                EVEN_Title       = even_title,
                                EVEN_Description = even_description,
                                AUDI_UserCrea    = audi_usercrea,
                                AUDI_FechCrea    = audi_fechcrea,
                                AUDI_UserModi    = audi_usermodi,
                                AUDI_FechModi    = audi_fechmodi
                            };
                            _eventList.Add(_event);
                        }
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_eventList == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registros no encontrados",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_eventList);
        }
Пример #6
0
        public List <Project> SelectByIdInvestment(int INVE_ID, out LogError logError)
        {
            logError = null;
            List <Project> _projectList = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("Projects_SelectAllByINVE_ID");
                DataAccessEnterprise.AddParameter(_command, "@INVE_ID", INVE_ID, SqlDbType.Int, 1, ParameterDirection.Input);

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        _projectList = new List <Project>();
                        while (reader.Read())
                        {
                            int      ID                   = (int)reader["PROJ_ID"];
                            int      IDInvestment         = (int)reader["INVE_ID"];
                            string   Name                 = (string)reader["PROJ_Name"];
                            int      OverallProfitability = (int)reader["PROJ_OverallProfitability"];
                            int      ExecutionTime        = (int)reader["PROJ_ExecutionTime"];
                            decimal  InvestmentCapital    = (decimal)reader["PROJ_InvestmentCapital"];
                            string   Modality             = (string)reader["PROJ_Modality"];
                            DateTime PromotionDate        = (DateTime)reader["PROJ_PromotionDate"];
                            DateTime ExpirationDate       = (DateTime)reader["PROJ_ExpirationDate"];
                            int      Progress             = (int)reader["PROJ_Progress"];
                            string   Description          = (string)reader["PROJ_Description"];
                            char     State                = Convert.ToChar(reader["PROJ_State"]);

                            string   Usercrea = (string)reader["audi_usercrea"];
                            DateTime Fechcrea = (DateTime)reader["audi_fechcrea"];
                            string   Usermodi = reader["audi_usermodi"] == DBNull.Value ? null : (string)reader["audi_usermodi"];
                            DateTime?Fechmodi = reader["audi_fechmodi"] == DBNull.Value ? null : (DateTime?)reader["audi_fechmodi"];

                            var _project = new Project()
                            {
                                PROJ_ID   = ID,
                                INVE_ID   = IDInvestment,
                                PROJ_Name = Name,
                                PROJ_OverallProfitability = OverallProfitability,
                                PROJ_ExecutionTime        = ExecutionTime,
                                PROJ_InvestmentCapital    = InvestmentCapital,
                                PROJ_Modality             = Modality,
                                PROJ_PromotionDate        = PromotionDate,
                                PROJ_ExpirationDate       = ExpirationDate,
                                PROJ_Progress             = Progress,
                                PROJ_Description          = Description,
                                PROJ_State    = State,
                                AUDI_UserCrea = Usercrea,
                                AUDI_FechCrea = Fechcrea,
                                AUDI_UserModi = Usermodi,
                                AUDI_FechModi = Fechmodi
                            };
                            _projectList.Add(_project);
                        }
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_projectList == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registros no encontrados",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_projectList);
        }
Пример #7
0
        public List <Log> SelectAll(out LogError logError)
        {
            logError = null;
            List <Log> _logList = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("Logs_SelectAll");

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        _logList = new List <Log>();
                        while (reader.Read())
                        {
                            int      log_id      = (int)reader["log_id"];
                            DateTime log_date    = (DateTime)reader["log_date"];
                            string   TYPE_TabAUD = (string)reader["TYPE_TabAUD"];
                            string   TYPE_CodAUD = (string)reader["TYPE_CodAUD"];
                            string   LOG_Object  = (string)reader["LOG_Object"];
                            string   LOG_Text    = (string)reader["LOG_Text"];

                            var _log = new Log()
                            {
                                LOG_ID      = log_id,
                                LOG_Date    = log_date,
                                TYPE_TabAUD = TYPE_TabAUD,
                                TYPE_CodAUD = TYPE_CodAUD,
                                LOG_Object  = LOG_Object,
                                LOG_Text    = LOG_Text
                            };
                            _logList.Add(_log);
                        }
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_logList == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registros no encontrados",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_logList);
        }
Пример #8
0
        public List <Type> SelectAll(out LogError logError)
        {
            logError = null;
            List <Type> _typeList = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("Types_SelectAll");
                _typeList           = new List <Type>();
                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        _typeList = new List <Type>();
                        while (reader.Read())
                        {
                            string   CodTable      = (string)reader["TYPE_CodTable"];
                            string   CodType       = (string)reader["TYPE_CodType"];
                            string   Desc1         = (string)reader["TYPE_Desc1"];
                            string   Desc2         = (string)reader["TYPE_Desc2"];
                            int      Num1          = (int)reader["TYPE_Num1"];
                            int      Num2          = (int)reader["TYPE_Num2"];
                            char     Status        = Convert.ToChar(reader["TYPE_Status"]);
                            string   audi_usercrea = (string)reader["audi_usercrea"];
                            DateTime audi_fechcrea = (DateTime)reader["audi_fechcrea"];
                            string   audi_usermodi = reader["audi_usermodi"] == DBNull.Value ? null : (string)reader["audi_usermodi"];
                            DateTime?audi_fechmodi = reader["audi_fechmodi"] == DBNull.Value ? null : (DateTime?)reader["audi_fechmodi"];

                            var _type = new Type()
                            {
                                TYPE_CodTable = CodTable,
                                TYPE_CodType  = CodType,
                                TYPE_Desc1    = Desc1,
                                TYPE_Desc2    = Desc2,
                                TYPE_Num1     = Num1,
                                TYPE_Num2     = Num2,
                                TYPE_Status   = Status,
                                AUDI_UserCrea = audi_usercrea,
                                AUDI_FechCrea = audi_fechcrea,
                                AUDI_UserModi = audi_usermodi,
                                AUDI_FechModi = audi_fechmodi
                            };
                            _typeList.Add(_type);
                        }
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_typeList == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registros no encontrados",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_typeList);
        }
Пример #9
0
        public Log SelectById(int id, out LogError logError)
        {
            logError = null;
            Log _log = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("Logs_Select");
                DataAccessEnterprise.AddParameter(_command, "@log_id", id, SqlDbType.Int, 1, ParameterDirection.Input);

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        reader.Read();
                        int      log_id      = (int)reader["log_id"];
                        DateTime log_date    = (DateTime)reader["log_date"];
                        string   TYPE_TabAUD = (string)reader["TYPE_TabAUD"];
                        string   TYPE_CodAUD = (string)reader["TYPE_CodAUD"];
                        string   LOG_Object  = (string)reader["LOG_Object"];
                        string   LOG_Text    = (string)reader["LOG_Text"];

                        _log = new Log()
                        {
                            LOG_ID      = log_id,
                            LOG_Date    = log_date,
                            TYPE_TabAUD = TYPE_TabAUD,
                            TYPE_CodAUD = TYPE_CodAUD,
                            LOG_Object  = LOG_Object,
                            LOG_Text    = LOG_Text
                        };
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_log == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registro no encontrado",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_log);
        }
Пример #10
0
        public List <SessionKey> SelectAll(out LogError logError)
        {
            logError = null;
            List <SessionKey> _sessionKeyList = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("SessionKeys_SelectAll");

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        _sessionKeyList = new List <SessionKey>();
                        while (reader.Read())
                        {
                            int      ID            = (int)reader["SESS_ID"];
                            DateTime Date          = (DateTime)reader["SESS_Date"];
                            string   PrivateKeyXML = (string)reader["SESS_PrivateKeyXML"];
                            string   PublicKeyXML  = (string)reader["SESS_PublicKeyXML"];
                            string   PrivateKeyPEM = (string)reader["SESS_PrivateKeyPEM"];
                            string   PublicKeyPEM  = (string)reader["SESS_PublicKeyPEM"];
                            string   audi_usercrea = (string)reader["audi_usercrea"];
                            DateTime audi_fechcrea = (DateTime)reader["audi_fechcrea"];
                            string   audi_usermodi = reader["audi_usermodi"] == DBNull.Value ? null : (string)reader["audi_usermodi"];
                            DateTime?audi_fechmodi = reader["audi_fechmodi"] == DBNull.Value ? null : (DateTime?)reader["audi_fechmodi"];

                            var _sessionKey = new SessionKey()
                            {
                                SESS_ID            = ID,
                                SESS_Date          = Date,
                                SESS_PrivateKeyXML = PrivateKeyXML,
                                SESS_PublicKeyXML  = PublicKeyXML,
                                SESS_PrivateKeyPEM = PrivateKeyPEM,
                                SESS_PublicKeyPEM  = PublicKeyPEM,
                                AUDI_UserCrea      = audi_usercrea,
                                AUDI_FechCrea      = audi_fechcrea,
                                AUDI_UserModi      = audi_usermodi,
                                AUDI_FechModi      = audi_fechmodi
                            };
                            _sessionKeyList.Add(_sessionKey);
                        }
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_sessionKeyList == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registros no encontrados",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            DataAccessEnterprise.EndConnection();
            return(_sessionKeyList);
        }
Пример #11
0
        public SessionKey SelectById(int SESS_ID, DateTime SESS_Date, out LogError logError)
        {
            logError = null;
            SessionKey _sessionKey = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("SessionKeys_Select");
                DataAccessEnterprise.AddParameter(_command, "@SESS_ID", SESS_ID, SqlDbType.Int, 1, ParameterDirection.Input);
                DataAccessEnterprise.AddParameter(_command, "@SESS_Date", SESS_Date, SqlDbType.DateTime, 8, ParameterDirection.Input);

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        reader.Read();

                        int      ID            = (int)reader["SESS_ID"];
                        DateTime Date          = (DateTime)reader["SESS_Date"];
                        string   PrivateKeyXML = (string)reader["SESS_PrivateKeyXML"];
                        string   PublicKeyXML  = (string)reader["SESS_PublicKeyXML"];
                        string   PrivateKeyPEM = (string)reader["SESS_PrivateKeyPEM"];
                        string   PublicKeyPEM  = (string)reader["SESS_PublicKeyPEM"];
                        string   audi_usercrea = (string)reader["audi_usercrea"];
                        DateTime audi_fechcrea = (DateTime)reader["audi_fechcrea"];
                        string   audi_usermodi = reader["audi_usermodi"] == DBNull.Value ? null : (string)reader["audi_usermodi"];
                        DateTime?audi_fechmodi = reader["audi_fechmodi"] == DBNull.Value ? null : (DateTime?)reader["audi_fechmodi"];

                        _sessionKey = new SessionKey()
                        {
                            SESS_ID            = ID,
                            SESS_Date          = Date,
                            SESS_PrivateKeyXML = PrivateKeyXML,
                            SESS_PublicKeyXML  = PublicKeyXML,
                            SESS_PrivateKeyPEM = PrivateKeyPEM,
                            SESS_PublicKeyPEM  = PublicKeyPEM,
                            AUDI_UserCrea      = audi_usercrea,
                            AUDI_FechCrea      = audi_fechcrea,
                            AUDI_UserModi      = audi_usermodi,
                            AUDI_FechModi      = audi_fechmodi
                        };
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_sessionKey == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registro no encontrado",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_sessionKey);
        }
Пример #12
0
        public List <Person> SelectByIdTypeGEN(string tabGEN, string codGEN, out LogError logError)
        {
            logError = null;
            List <Person> _personList = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("Persons_SelectAllByTypeGEN");
                DataAccessEnterprise.AddParameter(_command, "@TYPE_TabGEN", tabGEN, SqlDbType.VarChar, 3, ParameterDirection.Input);
                DataAccessEnterprise.AddParameter(_command, "@TYPE_CodGEN", codGEN, SqlDbType.VarChar, 3, ParameterDirection.Input);

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        _personList = new List <Person>();
                        while (reader.Read())
                        {
                            int      ID             = (int)reader["PERS_ID"];
                            string   Names          = (string)reader["PERS_Names"];
                            string   LastName       = (string)reader["PERS_LastName"];
                            string   MotherLastName = (string)reader["PERS_MotherLastName"];
                            DateTime BirthDate      = (DateTime)reader["PERS_BirthDate"];
                            string   TabGEN         = (string)reader["TYPE_TabGEN"];
                            string   CodGEN         = (string)reader["TYPE_CodGEN"];
                            string   TabDOC         = (string)reader["TYPE_TabDOC"];
                            string   CodDOC         = (string)reader["TYPE_CodDOC"];
                            string   Usercrea       = (string)reader["audi_usercrea"];
                            DateTime Fechcrea       = (DateTime)reader["audi_fechcrea"];
                            string   Usermodi       = reader["audi_usermodi"] == DBNull.Value ? null : (string)reader["audi_usermodi"];
                            DateTime?Fechmodi       = reader["audi_fechmodi"] == DBNull.Value ? null : (DateTime?)reader["audi_fechmodi"];

                            var _person = new Person()
                            {
                                PERS_ID             = ID,
                                PERS_Names          = Names,
                                PERS_LastName       = LastName,
                                PERS_MotherLastName = MotherLastName,
                                PERS_BirthDate      = BirthDate,
                                TYPE_TabGEN         = TabGEN,
                                TYPE_CodGEN         = CodGEN,
                                TYPE_TabDOC         = TabDOC,
                                TYPE_CodDOC         = TabDOC,
                                AUDI_UserCrea       = Usercrea,
                                AUDI_FechCrea       = Fechcrea,
                                AUDI_UserModi       = Usermodi,
                                AUDI_FechModi       = Fechmodi
                            };
                            _personList.Add(_person);
                        }
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_personList == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registros no encontrados",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_personList);
        }
Пример #13
0
        public List <Param> SelectAll(out LogError logError)
        {
            logError = null;
            List <Param> _paramList = null;

            try
            {
                SqlCommand _command = DataAccessEnterprise.AsignProcedure("Params_SelectAll");

                _command.Connection = DataAccessEnterprise.BeginConnection();
                {
                    SqlDataReader reader = _command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        _paramList = new List <Param>();
                        while (reader.Read())
                        {
                            int      ID          = (int)reader["PARA_ID"];
                            string   Key         = (string)reader["PARA_Key"];
                            string   Value       = (string)reader["PARA_Value"];
                            string   Description = (string)reader["PARA_Description"];
                            string   Usercrea    = (string)reader["audi_usercrea"];
                            DateTime Fechcrea    = (DateTime)reader["audi_fechcrea"];
                            string   Usermodi    = reader["audi_usermodi"] == DBNull.Value ? null : (string)reader["audi_usermodi"];
                            DateTime?Fechmodi    = reader["audi_fechmodi"] == DBNull.Value ? null : (DateTime?)reader["audi_fechmodi"];

                            var _param = new Param()
                            {
                                PARA_ID          = ID,
                                PARA_Key         = Key,
                                PARA_Value       = Value,
                                PARA_Description = Description,
                                AUDI_UserCrea    = Usercrea,
                                AUDI_FechCrea    = Fechcrea,
                                AUDI_UserModi    = Usermodi,
                                AUDI_FechModi    = Fechmodi
                            };
                            _paramList.Add(_param);
                        }
                    }
                    //DataAccessEnterprise.EndConnection();
                    _command.Connection.Close();
                }
                if (_paramList == null)
                {
                    logError = new LogError()
                    {
                        Message        = "Registros no encontrados",
                        ErrorValidado  = true,
                        MensajeUsuario = "Error en procesar petición, El registro no existe"
                    };
                }
            }
            catch (SqlException e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = e.Number
                };
            }
            catch (Exception e)
            {
                logError = new LogError()
                {
                    Message     = e.Message,
                    StackTracer = e.StackTrace,
                    NumberError = null
                };
            }
            DataAccessEnterprise.EndConnection();
            return(_paramList);
        }