Exemplo n.º 1
0
 private void addCustomerButton_Click(object sender, EventArgs e)
 {
     using (var form = new AddCustomerForm())
     {
         form.ShowDialog();
     }
 }
Exemplo n.º 2
0
        public async Task AddCustomer(IDialogContext context, LuisResult result)
        {
            var getEmailForm = new AddCustomerForm();
            var form         = new FormDialog <AddCustomerForm>(new AddCustomerForm(), new BuildFormDelegate <AddCustomerForm>(getEmailForm.BuildForm), FormOptions.PromptInStart);

            context.Call <AddCustomerForm>(form, callback.CallbackGlobal);
        }
Exemplo n.º 3
0
		public JsonResult Add(AddCustomerForm form)
		{
			var customer = Mapper.Map<Customer>(form);
			_context.Customers.Add(customer);
			_context.SaveChanges();

			var model = Mapper.Map<CustomerViewModel>(customer);
			return BetterJson(model);
		}
Exemplo n.º 4
0
        private void bt_add_customer_Click(object sender, EventArgs e)
        {
            AddCustomerForm acf = new AddCustomerForm();

            if (acf.ShowDialog() == DialogResult.OK)
            {
                dtshowcustomer_find.DataSource = CustomerController.loadAddedCustomer();
                keycustomerText.Focus();
            }
        }
Exemplo n.º 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            AddCustomerForm acf = new AddCustomerForm();

            if (acf.ShowDialog() == DialogResult.OK)
            {
                selected_customer = CustomerController.addedCustomer;
                showInfor();
            }
        }
        public JsonResult Add(AddCustomerForm form)
        {
            var customer = Mapper.Map <Customer>(form);

            _context.Customers.Add(customer);
            _context.SaveChanges();

            var model = Mapper.Map <CustomerViewModel>(customer);

            return(BetterJson(model));
        }
Exemplo n.º 7
0
 private void BtnAddCustomer_Click(object sender, EventArgs e)
 {
     if (!CustomerAdded)
     {
         _addCustomerForm = new AddCustomerForm(this);
         _addCustomerForm.ShowDialog();
     }
     else
     {
         MessageBox.Show("Cliente já foi adicionado.");
     }
 }
Exemplo n.º 8
0
 private void validCreateCustomerForm(AddCustomerForm form)
 {
     if (form.Solde < 50)
     {
         ModelState.AddModelError("Solde", "le solde initial doit etre superieur à 50€");
     }
     try
     {
         customerRepo.GetCustomers().First(c => c.AccountNumber == form.CustomerNumber);
         ModelState.AddModelError("CustomerNumber", "ce numéro utilisateur est déja attribué");
     }
     catch (Exception) {}
     validCreateAccount(new AddAccountForm {
         BIC = form.BIC, IBAN = form.IBAN
     });
 }
Exemplo n.º 9
0
        public ActionResult Create(AddCustomerForm form)
        {
            if (!IsConnected)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (ModelState.IsValid)
            {
                validCreateCustomerForm(form);
                if (ModelState.IsValid)
                {
                    var customer = new Customer
                    {
                        FirstName     = form.FirstName,
                        LastName      = form.LastName,
                        AccountNumber = form.CustomerNumber,
                        Password      = form.Password,
                        Banker_ID     = form.BankerID,
                        Accounts      = new List <Account>()
                    };
                    var account = new Account
                    {
                        Solde = form.Solde,
                        Owner = customer,
                        BIC   = form.BIC,
                        IBAN  = form.IBAN
                    };
                    accountRepo.InsertAccount(account);
                    customer.Accounts.Add(account);
                    customerRepo.InsertCustomer(customer);
                    customerRepo.Save();
                    return(RedirectToAction("Index"));
                }
            }

            return(View(new AddCustomerForm
            {
                Bankers = bankerRepo.GetBankers().Select(b => new SelectListItem
                {
                    Value = b.ID.ToString(),
                    Text = b.FirstName + " " + b.LastName
                })
            }));
        }
Exemplo n.º 10
0
        private void OpenAddForm(int id)
        {
            selectedId = id;

            Form addForm = this.ParentForm.OwnedForms.FirstOrDefault(a => a.Name == "AddCustomerForm");
            if (addForm == null)
            {
                AddCustomerForm form = new AddCustomerForm();
                form.CustomerId = id;
                form.CustomerUpdated += new CustomerUpdatedEventHandler(form_CustomerUpdated);
                form.Owner = this.ParentForm;
                form.Show();
            }
            else
            {
                AddCustomerForm openedForm = (AddCustomerForm)addForm;
                openedForm.CustomerId = id;
                openedForm.LoadCustomerDetails();
                openedForm.Focus();
            }
        }
Exemplo n.º 11
0
        private void Clear()
        {
            int tempX = lblTotal.Width;

            NewSource();
            lblDiscount.Text   = "0,00";
            lblItemAmount.Text = "0";
            lblSubtotal.Text   = "0,00";
            lblTotal.Text      = "0,00";
            //picProduct.Image = "";
            txtAmount.Text       = "1";
            txtCode.Text         = "";
            lblCustomerCPF.Text  = "";
            lblCustomerName.Text = "";
            gbCustomer.Visible   = false;
            _addCustomerForm     = null;
            _finalizeForm        = null;
            _customer            = null;
            CustomerAdded        = false;

            lblTotal.Location       = new Point(lblTotal.Location.X + Math.Abs((tempX - lblTotal.Width)), lblTotal.Location.Y);
            lblCifraoTotal.Location = new Point(lblCifraoTotal.Location.X + Math.Abs((tempX - lblTotal.Width)), lblCifraoTotal.Location.Y);
        }
Exemplo n.º 12
0
        private void Button5_Click(object sender, EventArgs e)
        {
            AddCustomerForm addCustomerForm = new AddCustomerForm();

            addCustomerForm.Show();
        }