コード例 #1
0
        public IActionResult SearchCustomer2(string search, string nam, string city, int page)
        {
            List <Customers> list = _context.Customers.Where(m => m.City == search).ToList();

            if (list.Count == 0)
            {
                list = _context.Customers.Where(c => c.Givenname.StartsWith(search) || c.Surname.StartsWith(search)).ToList();
            }

            if (list.Count == 0)
            {
                list = _context.Customers.Where(k => k.Givenname.StartsWith(nam) && k.City.Contains(city)).ToList();
            }


            const int pagesize = 50;

            var totalNumber = list.Count();

            var customers = list.Skip(pagesize * (page - 1)).Take(pagesize);

            var modelCustomers = new CustomerInformationViewModel
            {
                Search             = search,
                pageNumber         = page,
                pageSize           = pagesize,
                TotalNumberOfItems = totalNumber,

                ShowMore      = page * pagesize < totalNumber,
                customerslist = customers.ToList()
            };

            return(View("SearchCustomer", modelCustomers));
        }
コード例 #2
0
        public IActionResult updateCustomer(CustomerInformationViewModel model, int id)
        {
            var newCus = _context.Customers.SingleOrDefault(k => k.CustomerId == id);

            if (model.customerInfo == null)
            {
                model.customerInfo = newCus;
            }
            else
            {
                newCus.Gender               = model.customerInfo.Gender;
                newCus.Givenname            = model.customerInfo.Givenname;
                newCus.Surname              = model.customerInfo.Surname;
                newCus.Streetaddress        = model.customerInfo.Streetaddress;
                newCus.City                 = model.customerInfo.City;
                newCus.Zipcode              = model.customerInfo.Zipcode;
                newCus.Country              = model.customerInfo.Country;
                newCus.CountryCode          = model.customerInfo.CountryCode;
                newCus.Birthday             = model.customerInfo.Birthday;
                newCus.NationalId           = model.customerInfo.NationalId;
                newCus.Telephonecountrycode = model.customerInfo.Telephonecountrycode;
                newCus.Telephonenumber      = model.customerInfo.Telephonenumber;
                newCus.Emailaddress         = model.customerInfo.Emailaddress;

                _context.SaveChanges();
                return(RedirectToAction("updateSuccess"));
            }

            return(View(model));
        }
コード例 #3
0
        public IActionResult updateCustomer(int id)
        {
            var model = new CustomerInformationViewModel();

            model.customerInfo = _context.Customers.SingleOrDefault(k => k.CustomerId == id);
            return(View(model));
        }
コード例 #4
0
        protected override void OnLoad(EventArgs e)
        {
            if (!this.DesignMode)
            {
                TranslateLabels();

                // Create a collection of pages
                this.pages = new List <OrderDetailsPage>(this.panelControl.Controls.Count);
                this.pages.Add(this.orderInformationPage);
                this.pages.Add(this.customerInformationPage);
                this.pages.Add(this.itemDetailsPage);
                this.pages.Add(this.deliveryInformationPage);
                this.pages.Add(this.paymentHistoryPage);
                this.pages.Add(this.cancellationChargePage);
                this.pages.Add(this.summaryPage);

                // Create a collection of view models
                pageViewModels               = new List <PageViewModel>();
                orderDetailsViewModel        = new OrderDetailsViewModel(this.transaction, this.mode);
                orderSummaryViewModel        = new OrderSummaryViewModel(this.transaction);
                customerInformationViewModel = new CustomerInformationViewModel(this.transaction);
                paymentHistoryViewModel      = new PaymentHistoryViewModel(this.transaction);
                itemDetailsViewModel         = new ItemDetailsViewModel(this.transaction);

                this.pageViewModels.Add(orderDetailsViewModel);
                this.pageViewModels.Add(orderSummaryViewModel);
                this.pageViewModels.Add(customerInformationViewModel);
                this.pageViewModels.Add(paymentHistoryViewModel);
                this.pageViewModels.Add(itemDetailsViewModel);

                // Listen to the property changed event on each view model
                this.pageViewModels.ForEach(vm => vm.PropertyChanged += new PropertyChangedEventHandler(OnPageViewModel_PropertyChanged));

                // Set on each page
                this.bindingSource.Add(orderDetailsViewModel);
                this.orderDetailsNavBar.SetViewModel(this.ViewModel);
                this.orderInformationPage.SetViewModel(this.ViewModel);
                this.itemDetailsPage.SetViewModel(itemDetailsViewModel);
                this.deliveryInformationPage.SetViewModel(this.ViewModel);
                this.customerInformationPage.SetViewModel(customerInformationViewModel);
                this.paymentHistoryPage.SetViewModel(paymentHistoryViewModel);
                this.cancellationChargePage.SetViewModel(this.ViewModel);
                this.summaryPage.SetViewModel(orderSummaryViewModel);

                this.ViewModel.SelectedPageIndex = GetStartPageIndex();
                this.ViewModel.SelectedPageTitle = this.pages[this.ViewModel.SelectedPageIndex].Text;
            }

            base.OnLoad(e);
        }
