Beispiel #1
0
 public bool Update(int id, ItemVM itemVM)
 {
     if (string.IsNullOrEmpty(id.ToString()) || string.IsNullOrWhiteSpace(id.ToString())) // untuk mengecek inputan kosong/null
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Name) || string.IsNullOrWhiteSpace(itemVM.Name)) // untuk mengecek inputan kosong/null
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Stock.ToString()) || string.IsNullOrWhiteSpace(itemVM.Stock.ToString()))
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Price.ToString()) || string.IsNullOrWhiteSpace(itemVM.Price.ToString()))
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Suppliers_Id.ToString()) || string.IsNullOrWhiteSpace(itemVM.Suppliers_Id.ToString()))
     {
         return(false);
     }
     else
     {
         return(_itemPersistence.Update(id, itemVM));
     }
 }
        public ActionResult UpdateItem(int id)
        {
            ActionResult response;

            //try to connect to the db and pull the indicated users information
            try
            {
                ItemVM item = new ItemVM();
                item.Item = Mapper.Mapper.ItemDOtoPO(iDAO.ViewItemSingle(id));
                response  = View(item);
            }
            //catch and log any unlogged sqlExceptions encountered
            catch (SqlException sqlEx)
            {
                if (!((bool)sqlEx.Data["Logged"] == true) || !sqlEx.Data.Contains("Logged"))
                {
                    Logger.LogSqlException(sqlEx);
                }
                response = RedirectToAction("Index", "Item");
            }
            catch (Exception ex)
            {
                if (!ex.Data.Contains("Logged") || (bool)ex.Data["Logged"] == false)
                {
                    Logger.LogException(ex);
                }
                response = RedirectToAction("Index", "Item");
            }
            return(response);
        }
Beispiel #3
0
 public void Update(ItemVM itemVM)
 {
     this.Name       = itemVM.Name;
     this.Price      = itemVM.Price;
     this.Stock      = itemVM.Stock;
     this.UpdateDate = DateTimeOffset.Now.LocalDateTime;
 }
 public bool Update(int id, ItemVM itemVM)
 {
     if (string.IsNullOrEmpty(id.ToString()) || string.IsNullOrWhiteSpace(id.ToString()))
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Name) || string.IsNullOrWhiteSpace(itemVM.Name))
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Price.ToString()) || string.IsNullOrWhiteSpace(itemVM.Price.ToString()) || itemVM.Price < 0)
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Stock.ToString()) || string.IsNullOrWhiteSpace(itemVM.Stock.ToString()) || itemVM.Stock < 0)
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Suppliers_Id.ToString()) || string.IsNullOrWhiteSpace(itemVM.Suppliers_Id.ToString()))
     {
         return(false);
     }
     else
     {
         return(_itemPersistence.Update(id, itemVM));
     }
 }
