public List <Activity> GetActivitiesByOrganization(int organizationId) { if (organizationId <= 0) { throw new ArgumentException(Resources.Organization.MessageZeroOrganizationId); } string userName = HttpContext.Current.User.Identity.Name; List <Activity> theList = new List <Activity>(); Activity theData = null; try { ActivityDS.ActivitiesDataTable theTable = theAdapter.GetActivitiesByOrganization(organizationId, userName); if (theTable != null && theTable.Rows.Count > 0) { foreach (ActivityDS.ActivitiesRow theRow in theTable) { theData = FillRecord(theRow); theList.Add(theData); } } } catch (Exception exc) { log.Error(Resources.Activity.MessageErrorGetForOrganization + " para organizationId: " + organizationId.ToString() + " y userName: " + userName, exc); throw new ArgumentException(Resources.Activity.MessageErrorGetForOrganization); } return(theList); }
public static List <Activity> GetActivitiesForAutocomplete(int organizationId, int areaId, int projectId, string filter) { string userName = HttpContext.Current.User.Identity.Name; List <Activity> theList = new List <Activity>(); Activity theData = null; try { ActivitiesTableAdapter localAdapter = new ActivitiesTableAdapter(); ActivityDS.ActivitiesDataTable theTable = localAdapter.GetActivitiesForAutocomplete(userName, organizationId, areaId, projectId, filter); if (theTable != null && theTable.Rows.Count > 0) { foreach (ActivityDS.ActivitiesRow theRow in theTable) { theData = FillRecord(theRow); theList.Add(theData); } } } catch (Exception exc) { log.Error(Resources.Activity.MessageErrorActivityList + " for autocomplete.", exc); throw new Exception(Resources.Activity.MessageErrorActivityList); } return(theList); }
public static Activity GetActivityById(int activityId) { if (activityId <= 0) { throw new ArgumentException(Resources.Activity.MessageErrorActivityID); } Activity theData = null; try { ActivitiesTableAdapter localAdapter = new ActivitiesTableAdapter(); ActivityDS.ActivitiesDataTable theTable = localAdapter.GetActivityById(activityId); if (theTable != null && theTable.Rows.Count > 0) { ActivityDS.ActivitiesRow theRow = theTable[0]; theData = FillRecord(theRow); } } catch (Exception exc) { log.Error(Resources.Activity.MessageErrorGetActivity + " id: " + activityId, exc); throw new Exception(Resources.Activity.MessageErrorGetActivity); } return(theData); }
public List <Activity> GetActivitiesBySearch(string whereClause) { if (string.IsNullOrEmpty(whereClause)) { whereClause = "1=1"; } string username = HttpContext.Current.User.Identity.Name; List <Activity> theList = new List <Activity>(); Activity theData = null; try { ActivityDS.ActivitiesDataTable theTable = theAdapter.GetActivityBySearch(username, whereClause); if (theTable != null && theTable.Rows.Count > 0) { foreach (ActivityDS.ActivitiesRow theRow in theTable) { theData = FillRecord(theRow); theList.Add(theData); } } } catch (Exception exc) { log.Error(Resources.Activity.MessageErrorActivityList, exc); throw new Exception(Resources.Activity.MessageErrorActivityList); } return(theList); }