Exemplo n.º 1
0
        private async void Start()
        {
            await Loading.Show();

            createBillValid  = new CreateBillValid();
            CreateBillVM     = new CreateBillVM(ViewLoaded);
            this.DataContext = CreateBillVM;
            InitializeComponent();
            validatorClass = createBillValid;
            ConnectValidators();
        }
Exemplo n.º 2
0
        // 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));
        }
Exemplo n.º 3
0
 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));
 }
Exemplo n.º 4
0
 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));
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 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();
 }
Exemplo n.º 7
0
        // 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));
        }
Exemplo n.º 8
0
 private void Add(object sender, System.Windows.RoutedEventArgs e)
 {
     CreateBillVM.AddBillingItem();
     CreateEnabler();
 }
Exemplo n.º 9
0
 protected internal bool Dirty()
 {
     return(CreateBillVM.BillingCount());
 }
Exemplo n.º 10
0
 private void CreateEnabler()
 {
     createBillValid.Create = createBillValid.AddValid && CreateBillVM.BillingCount();
 }
Exemplo n.º 11
0
 private void Create(object sender, System.Windows.RoutedEventArgs e)
 {
     CreateBillVM.ExecuteMethod();
 }
Exemplo n.º 12
0
 private void Erase(object sender, System.Windows.RoutedEventArgs e)
 {
     CreateBillVM.Erase();
     CreateEnabler();
 }
Exemplo n.º 13
0
 private void Decrease(object sender, System.Windows.RoutedEventArgs e)
 {
     CreateBillVM.ChangeValue(false);
 }