Beispiel #5
0
 public ActionResult CreateItem(ItemVM item)
 {
     using (LIVEEntities db = new LIVEEntities())
     {
         FrdItem nw = new FrdItem();
         nw.ItemNo          = item.ItemNo;
         nw.ItemCode        = item.ItemCode;
         nw.ItemName        = item.ItemName;
         nw.ItemDescription = item.ItemDescription;
         nw.ItemType        = item.ItemType;
         nw.ItemTypeCode    = item.ItemTypeCode;
         nw.ItemUnitCode    = item.ItemUnitCode;
         nw.PlantCode       = item.PlantCode;
         nw.ItemMachineCode = item.ItemMachineCode;
         nw.UnitPrice       = item.UnitPrice;
         nw.TaxFlag         = item.TaxFlag;
         nw.ConvertValue    = item.ConvertValue;
         nw.UseFor          = item.UseFor;
         nw.Show            = item.Show;
         nw.CreateBy        = Session["Name"].ToString();
         nw.CreateDate      = DateTime.Now;
         db.FrdItems.Add(nw);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
 }
Beispiel #6
0
        public bool Insert(ItemVM itemVM)
        {
            var push = new Item(itemVM);
            var get  = myContext.Type.Find(itemVM.Type_Id);

            if (get != null)
            {
                push.Type = get;
                myContext.Item.Add(push);
                var result = myContext.SaveChanges();
                if (result > 0)
                {
                    status = true;
                    return(status);
                }
                else
                {
                    return(status);
                }
            }
            else
            {
                return(status);
            }
        }
Beispiel #7
0
        private void Btn_SaveOrEditItem_Click(object sender, RoutedEventArgs e)
        {
            var result = false;

            if (string.IsNullOrWhiteSpace(txt_IdItem.Text))
            {
                var itemParam = new ItemVM(txt_NameItem.Text, Convert.ToInt32(txt_PriceItem.Text), Convert.ToInt32(txt_StockItem.Text), Convert.ToInt32(cmb_Supplier.SelectedValue));
                result = iItemService.Insert(itemParam);
            }
            else
            {
                itemVM.Update(Convert.ToInt32(txt_IdItem.Text), txt_NameItem.Text, Convert.ToInt32(txt_PriceItem.Text), Convert.ToInt32(txt_StockItem.Text), Convert.ToInt32(cmb_Supplier.SelectedValue));
                result = iItemService.Update(itemVM.Id, itemVM);
            }
            if (result)
            {
                MessageBox.Show("Save Successfully");
            }
            else
            {
                MessageBox.Show("Save Fail");
            }
            LoadGrid();
            LoadCombo();
            ResetItem();
        }
Beispiel #8
0
        public void Delete(Guid id)
        {
            ResponseService.Init();

            ItemVM itemVM = GetByGuid(id);

            if (itemVM != null)
            {
                UnitOfWork.ItemRepository.Remove(itemVM.ElementId);
                if (UnitOfWork.Save() > 0)
                {
                    ResponseService.Status = true;
                    ResponseService.Errors.Add("Item Deleted Successfully");
                }
                else
                {
                    ResponseService.Status = false;
                    ResponseService.Errors.Add("Server Error");
                }
            }
            else
            {
                ResponseService.Status = false;
                ResponseService.Errors.Add("Item Not Found");
            }
        }
Beispiel #9
0
        public ItemVM ProductsByIdProd(int IdProducto)
        {
            Productos listaProductos = db.Productos.Where(x => x.Id == IdProducto).FirstOrDefault();

            if (listaProductos == null)
            {
                return(null);
            }
            ItemVM listVM = new ItemVM()
            {
                Id                = listaProductos.Id,
                Nombre            = listaProductos.Nombre,
                Descripcion       = string.IsNullOrEmpty(listaProductos.Descripcion) ? "Palermo. Buenos Aires" : listaProductos.Descripcion,
                IdTipo            = listaProductos.IdTipo,
                Fecha_Publicacion = listaProductos.Fecha_Publicacion,
                Ult_Dias          = (int)DateTime.Now.Subtract(listaProductos.Fecha_Publicacion.Value).TotalDays,
                Imagen            = listaProductos.Imagen,
                Categoria         = listaProductos.Categorias.Nombre,
                IdCategoria       = listaProductos.IdCategoria.ToString(),
                Importe           = listaProductos.Importe.ToString(),
                lat               = string.IsNullOrEmpty(listaProductos.lat) ? "0" : listaProductos.lat,
                lng               = string.IsNullOrEmpty(listaProductos.lng) ? "0" : listaProductos.lng,
                IdUsuario         = listaProductos.IdUsuario ?? 0,
                Usuario           = listaProductos.Usuarios.Nombre,
                UsuarioImagen     = listaProductos.Usuarios.Imagen,
                CodigoDescuento   = listaProductos.CodigoDescuento,
                Cantidad          = listaProductos.Cantidad ?? 0,
                FechaVencimiento  = listaProductos.FechaVencimiento,
                PorcentajeDesc    = listaProductos.PorcentajeDescuento,
                DireccionUsuario  = listaProductos.Usuarios.Direccion
            };

            return(listVM);
        }
Beispiel #10
0
        public ActionResult Create(ItemVM itemVM)
        {
            if (ModelState.IsValid)
            {
                RestaurantItem restItem = new RestaurantItem
                {                       /*RestaurantId = itemVM.RestaurantId,*/
                    StockCode = 1
                };
                if (itemVM.NewItem)
                {
                    restItem.Item = new Item {
                        Name = itemVM.Name
                    };
                }
                else
                {
                    restItem.ItemId = itemVM.ItemId;
                }
                Restaurant rest = db.Restaurants.Find(itemVM.RestaurantId);
                rest.RestaurantItems.Add(restItem);
                //db.RestaurantItems.Add(restItem);
                db.Entry(rest).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", new { id = itemVM.RestaurantId }));
            }
            int id        = itemVM.RestaurantId;
            var myItemIds = db.RestaurantItems.Where(x => x.RestaurantId == id).Select(x => x.ItemId);
            var newItemsA = db.RestaurantItems.Where(x => x.RestaurantId != id && !myItemIds.Contains(x.ItemId)).Select(y => y.Item);
            var newItemsB = db.Items.Where(x => !x.RestaurantItems.Any());
            var newItems  = newItemsA.Concat(newItemsB);

            ViewBag.ItemId = new SelectList(newItems, "Id", "Name", itemVM.ItemId);
            return(View(itemVM));
        }
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            List <ItemVM> updateitem = new List <ItemVM>();

            foreach (ItemVM item in editedItems)
            {
                ItemVM i = Controllers.ItemCtrl.GetItem(item.ItemCode);
                i.ReorderLevel = item.NewReorderLvl;
                i.ReorderQty   = item.NewReorderQty;
                updateitem.Add(i);
            }


            bool success = Controllers.ItemCtrl.UpdateItems(updateitem);

            if (success)
            {
                Main master = (Main)this.Master;
                master.ShowToastr(this, String.Format("Item Reorder Level and Quantity are updated"), "Successfully update!", "success");
                //BindGrid();
            }
            else
            {
                Main master = (Main)this.Master;
                master.ShowToastr(this, String.Format("Item Reorder Level and Quantity Changes not Submitted"), "Something Went Wrong!", "error");
            }

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#mdlConfirm').modal('toggle');", true);//modal popup
        }
        public ActionResult ViewItems()
        {
            ActionResult oResponse = null;

            if (Session["Username"] == null) //Guest
            {
                oResponse = RedirectToAction("Index", "Home");
            }
            else //Everyone else
            {
                //Creating a new instance of VM
                ItemVM newVM = new ItemVM();
                try
                {
                    //Call for method from DAL and set to variable
                    List <IItemDO> itemInfo = ItemAccess.ViewAllItems();
                    //Call mapping and assign in variable
                    newVM.ItemList = ItemMap.MapDOtoPO(itemInfo);
                    //return view
                    oResponse = View(newVM);
                }
                catch (Exception e)
                {
                    newVM.ErrorMessage = "Sorry, We couldn't obtain the list of items avaliable";
                    ErrorLog.LogError(e);
                    oResponse = View(newVM);
                }
                finally
                {
                    //Onshore standards
                }
            }

            return(oResponse);
        }
        public static List <ItemVM> Convert_Item_To_ItemVM(List <Item> items)
        {
            List <ItemVM> itemlistvm = new List <ItemVM>();

            foreach (Item item in items)
            {
                ItemVM itemVM = new ItemVM();
                itemVM.ItemCode     = item.ItemCode;
                itemVM.Cat          = item.Cat;
                itemVM.Desc         = item.Desc;
                itemVM.Location     = item.Location;
                itemVM.UOM          = item.UOM;
                itemVM.IsActive     = item.IsActive;
                itemVM.Balance      = item.Balance;
                itemVM.ReorderLevel = item.ReorderLevel;
                itemVM.ReorderQty   = item.ReorderQty;
                itemVM.TempQtyDisb  = item.TempQtyDisb;
                itemVM.TempQtyCheck = item.TempQtyCheck;
                itemVM.SuppCode1    = item.SuppCode1;
                itemVM.SuppCode2    = item.SuppCode2;
                itemVM.SuppCode3    = item.SuppCode3;
                itemVM.Price1       = item.Price1 ?? default(double);
                itemVM.Price2       = item.Price2 ?? default(double);
                itemVM.Price3       = item.Price3 ?? default(double);

                itemlistvm.Add(itemVM);
            }

            return(itemlistvm);
        }
