Exemplo n.º 1
0
 private void toolBar_btnEdit_Click(object sender)
 {
     if (item_receipeDataGrid.SelectedItem != null)
     {
         item_recepie item_recepie_old = (item_recepie)item_receipeDataGrid.SelectedItem;
         item_recepie_old.IsSelected = true;
         item_recepie_old.State      = EntityState.Modified;
         ProductRecipeDB.Entry(item_recepie_old).State = EntityState.Modified;
     }
     else
     {
         toolBar.msgWarning("Please Select an Item");
     }
 }
Exemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            item_recepie item_recepie = item_recepieViewSource.View.CurrentItem as item_recepie;
            decimal      Cost         = 0;
            int          id_currency  = CurrentSession.CurrencyFX_Default.id_currency;

            foreach (item_recepie_detail item_recepie_detail in item_recepie.item_recepie_detail)
            {
                if (item_recepie_detail.item.item_price.Where(x => x.id_currency == id_currency).FirstOrDefault() != null)
                {
                    Cost += item_recepie_detail.item.item_price.Where(x => x.id_currency == id_currency).FirstOrDefault().valuewithVAT;
                }
            }
            lblCost.Content = "Total Cost is :" + Math.Round(Cost);
        }
Exemplo n.º 3
0
 private void btnDelete_Click(object sender)
 {
     try
     {
         if (MessageBox.Show("Are you sure want to Delete?", "Cognitivo", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
         {
             item_recepie item_recepie = (item_recepie)item_receipeDataGrid.SelectedItem;
             item_recepie.is_head    = false;
             item_recepie.State      = EntityState.Deleted;
             item_recepie.IsSelected = true;
         }
     }
     catch (Exception ex)
     {
         toolBar.msgError(ex);
     }
 }
Exemplo n.º 4
0
        private void item_Select_detail(object sender, EventArgs e)
        {
            if (sbxItemDetail.ItemID > 0)
            {
                item_recepie item_recepie = item_recepieViewSource.View.CurrentItem as item_recepie;
                item         item         = ProductRecipeDB.items.Where(x => x.id_item == sbxItemDetail.ItemID).FirstOrDefault();

                if (item_recepie != null)
                {
                    item_recepie_detail item_recepie_detail = new item_recepie_detail();
                    item_recepie_detail.id_item      = item.id_item;
                    item_recepie_detail.item         = item;
                    item_recepie_detail.quantity     = 1;
                    item_recepie_detail.item_recepie = item_recepie;
                    item_recepie.item_recepie_detail.Add(item_recepie_detail);
                }
                item_recepieitem_recepie_detailViewSource.View.Refresh();
            }
        }
Exemplo n.º 5
0
        private void item_Select(object sender, EventArgs e)
        {
            if (sbxItem.ItemID > 0)
            {
                item item = ProductRecipeDB.items.Where(x => x.id_item == sbxItem.ItemID).FirstOrDefault();
                item.is_autorecepie = true;

                if (ProductRecipeDB.item_recepie.Where(x => x.id_item == item.id_item).Count() == 0)
                {
                    item_recepie item_recepie = item_recepieViewSource.View.CurrentItem as item_recepie;
                    item_recepie.id_item = item.id_item;
                    item_recepie.item    = item;
                }
                else
                {
                    toolBar.msgWarning("Item Already Used....");
                }
            }
        }