public Boolean exists(ActivesStatus ostatus) { Boolean exists; String oSql = "SP_EXISTACTIVESSTATUS"; try { SqlCommand oCommand = new SqlCommand(oSql); oCommand.CommandType = CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@ID", ostatus.activesSatus_ID); Int32 recordExists = Convert.ToInt32(DAO.getInstance().executeQueryScalar(oCommand)); if (recordExists == 0) { exists = false; } else { exists = true; } } catch (Exception ex) { throw ex; } finally { } return(exists); }
public List <ActivesStatus> getAll() { String sql = "SP_GETALLACTIVESSTATUS"; try { SqlCommand oCommand = new SqlCommand(sql); oCommand.CommandType = System.Data.CommandType.StoredProcedure; DataTable oDataTable = DAO.getInstance().executeQuery(oCommand); List <ActivesStatus> listActivesStatus = new List <ActivesStatus>(); foreach (DataRow oDataRow in oDataTable.Rows) { ActivesStatus oActivites = new ActivesStatus(); oActivites.activesSatus_ID = Convert.ToInt32(oDataRow[0].ToString()); oActivites.description = oDataRow[1].ToString(); listActivesStatus.Add(oActivites); } return(listActivesStatus); } catch (Exception ex) { throw ex; } finally { } }
public Int32 modify(ActivesStatus ostatus) { String oSql = "SP_MODIFYSTATUSACTIVE"; try { SqlCommand oCommand = new SqlCommand(oSql); oCommand.CommandType = CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@ID", ostatus.activesSatus_ID); oCommand.Parameters.AddWithValue("@DESCRIPTION", ostatus.description); return(DAO.getInstance().executeSQL(oCommand)); } catch (Exception ex) { throw ex; } finally { } }
public List <Actives> getAllByProgram(Int32 pCode) { String sql = "SP_GETALLACTIVESBYPROGRAM"; try { SqlCommand oCommand = new SqlCommand(sql); oCommand.CommandType = System.Data.CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@PROGRAM_ID", pCode); DataTable oDataTable = DAO.getInstance().executeQuery(oCommand); List <Actives> listActives = new List <Actives>(); foreach (DataRow oDataRow in oDataTable.Rows) { Actives oActivites = new Actives(); ClassRoom oClassRoom = new ClassRoom(); Program oProgram = new Program(); ActivesStatus oStatus = new ActivesStatus(); oActivites.code = Convert.ToInt32(oDataRow[0].ToString()); oStatus.activesSatus_ID = Convert.ToInt32(oDataRow[1].ToString()); oStatus.description = oDataRow[2].ToString(); oActivites.codeAlphaNumeric = oDataRow[3].ToString(); oActivites.description = oDataRow[4].ToString(); oClassRoom.code = Convert.ToInt32(oDataRow[5].ToString()); oClassRoom.num_room = oDataRow[6].ToString(); oProgram.code = Convert.ToInt32(oDataRow[7].ToString()); oProgram.name = oDataRow[8].ToString(); oActivites.oClassRoom = oClassRoom; oActivites.oProgram = oProgram; oActivites.status = oStatus; listActives.Add(oActivites); } return(listActives); } catch (Exception ex) { throw ex; } finally { } }
public ActivesStatus getActivesStatus(int code) { String sql = "SP_GETACTIVESTATUSBYCODE"; try { SqlCommand oCommand = new SqlCommand(sql); oCommand.CommandType = CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@ID", code); DataTable oDataTable = DAO.getInstance().executeQuery(oCommand); ActivesStatus oActivites = new ActivesStatus(); foreach (DataRow oDataRow in oDataTable.Rows) { oActivites.activesSatus_ID = Convert.ToInt32(oDataRow[0].ToString()); oActivites.description = oDataRow[1].ToString(); } return(oActivites); } catch (Exception ex) { throw ex; } finally { } }