public async Task <IActionResult> Overview()
        {
            string email = User.FindFirstValue(ClaimTypes.Name);

            var user = await _userManager.FindByNameAsync(email);

            var items = _appDbContext.Items.Where(i => i.SellerId == user.Id);

            int     itemsListed      = items.Count();
            int     itemsForSale     = 0;
            int     itemsSold        = 0;
            decimal totalDollarSales = 0;

            items.Where(i => !i.Sold).ToList().ForEach(i => itemsForSale++);
            items.Where(i => i.Sold).ToList().ForEach(i => itemsSold++);
            items.Where(i => i.Sold).ToList().ForEach(i => totalDollarSales += i.Price);

            var overviewModel = new OverviewModel()
            {
                FirstName        = user.FirstName,
                LastName         = user.LastName,
                Email            = email,
                ItemsListed      = itemsListed,
                ItemsForSale     = itemsForSale,
                TotalItemsSold   = itemsSold,
                TotalDollarSales = totalDollarSales
            };

            return(Ok(overviewModel));
        }
Beispiel #2
0
        public async Task <ViewResult> Index(string customerId)
        {
            this.ViewBag.CustomerId = customerId;
            OverviewModel <SubscriptionResponse> model = await this._subscriptionOverviewClient.GetList(customerId);

            return(this.View(model));
        }
Beispiel #3
0
        public ActionResult GetOverview([FromQuery(Name = "deviceEUI")] string deviceEUI)
        {
            OverviewModel nightOverview = _repo.GetOverviewToday(deviceEUI);
            OverviewModel weekOverview  = _repo.GetOverviewLastWeek(deviceEUI);

            var overview = new
            {
                tempMin      = nightOverview.tempMin,
                tempMax      = nightOverview.tempMax,
                tempAvg      = nightOverview.tempAvg,
                humiMin      = nightOverview.humiMin,
                humiMax      = nightOverview.humiMax,
                humiAvg      = nightOverview.humiAvg,
                co2Min       = nightOverview.co2Min,
                co2Max       = nightOverview.co2Max,
                co2Avg       = nightOverview.co2Avg,
                tempMin7days = weekOverview.tempMin,
                tempMax7days = weekOverview.tempMax,
                tempAvg7days = weekOverview.tempAvg,
                humiMin7days = weekOverview.humiMin,
                humiMax7days = weekOverview.humiMax,
                humiAvg7days = weekOverview.humiAvg,
                co2Min7days  = weekOverview.co2Min,
                co2Max7days  = weekOverview.co2Max,
                co2Avg7days  = weekOverview.co2Avg
            };

            return(Ok(overview));
        }
Beispiel #4
0
        public IActionResult Overview(OverviewModel Model, int ModelExists, int ParticipantType)
        {
            if (!String.IsNullOrEmpty(HttpContext.Session.GetString("User")))
            {
                if (HttpContext.Session.GetString("User") == "Administratie:8MmNS")
                {
                    ViewData["Message"] = null;

                    Queries Database = new Queries();

                    if (ModelExists == 0)
                    {
                        Model = new OverviewModel();
                        Model.ParticipantType = ParticipantType;
                    }

                    Model.ParticipantList = Database.RetrieveParticipants(Model.ParticipantType);

                    return(View(Model));
                }
            }

            return(RedirectToAction("Login", "Home", new RouteValueDictionary {
                { "ViewMessage", "Je bent niet gemachtigd om deze pagina te bezoeken." }
            }));
        }
        public async Task <ActionResult> Overview()
        {
            var model = new OverviewModel();

            var memberApi = GetMemberApiProxy(Request);

            var bonuses = await memberApi.GetQualifiedBonuses(new QualifiedBonusRequest());

            var bonus = bonuses.FirstOrDefault();

            var messages = await memberApi.GetOnSiteMessagesAsync();

            model.MessageSubject = messages.OnSiteMessages
                                   .FirstOrDefault()?
                                   .Subject;

            model.MessageId = messages.OnSiteMessages.FirstOrDefault()?.Id;

            model.Games = new GamesDataView
            {
                IsAuthenticated = Request.IsAuthenticated,
                Data            = await GetGames()
            };

            if (bonus == null)
            {
                return(View(model));
            }

            model.BonusId   = bonus.Id;
            model.BonusCode = bonus.Code;
            model.BonusName = bonus.Name;

            return(View(model));
        }