Beispiel #14
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            ItemVM itemVm = new ItemVM();

            item.Company      = companyComboBox.GetItemText(companyComboBox.SelectedItem);
            item.Category     = categoryComboBox.GetItemText(categoryComboBox.SelectedItem);
            item.Name         = nameTextBox.Text;
            item.ErrorText    = itemErrorLabel.Text;
            item.ReorderError = reorderErrorLabel.Text;
            item.Reorder      = reorderTextBox.Text;

            itemVm.Name     = nameTextBox.Text;
            itemVm.Company  = companyComboBox.GetItemText(companyComboBox.SelectedItem);
            itemVm.Category = categoryComboBox.GetItemText(categoryComboBox.SelectedItem);
            itemVm.Reorder  = reorderTextBox.Text;

            bool verify = itemManagement.IsVerified(item);

            if (verify)
            {
                MessageBox.Show("Field Must Not Be Empty!!");
                return;
            }


            bool error = itemManagement.IsError(item);

            if (error)
            {
                MessageBox.Show("Please Resolve Your Error!!");
                return;
            }


            //Check Existing Item
            bool isExist = itemManagement.IsExisted(item);

            if (isExist)
            {
                itemErrorLabel.Text = "* This Item Already Existed!!";
                return;
            }
            itemErrorLabel.Text = "";

            disItemVms.Add(itemVm);

            bool isAdd = itemManagement.IsAdded(item);

            if (isAdd)
            {
                //MessageBox.Show("New Item Successfully Add!!");

                itemDataGridView.DataSource = null;
                itemDataGridView.DataSource = disItemVms;

                nameTextBox.Clear();
                reorderTextBox.Clear();
                reorderErrorLabel.Text = "";
            }
        }
