Пример #1
0
        /// <summary>
        /// Opens SearchForm and show the founded results
        /// </summary>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            SearchForm     searchForm        = new SearchForm(myCultureInfo);
            ListOfCustomer searchedCustomers = new ListOfCustomer();

            if (searchForm.ShowDialog() == DialogResult.OK)
            {
                foreach (Customer oneCustomer in this.listOfCustomer)
                {
                    if (oneCustomer.NAME.ToUpper().Contains(searchForm.Searchtext.ToUpper())
                        ||
                        oneCustomer.SURNAME.ToUpper().Contains(searchForm.Searchtext.ToUpper())
                        ||
                        oneCustomer.MAIL.ToUpper().Contains(searchForm.Searchtext.ToUpper())
                        )
                    {
                        searchedCustomers.Add(oneCustomer);
                    }
                }
                if (searchedCustomers.Count != 0)
                {
                    UpdateDatagridview(searchedCustomers);
                }
                else
                {
                    MessageBox.Show(Properties.Resources.stringSearch, Properties.Resources.stringError, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Пример #2
0
        // GET: Customer
        public ActionResult Index()
        {
            var customers = _Context.Customers.Include(c => c.MembershipType).ToList();
            var ViewModel = new ListOfCustomer
            {
                Customers = customers
            };

            return(View(ViewModel));
        }
Пример #3
0
 /// <summary>
 /// Creates a MainForm
 /// </summary>
 public MainForm(string password)
 {
     LoadLanguage();
     this.myCultureInfo  = new CultureInfo(language);
     this.password       = password;
     this.listHasChanged = false;
     this.listOfCustomer = new ListOfCustomer();
     Thread.CurrentThread.CurrentCulture   = myCultureInfo;
     Thread.CurrentThread.CurrentUICulture = myCultureInfo;
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
     this.StartPosition = FormStartPosition.CenterScreen;
     this.Size          = Screen.PrimaryScreen.WorkingArea.Size;
     LoadMainForm();
     SaveLanguage();
 }
Пример #4
0
 /// <summary>
 /// Update the data in datagridview with any ListOfCustomer
 /// </summary>
 private void UpdateDatagridview(ListOfCustomer customers)
 {
     this.dgvCustomers.Rows.Clear();
     foreach (Customer customer in customers)
     {
         this.dgvCustomers.Rows.Add(new object[] {
             customer.CUSTOMERNR,
             customer.NAME,
             customer.SURNAME,
             customer.MAIL,
             customer.BALANCE,
             customer.LASTCHANGE.ToShortDateString()
         });
     }
 }
Пример #5
0
 /// <summary>
 /// Creates a new EditForm, where customer can be edited / istOfCustomer is used for checking individual Mail
 /// Show surname or mail in the Textbox
 /// </summary>
 public EditForm(ListOfCustomer listOfCustomer, Customer customer, CultureInfo myCultureInfo)
 {
     this.StartPosition = FormStartPosition.CenterParent;
     Thread.CurrentThread.CurrentCulture   = myCultureInfo;
     Thread.CurrentThread.CurrentUICulture = myCultureInfo;
     this.customer       = customer;
     this.listOfCustomer = listOfCustomer;
     InitializeComponent();
     if (this.rdbSurname.Checked)
     {
         this.tbxEdit.Text = this.customer.SURNAME;
     }
     else if (this.rdbMail.Checked)
     {
         this.tbxEdit.Text = this.customer.MAIL;
     }
 }