public ActionResult Edit_POST(Merchandise merchandiseToEdit)
 {
     try
     {
         _repository.Edit(merchandiseToEdit);
         return(RedirectToAction("Edit"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Edit_POST(Merchandise merchandiseToEdit)
 {
     try
     {
         _repository.Edit(merchandiseToEdit);
         return RedirectToAction("Edit");
     }
     catch
     {
         return View();
     }
 }
Example #3
0
        public IHttpActionResult InsertMerchandise(Merchandise data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var session = HttpContext.Current.Request.Cookies.Get("sessionId");

            if (session == null)
            {
                return(BadRequest("请先登录!"));
            }

            int sellerId = SellerSession.GetSellerIdFromSession(int.Parse(session.Value));

            if (sellerId < 0)
            {
                return(BadRequest("请先登录!"));
            }
            if (_db.Merchandises.Find(data.MerchandiseId) == null)
            {
                Merchandise merchandise = new Merchandise
                {
                    SellerId    = sellerId,
                    ISBN        = data.ISBN,
                    Description = data.Description,
                    Price       = data.Price,
                    IsValid     = 1,
                };


                _db.Merchandises.Add(merchandise);
                _db.SaveChanges();

                return(Ok("商品上架成功!"));
            }

            var updatedMerchandise = _db.Merchandises.FirstOrDefault(m => m.MerchandiseId == data.MerchandiseId);

            if (updatedMerchandise != null)
            {
                updatedMerchandise.ISBN        = data.ISBN;
                updatedMerchandise.Description = data.Description;
                updatedMerchandise.Price       = data.Price;
                updatedMerchandise.IsValid     = data.IsValid;
                _db.SaveChanges();
                return(Ok("更新商品成功!"));
            }

            return(BadRequest("请重新更新商品!"));
        }
        public IHttpActionResult ManageUpdateMerchandise(Merchandise merchandise)
        {
            Merchandise updatedMerchandise = db.Merchandises.FirstOrDefault(m => m.MerchandiseId == merchandise.MerchandiseId);

            if (updatedMerchandise != null)
            {
                updatedMerchandise.IsValid = merchandise.IsValid;
                db.SaveChanges();
                return(Ok("更新成功!"));
            }

            return(BadRequest("请重新操作!"));
        }
Example #5
0
        public async Task <IActionResult> MerchandiseDetails(int merchandiseId)
        {
            Merchandise merchandise = await _merchandiseRepository.GetMerchandiseById(merchandiseId);

            if (merchandise == null)
            {
                return(NotFound());
            }
            return(Ok(new BaseResponse <Merchandise>()
            {
                Data = merchandise, Success = true
            }));
        }
 public static MerchandiseDto ToDto(this Merchandise merchandise)
 {
     return(new MerchandiseDto
            (
                merchandise.Id,
                merchandise.Name,
                merchandise.Description,
                merchandise.Type.ToString(),
                merchandise.Unit.ToString(),
                merchandise.NettoPrice,
                merchandise.Vat
            ));
 }
 public IActionResult EditMerchandise(Merchandise merchandise)
 {
     if (ModelState.IsValid)
     {
         ViewBag.club = clubRepository.Clubs;
         repository.AddMerchandise(merchandise);
         return(RedirectToAction("Merchandise"));
     }
     else
     {
         return(View(merchandise));
     }
 }
        private void MakeOrderButton_Click(object sender, RoutedEventArgs e)
        {
            string tempAmountBox = OrderAmountBox.Text;

            if ((TempStores.MerchandiseIndexTemp >= 0) && (TempStores.CustomerIndexTemp >= 0))
            {
                if (!string.IsNullOrWhiteSpace(tempAmountBox) && Int32.TryParse(tempAmountBox, out int p))
                {
                    CustomerOrder tempObj = new CustomerOrder(store.CustomerCollection[TempStores.CustomerIndexTemp], store.MerchandiseCollection[TempStores.MerchandiseIndexTemp], Int32.Parse(OrderAmountBox.Text));

                    if (tempObj != null && tempObj.Amount <= (store.MerchandiseCollection[TempStores.MerchandiseIndexTemp].Stock))
                    {
                        NotEnoughInStockPrompt.Visibility  = Visibility.Collapsed;
                        NoAmountEnteredPrompt.Visibility   = Visibility.Collapsed;
                        ListViewSelectionPrompt.Visibility = Visibility.Collapsed;

                        // when enough in stock for new order:
                        // add order to list for paid and delivered orders - CustomerOrderCollection
                        // decrease merchandise stock quantity with the size of the customer order - tempObj - and update list.
                        store.CustomerOrderCollection.Add(tempObj);
                        Merchandise merchtemp = store.MerchandiseCollection[TempStores.MerchandiseIndexTemp];
                        merchtemp.DecreaseStock(tempObj.Amount);
                        store.MerchandiseCollection.Insert(TempStores.MerchandiseIndexTemp, merchtemp);
                        store.MerchandiseCollection.RemoveAt(TempStores.MerchandiseIndexTemp + 1);

                        TempStores.MerchandiseIndexTemp = -1;
                        OrderAmountBox.Text             = string.Empty;
                        //OrderMadePrompt.Visibility = Visibility.Visible;
                        OrderMadePopUp.IsOpen = true;
                        TimerSetUp();
                    }
                    // when not enough in stock for new order:
                    // add the placed order to the backlog - BacklogCustomerOrderCollection
                    else if (tempObj.Amount > store.MerchandiseCollection[TempStores.MerchandiseIndexTemp].Stock)
                    {
                        store.BacklogCustomerOrderCollection.Add(tempObj);
                        NotEnoughInStockPrompt.Visibility  = Visibility.Visible;
                        ListViewSelectionPrompt.Visibility = Visibility.Collapsed;
                    }
                }
                else
                {
                    NoAmountEnteredPrompt.Visibility   = Visibility.Visible;
                    ListViewSelectionPrompt.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                ListViewSelectionPrompt.Visibility = Visibility.Visible;
            }
        }
        // GET: Merchandises/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Merchandise merchandise = db.Merchandises.Find(id);

            if (merchandise == null)
            {
                return(HttpNotFound());
            }
            return(View(merchandise));
        }
        protected void ButtonAddToCart_Click(object sender, EventArgs e)
        {
            bool addItem = true;

            //get selected item from product list
            string selectedItem = ListBoxProducts.SelectedItem.Text;

            foreach (Merchandise item in shop.Products)
            {
                if (selectedItem.Contains(item.Name))
                {
                    Merchandise selectedValue = item;
                    //ClientScript.RegisterStartupScript(this.GetType(), selectedValue.Name, "alert('" + selectedItem + "');", true);
                    if (ViewState["Shoppingcart"] == null)
                    {
                        List <Merchandise> itemList = new List <Merchandise>();

                        itemList.Add(selectedValue);


                        ViewState["Shoppingcart"] = itemList;
                    }
                    else
                    {
                        List <Merchandise> itemList = (List <Merchandise>)ViewState["Shoppingcart"];
                        //loop through shopping cart checking for duplicates (becuse this is a consignment shop, there should only be one
                        //of each product
                        foreach (Merchandise temp in itemList.ToList())
                        {
                            if (temp.Name.Equals(selectedValue.Name))
                            {
                                addItem = false;
                            }
                        }
                        if (addItem == true)
                        {
                            itemList.Add(selectedValue); //Add to cart
                            addItem = false;
                        }
                    }
                    List <Merchandise> shoppingCartList = (List <Merchandise>)ViewState["Shoppingcart"];

                    ListBoxShoppingCart.DataTextField  = "Display";
                    ListBoxShoppingCart.DataValueField = "Display";

                    ListBoxShoppingCart.DataSource = shoppingCartList;
                    ListBoxShoppingCart.DataBind();
                }
            }
        }
        public void SelectOrderTest1()
        {
            Order        o1           = new Order(8888, new Client("Li"), DateTime.Now);
            OrderService orderService = new OrderService();
            Merchandise  mc           = new Merchandise("mc", 10);

            o1.orderItems.Add(new OrderItem(mc, 10));

            orderService.AddOrder(o1);
            List <Order> list = new List <Order>();

            list.Add(o1);
            CollectionAssert.AreEqual(list, orderService.orderList);
        }
Example #12
0
 public override void OnRemoveWorker(Worker worker)
 {
     if (pickedUpMerchandise)
     {
         pickedUpMerchandise = false;
         Merchandise merchandise = worker.GetComponent <Inventory>().Remove();
         merchandise.transform.position = worker.transform.position;
     }
     if (stockpile)
     {
         stockpile.reserved = false;
         stockpile          = null;
     }
 }
        public async Task <IActionResult> Create([Bind("ItemName,ItemId,Price,ItemType,ConcId,AttrId")] Merchandise merchandise)
        {
            if (ModelState.IsValid)
            {
                _context.Add(merchandise);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AttrId"]   = new SelectList(_context.Attractions, "AttractionId", "AttractionId", merchandise.AttrId);
            ViewData["ConcId"]   = new SelectList(_context.Concessions, "ConcessionId", "ConcessionId", merchandise.ConcId);
            ViewData["ItemType"] = new SelectList(_context.ItemTypeTable, "ItemTypeIndex", "ItemType", merchandise.ItemType);
            return(View(merchandise));
        }
Example #14
0
        public int GetMerchId(Merchandise nameMerch)
        {
            int id = 0;

            using (var en = new DB_SystemFoodTrucksEntities())
            {
                var query = en.Merchandise.FirstOrDefault(m => m.Name == nameMerch.Name);
                if (query != null)
                {
                    id = query.Id;
                }
                return(id);
            }
        }
Example #15
0
        private static void UpdateMerchandise(IDbGeneralContext db, Merchandise m)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }

            if (m == null)
            {
                return;
            }

            // save merchandise to DB
            db.Merchandises.AddOrUpdate(p => p.ID, new Merchandise[] { m });
        }
Example #16
0
        static void Main(string[] args)
        {
            // Массив "суперклассов", который заполняется объектами подклассов.
            Merchandise[] goods = new Merchandise[] { new Merchandise(),
                                                      new Toy(),
                                                      new Product(),
                                                      new DairyProduct() };
            foreach (Merchandise currentMerchandise in goods)
            {
                System.Console.WriteLine(currentMerchandise.ToString());
            }

            System.Console.WriteLine(FAREWELL_MESSAGE);
            System.Console.ReadKey();
        }
Example #17
0
        public async Task <IActionResult> Add(Merchandise merch)
        {
            if (ModelState.IsValid)
            {
                aRWContext.Add(merch);
                await aRWContext.SaveChangesAsync();

                return(RedirectToAction("TableView"));
            }
            else
            {
                ViewData["FilmFk"] = new SelectList(aRWContext.Film.OrderBy(f => f.MovieTitle), "FilmPk", "MovieTitle");

                return(View());
            }
        }
        public void AddTest()
        {
            Merchandise jajko = new Merchandise
            {
                Id          = "0",
                Name        = "Jajko",
                Description = "Produkty wiejski.",
                Type        = ArticleType.GROCERIES,
                Unit        = ArticleUnit.PACK,
                Vat         = 0.08,
                NettoPrice  = 12.40
            };

            MerchandiseRepository.Add(jajko);
            Assert.IsNotNull(MerchandiseRepository.Get("0"));
        }
Example #19
0
        public void GetMerchandisesTest()
        {
            DataContext        dataContext  = new DataContext();
            Merchandise        merchandise1 = new Merchandise("0", "Jajao", "Produkt wiejski", ArticleType.GROCERIES, ArticleUnit.PACK, 13.20, 0.01);
            Merchandise        merchandise2 = new Merchandise("1", "Chleb", "Artykuły spożywcze", ArticleType.GROCERIES, ArticleUnit.PIECE, 5.20, 0.05);
            List <Merchandise> merchandises = new List <Merchandise>();

            merchandises.Add(merchandise1);
            merchandises.Add(merchandise2);
            dataContext.Merchandises = merchandises;
            Repository        repository        = new Repository(dataContext);
            ManageDataService manageDataService = new ManageDataService(repository, (mesg) => { }, _uriPeer);

            Assert.IsNotNull(manageDataService.GetLocalMerchandises());
            Assert.AreEqual(manageDataService.GetLocalMerchandises().Count, 2);
        }
Example #20
0
 private void btnPurchase_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var supplQuery = new Supplier
         {
             Supplier1 = cboSuppl.SelectedValue.ToString()
         };
         var merchQuery = new Merchandise
         {
             Name = cboMerch.SelectedValue.ToString()
         };
         int IdMerch  = MerLogic.GetInstance().GetMerchId(merchQuery);
         int IdSuppl  = MerLogic.GetInstance().GetIdSuppl(supplQuery);
         int AmountP  = Convert.ToInt32(txtCostPur.Text);
         int Qty      = Convert.ToInt32(txtCant.Text);
         int IdUser   = LoginBL.GetInstance().IdUser;
         var purchase = new purchase_of_merchandise
         {
             Detail         = txtDetail.Text,
             Amount         = AmountP,
             Date_purchase  = DateTime.Now,
             Quantity       = Qty,
             Id_merchandise = IdMerch,
             Id_supplier    = IdSuppl,
             Id_user        = IdUser
         };
         var updateMerch = new Merchandise()
         {
             Id    = IdMerch,
             Stock = Qty,
             Name  = cboMerch.SelectedValue.ToString()
         };
         MerLogic.GetInstance().RegisterPofMerch(purchase, updateMerch);
         MessageBoxRM.Show("Compra registrada correctamente!", "Registro de compras", MessageBoxButtonRM.OK, MessageBoxIconRM.Information);
         txtDetail.Clear();
         txtCant.Clear();
         txtCostPur.Clear();
         cboMerch.SelectedIndex = -1;
         cboSuppl.SelectedIndex = -1;
         RechargeAllCboS();
     }
     catch (Exception ex)
     {
         MessageBoxRM.Show(ex.Message, "Ha ocurrido un error :(", MessageBoxButtonRM.OK, MessageBoxIconRM.Error);
     }
 }
Example #21
0
        public MerchandisePopulator(int amount)
        {
            parentCategories = new List <Category>();
            childCategories  = new List <Category>();

            parentCategories.Add(new Category("Pai 1"));
            parentCategories.Add(new Category("Pai 2"));
            parentCategories.Add(new Category("Pai 3"));
            childCategories.Add(new Category("Filho do Pai 2 #1", parentCategories[1].Id));

            merchandises = new List <Merchandise>();
            for (int i = 0; i < amount; i++)
            {
                Merchandise merchandise = GenerateMerchandise();
                this.merchandises.Add(merchandise);
            }
        }
Example #22
0
 public void OnSuccessBuy(Merchandise merchandise, ProductInShop productInShop)
 {
     if (merchandise.costType == CostType.Pearl)
     {
         if (EntireGameManager.getInstance().getPlayerData().pearl < merchandise.cost)
         {
             Debug.Log("珍珠不足");
             MainUIManager.CreateCheckBox(() => { }, "珍珠不足");
             return;
         }
         else
         {
             EntireGameManager.getInstance().playerData.pearl -= merchandise.cost;
         }
     }
     else
     {
         if (EntireGameManager.getInstance().getPlayerData().sugar < merchandise.cost)
         {
             MainUIManager.CreateCheckBox(() => { }, "方糖不足");
             Debug.Log("方糖不足");
             return;
         }
         else
         {
             EntireGameManager.getInstance().playerData.sugar -= merchandise.cost;
         }
     }
     Debug.Log("成功購買" + merchandise.chineseName);
     if (merchandise.type == MerchandiseType.Animal)
     {
         EntireGameManager.getInstance().getPlayerData().animalList.Add(merchandise.indexName);
     }
     else if (merchandise.type == MerchandiseType.Cup)
     {
         EntireGameManager.getInstance().getPlayerData().cupList.Add(merchandise.indexName);
     }
     else if (merchandise.type == MerchandiseType.Liquid)
     {
         EntireGameManager.getInstance().getPlayerData().liquidList.Add(merchandise.indexName);
     }
     productInShop.HaveProduct(true);
     EntireGameManager.getInstance().Save();
     AudioManager.Play("purchase");
     UpdateMoney();
 }
Example #23
0
        private void button2_Click(object sender, EventArgs e)
        {
            var storeDB = GenerateConnection(DataBaseType.Store, ConnectionType.Host);

            for (int i = 0; i < dataGridView2.RowCount; i++)
            {
                if (Convert.ToBoolean(dataGridView2[0, i].Value))
                {
                    var newr = new MerchandiseAcceptanceLog()
                    {
                        ID_StoreOrder    = Guid.Parse(dataGridView2["idColumn", i].Value.ToString()),
                        ID_AcceptManager = GlobalHelper.User.ID_Employee,
                        AcceptDate       = DateTime.Now,
                        Weight           = Convert.ToInt32(dataGridView2["weightColumn", i].Value)
                    };
                    storeDB.MerchandiseAcceptanceLogs.Add(newr);
                    storeDB.SaveChanges();

                    var id_o  = Guid.Parse(dataGridView2["idColumn", i].Value.ToString());
                    var order = storeDB.StoreOrders.SingleOrDefault(item =>
                                                                    item.ID_StoreOrder == id_o);
                    if (order == null)
                    {
                        return;
                    }

                    order.ID_StatusOrder =
                        storeDB.StatusOrders.SingleOrDefault(item => item.NameStatusOrder == "Accepted by the store").ID_StatusOrder;

                    storeDB.SaveChanges();

                    var newm = new Merchandise()
                    {
                        ID_Merchandise  = Guid.NewGuid(),
                        ID_Product      = order.ID_Product,
                        ID_RealEstate   = order.ID_RealEstateStore,
                        Weight          = newr.Weight,
                        ManufactureDate = newr.AcceptDate,
                        PricePerGramm   = 15
                    };
                    storeDB.Merchandises.Add(newm);
                    storeDB.SaveChanges();
                }
            }
            acceptToolStripMenuItem.PerformClick();
        }
        public void DeleteTest()
        {
            Merchandise jajko = new Merchandise
            {
                Id          = "0",
                Name        = "Jajko",
                Description = "Produkty wiejski.",
                Type        = ArticleType.GROCERIES,
                Unit        = ArticleUnit.PACK,
                Vat         = 0.08,
                NettoPrice  = 12.40
            };

            MerchandiseRepository.Add(jajko);
            MerchandiseRepository.Delete("0");

            Assert.AreEqual(0, MerchandiseRepository.Get().ToList().Count());
        }
Example #25
0
 private void btnRegMerch_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var merch = new Merchandise
         {
             Name  = txtMerch.Text,
             Stock = 0
         };
         MerLogic.GetInstance().RegisterMerch(merch);
         MessageBoxRM.Show("Mercancia registrada correctamente!", "Registro de Mercancia", MessageBoxButtonRM.OK, MessageBoxIconRM.Information);
         txtMerch.Clear();
         RechargeAllCboS();
     }
     catch (Exception ex)
     {
         MessageBoxRM.Show(ex.InnerException.Message, "Ha ocurrido un error :(", MessageBoxButtonRM.OK, MessageBoxIconRM.Error);
     }
 }