Beispiel #6
0
        } // End Action Index

        public ActionResult Overview()
        {
            OverviewModel om = new OverviewModel();

            //Guid xx = System.Web.HttpContext.Current.GetUserId<Guid>();

            //var UserFromDb = System.Web.Security.Membership.GetUser();
            //var MyUserId = UserFromDb.ProviderUserKey;

            //Console.WriteLine(UserFromDb.ToJSON());

            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "FeatureRequest", strDivClass = "B3", strSpanText = "Feature Request"
            });
            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "Tasks", strDivClass = "B4", strSpanText = "My Tasks"
            });
            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "IssueList", strDivClass = "B5", strSpanText = "Issue List"
            });
            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "Time", strDivClass = "B6", strSpanText = "Donnerstag<br />18.04.2013<br />18:09:35"
            });
            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "Dashboard", strDivClass = "B7", strSpanText = "Dashboard"
            });
            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "Reports", strDivClass = "B8", strSpanText = "Reports"
            });
            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "Events", strDivClass = "B8", strSpanText = "Events"
            });
            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "Scheduling", strDivClass = "B8", strSpanText = "Scheduling"
            });
            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "TimeTracking", strDivClass = "B6", strSpanText = "Time-Tracking"
            });
            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "MyTickets", strDivClass = "B6", strSpanText = "My Tickets"
            });
            om.lsMenuPoints.Add(new Models.Win8StyleMenuPoint()
            {
                strId = "NewTicket", strDivClass = "B6", strSpanText = "New Ticket"
            });
            //om.lsMenuPoints.Add(new Win8StyleMenuPoint() { strId = "", strDivClass = "", strSpanText = "" });
            //om.lsMenuPoints.Add(new Win8StyleMenuPoint() { strId = "", strDivClass = "", strSpanText = "" });

            return(View(om));
        } // End Action Overview
        public ActionResult Index()
        {
            var contentTypes = _contentTypeRepository.List()
                               .Select(CreateContentTypeModel)
                               .OrderBy(contentType => contentType.Name)
                               .ToList();
            var model = new OverviewModel
            {
                PageTypes = contentTypes
                            .Where(x => x.Category == ContentTypeModel.ContentTypeCategory.Page)
                            .ToList(),
                BlockTypes = contentTypes
                             .Where(x => x.Category == ContentTypeModel.ContentTypeCategory.Block)
                             .ToList(),
                MediaTypes = contentTypes
                             .Where(x => x.Category == ContentTypeModel.ContentTypeCategory.Media)
                             .ToList(),
                OtherTypes = contentTypes
                             .Where(x =>
                                    new[]
                {
                    ContentTypeModel.ContentTypeCategory.Page,
                    ContentTypeModel.ContentTypeCategory.Block,
                    ContentTypeModel.ContentTypeCategory.Media
                }.Contains(x.Category) == false)
                             .ToList(),
                EditUrls = contentTypes.ToDictionary(x => x.Id, CreateEditContentTypeUrl)
            };

            return(View(string.Empty, model));
        }
        public async Task <ViewResult> Index(string customerId)
        {
            ViewBag.CustomerId = customerId;
            OverviewModel <MandateResponse> model = await _mandateOverviewClient.GetList(customerId);

            return(View(model));
        }
        // GET: Application
        public ActionResult Overview(OverviewModel overviewModel)
        {
            BackendlessUser user = Backendless.UserService.CurrentUser;

            if (user == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View(overviewModel));
        }
