private void btnVisitorSearch_Click(object sender, EventArgs e)
        {
            lbResults.Items.Clear();
            string searchString = tbxVisitorSearch.Text;

            if (searchString != "")
            {
                try
                {
                    if (rbtnVisitorNo.Checked)
                    {
                        int     id = Convert.ToInt32(searchString);
                        Visitor v  = Visitor.FindVisitorByID(id);
                        if (v != null)
                        {
                            lbResults.Items.Add(v);
                        }
                        else
                        {
                            DirectMessage.ShowInfo("No results found.");
                        }
                    }
                    else
                    {
                        string         name     = searchString;
                        List <Visitor> visitors = Visitor.FindVisitorByName(name);
                        if (visitors.Count != 0)
                        {
                            foreach (Visitor visitor in visitors)
                            {
                                lbResults.Items.Add(visitor);
                            }
                        }
                        else
                        {
                            DirectMessage.ShowInfo("No results found.");
                        }
                    }
                }
                catch (FormatException)
                {
                    DirectMessage.ShowError("Search query is not in correct format.");
                }
            }
            else
            {
                DirectMessage.ShowWarning("You have to input a search query");
            }
        }
Example #2
0
 private void btnRefreshSoldAmount_Click(object sender, EventArgs e)
 {
     UpdateProductsDataTable();
     DirectMessage.ShowInfo("Update successful");
 }
 private void btnRefreshRefundsPerShop_Click(object sender, EventArgs e)
 {
     UpdateRefundsPerShopDataTable();
     DirectMessage.ShowInfo("Update successful");
 }
Example #4
0
 private void btnRefreshTotalMoney_Click(object sender, EventArgs e)
 {
     UpdateShopsDataTable();
     DirectMessage.ShowInfo("Update successful");
 }