Example #26
0
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
        public IHttpActionResult GetMerchandise(int?id, string?article)
        {
            if (id is null)
            {
                if (string.IsNullOrEmpty(article))
                {
                    throw new ArgumentException("No id or article provided", nameof(article));
                }
                Merchandise merchandise1 = merchandiseRepository.GetMerchandiseByArticle(article);
                if (merchandise1 == null)
                {
                    return(NotFound());
                }
                return(Ok(merchandise1));
            }
            int         notNullID    = (Int32)id;
            Merchandise merchandise2 = merchandiseRepository.GetMerchandiseByID(notNullID);

            return(Ok(merchandise2));
        }
Example #27
0
        public void AddMerchandise(int companyId, string merchandiseName, MeasurmentUnit me)
        {
            var         company = GetCompanyDetails(companyId);
            Merchandise merch   = _context.Merchandises.SingleOrDefault(m => m.Name.Equals(merchandiseName) && m.MesaurmentUnit == me);

            if (merch == null)
            {
                merch = new Merchandise
                {
                    Name           = merch.Name,
                    MesaurmentUnit = merch.MesaurmentUnit
                };
                _context.Merchandises.Add(merch);
            }
            company.CurrentStock.Add(new CurrentStock
            {
                MerchandiseId       = merch.Id,
                AmountOfMerchandise = 0
            });
            _context.SaveChanges();
        }