Beispiel #15
0
 //constructor with parameter
 public Item(ItemVM itemVM)
 {
     this.Name       = itemVM.Name;
     this.Stock      = itemVM.Stock;
     this.Price      = itemVM.Price;
     this.CreateDate = DateTimeOffset.Now.ToLocalTime();
 }
        public ActionResult Edit(int id)
        {
            //TODO: Fetch item with id=id from DB

            using (AppContext db = new AppContext())
            {
                var item = db.Items.FirstOrDefault(x => x.Id == id);
                if (item != null)
                {
                    ItemVM vm = new ItemVM();
                    vm.Id       = item.Id;
                    vm.Text     = item.Text;
                    vm.Link     = item.Link;
                    vm.Price    = item.Price;
                    vm.Priority = item.Priority;
                    return(View(vm));
                }
                else
                {
                    return(null);
                }
            }

            //ItemVM Item = ItemsDB.FirstOrDefault(x => x.Id == id);
            //if (Item == null)
            //{
            //    return null;
            //}

            //return View(Item);
        }
        public bool Update(int id, ItemVM itemVM)
        {
            var get = Get(id);

            if (get != null)
            {
                var getSup = myContext.Suppliers.Find(get.Supplier_Id);
                if (getSup != null)
                {
                    get.Suppliers = getSup;
                    get.Update(id, itemVM);
                    myContext.Entry(get).State = EntityState.Modified;
                    var result = myContext.SaveChanges();
                    return(result > 0);
                }
                else
                {
                    return(status);
                }
            }
            else
            {
                return(status);
            }
        }
        public IActionResult GetShoppingList(int userId)
        {
            var tempShopList = _context.ShoppingLists.FirstOrDefault(s => s.UserId == userId);

            if (tempShopList == null)
            {
                return(NotFound());
            }
            var shoppingListId = tempShopList.Id;
            var tmpItemList    = from itemListPtr in _context.Items
                                 where itemListPtr.ShoppingListId == shoppingListId
                                 select itemListPtr;
            var tempItemList = tmpItemList.ToList();

            List <ItemVM> itemList = new List <ItemVM>();

            foreach (Item item in tempItemList)
            {
                var tempItem = new ItemVM();
                tempItem.ItemName = item.ItemName;
                tempItem.ItemQty  = item.ItemQty;
                tempItem.ItemUnit = item.ItemUnit;
                itemList.Add(tempItem);
            }

            var shoppingList = new ShoppingListVM();

            shoppingList.ListName       = tempShopList.ListName;
            shoppingList.ShoppingListId = tempShopList.Id;
            shoppingList.UserId         = tempShopList.UserId;
            shoppingList.Items          = itemList;

            return(new ObjectResult(shoppingList));
        }
