Beispiel #1
0
        private void AddDataItem_Click(object sender, RoutedEventArgs e)
        {
            ItemController CallItem = new ItemController();

            //var combo = CategoryComboBox.SelectedValue.ToString();
            //MessageBox.Show(CategoryComboBox.Text);
            if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                ItemNameTextBox.Focus();
                QuantityTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0)
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                ItemNameTextBox.Focus();
                QuantityTextBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                ItemNameTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                QuantityTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0)
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                ItemNameTextBox.Focus();
            }
            else if (QuantityTextBox.Text.Length == 0)
            {
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                QuantityTextBox.Focus();
            }
            else if (CategoryComboBox.Text == "")
            {
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                CategoryComboBox.Focus();
            }
            else
            {
                string Iname = ItemNameTextBox.Text;
                int    Iqty  = Convert.ToInt32(QuantityTextBox.Text);
                int    Icat  = Convert.ToInt32(CategoryComboBox.SelectedValue.ToString());

                CallItem.AddItem(Iname, Iqty, Icat, email, name, roles);
            }
        }
Beispiel #2
0
        // Method to setup the page for the user.
        protected void Page_Load(object sender, EventArgs e)
        {
            EquipCheckAppUser user = (EquipCheckAppUser)Session["user"];

            if (user == null)
            {
                Response.Redirect("/Login.aspx");
            }
            else if (Roles.IsUserInRole(user.Username, "Members"))
            {
                ItemNameTextBox.Focus();

                Session["selectedItems"] = null;
                Session["selectedItemsWithDescriptions"] = null;

                if (Session["message_type"] != null &&
                    ((String)Session["message_type"]).Equals("item_error") && !IsPostBack)
                {
                    String[] itemEntries = (String[])Session["itemEntries"];
                    DropDownList.SelectedIndex = Convert.ToInt32(itemEntries[0]);
                    ItemNameTextBox.Text = itemEntries[1];
                    ItemDescriptionTextBox.Text = itemEntries[2];
                }
            }
            else
            {
                Response.Redirect("/NotAuthorized.aspx");
            }
        }
Beispiel #3
0
 private void ClearAllRecords()
 {
     NewCategoryTextBox.Clear();
     ItemNameTextBox.Clear();
     PriceTextBox.Clear();
     CategoryComboBox.SelectedIndex = -1;
 }
 //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);
     }
 }
Beispiel #5
0
        private void UpdateDataItem_Click(object sender, RoutedEventArgs e)
        {
            ItemController CallItem = new ItemController();

            if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                ItemNameTextBox.Focus();
                QuantityTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0)
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                ItemNameTextBox.Focus();
                QuantityTextBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                ItemNameTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                QuantityTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0)
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                ItemNameTextBox.Focus();
            }
            else if (QuantityTextBox.Text.Length == 0)
            {
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                QuantityTextBox.Focus();
            }
            else if (CategoryComboBox.Text == "")
            {
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                CategoryComboBox.Focus();
            }
            else
            {
                string Iname = ItemNameTextBox.Text;
                int    Iqty  = Convert.ToInt32(QuantityTextBox.Text);
                int    Icat  = Convert.ToInt32(CategoryComboBox.SelectedValue.ToString());

                CallItem.UpdateItem(Convert.ToInt16((dataGrid.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text), Iname, Iqty, Icat);
            }
        }
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are You Really Want To Update This Record", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (result == DialogResult.OK)
            {
                UpdateAllItems();
                MessageBox.Show("Record Updated Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                CategoryComboBox.SelectedIndex = -1;
                ItemNameTextBox.Clear();
                PriceTextBox.Clear();
            }
        }
Beispiel #7
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (User.Identity.IsAuthenticated && User.IsInRole("Kitchen-Admin"))
        {
            if (Session["SessionID"] == null)
            {
                System.Web.Security.FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx", false);

                Response.End();
            }
            else
            {
                Page.Master.Page.Form.DefaultFocus = SaveButton.UniqueID;

                InvoicedCostTextBox.Attributes["onkeyup"]           = "javascript:updatecost()";
                PiecesPerPurchasedUnitTextBox.Attributes["onkeyup"] = "javascript:updatecost()";
                UnitDropDownList.Attributes["onclick"] = "javascript:updateparlabel()";

                ItemNameTextBox.Focus();

                Load += (Page_Load);

                if (!IsPostBack)
                {
                    BuildDropDownLists();
                }
            }
        }
        else
        {
            Response.Redirect("Default.aspx", false);

            Response.End();
        }
    }
        public MapItemNamePrompt()
        {
            InitializeComponent();

            ItemNameTextBox.Focus();
        }
Beispiel #9
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            BindingExpression be = ItemNameTextBox.GetBindingExpression(TextBox.TextProperty);

            be?.UpdateSource();
        }