Example #28
0
        public override void Process(Worker worker)
        {
            MoveTo moveTo = worker.GetComponent <MoveTo>();

            if (moveTo.reachedGoal)
            {
                if (!pickedUpMerchandise)
                {
                    worker.GetComponent <Inventory>().Add(merchandise);
                    pickedUpMerchandise = true;
                    moveTo.SetGoal(stockpile.transform.position, 1);
                }
                else
                {
                    Merchandise merchandise = worker.GetComponent <Inventory>().Remove();
                    stockpile.Add(merchandise);
                    pickedUpMerchandise = false;
                    Complete();
                }
            }
        }
        public static void Init(TestContext testcontext)
        {
            context = testcontext;
            string a0 = "1000001";

            a1  = new Client("张三", "北京东路100号");
            m1  = new Merchandise("菲力牛排", 128.88);
            b1  = new OrderDetails(m1, 2, DateTime.Now);
            b11 = new Order(a1, a0);
            b11.AddDetails(b1);

            Client       a2  = new Client("李四", "南京西路666号");
            Merchandise  m2  = new Merchandise("豆腐巧克力", 15);
            OrderDetails b2  = new OrderDetails(m2, 10, DateTime.Now);
            Order        b21 = new Order(a2, (Convert.ToInt32(a0) + 1).ToString());

            b21.AddDetails(b2);

            service.AddOrder(b11);
            service.AddOrder(b21);
        }