Beispiel #19
0
        public ActionResult Edit(int?id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(400));
                }

                Item i = new Item();
                i = service.GetItem((int)id);

                if (i == null)
                {
                    return(new HttpStatusCodeResult(404));
                }

                ItemVM vm = new ItemVM()
                {
                    Item = i
                };

                return(View(vm));
            }
            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Item", "Edit")));
            }
        }
Beispiel #20
0
        public bool IsItemSaved(ItemVM itemVm)
        {
            Item item = new Item()
            {
                Name        = itemVm.Name,
                Code        = itemVm.Code,
                Description = itemVm.Description,
                Image       = itemVm.Image,
                Date        = itemVm.Date,
                CategoryId  = itemVm.CategoryId,
                CostPrice   = itemVm.CostPrice,
                SalePrice   = itemVm.SalePrice
            };

            dbContext.Items.Add(item);
            var isAdded = dbContext.SaveChanges();

            if (isAdded > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }

            return(false);
        }
Beispiel #21
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            var vm = new ItemVM();

            myList.ItemsSource = vm.AddOns;
        }
Beispiel #22
0
        public void AddItemToCart(ItemVM ci, HttpSessionStateBase session)
        {
            ICollection <ItemVM> items = GetCartItem(session);

            items.Add(ci);
            SetCart(items, session);
        }
Beispiel #23
0
        // GET: api/Productos/5
        //[ResponseType(typeof(Productos))]
        //public IHttpActionResult GetProductos(int id)
        //{
        //    Productos productos = db.Productos.Find(id);
        //    if (productos == null)
        //    {
        //        return NotFound();
        //    }

        //    return Ok(productos);
        //}
        public ItemVM GetProductos(int id)
        {
            Productos objProd        = db.Productos.Find(id);
            int       nroSolicitudes = objProd.Pedidos.Count;

            if (objProd == null)
            {
                return(null);
            }

            ItemVM listVM = new ItemVM()
            {
                Id                = objProd.Id,
                Nombre            = objProd.Nombre,
                Descripcion       = string.IsNullOrEmpty(objProd.Descripcion) ? "Palermo. Buenos Aires" : objProd.Descripcion,
                IdTipo            = objProd.IdTipo,
                Fecha_Publicacion = objProd.Fecha_Publicacion,
                Ult_Dias          = (int)DateTime.Now.Subtract(objProd.Fecha_Publicacion.Value).TotalDays,
                Imagen            = objProd.Imagen,
                Categoria         = objProd.Categorias.Nombre,
                IdCategoria       = objProd.IdCategoria.ToString(),
                Importe           = objProd.Importe.ToString(),
                lat               = string.IsNullOrEmpty(objProd.lat) ? "0" : objProd.lat,
                lng               = string.IsNullOrEmpty(objProd.lng) ? "0" : objProd.lng,
                NroSolicitudes    = nroSolicitudes.ToString(),
                Usuario           = objProd.Usuarios.Nombre,
                UsuarioImagen     = objProd.Usuarios.Imagen,
                IdProductoUsuario = objProd.Usuarios.Id.ToString()
            };


            return(listVM);
        }
