/* private void ClearAll() * { * Identity.Text = ""; * FirstTBox.Text = ""; * LastTBox.Text = ""; * phoneTBox.Text = ""; * AddressTBox.Text = ""; * CountryTBox.Text = ""; * PostalTBox.Text = ""; * EmailTBox.Text = ""; * }*/ public void setUpCustomerListView() { ListViewItem customerDetails; CustomerListView.Clear(); CustomerListView.Columns.Insert(0, "CustomerID", 120, HorizontalAlignment.Left); CustomerListView.Columns.Insert(1, "Name", 150, HorizontalAlignment.Left); CustomerListView.Columns.Insert(2, "EmailAddress", 120, HorizontalAlignment.Left); CustomerListView.Columns.Insert(3, "NumberOfRooms", 120, HorizontalAlignment.Left); foreach (Customer customer in customers) { customerDetails = new ListViewItem(); customerDetails.Text = customer.CustomerID.ToString(); customerDetails.SubItems.Add(customer.Name); customerDetails.SubItems.Add(customer.Surname); customerDetails.SubItems.Add(customer.EmailAddress); CustomerListView.Items.Add(customerDetails); } CustomerListView.Refresh(); CustomerListView.GridLines = false; }
private async void deleteButton_Clicked(object sender, EventArgs e) { try { if (selectedCustomer != null) { await App.mobileService.GetTable <Customer>().DeleteAsync(selectedCustomer); await FormModel.JobsCustomersAzureDatabaseQuery(); await Application.Current.MainPage.DisplayAlert("Success", $"{selectedCustomer.CustomerName} deleted.", "OK"); App.Customers.Remove(selectedCustomer); } } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Error", $"{ex}", "OK"); } CustomerListView.SelectedItem = null; CustomerListView.ItemsSource = App.Customers; CustomerListView.RefreshView(); }
public void FindCustomerClick(object sender, RoutedEventArgs args) { CustomerListView clv = new CustomerListView(); clv.DataContext = (DataContext as MainVM).FindCustomer(search.Text); clv.Show(); }
public CustomerListViewModel(CustomerListView customerListView) { WaitWindow = new WaitWindow(); CustomerListView = customerListView; Task.Run(() => LoadCustomersAsync()); AddCustomerCommand = new RelayCommand(ExecAddCustomer, CanAddCustomer); EditCustomerCommand = new RelayCommand(ExecEditCustomer, CanEditCustomer); DeleteCustomerCommand = new RelayCommand(ExecDeleteCustomerAsync, CanDeleteCustomer); }
public void CustomerListViewTest() { var customerListView = new CustomerListView(); customerListView.Initialize(new DataManager(Customers)); using (var testForm = new UserControlTestForm(customerListView)) { testForm.ShowDialog(); } }
private static void SetupDomainEventHandlers(IBus bus, IDocumentStore documentStore) { //TODO: Resolve through IoC var view = new CustomerListView(documentStore); bus.RegisterHandler<CustomerCreatedEvent>(view.Handle); bus.RegisterHandler<CustomerRelocatedEvent>(view.Handle); var addressView = new CustomerAddressView(documentStore); bus.RegisterHandler<CustomerCreatedEvent>(addressView.Handle); bus.RegisterHandler<CustomerRelocatedEvent>(addressView.Handle); }
public ActionResult EnabledCustomer() { CustomerListView culist = new CustomerListView(); List <SalePoint> salepointlist = AgroExpressDBAccess.GetallEnabledSalePoint(); if (salepointlist != null) { culist.salepointlist = salepointlist.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); } List <Area> arealist = AgroExpressDBAccess.GetallEnabledArea(); if (arealist != null) { culist.arealist = arealist.Select(x => new SelectListItem { Value = x.PKAreaId.ToString(), Text = x.AreaName }); } List <SubArea> sarealist = AgroExpressDBAccess.GetallEnabledSubArea(); if (sarealist != null) { culist.subarealist = sarealist.Select(x => new SelectListItem { Value = x.PKSubAreaId.ToString(), Text = x.SubAreaName }); } var customerlist = AgroExpressDBAccess.GetallEnabledCustomer(); culist.customerlist = customerlist; if (customerlist != null) { culist.selectedcustomerlist = customerlist.Select(x => new SelectListItem { Value = x.PKCustomerId.ToString(), Text = x.FullName }); } return(View(culist)); }
private static void SetupDomainEventHandlers(IBus bus, IDocumentStore documentStore) { //TODO: Resolve through IoC var view = new CustomerListView(documentStore); bus.RegisterHandler <CustomerCreatedEvent>(view.Handle); bus.RegisterHandler <CustomerRelocatedEvent>(view.Handle); var addressView = new CustomerAddressView(documentStore); bus.RegisterHandler <CustomerCreatedEvent>(addressView.Handle); bus.RegisterHandler <CustomerRelocatedEvent>(addressView.Handle); }
// GET: Owner public ActionResult Index(CustomerListView viewModel) { viewModel.CustomerLists = db.Customers .Select(c => new CustomerList() { Customer = c, Owner = c.Owner, Count = c.Owner.Inventories.Count }) .OrderBy(c => c.Owner.Name) .ToPagedList(viewModel.Page, viewModel.PageSize); return(View(viewModel)); }
protected void clearUserControls() { HIDDEN_LABEL_selectedCustomerID.Text = ""; selectedCustomerRental.Text = ""; PhoneNumberInput.Text = ""; selectedCustomerName.Text = ""; selectedCustomerAddress.Text = ""; selectedCustomerCity.Text = ""; creditcardinput.Text = ""; //no real need //RentalEquipmentListview.DataBind(); CustomerListView.DataBind(); PendingRentalListView.DataBind(); newRental.Visible = false; }
public CustomersPage() { #region customer list activity inidicator ActivityIndicator customerListActivityIndicator = new ActivityIndicator() { HeightRequest = Sizes.MediumRowHeight }; customerListActivityIndicator.SetBinding(IsEnabledProperty, "IsBusy"); customerListActivityIndicator.SetBinding(IsVisibleProperty, "IsBusy"); customerListActivityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); #endregion #region customer list CustomerListView customerListView = new CustomerListView(); customerListView.SetBinding(CustomerListView.ItemsSourceProperty, "Accounts"); customerListView.SetBinding(IsEnabledProperty, "IsBusy", converter: new InverseBooleanConverter()); customerListView.SetBinding(IsVisibleProperty, "IsBusy", converter: new InverseBooleanConverter()); customerListView.ItemTapped += async(sender, e) => { Account account = (Account)e.Item; await PushTabbedPage(account); }; #endregion #region compose view hierarchy Content = new UnspacedStackLayout() { Children = { customerListActivityIndicator, customerListView }, Padding = Device.OnPlatform(Thicknesses.IosStatusBar, Thicknesses.Empty, Thicknesses.Empty) }; #endregion #region wire up MessagingCenter // Catch the login success message from the MessagingCenter. // This is really only here for Android, which doesn't fire the OnAppearing() method in the same way that iOS does (every time the page appears on screen). Device.OnPlatform(Android: () => MessagingCenter.Subscribe <CustomersPage>(this, MessagingServiceConstants.AUTHENTICATED, sender => OnAppearing())); #endregion }
public void SendMailOnApproval(int CustomerId, string TemplatePath) { CustomerListView objLV = this.uow.CustomerListView.GetAll().Where(x => x.loginID == CustomerId).FirstOrDefault(); LoginDetailModel objLD = this.uow.LoginDetails.GetAll().Where(x => x.loginID == CustomerId).FirstOrDefault(); if (objLV != null && objLD != null) { StringBuilder sbMailTemplate = new StringBuilder(); sbMailTemplate.Append(System.IO.File.ReadAllText(TemplatePath)); List <string> lstOfEmailIDs = new List <string>(); lstOfEmailIDs.Add(objLV.emailId); sbMailTemplate = sbMailTemplate.Replace("${CustomerName}", objLV.firstName + " " + objLV.lastName); sbMailTemplate = sbMailTemplate.Replace("${Username}", objLD.username); sbMailTemplate = sbMailTemplate.Replace("${Password}", objLD.password); MailUtility objMu = new MailUtility(); objMu.SendMail(lstOfEmailIDs, "Account approved @ rosyblueonline.com", true, sbMailTemplate.ToString()); } }
public CustomersPage() { #region customer list activity inidicator ActivityIndicator customerListActivityIndicator = new ActivityIndicator() { HeightRequest = Sizes.MediumRowHeight }; customerListActivityIndicator.SetBinding(IsEnabledProperty, "IsBusy"); customerListActivityIndicator.SetBinding(IsVisibleProperty, "IsBusy"); customerListActivityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); #endregion #region customer list CustomerListView customerListView = new CustomerListView(); customerListView.SetBinding(CustomerListView.ItemsSourceProperty, "Accounts"); customerListView.SetBinding(IsEnabledProperty, "IsBusy", converter: new InverseBooleanConverter()); customerListView.SetBinding(IsVisibleProperty, "IsBusy", converter: new InverseBooleanConverter()); customerListView.ItemTapped += async(sender, e) => await App.ExecuteIfConnected(async() => { Account account = (Account)e.Item; await PushTabbedPage(account); }); #endregion #region compose view hierarchy Content = new UnspacedStackLayout() { Children = { customerListActivityIndicator, customerListView }, Padding = Device.OnPlatform(Thicknesses.IosStatusBar, Thicknesses.Empty, Thicknesses.Empty) }; #endregion }
protected void clearUserControls() { HIDDEN_LABEL_selectedCustomerID.Text = ""; selectedCustomerRental.Text = ""; PhoneNumberInput.Text = ""; selectedCustomerName.Text = ""; selectedCustomerAddress.Text = ""; selectedCustomerCity.Text = ""; creditcardinput.Text = ""; PhoneNumberInput.Enabled = true; PhoneNumberInput.ForeColor = System.Drawing.Color.Empty; phoneNumberSubmitBtn.Enabled = true; phoneNumberSubmitBtn.ForeColor = System.Drawing.Color.Empty; //no real need //RentalEquipmentListview.DataBind(); CustomerListView.DataBind(); PendingRentalListView.DataBind(); //newRental.Visible = false; }
private void SearchButton_Click(object sender, EventArgs e) { dictCustomer = CustomerDB.ReadFromFile(); String code = SearchCustomerTextBox.Text; Customer aCustomer; if (dictCustomer.TryGetValue(Int32.Parse(code), out aCustomer)) { ListViewItem searchItem = null; int index = 0; do { if (index < CustomerListView.Items.Count) { searchItem = CustomerListView.FindItemWithText(code, true, index, false); if (searchItem != null) { for (int i = 0; i < CustomerListView.SelectedIndices.Count; i++) { CustomerListView.Items[CustomerListView.SelectedIndices[i]].Selected = false; } CustomerListView.Items[searchItem.Index].Selected = true; CustomerListView.Select(); index = searchItem.Index + 1; } } else { searchItem = null; } } while (searchItem != null); } else { MessageBox.Show("Customer not found!"); Reset(); } }
private void OpenCustomerListView() { var clv = new CustomerListView(); clv.Show(); }
public ActionResult EnabledCustomer(CustomerListView culist) { List <Customer> customerlist = AgroExpressDBAccess.GetallEnabledCustomer(); List <Area> AreList = new List <Area>(); if (culist.CustomerID != null) { customerlist = customerlist.Where(a => a.PKCustomerId == culist.CustomerID).ToList(); } if (culist.Mobile != null) { customerlist = customerlist.Where(a => a.Mobile == culist.Mobile).ToList(); } if (culist.SubAreaId != null) { customerlist = customerlist.Where(a => a.SubAreaId == culist.SubAreaId).ToList(); } List <SubArea> subAreList = AgroExpressDBAccess.GetallEnabledSubArea(); if (culist.SalePointId != null) { AreList = AgroExpressDBAccess.GetAreaBySalePointID((int)culist.SalePointId); if (AreList != null) { subAreList = subAreList .Where(x => AreList.Any(y => y.PKAreaId == x.AreaId)).ToList(); } customerlist = customerlist.Where(customer => subAreList.Any(subarea => subarea.PKSubAreaId == customer.SubAreaId)).ToList(); } if (culist.AreaId != null) { subAreList = subAreList .Where(x => x.AreaId == culist.AreaId).ToList(); customerlist = customerlist.Where(customer => subAreList.Any(subarea => subarea.PKSubAreaId == customer.SubAreaId)).ToList(); } if (culist.RateMin != null) { customerlist = customerlist.Where(a => a.Rate >= culist.RateMin).ToList(); } if (culist.RateMax != null) { customerlist = customerlist.Where(a => a.Rate <= culist.RateMax).ToList(); } if (culist.DueMin != null) { customerlist = customerlist.Where(a => (a.TotalBill - a.TotalPaid) >= culist.DueMin).ToList(); } if (culist.DueMax != null) { customerlist = customerlist.Where(a => (a.TotalBill - a.TotalPaid) <= culist.DueMax).ToList(); } List <SalePoint> salepointlist = AgroExpressDBAccess.GetallEnabledSalePoint(); if (salepointlist != null) { culist.salepointlist = salepointlist.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); } List <Area> arealist = AgroExpressDBAccess.GetallEnabledArea(); if (arealist != null) { culist.arealist = arealist.Select(x => new SelectListItem { Value = x.PKAreaId.ToString(), Text = x.AreaName }); } List <SubArea> sarealist = AgroExpressDBAccess.GetallEnabledSubArea(); if (sarealist != null) { culist.subarealist = sarealist.Select(x => new SelectListItem { Value = x.PKSubAreaId.ToString(), Text = x.SubAreaName }); } culist.customerlist = customerlist; culist.customerlist = customerlist; //culist.StartValue = culist.StartValue; //culist.EndValue = culist.EndValue; culist.Mobile = culist.Mobile; //culist.Rate = culist.Rate; if (customerlist != null) { culist.selectedcustomerlist = customerlist.Select(x => new SelectListItem { Value = x.PKCustomerId.ToString(), Text = x.FullName }); } return(View(culist)); }
static void Main(string[] args) { IView customerList = new CustomerListView(); IView customerView = null; while (customerView == null) { customerList.Show(); Console.WriteLine("\nAre you a new customer?\nPress 1 if yes, otherwise press 2."); int response = Console.ReadLine().ToInt(-1); Console.Clear(); if (response == 1) { Customer customer = new Customer(); customer.Id = GenerateID.GetGeneratedID(); Console.WriteLine("Enter your first name:"); customer.FirstName = Console.ReadLine(); Console.WriteLine("Enter your Middle name:"); customer.MiddleName = Console.ReadLine(); Console.WriteLine("Enter your Last name:"); customer.LastName = Console.ReadLine(); Console.WriteLine("Enter your gender 'M' - Male, 'F' - Female:"); customer.Gender = Console.ReadLine(); Console.WriteLine("Enter your contact no."); customer.ContactNo = Console.ReadLine(); Console.WriteLine("Enter your email address:"); customer.Email = Console.ReadLine(); Console.WriteLine("Enter your current address"); customer.Address = Console.ReadLine(); customerView = new CustomerView(customer); if (((CustomerView)customerView).CustomerManager.Add(customer)) { Console.WriteLine("Member succesfully added! See details below."); customerView.Show(); } else { Console.WriteLine("Member can't be added."); customerView = null; } } else if (response == 2) { Console.WriteLine("Enter your Id."); Customer customer = ((CustomerListView)customerList).Manager.GetById(Console.ReadLine().ToInt(-1), "Id"); if (customer == null) { Console.WriteLine($"Entered Id can't be found!"); } else { customerView = new CustomerView(customer); } } else { Console.WriteLine("Response not recognize. Please try again."); } } while (true) { Console.WriteLine($"\nHello {((CustomerView)customerView).Customer.Info.FirstName}! What would you like to do?"); Console.WriteLine("Press 1 to show your order history. Press 2 to shop! Press 3 to exit.\n"); int response = Console.ReadLine().ToInt(-1); Console.Clear(); if (response == 1) { customerView.Show(); } else if (response == 2) { IView cartView = null; bool doneShopping = false; PurchaseHistory purchaseHistory = ((CustomerView)customerView).Customer.PurchaseHistory.Find(x => x.Purchase.Status == "Pending"); Purchase purchase; if (purchaseHistory == null) { purchase = new Purchase(GenerateID.GetGeneratedID(), ((CustomerView)customerView).Customer.Info.Id, "Pending", DateTime.Now.ToString(), 0); if (((CustomerView)customerView).PurchaseManager.Add(purchase)) { Console.WriteLine("New purchase. Add items to your cart."); ((CustomerView)customerView).Customer.PurchaseHistory.Add(new PurchaseHistory(purchase)); cartView = new CartView(new List <PurchaseDetails>(), purchase.Id); } else { Console.WriteLine("Can't create new purchase. Please try again."); doneShopping = true; } } else { purchase = purchaseHistory.Purchase; Console.WriteLine("You have a pending purchase. Restoring."); cartView = new CartView(purchaseHistory.PurchaseDetails, purchaseHistory.Purchase.Id); } IView groceriesView = new GroceriesView(); while (!doneShopping) { Console.WriteLine("Press 1 to add an item, 2 to change the quantity of an item, " + "3 to show your cart, and 4 to check out, 5 to exit.\n"); groceriesView.Show(); Console.WriteLine(); int input; input = Console.ReadLine().ToInt(0); Actions action = (Actions)input; Console.Clear(); switch (action) { case Actions.ADD_ITEM: { Console.WriteLine("Enter the barcode of an item"); Item item = ((GroceriesView)groceriesView).Manager.GetById(Console.ReadLine().ToInt(-1), "Id"); if (item == null) { Console.WriteLine("Item can't be found."); } else { ((CartView)cartView).AddItem(item); } break; } case Actions.CHANGE_QUANTITY: { Console.WriteLine("Enter the barcode of an item to change quantity."); int id = Console.ReadLine().ToInt(-1); Item item = null; try { item = ((CartView)cartView).Purchases.Find(x => x.PurchaseItem.ItemId == id).Item; } catch (Exception ex) { Logging.log.Error(ex); } if (item != null) { Console.WriteLine("Enter the new quantity of the item"); int quantity = Console.ReadLine().ToInt(-1); if (quantity == -1) { Console.WriteLine("Can't change quantity for that value"); } else { ((CartView)cartView).ChangeQuantity(item, quantity); } } else { Console.WriteLine("Entered item can't be found!"); } break; } case Actions.SHOW_CART: { cartView.Show(); break; } case Actions.CHECK_OUT: { using (TransactionScope scope = new TransactionScope()) { float total = ((CartView)cartView).ComputeTotalPrice(); purchase.Status = "Purchased"; purchase.Date = DateTime.Now.ToString(); purchase.Total = total; if (((CustomerView)customerView).PurchaseManager.Update(purchase)) { Console.WriteLine("Thank you. Please come again."); doneShopping = true; } else { Console.WriteLine("Can't proceed to check out. Please try again."); break; } scope.Complete(); } break; } case Actions.EXIT: { doneShopping = true; break; } default: { Console.WriteLine("Action not recognize. Try again."); break; } } } } else if (response == 3) { break; } else { Console.WriteLine("Response not recognize. Please try again."); } } }
private async void saveButton_Clicked(object sender, EventArgs e) { bool validEntry = true; Customer newCustomer = new Customer(); if (string.IsNullOrEmpty(customerNameEntry.Text)) { validEntry = false; await Application.Current.MainPage.DisplayAlert("Error", "Please enter customer name.", "OK"); } if (!FormModel.IsPhoneNumber(customerPhoneEntry.Text)) { validEntry = false; await Application.Current.MainPage.DisplayAlert("Error", "Please enter valid phone number.", "OK"); } if (customerPhone2Entry.Text != null) { if (!FormModel.IsPhoneNumber(customerPhone2Entry.Text)) { validEntry = false; await Application.Current.MainPage.DisplayAlert("Error", "Please enter valid 2nd phone number", "OK"); } } if (!FormModel.IsValidEmail(customerEmailEntry.Text)) { validEntry = false; await Application.Current.MainPage.DisplayAlert("Error", "Please enter valid email address.", "OK"); } if (string.IsNullOrEmpty(streetEntry.Text)) { validEntry = false; await Application.Current.MainPage.DisplayAlert("Error", "Please enter street.", "OK"); } if (string.IsNullOrEmpty(cityAddressEntry.Text)) { validEntry = false; await Application.Current.MainPage.DisplayAlert("Error", "Please enter city.", "OK"); } if (string.IsNullOrEmpty(stateAddressEntry.Text)) { validEntry = false; await Application.Current.MainPage.DisplayAlert("Error", "Please enter state.", "OK"); } if (string.IsNullOrEmpty(zipAddressEntry.Text)) { validEntry = false; await Application.Current.MainPage.DisplayAlert("Error", "Please enter zipcode.", "OK"); } if (validEntry) { try { if (App.user != null) { CustomerListView.ItemsSource = null; newCustomer.EmployeeID = App.user.ID; newCustomer.CustomerName = customerNameEntry.Text; newCustomer.CustomerPhone = customerPhoneEntry.Text; newCustomer.CustomerPhone2 = customerPhone2Entry.Text; newCustomer.CustomerEmail = customerEmailEntry.Text; newCustomer.CustomerStreetAddress = streetEntry.Text; newCustomer.CustomerCity = cityAddressEntry.Text; newCustomer.CustomerState = stateAddressEntry.Text; newCustomer.CustomerZipCode = zipAddressEntry.Text; var existsAlready = App.Customers.Where(u => u.CustomerName == newCustomer.CustomerName).FirstOrDefault(); if (existsAlready != null) { newCustomer.ID = existsAlready.ID; await App.mobileService.GetTable <Customer>().UpdateAsync(newCustomer); await FormModel.JobsCustomersAzureDatabaseQuery(); await Application.Current.MainPage.DisplayAlert("Success", $"{newCustomer.CustomerName} updated.", "OK"); } else { await App.mobileService.GetTable <Customer>().InsertAsync(newCustomer); await FormModel.JobsCustomersAzureDatabaseQuery(); await Application.Current.MainPage.DisplayAlert("Success", $"{newCustomer.CustomerName} saved.", "OK"); } } } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Error", $"{ex}", "OK"); } selectedCustomer = null; } CustomerListView.ItemsSource = App.Customers; CustomerListView.RefreshView(); }