private void SaveItem()
 {
     _customer.CompanyName = CompanyName;
     _customer.BillToAddr1 = BillToAddr1;
     _customer.BillToAddr2 = BillToAddr2;
     _customer.BillToCity  = BillToCity;
     _customer.BillToState = SelectedBillToState.Name;
     _customer.BillToZip5  = BillToZip5;
     _customer.BillToZip4  = BillToZip4;
     _customer.BillToState = SelectedBillToState.Name;
     _customer.BillToPhone = BillToPhone;
     _customer.BillToFax   = BillToFax;
     _customer.email       = Email;
     _customer.ShipToAddr1 = ShipToAddr1;
     _customer.ShipToAddr2 = ShipToAddr2;
     _customer.ShipToCity  = ShipToCity;
     _customer.ShipToState = SelectedShipToState;
     _customer.ShipToZip5  = ShipToZip5;
     _customer.ShipToZip4  = ShipToZip4;
     _customer.ShipToPhone = ShipToPhone;
     _customer.ShipToFax   = ShipToFax;
     if (!_customerExists)
     {
         context.Customers.InsertOnSubmit(_customer);
     }
     context.SubmitChanges();
     ClearFields();
 }
예제 #2
0
 public void DeleteItem(AllItemsGridView itemToDelete)
 {
     context.Items.DeleteOnSubmit(context.Items.FirstOrDefault(it => it.Sku.Equals(itemToDelete.Sku)));
     context.SubmitChanges();
     FillItemsGrid();
     //  this.RaisePropertyChanged(vm => vm.ItemsGrid);
 }
 public void DeleteCustomer(Customer customerToDelete)
 {
     context.Customers.DeleteOnSubmit(context.Customers.FirstOrDefault(it => it.CustomerNum.Equals(customerToDelete.CustomerNum)));
     context.SubmitChanges();
     FillItemsGrid();
     //  this.RaisePropertyChanged(vm => vm.ItemsGrid);
 }
예제 #4
0
        private void SaveItem()
        {
            _item.SeasonID = SelectedSeason.SeasonCode;
            _item.ColorID  = SelectedColor1.ColorCode;
            _item.Color2ID = SelectedColor2.ColorCode;
            _item.Color3ID = SelectedColor3.ColorCode;
            _item.SizeType = SelectedSizeTypeID.SizeTypeName;
            _item.Name     = ItemName;
            //   _item.Size = SelectedSize.SizeVal;
            _item.StyleTypeID = _selectedStyleType.ID;
            _item.DesignID    = SelectedDesign.ID;
            //  _item.Price = _validatedPrice;
            var deleteSizesPrices =
                from isz in context.ItemSizes
                where isz.Sku == this.SKU
                select isz;

            foreach (var isz in deleteSizesPrices)
            {
                context.ItemSizes.DeleteOnSubmit(isz);
            }
            foreach (var spc in SizePrices)
            {
                ItemSize isv = new ItemSize();
                isv.Sku     = this.SKU;
                isv.SizeVal = spc.Size;
                isv.Price   = spc.Price;
                context.ItemSizes.InsertOnSubmit(isv);
            }

            if (!_itemExists)
            {
                context.Items.InsertOnSubmit(_item);
            }
            context.SubmitChanges();

            this.RaiseAndSetIfChanged(vm => vm.SKU, ref _sku, "");
        }
예제 #5
0
        private void SaveOrder()
        {
            if (!_orderExists)
            {
                _order.OrderDate = DateTime.Now;

                foreach (ItemOptionsClass ioc in OrderItems)
                {
                    OrderItem oi = new OrderItem();
                    oi.Sku      = ioc.Sku;
                    oi.Quantity = Int16.Parse(ioc.Quantity);
                    oi.OrderNum = _order.OrderNum;
                    context.OrderItems.InsertOnSubmit(oi);
                }

                context.Orders.InsertOnSubmit(_order);
            }
            else
            {
                foreach (ItemOptionsClass ioc in OrderItems)
                {
                    // add new items
                    OrderItem oi = new OrderItem();
                    oi.Sku      = ioc.Sku;
                    oi.Quantity = Int16.Parse(ioc.Quantity);
                    oi.OrderNum = _order.OrderNum;
                    if (!context.OrderItems.Contains(oi))
                    {
                        context.OrderItems.InsertOnSubmit(oi);
                    }
                }
            }
            context.SubmitChanges();

            this.RaiseAndSetIfChanged(vm => vm.OrderNum, ref _orderNum, "");
            _hasChanges = false;
        }