// public BatchhistoryBreakdown(int collectionID, int InstallationNo, int BatchID, string ExchangeConst, int WeekId) { try { _ExchangeConst = String.IsNullOrEmpty(ExchangeConst) ? "" : CommonUtilities.SiteConnectionString(ExchangeConst); _batch = _ExchangeConst != string.Empty ? new BatchDataAccess(new SqlConnection(_ExchangeConst)) : new BatchDataAccess(_ExchangeConst); _isAFTIncludedInCalculation = (Settings.IsAFTIncludedInCalculation); _collectionID = collectionID; _batchID = BatchID; _weekID = WeekId; } catch (Exception ex) { LogError(ex); } }
// public List <AllEvents> GetAllEvents(int CollectionNo, int InstallatioNo, int Top) { List <AllEvents> LstAllEvents = new List <AllEvents>(); try { BatchDataAccess Batch = _ExchangeConst != string.Empty ? new BatchDataAccess(new SqlConnection(_ExchangeConst)) : new BatchDataAccess(_ExchangeConst); List <DoorEventRecord> DoorEvents; IEnumerable <FaultEventRecord> FaultEvents; IEnumerable <PowerEventRecord> PowerEvents; DoorEvents = Batch.GetDoorEventData(CollectionNo, InstallatioNo, Top).ToList(); FaultEvents = Batch.GetFaultEventData(CollectionNo, InstallatioNo, Top).ToList(); PowerEvents = Batch.GetPowerEventData(CollectionNo, InstallatioNo, Top).ToList(); AllEvents Events; foreach (var item in DoorEvents) { Events = new AllEvents(); Events.Type = "Door"; Events.Date = item.Date.GetUniversalDateFormat(); Events.Time = item.Date.GetUniversalTimeFormat(); Events.Duration = HelperFunctions.GetDuration(item.Duration); Events.Description = item.Error_Code_Description;//Door_Event_Type.Trim();// == "3" ? "Cash Door open by " : "Slot Door open by " ; LstAllEvents.Add(Events); } foreach (var item in FaultEvents) { Events = new AllEvents(); Events.Type = "Fault"; Events.Date = item.Date.GetUniversalDateFormat(); Events.Time = item.Date.GetUniversalTimeFormat(); Events.Duration = "n/a"; Events.Description = item.Fault_Description; LstAllEvents.Add(Events); } foreach (var item in PowerEvents) { Events = new AllEvents(); Events.Type = "Power On"; Events.Date = item.Date.GetUniversalDateFormat(); Events.Time = item.Date.GetUniversalTimeFormat(); Events.Duration = HelperFunctions.GetDuration(item.Duration); Events.Description = ""; LstAllEvents.Add(Events); } } catch (Exception ex) { LogError(ex); } return(LstAllEvents); }