Пример #1
0
 /// <remarks>
 /// Jared Greenfield
 /// Updated: 2019/04/03
 /// Updated to remove products and add in Item
 /// </remarks>
 public CreateItem(Item selectedItem, Employee user)
 {
     _user   = user;
     oldItem = selectedItem;
     InitializeComponent();
     try
     {
         _offeringManager = new OfferingManager();
         if (oldItem.OfferingID != null)
         {
             _offering = _offeringManager.RetrieveOfferingByID((int)oldItem.OfferingID);
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Error collecting price.");
     }
     SetupReadOnly(selectedItem.ItemID);
     this.txtDescription.IsReadOnly = true;
     this.txtName.IsReadOnly        = true;
     this.txtOnHand.IsReadOnly      = true;
     this.txtReorder.IsReadOnly     = true;
     this.txtPrice.IsReadOnly       = true;
     this.cbPurchasable.IsEnabled   = false;
     this.cbActive.IsEnabled        = false;
     this.dpDateActive.IsEnabled    = false;
     this.btnSubmit.Visibility      = Visibility.Hidden;
     this.btnEdit.Visibility        = Visibility.Visible;
     this.lblDateActive.Visibility  = Visibility.Visible;
     this.lblActive.Visibility      = Visibility.Visible;
     this.dpDateActive.Visibility   = Visibility.Visible;
     this.cbActive.Visibility       = Visibility.Visible;
     this.dpDateActive.SelectedDate = selectedItem.DateActive;
     this.txtDescription.Text       = selectedItem.Description;
     this.txtName.Text = selectedItem.Name;
     if (_offering != null)
     {
         this.txtPrice.Text = _offering.Price.ToString();
     }
     this.txtOnHand.Text  = selectedItem.OnHandQty.ToString();
     this.txtReorder.Text = selectedItem.ReorderQty.ToString();
     if (selectedItem.Active)
     {
         this.cbActive.IsChecked = true;
     }
     else
     {
         this.cbActive.IsChecked = false;
     }
     if (selectedItem.CustomerPurchasable)
     {
         this.cbPurchasable.IsChecked = true;
     }
     this.cboItemType.SelectedItem = selectedItem.ItemType;
     ///this.txtPrice.Text = selectedItem.;
     this.cbActive.IsChecked = true;
     this.Title = "View Item";
 }
Пример #2
0
        /// <summary>
        /// James Heim
        /// Created 2019-04-29
        ///
        /// Populate the DataGrid with the TabLines.
        /// </summary>
        private void loadTabLines()
        {
            try
            {
                _vmTabLines = new List <VMTabLine>();

                // Build the TabLine View Models.
                foreach (var tab in _memberTab.MemberTabLines)
                {
                    var vmTab = new VMTabLine()
                    {
                        Date           = tab.DatePurchased,
                        FormattedPrice = tab.Price.ToString("C"),
                        Quantity       = tab.Quantity,

                        OfferingID = tab.OfferingID
                    };

                    // Get the specific Offering so we can save the Description and TypeID.
                    var offering = _offeringManager.RetrieveOfferingByID(tab.OfferingID);
                    vmTab.OfferingDescription = offering.Description;
                    vmTab.OfferingType        = offering.OfferingTypeID;

                    if (tab.GuestID != null)
                    {
                        vmTab.GuestID = tab.GuestID;
                        var guest = _guestManager.ReadGuestByGuestID((int)tab.GuestID);
                        vmTab.GuestName = guest.FirstName + " " + guest.LastName;
                    }
                    else
                    {
                        vmTab.GuestName = _member.FirstName + " " + _member.LastName;
                    }

                    if (tab.EmployeeID != null)
                    {
                        vmTab.EmployeeID = tab.EmployeeID;
                        var employee = _employeeManager.RetrieveEmployeeInfo((int)tab.EmployeeID);
                        vmTab.EmployeeName = employee.FirstName + " " + employee.LastName;
                    }
                    else
                    {
                        vmTab.EmployeeName = "";
                    }

                    _vmTabLines.Add(vmTab);
                }

                dgTabLines.ItemsSource = _vmTabLines;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Database Error", ex.Message);
            }
        }
 /// <summary>
 /// Jared Greenfield
 /// Created: 2019/01/24
 ///
 /// Edit / View OPERATION
 /// A form detailing a recipe record.
 /// </summary>
 /// <param name="recipe">Recipe object for filling out form.</param>
 public frmCreateRecipe(Recipe recipe, Employee user)
 {
     InitializeComponent();
     _user      = user;
     _oldRecipe = recipe;
     try
     {
         _item = _itemManager.RetrieveItemByRecipeID(recipe.RecipeID);
         if (_item.OfferingID != null)
         {
             _offering = _offeringManager.RetrieveOfferingByID((int)_item.OfferingID);
         }
         List <RecipeItemLineVM> recipeLines = _recipeManager.RetrieveRecipeLinesByID(_oldRecipe.RecipeID);
         dgIngredientList.ItemsSource = recipeLines;
         SetupViewPage();
     }
     catch (Exception)
     {
         MessageBox.Show("There was an error showing this recipe. Please try agin later.");
         this.Close();
     }
 }