//public static Area GetArea() //{ // AreaTableAdapter localAdapter = new AreaTableAdapter(); // Area theUser = null; // try // { // AreaDS.AreaDataTable table = localAdapter.GetArea(); // if (table != null && table.Rows.Count > 0) // { // AreaDS.AreaRow row = table[0]; // theUser = FillUserRecord(row); // } // } // catch (Exception q) // { // log.Error("Un error ocurrio mientras obtenia el Area de la base de dato", q); // return null; // } // return theUser; //} public static Area GetAreaById(int idArea) { AreaTableAdapter localAdapter = new AreaTableAdapter(); if (idArea <= 0) { return(null); } Area theUser = null; try { AreaDS.AreaDataTable table = localAdapter.GetAreaById(idArea); if (table != null && table.Rows.Count > 0) { AreaDS.AreaRow row = table[0]; theUser = FillUserRecord(row); } } catch (Exception q) { log.Error("Un error ocurrio mientras obtenia el Area de la base de dato", q); return(null); } return(theUser); }
public Area GetAreaByOrganizationAndName(int organizationId, string name) { if (organizationId <= 0) { throw new ArgumentException(Resources.Organization.MessageZeroOrganizationId); } if (string.IsNullOrEmpty(name)) { throw new ArgumentException(Resources.Organization.MessageEmptyNameArea); } Area theData = null; try { AreaDS.AreaDataTable theTable = theAdapter.GetAreaByOrganizationAndArea(organizationId, name); if (theTable != null && theTable.Rows.Count > 0) { AreaDS.AreaRow theRow = theTable[0]; theData = FillRecord(theRow); } } catch (Exception exc) { log.Error("Ocurrió un error mientras se obtenía el area de nombre: " + name, exc); throw exc; } return(theData); }
public static Area GetAreaById(int areaId) { if (areaId <= 0) { throw new ArgumentException(Resources.Organization.MessageZeroAreaId); } Area theData = null; try { AreaTableAdapter localAdapter = new AreaTableAdapter(); AreaDS.AreaDataTable theTable = localAdapter.GetAreaById(areaId); if (theTable != null && theTable.Rows.Count > 0) { AreaDS.AreaRow theRow = theTable[0]; theData = FillRecord(theRow); } } catch (Exception exc) { log.Error("Ocurrió un error mientras se obtenía el area de id: " + areaId, exc); throw exc; } return(theData); }
private static Area FillUserRecord(AreaDS.AreaRow row) { Area theNewRecord = new Area( row.areaID, row.IsdescripcionNull() ? "" : row.descripcion); return(theNewRecord); }
private static Area FillRecord(AreaDS.AreaRow row) { Area theNewRecord = new Area( row.areaID, row.organizationID, row.name); theNewRecord.OrganizationName = row.IsorganizationNameNull() ? "" : row.organizationName; theNewRecord.NumberOfKpis = row.IsnumberKPIsNull() ? 0 : row.numberKPIs; return(theNewRecord); }