Beispiel #1
0
 private void item_priceDataGrid_InitializingNewItem(object sender, InitializingNewItemEventArgs e)
 {
     entity.item       item       = itemViewSource.View.CurrentItem as entity.item;
     entity.item_price item_price = e.NewItem as entity.item_price;
     if (item != null)
     {
         item_price.id_item = item.id_item;
         item_price.item    = item;
     }
 }
Beispiel #2
0
        private void toolBar_btnDelete_Click(object sender)
        {
            MessageBoxResult res = MessageBox.Show("Are you sure want to Delete?", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (res == MessageBoxResult.Yes)
            {
                item item = (item)itemDataGrid.SelectedItem;
                item.is_active = false;
                //mycntrl._item =item;
                itemViewSource.View.Filter = i =>
                {
                    entity.item objitem = (item)i;
                    if (objitem.is_active == true)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                };
            }
        }
Beispiel #3
0
 private void cmbitem_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     entity.item item = itemViewSource.View.CurrentItem as entity.item;
     if (item != null)
     {
         //Product
         if (item.id_item_type == global::entity.item.item_type.Product)
         {
             if (item.item_product.Count == 0)
             {
                 item_product _product = new item_product();
                 item.item_product.Add(_product);
             }
             if (item.item_asset.Count > 0)
             {
                 List <item_asset> records = item.item_asset.ToList();
                 foreach (var record in records)
                 {
                     db.item_asset.Remove(record);
                 }
             }
         }
         //Searvice
         else if (item.id_item_type == global::entity.item.item_type.Service)
         {
             if (item.item_asset.Count > 0)
             {
                 List <item_asset> records = item.item_asset.ToList();
                 foreach (var record in records)
                 {
                     db.item_asset.Remove(record);
                 }
             }
             if (item.item_product.Count > 0)
             {
                 List <item_product> records = item.item_product.ToList();
                 foreach (var record in records)
                 {
                     db.item_product.Remove(record);
                 }
             }
         }
         //Capital Resource
         else if (item.id_item_type == global::entity.item.item_type.FixedAssets)
         {
             if (item.item_asset.Count == 0)
             {
                 item_asset _capital = new item_asset();
                 item.item_asset.Add(_capital);
             }
             if (item.item_product.Count > 0)
             {
                 List <item_product> records = item.item_product.ToList();
                 foreach (var record in records)
                 {
                     db.item_product.Remove(record);
                 }
             }
         }
     }
     //Product
 }