public IEnumerable <TerminalTableVM> GetTerminalsReport(TerminalListViewModel vmodel, string[] listtn, int parentId) { DateTime?start = null; DateTime?end = null; if (vmodel.StartDate != null) { start = DateTime.ParseExact(vmodel.StartDate, "MM/dd/yyyy", CultureInfo.InvariantCulture); } if (vmodel.EndDate != null) { end = DateTime.ParseExact(vmodel.EndDate, "MM/dd/yyyy", CultureInfo.InvariantCulture); } bool groupfilter = listtn == null ? false : true; string[] aux = { "0" }; listtn = listtn ?? aux; int zip = Int32.Parse(vmodel.ZipCode ?? "0"); IEnumerable <Partner> listpartner = vmodel.PartnerId == -1 ? GetPartnerByParentId(parentId) : GetPartnerByParentId(vmodel.PartnerId);// parentId : terminales del usuario logueado,partnerId: terminales del parnet especifico del filtro IEnumerable <Terminal> list4 = (from p in listpartner join m in Table.Include(b => b.TerminalContacts).Include(b => b.Make).Include(b => b.City).Include(b => b.State) on p.Id equals m.PartnerId select m).ToList(); try { var list = list4.Where(b => groupfilter == false || listtn.Contains(b.TerminalId)) .Where(b => vmodel.Status == StatusType.Status.All ? (b.Status == StatusType.Status.Active || b.Status == StatusType.Status.Inactive || b.Status == StatusType.Status.Incomplete) : b.Status == vmodel.Status) .Where(b => vmodel.AccountId == -1 || b.Partner.BankAccounts.Where(z => z.Id == vmodel.AccountId).Count() > 0) .Where(b => vmodel.TerminalId == null || b.TerminalId == vmodel.TerminalId) .Where(b => vmodel.CityId == -1 || b.CityId == vmodel.CityId) .Where(b => vmodel.StateId == -1 || b.CityId == vmodel.StateId) .Where(b => vmodel.ZipCode == null || b.Zip == zip) .Where(b => vmodel.ConectionType == CommunicationType.Communication.All ? (b.CommunicationType == CommunicationType.Communication.PhoneLine || b.CommunicationType == CommunicationType.Communication.TcpIp) : b.CommunicationType == vmodel.ConectionType) .Where(b => vmodel.StartDate == null || b.DateCreated >= start) .Where(b => vmodel.EndDate == null || b.DateCreated <= end) .Where(b => b.TerminalContacts.FirstOrDefault() != null && b.Make != null) .Select(b => new TerminalTableVM { TerminalID = b.TerminalId, LocationName = b.LocationName, Address = b.Address1 + b.Address2, City = b.City.Name, State = b.State.Name, PostalCode = b.Zip.ToString(), ContactName = b.TerminalContacts.First().Name, ContactPhone = b.TerminalContacts.First().Phone, ATMType = b.Make.Name + " " + b.Make.Name, Connection = b.CommunicationType.ToString(), SurchargeAmount = b.SurchargeAmountFee.ToString(), CreationDate = b.DateCreated.ToString(), EMVStatus = "falta por hacer", DCCStatus = "falta por hacer" }) .ToList(); return(list); } catch (Exception e) { throw new Exception("Error database " + e.Message); } // throw new NotImplementedException(); }
public ActionResult TerminalList([Bind(Include = "TerminalId,Status,Partner,PartnerId,Group,GroupId,Account,AccountId,StartDate,EndDate,ConectionType,State,StateId,City,CityId,ZipCode")] TerminalListViewModel vmodel) { ModelState.Remove("PartnerId"); ModelState.Remove("AccountId"); ModelState.Remove("GroupId"); ModelState.Remove("StateId"); ModelState.Remove("CityId"); if (ModelState.IsValid) { string[] listtn = ListTerminalByGroup(vmodel.GroupId); IEnumerable <TerminalTableVM> listvm = repo_terminal.GetTerminalsReport(vmodel, listtn, Convert.ToInt32(Session["partnerId"])); TempData["List"] = listvm.Count() > 0 ? Utils.ToDataTable <TerminalTableVM>(listvm) : null; TempData["filename"] = "TerminalList"; TempData["sub"] = false; return(View("TerminalList/TerminalList")); } return(RedirectToAction("Index")); }
public SettingsModule(IRegionManager regionManager, WorkPeriodsView workPeriodsView) { _regionManager = regionManager; _workPeriodsView = workPeriodsView; NavigateWorkPeriodsCommand = new CategoryCommand<string>(Resources.DayOperations, Resources.Common, "Images/Run.png", OnNavigateWorkPeriods, CanNavigateWorkPeriods); ListProgramSettingsCommand = new CategoryCommand<string>(Resources.LocalSettings, Resources.Settings, OnListProgramSettings); ListTerminalsCommand = new CategoryCommand<string>(Resources.Terminals, Resources.Settings, OnListTerminals); ListPrintersCommand = new CategoryCommand<string>(Resources.Printers, Resources.Settings, OnListPrinters); ListPrintJobsCommand = new CategoryCommand<string>(Resources.PrintJobs, Resources.Settings, OnListPrintJobs); ListPrinterTemplatesCommand = new CategoryCommand<string>(Resources.PrinterTemplates, Resources.Settings, OnListPrinterTemplates); ListNumeratorsCommand = new CategoryCommand<string>(Resources.Numerators, Resources.Settings, OnListNumerators); ListVoidReasonsCommand = new CategoryCommand<string>(Resources.VoidReasons, Resources.Products, OnListVoidReasons); ListGiftReasonsCommand = new CategoryCommand<string>(Resources.GiftReasons, Resources.Products, OnListGiftReasons); ListMenuItemSettingsCommand = new CategoryCommand<string>(Resources.ProgramSettings, Resources.Settings, OnListMenuItemSettings) { Order = 10 }; ListRuleActionsCommand = new CategoryCommand<string>(Resources.RuleActions, Resources.Settings, OnListRuleActions); ListRulesCommand = new CategoryCommand<string>(Resources.Rules, Resources.Settings, OnListRules); ListTriggersCommand = new CategoryCommand<string>(Resources.Triggers, Resources.Settings, OnListTriggers); ShowBrowser = new CategoryCommand<string>(Resources.SambaPosWebsite, Resources.SambaNetwork, OnShowBrowser) { Order = 99 }; PermissionRegistry.RegisterPermission(PermissionNames.OpenWorkPeriods, PermissionCategories.Navigation, Resources.CanStartEndOfDay); PermissionRegistry.RegisterPermission(PermissionNames.CloseActiveWorkPeriods, PermissionCategories.Navigation, Resources.ForceClosingActiveWorkPeriod); EventServiceFactory.EventService.GetEvent<GenericEvent<VisibleViewModelBase>>().Subscribe(s => { if (s.Topic == EventTopicNames.ViewClosed) { if (s.Value == _settingsViewModel) _settingsViewModel = null; if (s.Value == _terminalListViewModel) _terminalListViewModel = null; if (s.Value == _printerListViewModel) _printerListViewModel = null; if (s.Value == _printerTemplateCollectionViewModel) _printerTemplateCollectionViewModel = null; if (s.Value == _printJobsViewModel) _printJobsViewModel = null; if (s.Value == _numeratorListViewModel) _numeratorListViewModel = null; if (s.Value == _voidReasonListViewModel) _voidReasonListViewModel = null; if (s.Value == _giftReasonListViewModel) _giftReasonListViewModel = null; if (s.Value == _ruleActionListViewModel) _ruleActionListViewModel = null; if (s.Value == _ruleListViewModel) _ruleListViewModel = null; if (s.Value == _triggerListViewModel) _triggerListViewModel = null; } }); }
private void OnListTerminals(string obj) { if (_terminalListViewModel == null) _terminalListViewModel = new TerminalListViewModel(); CommonEventPublisher.PublishViewAddedEvent(_terminalListViewModel); }