示例#1
0
 //adds employee to new event, and updates list on page
 private void AddEmployeeButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckForFields())
         {
             if (float.Parse(PayTextBox.Text) >= 0)
             {
                 Staff foo = new Staff(NameTextBox.Text, (float.Parse(PayTextBox.Text)));
                 eventRef.staffMembers.Add(foo);
                 parentRef.UpdateEvent(eventRef);
                 ListBoxInsert(EmployeeListBox, foo.name);
                 ClearErrorLabel(ErrorLabel);
                 PayTextBox.Text  = "";
                 NameTextBox.Text = "";
             }
             else
             {
                 SetError(ErrorLabel, "Pay Cannot Be < 0");
             }
         }
     }
     catch (Exception bar)
     {
         SetError(ErrorLabel, bar.Message);
     }
 }
 //adds item to event item list
 private void AddButon_Click(object sender, EventArgs e)
 {
     ClearErrorLabel(ErrorLabel);
     try
     {
         if (CheckTBOccupied(ItemNameTextBox))
         {
             if (CheckTBOccupied(WholeSaleTextBox))
             {
                 if (CheckTBOccupied(SaleTextBox))
                 {
                     if (float.Parse(WholeSaleTextBox.Text) < float.Parse(SaleTextBox.Text))
                     {
                         if (float.Parse(WholeSaleTextBox.Text) > 0)
                         {
                             if (float.Parse(SaleTextBox.Text) > 0)
                             {
                                 Item foo = new Item(ItemNameTextBox.Text, float.Parse(WholeSaleTextBox.Text), float.Parse(SaleTextBox.Text));
                                 eventRef.eventItems.Add(foo);
                                 parentRef.UpdateEvent(eventRef);
                                 ItemListBox.Items.Add(foo.name);
                                 ItemNameTextBox.Clear();
                                 WholeSaleTextBox.Clear();
                                 SaleTextBox.Clear();
                             }
                             else
                             {
                                 SetError(ErrorLabel, "Sale Price Cannot Be =< 0");
                             }
                         }
                         else
                         {
                             SetError(ErrorLabel, "Wholesale Price Cannot Be =< 0");
                         }
                     }
                     else
                     {
                         SetError(ErrorLabel, "Items Sold > Items Stocked");
                     }
                 }
                 else
                 {
                     SetError(ErrorLabel, "No Sale Value");
                 }
             }
             else
             {
                 SetError(ErrorLabel, "No Wholesale Value");
             }
         }
         else
         {
             SetError(ErrorLabel, "No Item Name Assigned");
         }
     }
     catch (Exception eMessage)
     {
         SetError(ErrorLabel, eMessage.Message);
     }
 }
示例#3
0
        //checks all fields are complete for submission to server

        private void SubmitStorebutton_Click(object sender, EventArgs e)
        {
            if (CheckCBSelected(ManagerComboBox))
            {
                newStore.manager = eventRef.GetStaffByName(GetCBSelected(ManagerComboBox));
                if (newStore.staffOnDuty.Count != 0)
                {
                    if (newStore.inventory.Count != 0)
                    {
                        if (StoreNameTextBox.Text != "")
                        {
                            submitPushed       = true;
                            newStore.storeName = StoreNameTextBox.Text;
                            eventRef.stores.Add(newStore);
                            UpdateStaffUsed();
                            parentRef.UpdateEvent(eventRef);
                            ListBoxInsert(StoreListBox, newStore.storeName);
                            StoreNameTextBox.Text = "";
                            DeselectComboBoxes(new List <ComboBox>()
                            {
                                ManagerComboBox, StaffComboBox, ItemComboBox
                            });
                            StockTextBox.Text = "";
                            ListBoxClear(StaffListBox);
                            ListBoxClear(ItemsListBox);
                            ComboBoxRemove(ManagerComboBox, newStore.manager.name);
                            newStore        = new Store();
                            previousManager = "";
                            submitPushed    = false;
                            ResetItemComboBox();
                        }
                        else
                        {
                            SetError(ErrorLabel, "No Store Name Assigned");
                        }
                    }
                    else
                    {
                        SetError(ErrorLabel, "No Items Assigned");
                    }
                }
                else
                {
                    SetError(ErrorLabel, "No Staff Assigned");
                }
            }
            else
            {
                SetError(ErrorLabel, "No Manager Assigned");
            }
        }