예제 #1
0
 public ActionResult AddPorduct(string models)
 {
     sd_product product = new sd_product();
     JsonResult result = new JsonResult();
     Product bll = new Product();
     if (models != null)
     {
         product = JsonConvert.DeserializeObject<sd_product>(models);
         product.addTime = DateTime.Now;
     }
     result.Data = bll.Add(product);
     return result;
 }
예제 #2
0
        private string Add(ref ProductInfo proAdd)
        {
            string result   = "success";
            string @string  = WebUtils.GetString(this.TextBox1.Text);
            int    autoID   = this.currCate.AutoID;
            int    @int     = WebUtils.GetInt(this.DropDownList3.SelectedValue, 0);
            string string2  = WebUtils.GetString(this.TextBox4.Text);
            int    int2     = WebUtils.GetInt(this.TextBox13.Text);
            bool   @checked = this.chkExchange.Checked;

            if (string.IsNullOrEmpty(@string))
            {
                result = "Vui lòng chọn tên sản phẩm";
            }
            if (autoID.Equals(0))
            {
                result = "Vui lòng chọn";
            }
            else if (@int.Equals(0))
            {
                result = "Vui lòng chọn thương hiệu";
            }
            else if (Product.ExistsProductSN(string2, 0))
            {
                result = "ID sản phẩm đã tồn tại";
            }
            else if (@checked && int2 <= 0)
            {
                result = "The required points for convertible goods are not less than 0";
            }
            else
            {
                proAdd.ProductName = @string;
                proAdd.CateID      = autoID;
                System.Collections.Generic.List <PhotoAlbumInfo> list = new System.Collections.Generic.List <PhotoAlbumInfo>();
                this.SetEntity(proAdd, list);
                System.Collections.Generic.Dictionary <string, ProductFieldInfo> fieldDicWithValues = this.GetFieldDicWithValues();
                if (!Product.Add(proAdd, fieldDicWithValues, list))
                {
                    result = "Thêm hàng hóa thất bại";
                }
            }
            return(result);
        }
예제 #3
0
        private void LoadProducts()
        {
            Product.Add(new Product
            {
                SKU   = "A99",
                Price = 0.50m
            });

            Product.Add(new Product
            {
                SKU   = "B15",
                Price = 0.30m
            });

            Product.Add(new Product
            {
                SKU   = "C40",
                Price = 0.60m
            });
        }
