private async void Start() { await Loading.Show(); createBillValid = new CreateBillValid(); CreateBillVM = new CreateBillVM(ViewLoaded); this.DataContext = CreateBillVM; InitializeComponent(); validatorClass = createBillValid; ConnectValidators(); }
// GET: Bills/Create public ActionResult Create() { CreateBillVM vm = new CreateBillVM(); List <BillTypeVM> types = CreateTypesList(); vm.TypeItems = new SelectList(types, "BillTypeId", "Name"); List <Recipient> recipients = CreateRecipientsList(); vm.RecipientsList = new SelectList(recipients, "RecipientId", "CompanyName"); vm.DueDate = DateTime.Now; return(View(vm)); }
public ActionResult Create([Bind(Include = "BillId,DueAmount,DueDate,Period,Description,BillTypeId,RecipientId")] CreateBillVM bill) { if (ModelState.IsValid) { IBill item = _billFactory.NewBill(bill.BillId, bill.RecipientId, bill.BillTypeId, bill.Description, bill.DueAmount, bill.DueDate, bill.Periodical, bill.Period, false); _billService.CreateBill(item); TempData["ResultMessage"] = "Utworzono rachunek"; var recipient = _recipientService.GetRecepient(bill.RecipientId); log.Info("Utworzono rachunek " + "Id:" + bill.RecipientId + ", Odbiorca: " + recipient.CompanyName + ", Kwota: " + bill.DueAmount); return(RedirectToAction("Index")); } return(View(bill)); }
public ActionResult Edit(CreateBillVM bill) { if (ModelState.IsValid) { _billService.UpdateBill( _billFactory.NewBill(bill.BillId, bill.RecipientId, bill.BillTypeId, bill.Description, bill.DueAmount, bill.DueDate, bill.Periodical, bill.Period, false) ); log.Info("Edytowano rachunek " + "Id:" + bill.BillId); TempData["ResultMessage"] = "Zmiany zapisane"; return(RedirectToAction("Index")); } return(View(bill)); }
private void AddEnabler() { if (createBillValid.PersonEnable) { createBillValid.AddValid = true; } else if (createBillValid.CompanyEnable && createBillValid.CompanyValid) { createBillValid.AddValid = true; } else { createBillValid.AddValid = false; } CreateEnabler(); CreateBillVM.From(createBillValid.PersonEnable); }
private void companyChooser_Validate(object sender, ValidationEventArgs e) { createBillValid.CompanyValid = false; if (string.IsNullOrEmpty(e.Value as string)) { e.SetError("Válassza ki a céget", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Information); } else if (!CreateBillVM.CompanyCheck(e.Value.ToString())) { e.SetError("A mező tartalma nem megfelelő", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical); } else { e.SetError("A mező tartalma megfelelő", DevExpress.XtraEditors.DXErrorProvider.ErrorType.User1); createBillValid.CompanyValid = true; } ForceBindingWithoutEnabledCheck(sender, e); AddEnabler(); }
// GET: Bills/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IBill bill = _billService.GetBill(CommonFunctions.NullableIntToInt(id)); CreateBillVM vm = new CreateBillVM(bill); List <BillTypeVM> types = CreateTypesList(); vm.TypeItems = new SelectList(types, "BillTypeId", "Name"); List <Recipient> recipients = CreateRecipientsList(); vm.RecipientsList = new SelectList(recipients, "RecipientId", "CompanyName"); if (bill == null) { return(HttpNotFound()); } return(View(vm)); }
private void Add(object sender, System.Windows.RoutedEventArgs e) { CreateBillVM.AddBillingItem(); CreateEnabler(); }
protected internal bool Dirty() { return(CreateBillVM.BillingCount()); }
private void CreateEnabler() { createBillValid.Create = createBillValid.AddValid && CreateBillVM.BillingCount(); }
private void Create(object sender, System.Windows.RoutedEventArgs e) { CreateBillVM.ExecuteMethod(); }
private void Erase(object sender, System.Windows.RoutedEventArgs e) { CreateBillVM.Erase(); CreateEnabler(); }
private void Decrease(object sender, System.Windows.RoutedEventArgs e) { CreateBillVM.ChangeValue(false); }