コード例 #1
0
        public ActionResult BudgetSubmitAjaxPostCall(string budget_name, DateTime date_selection, string description, string expense_type, float amount_input, int user_id)
        {
            BudgetRecord budget = new BudgetRecord
            {
                UserID           = user_id,
                DateOfTrans      = date_selection,
                TypeOfTrans      = budget_name,
                TransDescription = description,
                Amount           = amount_input,
                ExpenseType      = expense_type,
            };



            try
            {
                if (ModelState.IsValid)
                {
                    DB.BudgetRecords.Add(budget);
                    DB.SaveChanges();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("error" + e);
            }
            return(Json(new { sucess = "true" }));
        }
コード例 #2
0
        public BudgetRecordEditorViewModel(BudgetRecord record)
        {
            Year     = record.Year;
            Month    = record.Month;
            Amount   = record.Amount;
            Category = new CategoryNode(record.Category);

            switch (record.Type)
            {
            case BudgetType.Monthly:
                Monthly = true;
                break;

            case BudgetType.Point:
                Point = true;
                OnDay = record.OnDay;
                break;

            case BudgetType.Daily:
                Daily = true;
                break;

            case BudgetType.Weekly:
                Weekly = true;
                OnDay  = record.OnDay;
                break;

            default:
                break;
            }
        }
コード例 #3
0
 public RecordItem(BudgetRecord rec)
 {
     this.record          = rec;
     rec.PropertyChanged += (sender, e) =>
     {
         // Raise all properties changed.
         RaisePropertyChanged(string.Empty);
     };
 }