Example #30
0
        public Merchandise Save()
        {
            Merchandise merchandise = null;

            var session = NHibernateSessionManager.GetLocalSession();

            session.DoTransactional(sess =>
            {
                merchandise = new Merchandise(
                    _form.MerchandiseCode,
                    _form.SelectedInventory,
                    _form.MerchandisePointCost,
                    _form.MerchandiseVolume,
                    _form.MerchandiseName,
                    _form.MerchandiseDescription
                    );

                merchandise = _merchandiseRepository.Insert(merchandise);
            });

            return(merchandise);
        }
        public Merchandise Save()
        {
            Merchandise merchandise = null;

            var session = NHibernateSessionManager.GetLocalSession();

            session.DoTransactional(sess =>
            {
                merchandise = new Merchandise(
                    _form.MerchandiseCode,
                    _form.SelectedInventory,
                    _form.MerchandisePointCost,
                    _form.MerchandiseVolume,
                    _form.MerchandiseName,
                    _form.MerchandiseDescription
                );

                merchandise = _merchandiseRepository.Insert(merchandise);
            });

            return merchandise;
        }
Example #32
0
        private void addItem()
        {
            var merchTable = (MerchendiseWindowViewModel)Application.Current.Resources["MerchendiseWindowViewModel"];

            if (
                Inspection.CheckString(merchTable.AddItem.Name.Text, 50) &&
                Inspection.CheckNumeric(merchTable.AddItem.txtConsignment.Text, 18, 0) &&
                Inspection.CheckNumeric(merchTable.AddItem.txtCountBooked.Text, 18, 0) &&
                Inspection.CheckNumeric(merchTable.AddItem.txtCountStored.Text, 18, 0) &&
                Inspection.CheckNumeric(merchTable.AddItem.txtCountOrder.Text, 18, 0) &&
                Inspection.CheckNumeric(merchTable.AddItem.txtCost.Text, 18, 2) &&
                Inspection.CheckNumeric(merchTable.AddItem.txtMargin.Text, 18, 2)
                )
            {
                var         context = new WarehouseEntities();
                Merchandise n       = new Merchandise()
                {
                    brand        = merchTable.AddItem.Name.Text,
                    consignment  = decimal.Parse(merchTable.AddItem.txtConsignment.Text),
                    arrived      = merchTable.AddItem.chkArrived.IsEnabled,
                    count_booked = decimal.Parse(merchTable.AddItem.txtCountBooked.Text),
                    count_stored = decimal.Parse(merchTable.AddItem.txtCountStored.Text),
                    count_order  = decimal.Parse(merchTable.AddItem.txtCountOrder.Text),
                    count_send   = decimal.Parse(merchTable.AddItem.txtCountSend.Text),
                    specif_n     = merchTable.AddItem.Descr.Text,
                    cost         = decimal.Parse(merchTable.AddItem.txtCost.Text),
                    id_type      = ((Types)merchTable.AddItem.comboType.SelectedValue).id_type,
                    margin       = decimal.Parse(merchTable.AddItem.txtMargin.Text)
                };
                context.Merchandise.Add(n);
                context.SaveChanges();
                merchTable.Merchandises = context.Merchandise.ToList();
                MessageBox.Show("запись создана");
            }
            else
            {
                MessageBox.Show("Некорректные данные!");
            }
        }