Beispiel #10
0
        /// <summary>
        /// Metoda uloží kolekce v modelu do XAML souborů (MaterialCollection, EmployeeCollection, ContractCollection, OverviewModel, TransactionCollection, DeletedMaterialCollection, DeletedEmployeeCollection, DeletedContractCollection).
        /// </summary>
        public void Save()
        {
            // K ukládání je využit serializér
            XmlSerializer materialSerializer = new XmlSerializer(MaterialCollection.GetType());

            using (StreamWriter sw = new StreamWriter(materialTrack))
            {
                materialSerializer.Serialize(sw, MaterialCollection);
            }
            XmlSerializer employeeSerializer = new XmlSerializer(EmployeeCollection.GetType());

            using (StreamWriter sw = new StreamWriter(employeeTrack))
            {
                employeeSerializer.Serialize(sw, EmployeeCollection);
            }
            XmlSerializer contractSerializer = new XmlSerializer(ContractCollection.GetType());

            using (StreamWriter sw = new StreamWriter(contractTrack))
            {
                contractSerializer.Serialize(sw, ContractCollection);
            }

            XmlSerializer overviwSerializer = new XmlSerializer(OverviewModel.GetType());

            using (StreamWriter sw = new StreamWriter(overviewTrack))
            {
                overviwSerializer.Serialize(sw, OverviewModel);
            }
            XmlSerializer accountSerializer = new XmlSerializer(TransactionCollection.GetType());

            using (StreamWriter sw = new StreamWriter(transactionTrack))
            {
                accountSerializer.Serialize(sw, TransactionCollection);
            }

            XmlSerializer deletedMaterialSerializer = new XmlSerializer(DeletedMaterialCollection.GetType());

            using (StreamWriter sw = new StreamWriter(deletedMaterialTrack))
            {
                deletedMaterialSerializer.Serialize(sw, DeletedMaterialCollection);
            }
            XmlSerializer deletedEmployeeSerializer = new XmlSerializer(DeletedEmployeeCollection.GetType());

            using (StreamWriter sw = new StreamWriter(deletedEmployeeTrack))
            {
                deletedEmployeeSerializer.Serialize(sw, DeletedEmployeeCollection);
            }
            XmlSerializer deletedContractSerializer = new XmlSerializer(DeletedContractCollection.GetType());

            using (StreamWriter sw = new StreamWriter(deletedContractTrack))
            {
                deletedContractSerializer.Serialize(sw, DeletedContractCollection);
            }
            FillingAllCollections();
        }
Beispiel #11
0
        public IActionResult Index()
        {
            var overview = new OverviewModel()
            {
                FeedBackTotal = _context.Feedbacks.Count(),
                RequestTotal  = _context.RequestPolicies.Count(),
                User          = _context.Users.Where(x => x.Level == Level.Admin).ToList(),
            };

            return(View(overview));
        }
        public ActionResult Index()
        {
            List <Tweet> recentTweets =
                OclumenContext.RawTweets.OrderByDescending(x => x.AutoSentimentTimestamp).Take(10).ToList();
            var model = new OverviewModel {
                RecentlyTaggedTweets = recentTweets
            };

            LoadTopHastagsAndRetweets(model);

            return(View(model));
        }
Beispiel #13
0
        public async Task <IActionResult> Index()
        {
            var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            OverviewModel model = new OverviewModel();

            model.Agencies = await _context.GetAgenciesForUser(userId);

            model.People = await _context.GetPeopleForUser(userId);

            return(View(model));
        }
Beispiel #14
0
        public virtual async Task <ActionResult> Overview()
        {
            ProductsDataListModel productsModel = new ProductsDataListModel();

            productsModel.Products = await this.productReader.ReadAll();

            OverviewModel model = new OverviewModel();

            model.SaveReceipt = new SaveReceiptModel();
            model.Products    = productsModel;

            return(this.View(model));
        }
Beispiel #15
0
        public async Task <IActionResult> Index()
        {
            DateTime now  = DateTime.Today;
            AppUser  user = await userManager.GetUserAsync(HttpContext.User);

            IEnumerable <Expense> expenses = repo.GetExpenses(user).Take(6);

            OverviewModel model = new OverviewModel
            {
                Expense  = expenses,
                Username = user.UserName
            };

            return(View("Index", model));
        }