예제 #4
0
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            //dtpLaunchDate.Format = DateTimePickerFormat.Custom;
            //dtpLaunchDate.CustomFormat = "yyyy-MM-dd";

            // Create new Product instance using entered values
            Product NewProduct = new Product
            {
                ProductType  = cbProductType.Text,
                SalesChannel = cbSalesChannel.Text,
                Title        = tbProductTitle.Text.ToString(),
                Color        = cbColor.Text,
                Weight       = Convert.ToDecimal(tbWeight.Text),
                WeightUnit   = cbWeightUnit.Text,
                Description  = tbDescription.Text.ToString(),
                Asin         = tbASIN.Text.ToString(),
                Fnsku        = tbFNSKU.Text.ToString(),
                Sku          = tbSKU.Text.ToString(),
                SizeTier     = cbSizeTier.Text,
                //ParentID = Convert.ToInt32(cbParentItem.Text), // Need to store Id of parent item but show the title
                EbayItemID    = tbEbayItemNumber.Text,
                EbayURL       = tbEbayURL.Text.ToString(),
                SalePrice     = Convert.ToDecimal(tbSalePrice.Text.ToString()),
                Dimensions    = tbLength.Text + "," + tbWidth.Text + "," + tbHeight.Text,
                DimensionUnit = cbDimensionUnit.Text,
                Status        = cbProductStatus.Text.ToString(),
                LaunchDate    = Convert.ToDateTime(dtpLaunchDate.Value)
            };

            // Add the product and display appropriate message
            if (Product.Add(NewProduct))
            {
                MessageBox.Show("Product added successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show("An error occured while adding the product!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #5
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (cbbSupplier.SelectedIndex > 0)
     {
         Supplier       sup  = cbbSupplier.SelectedItem as Supplier;
         List <Product> list = Product.FindByProductNameSupplierID(txtProductName.Text, sup.SupplierID);
         if (list.Count > 0)
         {
             MessageBox.Show("This Product had been exited!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             btnAdd.Enabled = false;
             return;
         }
         Product newPro = controlsLoad();
         Product.Add(newPro);
         MessageBox.Show("Adding is successful!", "Message Box!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     else
     {
         MessageBox.Show("You don't choose Supplier!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #6
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         bool    result  = false;
         Product product = GetData();
         if (product.ProductID > 0)
         {
             result         = Product.Update(product);
             lblStatus.Text = result ? "Update Successful" : "Update failed";
         }
         else
         {
             result         = Product.Add(product);
             lblStatus.Text = result ? "Insert Successful" : "Insert Failed";
             if (result)
             {
                 ResetForm();
             }
         }
     }
 }
예제 #7
0
        public int AddProduct(string Name, double ProductPrice, int Quantity, ProductsCategory category)
        {
            if (string.IsNullOrEmpty(Name))
            {
                throw new ArgumentNullException("Name", "Product's name is empty");
            }
            if (ProductPrice == 0)
            {
                throw new ArgumentOutOfRangeException("ProductPrice", "Product's price is wrong");
            }
            if (ProductPrice < 0)
            {
                throw new ArgumentOutOfRangeException("ProductPrice", "Product's price can't less than 0");
            }
            if (Quantity == 0)
            {
                throw new ArgumentOutOfRangeException("Quantity", "Product's count is wrong");
            }
            if (ProductPrice < 1)
            {
                throw new ArgumentOutOfRangeException("Quantity", "Product's count can't less than 0");
            }

            if (category == ProductsCategory.xeta)
            {
                throw new ArgumentNullException("category", "Product's category is wrong");
            }

            Products product = new();

            product.Name         = Name;
            product.ProductPrice = ProductPrice;
            product.Quantity     = Quantity;
            product.Category     = category;


            Product.Add(product);
            return(product.No);
        }
예제 #8
0
 public void StartUpOperations()
 {
     //Starting with brandname
     product.Add(string.Format($"Car Model Name : {this.brandName}"));
 }
예제 #9
0
 public void BuilderPartA() => product.Add("T Component");
예제 #10
0
 //All production steps work with the same product instance.
 public void BuildPartA()
 {
     _product.Add("PartA1");
 }
예제 #11
0
 public override void BuildPartA()
 {
     _product.Add("部件A");
 }
예제 #12
0
 // Methods
 override public void BuildPartA()
 {
   product = new Product();
   product.Add( "PartX" );
 }
예제 #13
0
 public override void BuildPartA()
 {
     product.Add("part a");
 }
예제 #14
0
        public static void MakeProduct_Main(string[] args)
        {
            Console.WriteLine("MakeProduct");

            // Command line parsing
            Arguments CommandLine = new Arguments(args);

            bool   err       = false;
            string errString = "";

            string file1   = "unassigned";
            string file2   = "unassigned";
            string outfile = "unassigned";

            // Look for specific arguments values and display
            // them if they exist (return null if they don't)
            if (CommandLine["file1"] != null)
            {
                file1 = CommandLine["file1"];
                if (!File.Exists(file1))
                {
                    errString += ("The specified 'file1' was not found: " + file1 + "  ");
                    err        = true;
                }
            }
            else
            {
                errString += ("The 'file1' was not specified.  ");
                err        = true;
            }

            if (CommandLine["file2"] != null)
            {
                file2 = CommandLine["file2"];
                if (!File.Exists(file2))
                {
                    errString += ("The specified 'file2' was not found: " + file2 + "  ");
                    err        = true;
                }
            }
            else
            {
                errString += ("The 'file2' was not specified.  ");
                err        = true;
            }

            if (CommandLine["outfile"] != null)
            {
                outfile = CommandLine["outfile"];
            }
            else
            {
                errString += ("The 'outfile' was not specified.  ");
                err        = true;
            }

            if (err)
            {
                Console.Out.WriteLine("Arguments parsing failed.");
                Console.Out.WriteLine("  " + errString);
            }
            else
            {
                Console.Out.WriteLine("Arguments parsing successful.");
                Console.Out.WriteLine("  file1 = " + file1);
                Console.Out.WriteLine("  file2 = " + file2);
                Console.Out.WriteLine("  outfile = " + outfile);

                SoapFormatter formatter = new SoapFormatter();

                FileStream    fs = new FileStream(file1, FileMode.Open);
                IDistribution d1 = (IDistribution)formatter.Deserialize(fs);
                fs.Close();

                fs = new FileStream(file2, FileMode.Open);
                IDistribution d2 = (IDistribution)formatter.Deserialize(fs);
                fs.Close();

                if (BlauSpace.intersects(d1.SampleSpace, d2.SampleSpace))
                {
                    Console.Out.WriteLine("The sample spaces of the two distributions have a non-empty intersection.");
                    Console.Out.WriteLine("  d1: " + d1);
                    Console.Out.WriteLine("  d2: " + d2);
                    Console.Out.WriteLine("The product must be constructed over disjoint sample spaces.");
                    Console.Out.WriteLine("This is a fatal error, preventing the construction of the product distribution.");
                }
                else
                {
                    int       dim3   = d1.SampleSpace.Dimension + d2.SampleSpace.Dimension;
                    string [] names3 = new string [dim3];
                    double [] mins3  = new double [dim3];
                    double [] maxs3  = new double [dim3];
                    for (int i = 0; i < d1.SampleSpace.Dimension; i++)
                    {
                        names3[i] = d1.SampleSpace.getAxis(i).Name;
                        mins3[i]  = d1.SampleSpace.getAxis(i).MinimumValue;
                        maxs3[i]  = d1.SampleSpace.getAxis(i).MaximumValue;
                    }
                    for (int i = 0; i < d2.SampleSpace.Dimension; i++)
                    {
                        names3[d1.SampleSpace.Dimension + i] = d2.SampleSpace.getAxis(i).Name;
                        mins3[d1.SampleSpace.Dimension + i]  = d2.SampleSpace.getAxis(i).MinimumValue;
                        maxs3[d1.SampleSpace.Dimension + i]  = d2.SampleSpace.getAxis(i).MaximumValue;
                    }
                    IBlauSpace s3 = BlauSpace.create(dim3, names3, mins3, maxs3);

                    Console.Out.WriteLine("  product space: " + s3);

                    Product d3 = new Product(s3);
                    d3.Add(d1);
                    d3.Add(d2);
                    d3.DistributionComplete();

                    Console.Out.WriteLine("Distribution: " + d3);


                    fs = new FileStream(outfile, FileMode.Create);
                    formatter.Serialize(fs, d3);
                    fs.Close();
                }
            }
        }
예제 #15
0
 public override void IncludePartOne()
 {
     Product.Add("Part C");
 }
예제 #16
0
 public override void BuildSavory()
 {
     _product.Add("Savory: 2");
 }
예제 #17
0
 public override void BuildPartOne()
 {
     _product.Add("Peugeot - 206");
 }
예제 #18
0
 public override void BuildPartOne()
 {
     product.Add(GetType().Name + " => " + nameof(BuildPartOne));
 }
예제 #19
0
        static bool Control(List <Product> lista, ushort[] id)
        {
            string input = Console.ReadLine();

            if (input == Anwser.add.ToString())
            {
                // Console.WriteLine("caso add");
                Console.WriteLine("Type the Name of the Product(optional: Quantity and Price)");
                string[] input2 = Console.ReadLine().Split(" ");

                if (input2.Length == 3)
                {
                    Product temp = new Product(id[0]++, input2[0], ushort.Parse(input2[1]), float.Parse(input2[2]));
                    lista.Add(temp);
                }
                else if (input2.Length == 2)
                {
                    Product temp = new Product(id[0]++, input2[0], ushort.Parse(input2[1]));
                    lista.Add(temp);
                }
                else if (input2.Length == 1)
                {
                    Product temp = new Product(id[0]++, input2[0]);
                    lista.Add(temp);
                }
            }
            else if (input == Anwser.remove.ToString())
            {
                // Console.WriteLine("caso remove");
                Console.WriteLine("Type the name of the Product to remove");
                string  input2 = Console.ReadLine();
                Product temp   = null;
                foreach (Product obj in lista)
                {
                    if (obj.Name == input2)
                    {
                        temp = obj;
                    }
                }
                if (temp != null)
                {
                    lista.Remove(temp);
                    Console.WriteLine("Product was removed successfully");
                    Console.Read();
                }
                else
                {
                    Console.WriteLine("Product not found");
                }
            }
            else if (input == Anwser.edit.ToString())
            {
                //Console.WriteLine("caso edit");
                Console.WriteLine("Type the name of the Product that will be modified");
                string  input2 = Console.ReadLine();
                Product temp   = null;
                foreach (Product obj in lista)
                {
                    if (obj.Name == input2)
                    {
                        temp = obj;
                    }
                }
                if (temp != null)
                {
                    bool editing = true;
                    while (editing)
                    {
                        Console.WriteLine("Do you want to edit <p>rice or <q>uantity?");
                        input2 = Console.ReadLine();
                        if (input2 == "p")
                        {
                            Console.WriteLine("How much will you change?");
                            float change = float.Parse(Console.ReadLine());
                            temp.Price = change;
                            editing    = false;
                        }
                        else if (input2 == "q")
                        {
                            Console.WriteLine("How much will you change?");
                            int change = int.Parse(Console.ReadLine());
                            if (change >= 0)
                            {
                                temp.Add((ushort)change);
                                editing = false;
                            }
                            else
                            {
                                change *= -1;
                                temp.Remove((ushort)change);
                                editing = false;
                            }
                        }
                    }
                }
            }
            else if (input == Anwser.show.ToString())
            {
                //   Console.WriteLine("caso show");
                Console.WriteLine("Type the name of the Product to show");
                string input2 = Console.ReadLine();

                foreach (Product obj in lista)
                {
                    if (obj.Name == input2)
                    {
                        Console.WriteLine(obj);
                    }
                }
                Console.Read();
            }

            else if (input == Anwser.show_all.ToString())
            {
                // Console.WriteLine("caso show all");
                foreach (Product o in lista)
                {
                    Console.WriteLine(o);
                }
                Console.ReadLine();
            }
            else if (input == Anwser.quit.ToString())
            {
                return(false);
            }
            else
            {
                Console.Write("<{0}> is not a operational function.", input);
                Console.WriteLine("To leave this programm type <quit>");
            }
            return(true);
        }
예제 #20
0
 public override void ConvertCharacter()
 {
     _product.Add("Convert Character to TextWidget");
 }
예제 #21
0
 public void Hamburger()
 {
     product.Add("Hamburger:");
     product.Add("Bread");
     product.Add("cheddar");
     product.Add("Onion");
     product.Add("Meat");
     product.Add("Bread");
     product.Add("\n");
 }
 public override void BuildHead()
 {
     product.Add("胖子增加头部\r\n");
 }
예제 #23
0
 public void StartUpOperations()
 {
     // Starting with brandname
     product.Add(string.Format("Car Model Name : {0}", brandName));
 }
예제 #24
0
 public void StartUpOperations()
 {
     product.Add(string.Format("Car Model name :{0}", this.brandName));
 }
예제 #25
0
 public void BuildPartA()
 {
     product.Add("PartX");
 }
        public HistogramChartViewModel()
        {
            this.Product = new ObservableCollection <HistogramChartModel>();

            Product.Add(new HistogramChartModel()
            {
                Price = 3
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 4
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 6
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 7
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 8
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 11
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 13
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 12
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 14
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 17
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 18
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 19
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 16
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 20
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 21
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 22
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 23
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 23
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 22
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 23
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 26
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 28
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 26
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 26
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 27
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 31
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 33
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 31
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 33
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 38
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 37
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 39
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 42
            });
            Product.Add(new HistogramChartModel()
            {
                Price = 44
            });
        }
 public void Build(string part)
 {
     _product.Add(part);
 }
예제 #28
0
 public override void SetPartsA()
 {
     _product.Add("деталька Two A1");
     _product.Add("деталька Two A2");
 }
예제 #29
0
 public override void BuildPartA() => _product.Add("PartA");
예제 #30
0
        static void Main(string[] args)
        {
            while (true)
            {
                System.Console.WriteLine("Для добавления нажмите Enter");
                if (System.Console.ReadKey().Key == ConsoleKey.Enter)
                {
                    XmlAdder xmlAdder = new XmlAdder();

                    Product product = new Product();
                    product.AddPressed += new AdderDelegate(xmlAdder.AddProduct);

                    System.Console.WriteLine("Введите название товара:");
                    product.Name = System.Console.ReadLine();

                    while (true)
                    {
                        System.Console.WriteLine("Введите массу товара");
                        try
                        {
                            product.Weight = int.Parse(System.Console.ReadLine());
                            if (product.Weight < 0 || product.Weight > 100000)
                            {
                                throw new Exception();
                            }
                        }
                        catch (Exception)
                        {
                            System.Console.WriteLine("Неверный ввод!");
                            continue;
                        }
                        break;
                    }

                    while (true)
                    {
                        System.Console.WriteLine("Введите объем товара");
                        try
                        {
                            product.Volume = int.Parse(System.Console.ReadLine());
                            if (product.Volume < 0)
                            {
                                throw new Exception();
                            }
                        }
                        catch (Exception)
                        {
                            System.Console.WriteLine("Неверный ввод!");
                            continue;
                        }
                        break;
                    }

                    product.ArriveDate = DateTime.Now;

                    product.Add();

                    System.Console.Clear();
                    System.Console.WriteLine("Товар успешно добавлен!");
                    System.Console.WriteLine();
                }
            }
        }
예제 #31
0
 public void BuildBody()
 {
     product.Add("This is a body of a Motorcycle");
 }
 public override void BuildPart(string partName)
 {
     product.Add(partName);
 }