Example #33
0
 /// <summary>
 /// ������ƷSearch���
 /// </summary>
 /// <param name="searchCondition">Search Condition</param>
 /// <param name="componentGroup">�������ƷSearch���</param>
 public static void Cache(SearchCondition searchCondition, Merchandise componentGroup)
 {
     if (Utility.IsSubAgent && searchCondition is TourSearchCondition)
         CachedSubTours[searchCondition] = componentGroup;
     else
         CachedMerchandises[searchCondition] = componentGroup;
 }
Example #34
0
 private static bool IsLegal(Merchandise merch)
 {
     return !CurrentSystem.IllegalGoods.Contains(merch);
 }
Example #35
0
 /// <summary>
 /// ������ƷSearch���
 /// </summary>
 /// <param name="searchCondition">Search Condition</param>
 /// <param name="componentGroup">�������ƷSearch���</param>
 public static void Cache(List<string> keys, Merchandise componentGroup)
 {
     CachedMoreTours[keys] = componentGroup;
 }
Example #36
0
    /// <summary>
    /// ɾ��ָ������ƷSearch���
    /// </summary>
    /// <param name="searchCondition"></param>
    /// <param name="componentGroup"></param>
    public static bool Remove(SearchCondition searchCondition, Merchandise componentGroup)
    {
        KeyValuePair<SearchCondition, Merchandise> item = new KeyValuePair<SearchCondition, Merchandise>(searchCondition, componentGroup);

        if (CachedMerchandises.Contains(item))
        {
            CachedMerchandises.Remove(item);
            return true;
        }
        else
        {
            return false;
        }
    }