Beispiel #24
0
        public async Task GetFeed()
        {
            HomeFeeds.Clear();

            var feeds = await _quizApi.GetHomeFeed();

            foreach (var feed in feeds.items)
            {
                IHomeItemVM vm = null;

                if (feed is ClassFeed)
                {
                    vm = new ClassFeedVM((ClassFeed)feed);
                }
                if (feed is StudySessionItem)
                {
                    vm = new StudySessionItemVM((StudySessionItem)feed);
                }
                if (feed is Item)
                {
                    vm = new ItemVM((Item)feed);
                }

                if (vm != null)
                {
                    HomeFeeds.Add(vm);
                }
            }
        }
        public ActionResult DeleteItem(long ItemID)
        {
            if (Session["Username"] == null || (Int16)Session["Role"] == 3)
            {
                //go to the returned redirect
            }
            else
            {
                ItemVM newVM = new ItemVM();

                try
                {
                    ItemAccess.DeleteItem(ItemID);
                }
                catch (Exception e)
                {
                    newVM.ErrorMessage = "Sorry we couldn't handle your request";
                    ErrorLog.LogError(e);
                }
                finally
                {
                    //Onshore standards
                }
            }
            return(RedirectToAction("ViewItems", "Item"));
        }
Beispiel #26
0
        public void CreateItem(ItemVM item)
        {
            //if (String.IsNullOrEmpty(item.ItemName))
            //{
            //    errMsg = "name field empty";
            //}else
            //{
            OneListEntitiesCore db = new OneListEntitiesCore();
            Item itemAdded         = new Item();

            itemAdded.UserID          = item.UserID;
            itemAdded.ItemName        = item.ItemName;
            itemAdded.ItemDescription = item.ItemDescription;
            itemAdded.ItemCategory    = (int)item.ItemCategory;

            //if (itemAdded.ItemCategory == 0)
            //{
            //    errMsg = "Items must belong to a category";
            //}
            //else {
            db.Items.Add(itemAdded);
            db.SaveChanges();
            //errMsg = "Item successfully added";
            //}
            //}
        }
Beispiel #27
0
        public static void DeleteShortcuts(ItemVM itemVMToDelete)
        {
            string shortcutsDirectoryPath = Helper.GetShortcutsPath();

            // Delete physical file/s first
            if (itemVMToDelete.IsGroup)
            {
                foreach (ItemVM subItemVMToDelete in itemVMToDelete.ItemVMs)
                {
                    string shortcutFileName = subItemVMToDelete.Guid;
                    string ext = subItemVMToDelete.Ext;
                    string shortcutFilePath = Path.Combine(shortcutsDirectoryPath, shortcutFileName + ext);
                    System.IO.File.Delete(shortcutFilePath);
                    // This should be recoursive
                    DeleteShortcuts(subItemVMToDelete);
                }
            }
            else
            {
                string shortcutFileName = itemVMToDelete.Guid;
                string ext = itemVMToDelete.Ext;
                string shortcutFilePath = Path.Combine(shortcutsDirectoryPath, shortcutFileName + ext);
                System.IO.File.Delete(shortcutFilePath);
            }
        }
