Exemplo n.º 1
0
        public ActionResult Add(Bill collection)
        {
            using (LinkToDBDataContext context = new LinkToDBDataContext())
            {
                try
                {
                    Bill bill = new Bill();
                    bill.CreationDate = DateTime.Now;
                    bill.ModifyDate = DateTime.Now;
                    bill.Version = 1;
                    bill.UserId = 1;
                    bill.PaymentTypeId = 4;
                    bill.IsActive = true;

                    bill.Amount = collection.Amount;
                    bill.DueDate = collection.DueDate;
                    bill.IssueDate = collection.IssueDate;
                    bill.Name = collection.Name;
                    bill.Payee = collection.Payee;
                    bill.Shared = collection.Shared;
                    bill.StaysSame = collection.StaysSame;

                    context.Bills.InsertOnSubmit(bill);
                    context.SubmitChanges();

                    return RedirectToAction("Index");
                }
                catch
                {
                    return View(collection);
                }
            }
        }
Exemplo n.º 2
0
 public DashboardItem(Bill bill)
 {
     Id = bill.Id;
     Name = bill.Name;
     Date = bill.DueDate;
     Amount = bill.Amount;
     IsPastDue = DueInDays < 0;
     IsShared = bill.Shared;
     Type = "Bill";
     IsPaid = false;
 }
Exemplo n.º 3
0
 public SharedBill(Bill bill, ApplicationUser user, SharedPercentage percentage)
 {
     Bill             = bill;
     SharedWithUser   = user;
     SharedPercentage = percentage;
 }
Exemplo n.º 4
0
 public SharedBill()
 {
     Bill = new Bill();
 }
Exemplo n.º 5
0
 partial void DeleteBill(Bill instance);
Exemplo n.º 6
0
 partial void UpdateBill(Bill instance);
Exemplo n.º 7
0
 partial void InsertBill(Bill instance);
Exemplo n.º 8
0
		private void detach_Bills(Bill entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
Exemplo n.º 9
0
		private void attach_Bills(Bill entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}
Exemplo n.º 10
0
		private void detach_Bills(Bill entity)
		{
			this.SendPropertyChanging();
			entity.PaymentType = null;
		}
Exemplo n.º 11
0
		private void attach_Bills(Bill entity)
		{
			this.SendPropertyChanging();
			entity.PaymentType = this;
		}
Exemplo n.º 12
0
        public ActionResult Edit(int id, Bill collection)
        {
            using (LinkToDBDataContext context = new LinkToDBDataContext())
            {
                Bill bill = context.GetBill(id);

                try
                {
                    bill.ModifyDate = DateTime.Now;
                    bill.Version += 1;
                    bill.Name = collection.Name;
                    bill.Payee = collection.Payee;
                    bill.DueDate = collection.DueDate;
                    bill.Amount = collection.Amount;
                    bill.IssueDate = collection.IssueDate;
                    bill.StaysSame = collection.StaysSame;
                    bill.Shared = collection.Shared;

                    context.SubmitChanges();

                    return RedirectToAction("Index");
                }
                catch
                {
                    return View(bill);
                }
            }
        }