Ejemplo n.º 1
0
 private static IEnumerable<ModuleStatusItem> ExecGetDetailsByArea(Period period, string areaName, string sproc,
     Func<IDataReader, List<ModuleStatusItem>> loadFunc)
 {
     using (var connection = DBHelper.DefaultConnection)
     {
         return connection.CreateCommand()
                          .ForProcedure(sproc, p => p.WithParam("@Period", period.Text, size: 100, unicode: false)
                                                     .WithParam("@PeriodYear", period.Year)
                                                     .WithParam("@AreaName", areaName, size: 100, unicode: false))
                          .ExecuteReader(loadFunc);
     }
 }
Ejemplo n.º 2
0
 public IEnumerable<ModuleStatusItem> GetDetailsByArea(Period period, ReportingScope currentScope, string areaName)
 {
     switch (currentScope)
     {
         case ReportingScope.Company:
             return ExecGetDetailsByArea(period, areaName, @"ReportingGetDetailsByAreaCompany", LoadGetDetailsByAreaDefault);
         case ReportingScope.Region:
             return ExecGetDetailsByArea(period, areaName, @"ReportingGetDetailsByAreaRegion", LoadGetDetailsByAreaDefault);
         case ReportingScope.Zone:
             return ExecGetDetailsByArea(period, areaName, @"ReportingGetDetailsByAreaZone", LoadGetDetailsByAreaDefault);
         case ReportingScope.District:
             return ExecGetDetailsByArea(period, areaName, @"ReportingGetDetailsByAreaDistrict", LoadGetDetailsByAreaDistrict);
         default:
             throw new NotImplementedException("This method has not yet been implemented for the passed currentScope.");
     }
 }