Ejemplo n.º 1
0
        public ServiceSummary GetSummary()
        {
            var            uow    = Request.GetUnitOfWork();
            ServiceSummary result = new ServiceSummary();

            result.TotalFiles       = FileUtility.GetFileCount();
            result.TotalImports     = uow.GetFileImportCount();
            result.TotalDataRecords = uow.GetMeterDataCount();
            result.CurrentIndex     = uow.GetMaxFileIndex().GetValueOrDefault(-1);
            result.LastFile         = FileUtility.GetFile(result.CurrentIndex);
            result.LastImport       = uow.GetFileImport(result.CurrentIndex);
            return(result);
        }
Ejemplo n.º 2
0
        public static void MyNotificationOpened()
        {
            //CrossFirebasePushNotification.Current.Subscribe("general");

            CrossFirebasePushNotification.Current.OnNotificationOpened += async(s, p) =>
            {
                if (!string.IsNullOrEmpty(p.Identifier))
                {
                }
                else if (p.Data.ContainsKey("service_name"))
                {
                    var            api            = new ApiService();
                    ServiceSummary serviceSummary = ServiceDetails.ToServiceSummary <ServiceSummary>(p.Data);
                    var            notvm          = MainViewModel.GetInstance().NotVM = new NotificationSummaryViewModel
                    {
                        Date               = serviceSummary.service_date,
                        DriverID           = serviceSummary.employee_id_number,
                        DriverLastName     = serviceSummary.employee_last_name,
                        DriverName         = serviceSummary.employee_name,
                        PaymentMethod      = serviceSummary.service_payment,
                        ServiceName        = serviceSummary.service_name,
                        Hour               = serviceSummary.service_time,
                        TotalAmount        = serviceSummary.service_cost,
                        DriverWorkPosition = serviceSummary.employee_work_position
                    };
                    var accountSettings = Settings.AccountSettings;
                    var account         = JsonConvert.DeserializeObject <Account>(accountSettings);
                    serviceSummary.user_notification = account.PhoneNumber;
                    await api.Post <ServiceSummary>(Constants.NOTIFICATION, serviceSummary);

                    MainViewModel.GetInstance().PayVM = new PaymentViewModel
                    {
                        ServiceSummaryInstance = serviceSummary
                    };


                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        //await Application.Current.MainPage.Navigation.PushModalAsync(new MenuPage());
                        if ("Efectivo".Equals(serviceSummary.service_payment))
                        {
                            await PopupNavigation.Instance.PushAsync(new EfectivePaymentPopUpView());
                        }
                        else
                        {
                            await PopupNavigation.Instance.PushAsync(new PaymentPopUpView());
                        }
                    });
                }
            };
        }
Ejemplo n.º 3
0
        public async Task <HttpResponseMessage> GetById(int id)
        {
            db.Configuration.LazyLoadingEnabled = false;
            var cust = await db.Customers
                       .Include(x => x.Addresses)
                       .Include(x => x.EmailAddresses)
                       .Include(x => x.Notes)
                       .Include(x => x.Phones)
                       .SingleOrDefaultAsync(x => x.Id == id);

            var svcSummary = ServiceSummary.GetServiceSummary(db, id);

            var resp = new { Customer = cust, ServiceSummary = svcSummary }; //, HowFounds = howFounds, PaymentMethods = paymentMethods, InvoiceMethods = invoiceMethods };

            return(Request.CreateResponse(HttpStatusCode.OK, resp));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Service Catalog Index, either business, technical, or both
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Index(ServiceCatalog type = ServiceCatalog.Business, int id = 0)
        {
            CatalogModel model = new CatalogModel {
                Catalog = type, CatalogItems = new List <ICatalogPublishable>()
            };

            model.Controls = new CatalogControlsModel {
                SearchString = "", CatalogType = type
            };                                                                                                    //setup info for the controls

            IEnumerable <IServiceDto> services;                                                                   //lazy loaded data for filtering and use later

            if (type == ServiceCatalog.Both || type == ServiceCatalog.Business)                                   //add things from the business catalog
            {
                services = (from s in _catalogController.RequestBusinessCatalog(UserId) select s).ToList();
                foreach (var service in services)                                                                       //add services to the catalog model
                {
                    var i = new ServiceSummary
                    {
                        Name          = service.Name,
                        Id            = service.Id,
                        BusinessValue = service.Description,
                        Options       = new List <ICatalogPublishable>()
                    };
                    if (service.ServiceOptionCategories != null)
                    {
                        i.Options.AddRange((from o in service.ServiceOptionCategories select(ICatalogPublishable) o).ToList());
                        //find the top 3 items
                    }
                    if (service.ServiceOptions != null)
                    {
                        //i.Options.AddRange((from o in service.ServiceOptions select (ICatalogPublishable) o).ToList()); removed upon request
                    }
                    int take;
                    try
                    {
                        take = ConfigHelper.GetScTopAmount();
                    }
                    catch (Exception) { take = 3; }

                    i.Options = i.Options.OrderByDescending(o => o.Popularity).Take(take).ToList();

                    model.CatalogItems.Add(i);
                }
            }

            if (type == ServiceCatalog.Both || type == ServiceCatalog.Technical)                              //add things from the tech catalog
            {
                services = (from s in _catalogController.RequestSupportCatalog(UserId) select s).ToList();
                foreach (var service in services)                                                                   //add services to the catalog model
                {
                    var i = new ServiceSummary
                    {
                        Name          = service.Name,
                        Id            = service.Id,
                        BusinessValue = service.Description,
                        Options       = new List <ICatalogPublishable>()
                    };
                    i.Options.AddRange((from o in service.ServiceOptionCategories select(ICatalogPublishable) o).ToList());                        //find the top 3 items
                    //i.Options.AddRange((from o in service.ServiceOptions select (ICatalogPublishable)o).ToList());
                    i.Options = i.Options.OrderByDescending(o => o.Popularity).Take(ConfigHelper.GetScTopAmount()).ToList();

                    model.CatalogItems.Add(i);
                }
            }
            model.CatalogItems = model.CatalogItems.OrderByDescending(x => x.Popularity).ToList();

            if (model.CatalogItems != null && model.CatalogItems.Count > _pageSize)
            {
                model.Controls.TotalPages = (model.CatalogItems.Count + _pageSize - 1) / _pageSize;
                model.CatalogItems        = (List <ICatalogPublishable>)model.CatalogItems.Skip(_pageSize * id).Take(_pageSize);
            }

            return(View("ServiceCatalog", model));
        }
Ejemplo n.º 5
0
 protected override void SetService(FoundSummaryItem item, ServiceSummary service)
 {
     item.Service = service;
 }
Ejemplo n.º 6
0
 protected override void SetAssociatedService(AssociationSummary association, ServiceSummary service)
 {
     association.AssociatedService = service;
 }
Ejemplo n.º 7
0
 protected override void SetAssociations(ServiceSummary service, AssociationSummary[] associations)
 {
     service.Associations = associations;
 }