Beispiel #28
0
        public List <ItemVM> GetItemsByCompanyId(int companyId)
        {
            Query   = "SELECT * FROM CheckItems WHERE CompanyId = @companyId";
            Command = new SqlCommand(Query, Connection);

            Command.Parameters.AddWithValue("@companyId", companyId);
            Connection.Open();
            Reader = Command.ExecuteReader();

            List <ItemVM> itemList = new List <ItemVM>();

            while (Reader.Read())                                           //Reading database row by row
            {
                ItemVM items = new ItemVM();
                items.Id                = Convert.ToInt32(Reader["Id"]);
                items.ItemName          = Reader["ItemName"].ToString();
                items.ReorderLevel      = Convert.ToInt32(Reader["ReorderLevel"]);
                items.AvailableQuantity = Convert.ToInt32(Reader["AvailableQuantity"]);
                items.CompanyId         = Convert.ToInt32(Reader["CompanyId"]);
                items.CompanyName       = (Reader["CompanyName"]).ToString();
                items.CategoryId        = Convert.ToInt32(Reader["CatagoryId"]);
                items.CatagoryName      = (Reader["CategoryName"]).ToString();

                itemList.Add(items);
            }
            Connection.Close();

            return(itemList);
        }
Beispiel #29
0
        public static Item TranslateItemVMToItem(ItemVM itemVM)
        {
            Item item = new Item();

            if (itemVM == null)
            {
                return(item);
            }

            item.Barcode        = itemVM.Barcode;
            item.BuyPrice       = itemVM.BuyPrice;
            item.Code           = itemVM.Code;
            item.ID             = itemVM.ID;
            item.IsGoods        = itemVM.IsGoods;
            item.ItemGroupId    = itemVM.ItemGroupId;
            item.ItemType       = itemVM.ItemType;
            item.MoneyStock     = itemVM.MoneyStock;
            item.Name           = itemVM.Name;
            item.OrganIdItem    = itemVM.OrganId;
            item.PurchasesTitle = itemVM.PurchasesTitle;
            item.SalesTitle     = itemVM.SalesTitle;
            item.SellPrice      = itemVM.SellPrice;
            item.Stock          = itemVM.Stock;
            item.UnitID         = itemVM.UnitID;


            return(item);
        }
        public void FixtureSetup()
        {
            Results = new CustomValidatorMockConfiguration();
            var initialState = Results.GetState();

            OwnerOfAB = new TwoItemListsVM(Results);
            OwnerOfC  = new ItemListVM(Results);

            ItemA   = new ItemVM(Results, "ItemA");
            ItemAB  = new ItemVM(Results, "ItemAB");
            ItemABC = new ItemVM(Results, "ItemABC");
            ItemC   = new ItemVM(Results, "ItemC");

            OwnerOfAB.CollectionA.Add(ItemA);
            OwnerOfAB.CollectionA.Add(ItemAB);
            OwnerOfAB.CollectionA.Add(ItemABC);

            OwnerOfAB.CollectionB.Add(ItemAB);
            OwnerOfAB.CollectionB.Add(ItemABC);

            OwnerOfC.CollectionC.Add(ItemABC);
            OwnerOfC.CollectionC.Add(ItemC);

            initialState.RestoreToState();
        }
 public MasterInventoryEditVM(ItemVM editingItem)
 {
     EditingItem = editingItem;
     EditSuppliers = new ObservableCollection<SupplierVM>();
     Categories = new ObservableCollection<ItemCategoryVM>();
     UpdateCategories();
     SetDefaultEditProperties();
 }
Beispiel #32
0
 private void UpdateSelectedCategoryItem(ItemVM oldSelectedCategoryItem)
 {
     if (oldSelectedCategoryItem == null) return;
     SelectedCategoryItem = CategoryItems.FirstOrDefault(item => item.ID.Equals(oldSelectedCategoryItem.ID));
 }
Beispiel #33
0
 private void UpdateSelectedItem(ItemVM oldSelectedItem)
 {
     if (oldSelectedItem == null) return;
     SelectedItem = Items.SingleOrDefault(item => item.ID.Equals(oldSelectedItem.ID));
 }