Example #37
0
 /// <summary>
 /// ������ƷSearch���
 /// </summary>
 /// <param name="searchCondition">Search Condition</param>
 /// <param name="componentGroup">�������ƷSearch���</param>
 public static void Cache(string keys, Merchandise componentGroup)
 {
     CachedTours[keys] = componentGroup;
 }
Example #38
0
 public static int Get_MerchPrice(int techLevel, Merchandise merch)
 {
     return GoodsPrices[techLevel][merch];
 }
 public ActionResult Edit_GET(Merchandise merchandiseToEdit)
 {
     return View(merchandiseToEdit);
 }
Example #40
0
        public Inventory Save()
        {
            Inventory inventory = null;
            var session = NHibernateSessionManager.GetLocalSession();

            session.DoTransactional(sess =>
                {
                    inventory = _inventoryRepository.Insert(
                        new Inventory(
                            _form.Code,
                            _form.InventoryName,
                            _form.Description,
                            _form.BuyPrice,
                            _form.UnitOfMeasurement
                        )
                    );

                    if (_form.InventoryStorageDto.Count > 0)
                    {
                        var stockMovement = new StockMovement(
                            StockMovementType.INITIALBALANCE,
                            @"CREATED AUTOMATICALLY FROM ADD NEW INVENTORY");

                        foreach (var inventoryStorageDto in _form.InventoryStorageDto)
                        {
                            stockMovement.AddMovementItem(inventory, inventoryStorageDto.Storage, inventoryStorageDto.Quantity);

                            _storageRepository.Update(inventoryStorageDto.Storage);
                        }

                        _stockMovementRepository.Insert(stockMovement);
                    }

                    if (_form.AddAsProduct)
                    {
                        var product = new Product(
                            _form.ProductCode,
                            inventory,
                            _form.ProductCategory,
                            _form.SellPrice
                        )
                            {
                                Volume = _form.Volume
                            };

                        _productRepository.Insert(product);
                    }

                    if (_form.AddAsMerchandise)
                    {
                        var merchandise = new Merchandise(
                            _form.MerchandiseCode,
                            inventory,
                            _form.MerchandisePoint,
                            1,
                            inventory.Name,
                            inventory.Description
                        );

                        _merchandiseRepository.Insert(merchandise);
                    }
                });

            return inventory;
        }
 public void Edit(Merchandise merchandiseToEdit)
 {
 }