public bool Update(Project Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Projects_Update"); DataAccessEnterprise.AddParameter(_command, "@PROJ_ID", Item.PROJ_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_ID", Item.INVE_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_Name", Item.PROJ_Name, SqlDbType.VarChar, 50, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_OverallProfitability", Item.PROJ_OverallProfitability, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_ExecutionTime", Item.PROJ_ExecutionTime, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_InvestmentCapital", Item.PROJ_InvestmentCapital, SqlDbType.Decimal, 10, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_Modality", Item.PROJ_Modality, SqlDbType.VarChar, 50, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_PromotionDate", Item.PROJ_PromotionDate, SqlDbType.Date, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_ExpirationDate", Item.PROJ_ExpirationDate, SqlDbType.Date, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_Progress", Item.PROJ_Progress, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_Description", Item.PROJ_Description, SqlDbType.VarChar, 200, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_State", Item.PROJ_State, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserModi", Item.AUDI_UserModi, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechModi", Item.AUDI_FechModi, SqlDbType.DateTime, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } 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(false); }
public bool Update(Person Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Persons_Update"); DataAccessEnterprise.AddParameter(_command, "@PERS_ID", Item.PERS_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PERS_Names", Item.PERS_Names, SqlDbType.VarChar, 25, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PERS_LastName", Item.PERS_LastName, SqlDbType.VarChar, 25, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PERS_MotherLastName", Item.PERS_MotherLastName, SqlDbType.VarChar, 25, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PERS_BirthDate", Item.PERS_BirthDate, SqlDbType.DateTime, 8, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_TabGEN", Item.TYPE_TabGEN, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodGEN", Item.TYPE_CodGEN, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_TabDOC", Item.TYPE_TabDOC, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodDOC", Item.TYPE_CodDOC, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserModi", Item.AUDI_UserModi, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechModi", Item.AUDI_FechModi, SqlDbType.DateTime, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } 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(false); }
public bool Update(Investment Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Investments_Update"); DataAccessEnterprise.AddParameter(_command, "@INVE_ID", Item.INVE_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@USER_ID", Item.USER_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_Amount", Item.INVE_Amount, SqlDbType.Decimal, 10, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_Date", Item.INVE_Date, SqlDbType.DateTime, 8, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_Observation", Item.INVE_Observation, SqlDbType.VarChar, 200, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_CostEffectiveness", Item.INVE_CostEffectiveness, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_State", Item.INVE_State, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserModi", Item.AUDI_UserModi, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechModi", Item.AUDI_FechModi, SqlDbType.DateTime, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { //if (Int32.TryParse(_command.Parameters["@PERS_ID"].Value.ToString(), out Int32 _PERS_ID)) //{ Item.PERS_ID = _PERS_ID; } return(true); } 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(false); }
public bool Update(Type Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Types_Update"); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodTable", Item.TYPE_CodTable, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodType", Item.TYPE_CodType, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_Desc1", Item.TYPE_Desc1, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_Desc2", Item.TYPE_Desc2, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_Num1", Item.TYPE_Num1, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_Num2", Item.TYPE_Num2, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_Status", Item.TYPE_Status, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserModi", Item.AUDI_UserModi, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechModi", Item.AUDI_FechModi, SqlDbType.DateTime, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } 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(false); }
public bool Update(Media Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Media_Update"); DataAccessEnterprise.AddParameter(_command, "@MEDI_ID ", Item.MEDI_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_ID ", Item.PROJ_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@EVEN_ID ", Item.EVEN_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@MEDI_Event ", Item.MEDI_Event, SqlDbType.Bit, 2, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@MEDI_Title ", Item.MEDI_Title, SqlDbType.VarChar, 50, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@MEDI_Description", Item.MEDI_Description, SqlDbType.VarChar, 250, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@MEDI_Url ", Item.MEDI_Url, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_TabMED ", Item.TYPE_TabMED, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodMED ", Item.TYPE_CodMED, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserModi", Item.AUDI_UserModi, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechModi", Item.AUDI_FechModi, SqlDbType.DateTime, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } 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(false); }
public bool Update(SessionKey Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("SessionKeys_Update"); DataAccessEnterprise.AddParameter(_command, "@SESS_ID", Item.SESS_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_Date", Item.SESS_Date, SqlDbType.Date, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_PrivateKeyXML", Item.SESS_PrivateKeyXML, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_PublicKeyXML", Item.SESS_PublicKeyXML, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_PrivateKeyPEM", Item.SESS_PrivateKeyPEM, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_PublicKeyPEM", Item.SESS_PublicKeyPEM, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserModi", Item.AUDI_UserModi, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechModi", Item.AUDI_FechModi, SqlDbType.DateTime, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } 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(false); }
public bool Insert(Project Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Projects_Insert"); DataAccessEnterprise.AddParameter(_command, "@INVE_ID", Item.INVE_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_Name", Item.PROJ_Name, SqlDbType.VarChar, 50, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_OverallProfitability", Item.PROJ_OverallProfitability, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_ExecutionTime", Item.PROJ_ExecutionTime, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_InvestmentCapital", Item.PROJ_InvestmentCapital, SqlDbType.Decimal, 10, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_Modality", Item.PROJ_Modality, SqlDbType.VarChar, 50, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_PromotionDate", Item.PROJ_PromotionDate, SqlDbType.Date, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_ExpirationDate", Item.PROJ_ExpirationDate, SqlDbType.Date, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_Progress", Item.PROJ_Progress, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_Description", Item.PROJ_Description, SqlDbType.VarChar, 200, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PROJ_State", Item.PROJ_State, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserCrea", Item.AUDI_UserCrea, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechCrea", Item.AUDI_FechCrea, SqlDbType.Date, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { //if (Int32.TryParse(_command.Parameters["@PERS_ID"].Value.ToString(), out Int32 _PERS_ID)) //{ Item.PERS_ID = _PERS_ID; } return(true); } } 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(false); }
public bool Insert(Person Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Persons_Insert"); // _command.Connection = DataAccessEnterprise.BeginConnection(); // { DataAccessEnterprise.AddParameter(_command, "@PERS_Names", Item.PERS_Names, SqlDbType.VarChar, 25, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PERS_LastName", Item.PERS_LastName, SqlDbType.VarChar, 25, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PERS_MotherLastName", Item.PERS_MotherLastName, SqlDbType.VarChar, 25, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PERS_BirthDate", Item.PERS_BirthDate, SqlDbType.DateTime, 8, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_TabGEN", Item.TYPE_TabGEN, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodGEN", Item.TYPE_CodGEN, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_TabDOC", Item.TYPE_TabDOC, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodDOC", Item.TYPE_CodDOC, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserCrea", Item.AUDI_UserCrea, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechCrea", Item.AUDI_FechCrea, SqlDbType.Date, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } // } } 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(false); }
public bool Update(User Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Users_Update"); DataAccessEnterprise.AddParameter(_command, "@USER_ID", Item.USER_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@PERS_ID", Item.PERS_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@USER_Email", Item.USER_Email, SqlDbType.VarChar, 25, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@USER_Password", Item.USER_Password, SqlDbType.VarChar, 200, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@USER_Admin", Item.USER_Admin, SqlDbType.Bit, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@USER_Status", Item.USER_Status, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserModi", Item.AUDI_UserModi, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechModi", Item.AUDI_FechModi, SqlDbType.DateTime, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } 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 }; } return(false); }
public bool Insert(Type Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Types_Insert"); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodTable", Item.TYPE_CodTable, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodType", Item.TYPE_CodType, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_Desc1", Item.TYPE_Desc1, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_Desc2", Item.TYPE_Desc2, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_Num1", Item.TYPE_Num1, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_Num2", Item.TYPE_Num2, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_Status", Item.TYPE_Status, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserCrea", Item.AUDI_UserCrea, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechCrea", Item.AUDI_FechCrea, SqlDbType.Date, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { //if (Int32.TryParse(_command.Parameters["@PERS_ID"].Value.ToString(), out Int32 _PERS_ID)) //{ Item.PERS_ID = _PERS_ID; } return(true); } } 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(false); }
public bool Update(Log Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Logs_Update"); DataAccessEnterprise.AddParameter(_command, "@LOG_ID", Item.LOG_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@LOG_Date", Item.LOG_Date, SqlDbType.DateTime, 8, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_TabAUD", Item.TYPE_TabAUD, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodAUD", Item.TYPE_CodAUD, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@LOG_Object", Item.LOG_Object, SqlDbType.VarChar, 30, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@LOG_Text", Item.LOG_Text, SqlDbType.Text, 250, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } 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(false); }
public bool Insert(Media Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Media_Insert"); DataAccessEnterprise.AddParameter(_command, "@PROJ_ID ", Item.PROJ_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@EVEN_ID ", Item.EVEN_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@MEDI_Event ", Item.MEDI_Event, SqlDbType.Bit, 2, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@MEDI_Title ", Item.MEDI_Title, SqlDbType.VarChar, 50, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@MEDI_Description", Item.MEDI_Description, SqlDbType.VarChar, 250, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@MEDI_Url ", Item.MEDI_Url, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_TabMED ", Item.TYPE_TabMED, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodMED ", Item.TYPE_CodMED, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserCrea", Item.AUDI_UserCrea, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechCrea", Item.AUDI_FechCrea, SqlDbType.Date, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } } 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(false); }
public bool Insert(User Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Users_Insert"); DataAccessEnterprise.AddParameter(_command, "@PERS_ID", Item.PERS_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@USER_Email", Item.USER_Email, SqlDbType.VarChar, 25, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@USER_Password", Item.USER_Password, SqlDbType.VarChar, 200, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@USER_Admin", Item.USER_Admin, SqlDbType.Bit, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@USER_Status", Item.USER_Status, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserCrea", Item.AUDI_UserCrea, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechCrea", Item.AUDI_FechCrea, SqlDbType.Date, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { //if (Int32.TryParse(_command.Parameters["@PERS_ID"].Value.ToString(), out Int32 _PERS_ID)) //{ Item.PERS_ID = _PERS_ID; } return(true); } } 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 }; } return(false); }
public bool Insert(Event Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Events_Insert"); DataAccessEnterprise.AddParameter(_command, "@PROJ_ID", Item.PROJ_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@EVEN_StartDate", Item.EVEN_StartDate, SqlDbType.DateTime, 8, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@EVEN_EndingDate", Item.EVEN_EndingDate, SqlDbType.DateTime, 8, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@EVEN_State", Item.EVEN_State, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@EVEN_Title", Item.EVEN_Title, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@EVEN_Description", Item.EVEN_Description, SqlDbType.VarChar, 200, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserCrea", Item.AUDI_UserCrea, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechCrea", Item.AUDI_FechCrea, SqlDbType.Date, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { //if (Int32.TryParse(_command.Parameters["@PERS_ID"].Value.ToString(), out Int32 _PERS_ID)) //{ Item.PERS_ID = _PERS_ID; } return(true); } } 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 }; } return(false); }
public bool Insert(SessionKey Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("SessionKeys_Insert"); DataAccessEnterprise.AddParameter(_command, "@SESS_ID", Item.SESS_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_Date", Item.SESS_Date, SqlDbType.Date, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_PrivateKeyXML", Item.SESS_PrivateKeyXML, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_PublicKeyXML", Item.SESS_PublicKeyXML, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_PrivateKeyPEM", Item.SESS_PrivateKeyPEM, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_PublicKeyPEM", Item.SESS_PublicKeyPEM, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserCrea", Item.AUDI_UserCrea, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechCrea", Item.AUDI_FechCrea, SqlDbType.Date, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } } 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(false); }
public bool Insert(Investment Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Investments_Insert"); DataAccessEnterprise.AddParameter(_command, "@USER_ID", Item.USER_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_Amount", Item.INVE_Amount, SqlDbType.Decimal, 10, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_Date", Item.INVE_Date, SqlDbType.DateTime, 8, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_Observation", Item.INVE_Observation, SqlDbType.VarChar, 200, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_CostEffectiveness", Item.INVE_CostEffectiveness, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@INVE_State", Item.INVE_State, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_UserCrea", Item.AUDI_UserCrea, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@AUDI_FechCrea", Item.AUDI_FechCrea, SqlDbType.DateTime, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } } 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(false); }
public bool Delete(string codTable, string codType, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Types_Delete"); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodTable", codTable, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodType", codType, SqlDbType.VarChar, 3, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } 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(false); }
public bool Delete(int SESS_ID, DateTime SESS_Date, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("SessionKeys_Delete"); DataAccessEnterprise.AddParameter(_command, "@SESS_ID", SESS_ID, SqlDbType.Int, 1, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@SESS_Date", SESS_Date, SqlDbType.DateTime, 8, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } 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(false); }
public bool Insert(Log Item, out LogError logError) { logError = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Logs_Insert"); DataAccessEnterprise.AddParameter(_command, "@LOG_Date", Item.LOG_Date, SqlDbType.DateTime, 0, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_TabAUD", Item.TYPE_TabAUD, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodAUD", Item.TYPE_CodAUD, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@LOG_Object", Item.LOG_Object, SqlDbType.VarChar, 30, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@LOG_Text", Item.LOG_Text, SqlDbType.Text, 250, ParameterDirection.Input); if (DataAccessEnterprise.ExecuteNonQuery(_command, null) > 0) { return(true); } } 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(false); }
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); }
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); }
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); }
public Type SelectById(string codTable, string codType, out LogError logError) { logError = null; Type _type = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Types_Select"); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodTable", codTable, SqlDbType.VarChar, 3, ParameterDirection.Input); DataAccessEnterprise.AddParameter(_command, "@TYPE_CodType", codType, SqlDbType.VarChar, 3, ParameterDirection.Input); _command.Connection = DataAccessEnterprise.BeginConnection(); { SqlDataReader reader = _command.ExecuteReader(); if (reader.HasRows) { 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"]; _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 }; } //DataAccessEnterprise.EndConnection(); _command.Connection.Close(); } if (_type == 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(_type); }
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); }
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); }
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); }
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); }
public Param SelectById(int PARA_ID, out LogError logError) { logError = null; Param _param = null; try { SqlCommand _command = DataAccessEnterprise.AsignProcedure("Params_Select"); DataAccessEnterprise.AddParameter(_command, "@PARA_ID", PARA_ID, SqlDbType.Int, 1, ParameterDirection.Input); _command.Connection = DataAccessEnterprise.BeginConnection(); { SqlDataReader reader = _command.ExecuteReader(); if (reader.HasRows) { 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"]; _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 }; } //DataAccessEnterprise.EndConnection(); _command.Connection.Close(); } if (_param == 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(_param); }
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); }