public Category(string name, CategoryColor color, CategoryKeyboardShortcut keyboardShortcut) : this()
 {
     Name             = name;
     Color            = color;
     KeyboardShortcut = keyboardShortcut;
     Id = Guid.NewGuid();
 }
        async public void SubmitButtonClicked(object obj)
        {
            if (AmountColor.Equals("Salmon") || CategoryColor.Equals("Salmon") ||
                AvailCategories.Count == 0 || SelectedCategoryIndex == -1)
            {
                await parentPage.DisplayAlert("Error!", "Some of you input is invalid. Please" +
                                              " be sure that you have selected a record type, valid amount and valid category.",
                                              "Ok");
            }
            else
            {
                var response =
                    await parentPage.DisplayAlert("Proceed?", "Are you sure you want to submit the changes" +
                                                  " that you have made to the record?", "Yes, I'm sure", "No, don't");

                if (response)
                {
                    record.RecordType   = ExpenseChecked ? "expense" : "income";
                    record.Amount       = Double.Parse(Amount);
                    record.Date         = Date;
                    record.Category     = AvailCategories[SelectedCategoryIndex];
                    record.Description  = Description ?? "";
                    record.IsModified   = true;
                    record.LastModified = DateTime.Now;
                    parentPage.parentPage.vm.Refresh();
                    //Application.Current.MainPage = parentPage.parentPage;
                    await parentPage.Navigation.PopAsync();
                }
            }
        }
        public List <CategoryColor> GetCategories()
        {
            List <CategoryColor> b1 = new List <CategoryColor>();
            //var b=(from a in _context.Newsinfo orderby a.Category ascending select new { a.Category, a.Color }).Distinct().ToList();
            var b = (from a in _context.Newsinfo orderby a.Category select new { a.Category, a.Color }).ToList().Distinct();

            foreach (var c in b)
            {
                CategoryColor b2 = new CategoryColor();
                b2.Category = c.Category;
                b2.Color    = c.Color;
                b1.Add(b2);
            }
            return(b1);
        }
Esempio n. 4
0
        private void SetCategoryColor(ExcelRange excelRange, CategoryColor category)
        {
            excelRange.Style.Font.Color.SetColor(1, 0, 0, 0);
            excelRange.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
            switch (category)
            {
            case CategoryColor.Contracorriente:
                excelRange.Style.Fill.BackgroundColor.SetColor(1, 240, 90, 90);
                break;

            case CategoryColor.Contradominancia:
                excelRange.Style.Fill.BackgroundColor.SetColor(1, 220, 90, 240);
                break;

            case CategoryColor.Bloqueo:
                excelRange.Style.Fill.BackgroundColor.SetColor(1, 90, 200, 240);
                break;

            case CategoryColor.Dominancia:
                excelRange.Style.Fill.BackgroundColor.SetColor(1, 90, 240, 170);
                break;
            }
        }