コード例 #5
0
        public IActionResult CustomerInformation(int id)
        {
            var model = new CustomerInformationViewModel();

            var customer     = _context.Customers.SingleOrDefault(c => c.CustomerId == id);
            var dispositions = _context.Dispositions.Where(d => d.Customer == customer).ToList();
            var list         = new List <Accounts>();

            foreach (var disposition in dispositions)
            {
                var account = _context.Accounts.SingleOrDefault(a => a.AccountId == disposition.AccountId); list.Add(account);
            }


            model.totalBalance = list.Sum(k => k.Balance);


            model.customerInfo = customer;
            model.accountInfo  = list;
            return(View(model));
        }
コード例 #6
0
 public async Task <IActionResult> Post(CustomerInformationViewModel input)
 {
     return(Ok(await _customerInformationService.Create(input)));
 }
コード例 #7
0
        protected override void OnLoad(EventArgs e)
        {
            if (!this.DesignMode)
            {
                TranslateLabels();

                // Create a collection of pages
                this.pages = new List <OrderDetailsPage>(this.panelControl.Controls.Count);
                this.pages.Add(this.orderInformationPage);
                this.pages.Add(this.customerInformationPage);
                this.pages.Add(this.itemDetailsPage);
                this.pages.Add(this.deliveryInformationPage);
                this.pages.Add(this.paymentHistoryPage);
                this.pages.Add(this.cancellationChargePage);
                this.pages.Add(this.summaryPage);

                // Create a collection of view models
                pageViewModels               = new List <PageViewModel>();
                orderDetailsViewModel        = new OrderDetailsViewModel(this.transaction, this.mode);
                orderSummaryViewModel        = new OrderSummaryViewModel(this.transaction);
                customerInformationViewModel = new CustomerInformationViewModel(this.transaction);
                paymentHistoryViewModel      = new PaymentHistoryViewModel(this.transaction);
                itemDetailsViewModel         = new ItemDetailsViewModel(this.transaction);
                this.pageViewModels.Add(orderDetailsViewModel);
                this.pageViewModels.Add(orderSummaryViewModel);
                this.pageViewModels.Add(customerInformationViewModel);
                this.pageViewModels.Add(paymentHistoryViewModel);
                this.pageViewModels.Add(itemDetailsViewModel);

                // Listen to the property changed event on each view model
                this.pageViewModels.ForEach(vm => vm.PropertyChanged += new PropertyChangedEventHandler(OnPageViewModel_PropertyChanged));

                // Set on each page
                this.bindingSource.Add(orderDetailsViewModel);
                this.orderDetailsNavBar.SetViewModel(this.ViewModel);
                this.orderInformationPage.SetViewModel(this.ViewModel);
                this.itemDetailsPage.SetViewModel(itemDetailsViewModel);
                this.deliveryInformationPage.SetViewModel(this.ViewModel);
                this.customerInformationPage.SetViewModel(customerInformationViewModel);
                this.paymentHistoryPage.SetViewModel(paymentHistoryViewModel);
                this.cancellationChargePage.SetViewModel(this.ViewModel);
                this.summaryPage.SetViewModel(orderSummaryViewModel);

                this.ViewModel.SelectedPageIndex = GetStartPageIndex();
                this.ViewModel.SelectedPageTitle = this.pages[this.ViewModel.SelectedPageIndex].Text;

                // for a customer order that is not on Create state (i.e. some operation has been performed on it, e.g. processing, packingslip, invoicing, etc)
                // then we cannot let the user click on the save button and edit this order
                bool saveButtonDisabled = this.transaction.Mode == CustomerOrderMode.Edit && this.transaction.OrderStatus != SalesStatus.Created;
                // Modificado por Adrián Barquero para FES; Se requeria que se puedan generar anticipos a las ordenes de ventas que tuvieran el status:
                //  Editado o Procesando
                if (this.transaction.Mode == CustomerOrderMode.Edit &&
                    (this.transaction.OrderStatus == SalesStatus.Processing ||
                     this.transaction.OrderStatus == SalesStatus.Invoiced))
                {
                    this.btnSave.Enabled = true;
                }
                else
                {
                    this.btnSave.Enabled = !saveButtonDisabled;
                }
            }

            base.OnLoad(e);
            try
            {
                if (this.transaction.PartnerData.isSuspended)
                {
                    this.ViewModel.SelectedPageIndex = pages.IndexOf(deliveryInformationPage);

                    this.transaction.PartnerData.isSuspended = false;
                    this.transaction.Save();

                    this.btnSave.PerformClick();
                }
            }
            catch (Exception ex)
            {
            }
        }
        public CustomerInformationPage()
        {
            InitializeComponent();

            BindingContext = model = new CustomerInformationViewModel();
        }