Beispiel #16
0
        public IActionResult EditEvent()
        {
            OverviewModel overview = new OverviewModel();

            overview.venues = venueApi.VenueGet();
            overview.events = eventApi.GetAllEvents();
            overview.dates  = dateApi.GetAllTicketEventDate();
            if (User.Identity.IsAuthenticated)
            {
                return(View(overview));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Beispiel #17
0
        //public ActionResult Start(int id)
        //{
        //    try
        //    {
        //        var records = WorkflowManager.StartWorkflow(id);
        //    }
        //    catch(Exception ex)
        //    {
        //        ModelState.AddModelError("error", ex);
        //    }

        //    return View(ModelState);
        //}

        public ActionResult Overview()
        {
            var           workflows = WorkflowManager.RecieveWorkflows();
            OverviewModel model     = new OverviewModel()
            {
                Workflows = new List <WorkflowViewModel>()
            };

            foreach (var workflow in workflows)
            {
                model.Workflows.Add(new WorkflowViewModel()
                {
                    Id       = workflow.Id,
                    Filename = workflow.Filename
                });
            }
            return(View(model));
        }
Beispiel #18
0
 public Overview2(OverviewModel model)
 {
     InitializeComponent();
     this.model        = model;
     lbl_Clerk.Content = this.model.Clerk.Name;
     filternames       = model.Filters.Select(x => x.FilterName).ToList();
     if (filternames.Count == 0)
     {
         Filter1.Title = "Kein Filter gespeichert"; Filter2.Title = "Kein Filter gespeichert";
     }
     if (filternames.Count == 1)
     {
         Filter1.Title = filternames[0]; Filter2.Title = "Kein Filter gespeichert";
     }
     if (filternames.Count > 1)
     {
         Filter1.Title = filternames[0]; Filter2.Title = filternames[1];
     }
 }
Beispiel #19
0
        /// <summary>
        /// Metoda naplní kolekce v modelu z XAML souborů (MaterialCollection, EmployeeCollection, ContractCollection, OverviewModel, TransactionCollection, DeletedMaterialCollection, DeletedEmployeeCollection, DeletedContractCollection).
        /// </summary>
        public void Load()
        {
            // Využití deserializace
            XmlSerializer materialSerializer = new XmlSerializer(MaterialCollection.GetType());

            if (File.Exists(materialTrack))
            {
                using (StreamReader sr = new StreamReader(materialTrack))
                {
                    MaterialCollection = (ObservableCollection <Material>)materialSerializer.Deserialize(sr);
                }
            }
            else
            {
                MaterialCollection = new ObservableCollection <Material>();
            }
            XmlSerializer employeeSerializer = new XmlSerializer(EmployeeCollection.GetType());

            if (File.Exists(employeeTrack))
            {
                using (StreamReader sr = new StreamReader(employeeTrack))
                {
                    EmployeeCollection = (ObservableCollection <Employee>)employeeSerializer.Deserialize(sr);
                }
            }
            else
            {
                EmployeeCollection = new ObservableCollection <Employee>();
            }
            XmlSerializer contractSerializer = new XmlSerializer(ContractCollection.GetType());

            if (File.Exists(contractTrack))
            {
                using (StreamReader sr = new StreamReader(contractTrack))
                {
                    ContractCollection = (ObservableCollection <Contract>)contractSerializer.Deserialize(sr);
                }
            }
            else
            {
                ContractCollection = new ObservableCollection <Contract>();
            }

            XmlSerializer overviewSerializer = new XmlSerializer(OverviewModel.GetType());

            if (File.Exists(overviewTrack))
            {
                using (StreamReader sr = new StreamReader(overviewTrack))
                {
                    OverviewModel = (OverviewFactory)overviewSerializer.Deserialize(sr);
                }
            }
            else
            {
                OverviewModel = new OverviewFactory();
            }
            XmlSerializer accountSerializer = new XmlSerializer(TransactionCollection.GetType());

            if (File.Exists(transactionTrack))
            {
                using (StreamReader sr = new StreamReader(transactionTrack))
                {
                    TransactionCollection = (ObservableCollection <Transaction>)accountSerializer.Deserialize(sr);
                }
            }
            else
            {
                TransactionCollection = new ObservableCollection <Transaction>();
            }
            RearrangeMaterialCollection();

            XmlSerializer deletedMaterialSerializer = new XmlSerializer(DeletedMaterialCollection.GetType());

            if (File.Exists(deletedMaterialTrack))
            {
                using (StreamReader sr = new StreamReader(deletedMaterialTrack))
                {
                    DeletedMaterialCollection = (ObservableCollection <Material>)deletedMaterialSerializer.Deserialize(sr);
                }
            }
            else
            {
                DeletedMaterialCollection = new ObservableCollection <Material>();
            }
            XmlSerializer deletedEmployeeSerializer = new XmlSerializer(DeletedEmployeeCollection.GetType());

            if (File.Exists(deletedEmployeeTrack))
            {
                using (StreamReader sr = new StreamReader(deletedEmployeeTrack))
                {
                    DeletedEmployeeCollection = (ObservableCollection <Employee>)deletedEmployeeSerializer.Deserialize(sr);
                }
            }
            else
            {
                DeletedEmployeeCollection = new ObservableCollection <Employee>();
            }
            XmlSerializer deletedEontractSerializer = new XmlSerializer(DeletedContractCollection.GetType());

            if (File.Exists(deletedContractTrack))
            {
                using (StreamReader sr = new StreamReader(deletedContractTrack))
                {
                    DeletedContractCollection = (ObservableCollection <Contract>)deletedEontractSerializer.Deserialize(sr);
                }
            }
            else
            {
                DeletedContractCollection = new ObservableCollection <Contract>();
            }
            FillingAllCollections();
        }
Beispiel #20
0
        public async Task <ViewResult> ApiUrl([FromQuery] string url)
        {
            OverviewModel <SubscriptionResponse> model = await this._subscriptionOverviewClient.GetListByUrl(url);

            return(this.View(nameof(this.Index), model));
        }
        public ActionResult Overview()
        {
            OverviewModel model = new OverviewModel(context);

            return(View(model));
        }
        public void LoadTopHastagsAndRetweets(OverviewModel model)
        {
            object result = cache.Get(HashtagSentimentKey);

            if (result != null)
            {
                model.TopHashtags = (IList <UseRecord>)result;
            }
            else
            {
                using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["OclumenContext"].ToString()))
                {
                    conn.Open();

                    var cmd = new SqlCommand("TopHashtagSentiment", conn);

                    cmd.CommandType = CommandType.StoredProcedure;

                    SqlDataReader rdr = cmd.ExecuteReader();

                    // read top hashtags
                    while (rdr.Read())
                    {
                        model.TopHashtags.Add(new UseRecord(rdr["tag"].ToString(), (int)rdr["Positive"], (int)rdr["Neutral"], (int)rdr["Negative"]));
                    }

                    rdr.Close();
                    conn.Dispose();
                }

                cache.Add(HashtagSentimentKey, model.TopHashtags, DateTimeOffset.UtcNow.AddMinutes(15));
            }

            // now load top retweets
            result = cache.Get(RetweetSentimentKey);

            if (result != null)
            {
                model.TopRetweets = (IList <UseRecord>)result;
            }
            else
            {
                using (var conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["OclumenContext"].ToString()))
                {
                    conn.Open();

                    var cmd = new SqlCommand("TopRetweetSentiment", conn);

                    cmd.CommandType = CommandType.StoredProcedure;
                    SqlDataReader rdr = cmd.ExecuteReader();

                    // read top retweets
                    while (rdr.Read())
                    {
                        model.TopRetweets.Add(new UseRecord(rdr["tag"].ToString(), int.Parse(rdr["Positive"].ToString()),
                                                            int.Parse(rdr["Neutral"].ToString()),
                                                            int.Parse(rdr["Negative"].ToString())));
                    }

                    rdr.Close();
                    conn.Dispose();
                }

                cache.Add(RetweetSentimentKey, model.TopRetweets, DateTimeOffset.UtcNow.AddMinutes(15));
            }

            // now load top recent sentiment
            result = cache.Get(RecentSentimentKey);

            if (result != null)
            {
                model.RecentSentiment = (IList <UseRecord>)result;
            }
            else
            {
                using (var conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["OclumenContext"].ToString()))
                {
                    conn.Open();

                    var cmd = new SqlCommand("RecentSentiment", conn);

                    cmd.CommandType = CommandType.StoredProcedure;
                    SqlDataReader rdr = cmd.ExecuteReader();

                    // read top retweets
                    rdr.Read();

                    model.RecentSentiment.Add(new UseRecord("Past Hour", int.Parse(rdr["Positive"].ToString()),
                                                            int.Parse(rdr["Neutral"].ToString()),
                                                            int.Parse(rdr["Negative"].ToString())));

                    model.RecentSentiment.Add(new UseRecord("One Hour Ago", int.Parse(rdr["PositiveOneHour"].ToString()),
                                                            int.Parse(rdr["NeutralOneHour"].ToString()),
                                                            int.Parse(rdr["NegativeOneHour"].ToString())));

                    model.RecentSentiment.Add(new UseRecord("Two Hours Ago", int.Parse(rdr["PositiveTwoHour"].ToString()),
                                                            int.Parse(rdr["NeutralTwoHour"].ToString()),
                                                            int.Parse(rdr["NegativeTwoHour"].ToString())));


                    rdr.Close();
                    conn.Dispose();
                }

                cache.Add(RecentSentimentKey, model.RecentSentiment, DateTimeOffset.UtcNow.AddMinutes(15));
            }
        }
