コード例 #1
0
 public void Run()
 {
     CommonClientFunctions.Menuing(MenuOptionsAnalysis(), (actionInput) =>
     {
         switch (actionInput)
         {
         case 1:
             ItemsReport();
             break;
         }
     });
 }
コード例 #2
0
ファイル: ItemClient.cs プロジェクト: WeLikeAich/ShopManager
        private void UpdateItem()
        {
            Console.WriteLine("Pick an Item to Edit");
            var items       = CommonClientFunctions.ReadItems();
            var hasElements = CommonClientFunctions.EntitySelection(items, out Item item);

            if (!hasElements)
            {
                Console.WriteLine("No Items Available");
                return;
            }
            if (item is null)
            {
                return;
            }

            Console.Write($"Name ({item.Name})> ");
            var newName = Console.ReadLine();

            Console.Write($"Name ({item.Description})> ");
            var newDescription = Console.ReadLine();

            item.Name        = String.IsNullOrWhiteSpace(newName) ? item.Name : newName;
            item.Description = String.IsNullOrWhiteSpace(newDescription) ? item.Description : newDescription;

            using (var db = new ShopContext())
            {
                new DataService(db).Update(item);
            }

            CommonClientFunctions.Menuing(MenuOptionsUpdateItemSizeOption(), (actionInput) =>
            {
                switch (actionInput)
                {
                case 1:
                    CreateSizeOption(item);
                    break;

                case 2:
                    UpdateSizeOption(item);
                    break;

                case 3:
                    DeleteSizeOption(item);
                    break;
                }
            });
        }
コード例 #3
0
        private void UpdateMaterials()
        {
            Console.WriteLine("Pick a Material to Edit");
            var materials   = CommonClientFunctions.ReadMaterials();
            var hasElements = CommonClientFunctions.EntitySelection(materials, out Material material);

            if (!hasElements)
            {
                Console.WriteLine("No Materials Available");
                return;
            }
            if (material is null)
            {
                return;
            }

            Console.Write($"Name ({material.FullMaterialName})> ");
            var newFullMaterialName = Console.ReadLine();

            Console.Write($"Name ({material.FriendlyName})> ");
            var newFriendlyName = Console.ReadLine();

            material.FullMaterialName = String.IsNullOrWhiteSpace(newFullMaterialName) ? material.FullMaterialName : newFullMaterialName;
            material.FriendlyName     = String.IsNullOrWhiteSpace(newFriendlyName) ? material.FriendlyName : newFriendlyName;

            using (var db = new ShopContext())
            {
                new DataService(db).Update(material);
            }

            CommonClientFunctions.Menuing(MenuOptionsUpdateMaterials(), (actionInput) =>
            {
                switch (actionInput)
                {
                case 1:
                    CreateColor(material);
                    break;

                case 2:
                    UpdateColors(material);
                    break;

                case 3:
                    DeleteColor(material);
                    break;
                }
            });
        }
コード例 #4
0
ファイル: ItemClient.cs プロジェクト: WeLikeAich/ShopManager
        public void Run()
        {
            CommonClientFunctions.Menuing(MenuOptionsItem(), (actionInput) =>
            {
                switch (actionInput)
                {
                case 1:
                    CreateItem();
                    break;

                case 2:
                    CommonClientFunctions.ListItems();
                    break;

                case 3:
                    UpdateItem();
                    break;

                case 4:
                    DeleteItem();
                    break;
                }
            });
        }
コード例 #5
0
ファイル: ItemClient.cs プロジェクト: WeLikeAich/ShopManager
        public void UpdateSizeOption(Item item)
        {
            var options     = item.SizeOptions;
            var hasElements = CommonClientFunctions.EntitySelection(options, out SizeOption option, 1);

            if (!hasElements)
            {
                Console.WriteLine("No Size Options Available");
                return;
            }
            if (option is null)
            {
                return;
            }

            Console.Write($"Size ({option.Size})> ");
            var newSize = Console.ReadLine();

            decimal newPrice;
            string  priceInput;

            do
            {
                newPrice = -1;
                Console.Write($"Price ({option.Price})> ");
                priceInput = Console.ReadLine().Replace("$", "");

                if (String.IsNullOrWhiteSpace(priceInput))
                {
                    break;
                }
                Decimal.TryParse(priceInput, out newPrice);
            } while (newPrice <= 0);

            int    newTTM;
            string timeInput;

            do
            {
                newTTM = -1;
                Console.Write($"Time To Make In Hours. Must be Non Zero. ({option.TimeToMakeInHours})> ");
                timeInput = Console.ReadLine();
                if (String.IsNullOrWhiteSpace(timeInput))
                {
                    break;
                }
                Int32.TryParse(timeInput, out newTTM);
            } while (newTTM <= 0);

            option.Size              = String.IsNullOrWhiteSpace(newSize) ? option.Size : newSize;
            option.Price             = newPrice == -1 ? option.Price : newPrice;
            option.TimeToMakeInHours = newTTM == -1 ? option.TimeToMakeInHours : newTTM;

            using (var db = new ShopContext())
            {
                new DataService(db).Update(option);
            }

            CommonClientFunctions.Menuing(MenuOptionsUpdateSizeOptionMaterialCount(), (actionInput) =>
            {
                switch (actionInput)
                {
                case 1:
                    CreateMaterialCount(option);
                    break;

                case 2:
                    EditMaterialCount(option);
                    break;

                case 3:
                    DeleteMaterialCount(option);
                    break;
                }
            });
        }