public List <BoStatus> Dao_getListStatusByIdObject(int pIdObject) { SqlConnection lConex = new SqlConnection(); using (lConex = Dao_SqlConnection(lConex)) { var lListStatus = new List <BoStatus>(); try { var lCommand = new SqlCommand { CommandText = "spr_GetListStatusByObject", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; lCommand.Parameters.Add(new SqlParameter("IdObject", pIdObject)); var lReader = lCommand.ExecuteReader(); if (lReader.HasRows) { while (lReader.Read()) { var lStatus = new BoStatus { LIdStatus = lReader["IdStatus"].ToString(), LDsEstado = lReader["DsEstado"].ToString(), LCreationDate = Convert.ToDateTime(lReader["CreationDate"].ToString()), LFlActive = Convert.ToBoolean(lReader["flActive"].ToString()) }; lListStatus.Add(lStatus); } } Dao_CloseSqlconnection(lConex); return(lListStatus); } catch (Exception e) { lListStatus = new List <BoStatus>(); var lStatus = new BoStatus { LException = e.Message, LMessageDao = BoErrors.MsgErrorGetSql }; if (e.InnerException != null) { lStatus.LInnerException = e.InnerException.ToString(); } lListStatus.Add(lStatus); Dao_CloseSqlconnection(lConex); return(lListStatus); } } }
public static BoStatus DaoUtilsLib_getStatusInPro(int pIdObject) { SqlConnection lConex = new SqlConnection(); using (lConex = Dao_SqlConnection(lConex)) { var lStatus = new BoStatus(); try { var lCommand = new SqlCommand { CommandText = "spr_GetStatusInProByIdObject", CommandTimeout = 30, CommandType = CommandType.StoredProcedure, Connection = lConex }; lCommand.Parameters.Add(new SqlParameter("IdObject", pIdObject)); var lReader = lCommand.ExecuteReader(); if (lReader.HasRows) { while (lReader.Read()) { lStatus.LIdStatus = lReader["IdStatus"].ToString(); lStatus.LNameStatus = lReader["NameStatus"].ToString(); lStatus.LDsEstado = lReader["DsEstado"].ToString(); lStatus.LFlActive = Convert.ToBoolean(lReader["flActive"].ToString()); } } Dao_CloseSqlconnection(lConex); return(lStatus); } catch (Exception e) { lStatus = new BoStatus { LException = e.Message, LMessageDao = BoErrors.MsgErrorGetSql }; if (e.InnerException != null) { lStatus.LInnerException = e.InnerException.ToString(); } Dao_CloseSqlconnection(lConex); return(lStatus); } } }