Beispiel #23
0
        // GET: Overview
        public async Task <ActionResult> Index(string email)
        {
            var userRepository = new UserRepository();
            var user           = await userRepository.FindByEmail(email);

            var scheduleRepository = new ScheduleRepository();
            var leaves             = await scheduleRepository.FindAllLeaves(user.Id);

            var leaveTypeRepository = new LeaveTypeRepository();
            var allLeaveTypes       = await leaveTypeRepository.FindAll();

            var leaveTypesLookUp = allLeaveTypes.ToDictionary(l => l.LeaveCodeName);

            var model = new OverviewModel
            {
                Leaves = leaves,
                User   = user
            };

            model.LeaveEntitlement.Add(GetLeaveEntitlement(user, leaves, leaveTypesLookUp["annual_leave"], user.LeaveQuotas.AnnualLeave));
            model.LeaveEntitlement.Add(GetLeaveEntitlement(user, leaves, leaveTypesLookUp["sick_leave"], user.LeaveQuotas.SickLeave));
            model.LeaveEntitlement.Add(GetLeaveEntitlement(user, leaves, leaveTypesLookUp["training_leave"], user.LeaveQuotas.TrainingLeave));
            model.LeaveEntitlement.Add(GetLeaveEntitlement(user, leaves, leaveTypesLookUp["compassionate_leave"], user.LeaveQuotas.CompassionateLeave));
            model.LeaveEntitlement.Add(GetLeaveEntitlement(user, leaves, leaveTypesLookUp["maternity_leave"], user.LeaveQuotas.MaternityLeave));
            model.LeaveEntitlement.Add(GetLeaveEntitlement(user, leaves, leaveTypesLookUp["paternity_leave"], user.LeaveQuotas.PaternityLeave));
            model.LeaveEntitlement.Add(GetLeaveEntitlement(user, leaves, leaveTypesLookUp["child_care_leave"], user.LeaveQuotas.ChildCareLeave));
            model.LeaveEntitlement.Add(GetLeaveEntitlement(user, leaves, leaveTypesLookUp["extended_child_care_leave"], user.LeaveQuotas.ExtendedChildCareLeave));
            model.LeaveEntitlement.Add(GetLeaveEntitlement(user, leaves, leaveTypesLookUp["ns_leave"], user.LeaveQuotas.NSLeave));

            var upcomingLeaves = leaves.Where(l => l.Date > DateTime.Now).OrderBy(l => l.Date).ToList();
            //var upcomingLeaves = leaves.OrderBy(l => l.Date).ToList();

            var groupedUpcomingLeaves = upcomingLeaves.GroupBy(l => l.LeaveType);

            foreach (var group in groupedUpcomingLeaves)
            {
                var groupLeaves     = group.ToList();
                var currentUpcoming = new UpcomingLeaves {
                    Type = group.Key
                };
                DateTime currentDate = groupLeaves[0].Date.Value;
                currentUpcoming.From   = FormatDate(currentDate);
                currentUpcoming.Reason = groupLeaves[0].Reason;

                if (groupLeaves.Count == 1)
                {
                    currentUpcoming.To = FormatDate(currentDate);
                    model.UpcomingLeaves.Add(currentUpcoming);
                }
                else
                {
                    int      nextLeaveIndex = 1;
                    string   reason         = groupLeaves[nextLeaveIndex].Reason;
                    DateTime nextLeave      = groupLeaves[nextLeaveIndex++].Date.Value;

                    while (nextLeaveIndex <= groupLeaves.Count)
                    {
                        while (nextLeaveIndex <= groupLeaves.Count &&
                               (currentDate.AddDays(1) == nextLeave ||
                                currentDate.AddDays(1).DayOfWeek == DayOfWeek.Saturday ||
                                currentDate.AddDays(1).DayOfWeek == DayOfWeek.Sunday))
                        {
                            if (nextLeaveIndex < groupLeaves.Count &&
                                currentDate.AddDays(1) == nextLeave)
                            {
                                nextLeave = groupLeaves[nextLeaveIndex++].Date.Value;
                            }
                            currentDate = currentDate.AddDays(1);
                        }

                        if (currentDate != nextLeave)
                        {
                            currentUpcoming.To = FormatDate(currentDate);
                            model.UpcomingLeaves.Add(currentUpcoming);

                            currentDate     = nextLeave;
                            currentUpcoming = new UpcomingLeaves
                            {
                                Type   = group.Key,
                                From   = FormatDate(currentDate),
                                Reason = reason
                            };
                        }

                        if (nextLeaveIndex < groupLeaves.Count)
                        {
                            reason    = groupLeaves[nextLeaveIndex].Reason;
                            nextLeave = groupLeaves[nextLeaveIndex].Date.Value;
                        }

                        nextLeaveIndex++;
                    }


                    if (currentUpcoming != null)
                    {
                        currentUpcoming.To = FormatDate(nextLeave);
                        model.UpcomingLeaves.Add(currentUpcoming);
                    }
                }
            }

            //upcomingLeaves.ForEach(l => model.UpcomingLeaves.Add(new UpcomingLeaves
            //    {
            //        Type = l.LeaveType,
            //        From = FormatDate(l.Date.Value),
            //        To = FormatDate(l.Date.Value)
            //    }));

            return(JsonNet(model));
        }
Beispiel #24
0
        public async Task <ViewResult> Index()
        {
            OverviewModel <PaymentMethodResponse> model = await this._paymentMethodOverviewClient.GetList();

            return(this.View(model));
        }
Beispiel #25
0
        public async Task <ViewResult> Index()
        {
            OverviewModel <PaymentResponse> model = await _paymentOverviewClient.GetList();

            return(View(model));
        }
        public async Task <ViewResult> Index()
        {
            OverviewModel <CustomerResponse> model = await _customerOverviewClient.GetList();

            return(View(model));
        }
Beispiel #27
0
        public async Task <ViewResult> ApiUrl([FromQuery] string url)
        {
            OverviewModel <PaymentResponse> model = await _paymentOverviewClient.GetListByUrl(url);

            return(View(nameof(this.Index), model));
        }
 public PieChart(OverviewModel filterModel)
 {
     InitializeComponent();
     this.filterModel = filterModel;
     this.DataContext = filterModel;
 }