示例#1
0
 public ActionResult Update(WareHouseItem warehouseItem)
 {
     try
     {
         var item = db.WareHouseItems.Find(warehouseItem.Id);
         item.NameJP          = warehouseItem.NameJP;
         item.NameEN          = warehouseItem.NameEN;
         item.CategoryId      = warehouseItem.CategoryId;
         item.CategoryWebName = warehouseItem.CategoryWebName;
         item.ImageBase64     = warehouseItem.ImageBase64;
         item.ProductCode     = warehouseItem.ProductCode;
         item.JanCode         = warehouseItem.JanCode;
         item.Quantity        = warehouseItem.Quantity;
         item.PriceTax        = warehouseItem.PriceTax;
         item.Amount          = warehouseItem.Quantity * warehouseItem.PriceTax;
         item.MadeIn          = warehouseItem.MadeIn;
         item.LinkWeb         = warehouseItem.LinkWeb;
         item.Material        = warehouseItem.Material;
         item.Component       = warehouseItem.Component;
         item.ComponentImage  = warehouseItem.ComponentImage;
         item.ProductTypeId   = warehouseItem.ProductTypeId;
         item.FlightCode      = warehouseItem.FlightCode;
         item.TrackingCode    = warehouseItem.TrackingCode;
         item.UpdatedAt       = DateTime.Now;
         item.UpdatedBy       = user.Staff.UserName;
         db.SaveChanges();
         return(Json(new { message = "Cập nhật dữ liệu thành công !", status = true }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json(new { message = "Cập nhật dữ liệu thất bại !", status = false }, JsonRequestBehavior.AllowGet));
     }
 }
示例#2
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            WareHouseSupplier Sup           = new WareHouseSupplier();
            WareHouseItem     wareHouseItem = new WareHouseItem();
            var ItemInfo      = db.Items.Where(S => S.Name == comboBox1.Text).FirstOrDefault();
            var supplierInfo  = db.Suppliers.Where(S => S.Name == comboBox2.Text).FirstOrDefault();
            var WareHouseInfo = db.WareHouses.Where(S => S.Name == comboBox3.Text).FirstOrDefault();


            Sup                       = db.WareHouseSuppliers.SingleOrDefault(s => s.id == Id);
            Sup.IdItem                = ItemInfo.ID;
            Sup.IdSupplier            = supplierInfo.Id;
            Sup.IdWareHouse           = WareHouseInfo.Id;
            wareHouseItem.IdWareHouse = WareHouseInfo.Id;
            wareHouseItem.Quantity    = int.Parse(TBQuantity.Text);
            wareHouseItem.IdItem      = ItemInfo.ID;
            Sup.Quantity              = int.Parse(TBQuantity.Text);
            Sup.LicenseNum            = int.Parse(TBPermitNUM.Text);
            Sup.LicenseDate           = LicenseDate.Value;


            db.SaveChanges();
            MessageBox.Show("Done");
            this.Close();

            _formPermission.ListOfSupplyPermission.DataSource = db.WareHouseSuppliers.Select(P => new { P.id, P.IdItem, P.IdSupplier, P.IdWareHouse, P.LicenseDate, P.LicenseNum, P.Quantity }).ToList();
        }
示例#3
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            WareHouseSupplier Sperm = new WareHouseSupplier();
            //|| CBCust.SelectedItem == null || CBItems.SelectedItem == null || CBStore.SelectedItem == null || CBSupplier.SelectedItem == null
            WareHouseItem store = new WareHouseItem();

            var itemInfo     = ENT.Items.Where(r => r.Name == (string)comboBox1.SelectedItem).SingleOrDefault();
            var supplierInfo = ENT.Suppliers.Where(r => r.Name == (string)comboBox2.SelectedItem).SingleOrDefault();
            var storeInfo    = ENT.WareHouses.Where(r => r.Name == (string)comboBox3.SelectedItem).SingleOrDefault();

            try
            {
                if (string.IsNullOrWhiteSpace(TBQuantity.Text) || string.IsNullOrWhiteSpace(TBPermitNUM.Text))
                {
                    MessageBox.Show("Please Complete empty Field");
                }

                else if (Convert.ToInt32(TBQuantity.Text) > itemInfo.Quantity)
                {
                    MessageBox.Show("this Quantity Greater than item Quantity");
                }


                else
                {
                    Sperm.IdItem      = itemInfo.ID;
                    Sperm.IdSupplier  = supplierInfo.Id;
                    Sperm.IdWareHouse = storeInfo.Id;

                    store.IdItem      = itemInfo.ID;
                    store.IdWareHouse = storeInfo.Id;

                    Sperm.LicenseDate = LicenseDate.Value; //permission date

                    store.Quantity = Convert.ToInt32(TBQuantity.Text);
                    Sperm.Quantity = Convert.ToInt32(TBQuantity.Text);
                    var quantity = itemInfo.Quantity - Convert.ToInt32(TBQuantity.Text);
                    itemInfo.Quantity = quantity;
                    Sperm.LicenseNum  = Convert.ToInt32(TBPermitNUM.Text);

                    ENT.WareHouseSuppliers.Add(Sperm);
                    ENT.WareHouseItems.Add(store);
                    ENT.SaveChanges();

                    MessageBox.Show("Done");
                    comboBox1.Items.Clear();
                    comboBox2.Items.Clear();
                    comboBox3.Items.Clear();
                    TBQuantity.Text  = string.Empty;
                    TBPermitNUM.Text = string.Empty;

                    ListOfSupplyPermission.DataSource = ENT.WareHouseSuppliers.Select(P => new { P.id, P.IdItem, P.IdSupplier, P.IdWareHouse, P.LicenseDate, P.LicenseNum, P.Quantity }).ToList();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Please Invalid Inputs");
            }
        }
示例#4
0
 //database
 public string CheckItem(WareHouseItem store)
 {
     if (store.NameEN == null)
     {
         store.NameEN = "";
     }
     if (store.NameJP == null)
     {
         store.NameJP = "";
     }
     if (store.JanCode != null && store.JanCode != "")
     {
         if (store.JanCode.StartsWith("4") == false)
         {
             return("item-deny");
         }
         else
         {
             if (store.JanCode.Length != 13)
             {
                 return("item-deny");
             }
         }
     }
     foreach (var item in keyJP.ToUpper().Split(','))
     {
         if (store.NameJP.ToUpper().Contains(item) || store.NameEN.ToUpper().Contains(item))
         {
             return("item-deny");
         }
     }
     foreach (var item in keyEN.ToUpper().Split(','))
     {
         if (store.NameEN.ToUpper().Contains(item) || store.NameJP.ToUpper().Contains(item))
         {
             return("item-deny");
         }
     }
     if (store.Quantity <= 0 || store.Quantity == null)
     {
         return("item-deny");
     }
     if (store.PriceTax <= 0 || store.PriceTax == null || store.PriceTax < 50)
     {
         return("item-deny");
     }
     if (store.LinkWeb == "" || store.LinkWeb == null)
     {
         return("item-deny");
     }
     if (store.ImageBase64 == "" || store.ImageBase64 == null)
     {
         return("item-deny");
     }
     return("");
 }
        private void button1_Click(object sender, EventArgs e)
        {
            var itemInfo      = db.Items.Where(r => r.Name == (string)CBItems.SelectedItem).SingleOrDefault();
            var supplierInfo  = db.Suppliers.Where(r => r.Name == (string)CBSupplier.SelectedItem).SingleOrDefault();
            var storeInfoFrom = db.WareHouses.Where(r => r.Name == (string)CBFrom.SelectedItem).SingleOrDefault();
            var storeInfoTo   = db.WareHouses.Where(r => r.Name == (string)CBTo.SelectedItem).SingleOrDefault();

            WareHouseItem     Item     = new WareHouseItem();
            WareHouseSupplier Supplier = new WareHouseSupplier();

            Item items = new Item();

            var wareHouseItems    = db.WareHouseItems.Where(r => r.IdWareHouse == storeInfoFrom.Id).SingleOrDefault();
            var wareHouseSupplier = db.WareHouseSuppliers.Where(r => r.IdWareHouse == storeInfoFrom.Id).SingleOrDefault();

            // items transfare
            wareHouseSupplier.IdItem = itemInfo.ID;
            wareHouseItems.IdItem    = itemInfo.ID;

            // Quantity Transfar
            wareHouseItems.Quantity    = Convert.ToInt32(TBQuntity.Text);
            wareHouseSupplier.Quantity = Convert.ToInt32(TBQuntity.Text);
            // supplier Transfare
            wareHouseSupplier.IdSupplier = supplierInfo.Id;
            // date
            wareHouseSupplier.LicenseDate = date.Value;
            // EXP
            items.EXP = Convert.ToInt32(TBEXP.Text);

            // store transfare
            wareHouseSupplier.IdWareHouse = storeInfoTo.Id;
            wareHouseItems.IdWareHouse    = storeInfoTo.Id;

            db.SaveChanges();
            MessageBox.Show("Done");
        }
示例#6
0
        public ActionResult Import(string fileName = "")
        {
            //upload file
            HttpPostedFileBase file = Request.Files[0];

            fileName = file.FileName.DoiTenFile();
            file.SaveAs(Server.MapPath("~/Uploads/Database/" + fileName));
            // Opening the Excel template...
            FileStream fs = new FileStream(Server.MapPath("~/Uploads/Database/" + fileName), FileMode.Open, FileAccess.Read);
            // Getting the complete workbook...
            ISheet sheet = null;

            if (fileName.Contains(".xlsx"))
            {
                XSSFWorkbook templateWorkbook = new XSSFWorkbook(Server.MapPath("~/Uploads/Database/" + fileName));
                sheet = templateWorkbook.GetSheet("例");
            }
            else if (fileName.Contains(".xls"))
            {
                HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs, true);
                sheet = templateWorkbook.GetSheet("例");
            }
            WebsiteHelpers websiteHelper = new WebsiteHelpers();
            //string namejp = "";
            string             jancode = "";
            double             orgprice;
            List <ProductItem> lst = new List <ProductItem>();

            for (int row = 8; row <= sheet.LastRowNum; row++)
            {   // Ignoring first row as headers.
                //namejp = sheet.GetRow(row).GetCell(1).StringCellValue;
                //if (namejp != "" && namejp != null && namejp.Trim().Length > 0)
                try
                {
                    jancode = (string)sheet.GetRow(row).GetCell(12).NumericCellValue.ToString();
                }
                catch (Exception)
                {
                    jancode = (string)sheet.GetRow(row).GetCell(12).StringCellValue.ToString();
                }
                if (jancode != "" && jancode != null && jancode.Trim().Length > 3)
                {
                    ProductItem p = new ProductItem();
                    p.JanCode            = jancode;
                    p.Link               = sheet.GetRow(row).GetCell(1).StringCellValue;
                    p.HSCode             = sheet.GetRow(row).GetCell(2).StringCellValue;
                    p.NameJP             = sheet.GetRow(row).GetCell(3).StringCellValue;
                    p.NameEN             = sheet.GetRow(row).GetCell(4).StringCellValue;
                    p.DescriptionOfGoods = sheet.GetRow(row).GetCell(5).StringCellValue;
                    p.Material           = sheet.GetRow(row).GetCell(6).StringCellValue;
                    p.MadeIn             = sheet.GetRow(row).GetCell(14).StringCellValue;
                    try
                    {
                        orgprice = sheet.GetRow(row).GetCell(7).NumericCellValue;
                    }
                    catch (Exception)
                    {
                        orgprice = Convert.ToDouble(sheet.GetRow(row).GetCell(7).StringCellValue.ToString().Replace(@"\d", ""));
                    }

                    p.Price = orgprice;

                    //p.NameJP = namejp;
                    //p.NameEN = sheet.GetRow(row).GetCell(2).StringCellValue;
                    //p.CategoryName = sheet.GetRow(row).GetCell(3).StringCellValue;
                    //p.Link = sheet.GetRow(row).GetCell(4).StringCellValue;
                    //p.Price = sheet.GetRow(row).GetCell(5).NumericCellValue;
                    //try
                    //{
                    //    string ImageUrl = websiteHelper.GetImage(p.Link);
                    //    p.ImageUrl = ImageUrl;
                    //    p.ImageBase64 = ImageUtils.Images(ImageUrl);
                    //}
                    //catch { }
                    //p.ShippingMark = sheet.GetRow(row).GetCell(6).StringCellValue;
                    //try
                    //{
                    //    p.JanCode = sheet.GetRow(row).GetCell(7).NumericCellValue + "";
                    //}
                    //catch
                    //{
                    //    p.JanCode = sheet.GetRow(row).GetCell(7) == null ? "" : sheet.GetRow(row).GetCell(7).StringCellValue;
                    //}
                    //p.Quantity = (int)sheet.GetRow(row).GetCell(8).NumericCellValue;
                    //p.MadeIn = sheet.GetRow(row).GetCell(9).StringCellValue;
                    //try
                    //{
                    //    p.Note1 = sheet.GetRow(row).GetCell(10).NumericCellValue + "";
                    //}
                    //catch
                    //{
                    //    p.Note1 = sheet.GetRow(row).GetCell(10).StringCellValue;
                    //}
                    //try
                    //{
                    //    p.Note2 = sheet.GetRow(row).GetCell(11).NumericCellValue + "";
                    //}
                    //catch
                    //{
                    //    p.Note2 = sheet.GetRow(row).GetCell(11).StringCellValue;
                    //}
                    //p.Amount = sheet.GetRow(row).GetCell(12).NumericCellValue;
                    if (lst.Where(n => n.JanCode == p.JanCode).Count() == 0)
                    {
                        lst.Add(p);
                    }
                    else
                    {
                        if (p.Price > 0)
                        {
                            lst.Single(n => n.JanCode == p.JanCode).Price = p.Price > lst.Single(n => n.JanCode == p.JanCode).Price ? (lst.Single(n => n.JanCode == p.JanCode).Price > 0? lst.Single(n => n.JanCode == p.JanCode).Price:p.Price) : p.Price;
                        }
                    }
                }
            }
            foreach (var item in lst)
            {
                try
                {
                    var itemOld = db.WareHouseItems.Single(n => n.JanCode == item.JanCode);
                    if (item.Price > 0)
                    {
                        itemOld.PriceTax = item.Price > itemOld.PriceTax ? (itemOld.PriceTax > 0? itemOld.PriceTax:item.Price) : item.Price;
                    }
                    if (itemOld.MadeIn == "" || itemOld.MadeIn == null)
                    {
                        itemOld.MadeIn = getMadeIn(item.MadeIn).Id + "";
                    }
                }
                catch
                {
                    WareHouseItem warehouse = new WareHouseItem()
                    {
                        Id                 = Guid.NewGuid(),
                        JanCode            = item.JanCode,
                        LinkWeb            = item.Link,
                        HSCode             = item.HSCode,
                        NameJP             = item.NameJP,
                        NameEN             = item.NameEN,
                        DescriptionOfGoods = item.DescriptionOfGoods,
                        Material           = item.Material,
                        PriceTax           = item.Price,
                        ProductCode        = item.JanCode,
                        MadeIn             = getMadeIn(item.MadeIn).Id + "",
                        CreatedAt          = DateTime.Now,
                        CreatedBy          = user.Staff.UserName,
                        UpdatedAt          = DateTime.Now,
                        UpdatedBy          = user.Staff.UserName,
                        ProductTypeId      = 1,
                        IsDeny             = false

                                             //Amount = item.Amount,
                                             //CategoryId = getCategory(item.CategoryName).Id,
                                             //CategoryName = item.CategoryName,
                                             //CreatedAt = DateTime.Now,
                                             //CreatedBy = user.Staff.UserName,
                                             //Id = Guid.NewGuid(),
                                             //Image = item.ImageUrl,
                                             //JanCode = item.JanCode,
                                             //LinkWeb = item.Link,
                                             //ImageBase64 = item.ImageBase64,
                                             //Component = "",
                                             //ComponentImage = "",
                                             //MadeIn = getMadeIn(item.MadeIn).Id + "",
                                             //Material = item.Note1,
                                             //NameEN = item.NameEN,
                                             //NameJP = item.NameJP,
                                             //Notes = item.Note1,
                                             //PriceTax = item.Price,
                                             //ProductCode = item.JanCode,
                                             //Quantity = item.Quantity,
                                             //UpdatedAt = DateTime.Now,
                                             //UpdatedBy = user.Staff.UserName,
                                             //ProductTypeId = 1,
                                             //IsDeny = false
                    };
                    db.WareHouseItems.Add(warehouse);
                }
            }

            db.SaveChanges();
            Session["Database"] = "Bar";
            return(View(lst));
            //return Redirect("/Database");
        }
示例#7
0
        public ActionResult Add(WareHouseItem warehouseItem)
        {
            var lstCateSearch = db.WareHouseCategories.Select(n => new SelectListItem()
            {
                Text = n.NameEN, Value = n.Id + ""
            }).ToList();

            warehouseItem.CreatedAt = warehouseItem.UpdatedAt = DateTime.Now;
            warehouseItem.CreatedBy = warehouseItem.UpdatedBy = user.Staff.UserName;
            warehouseItem.CreatedBy = warehouseItem.UpdatedBy = user.Staff.UserName;
            warehouseItem.IsDeny    = false;

            if (warehouseItem.CategoryId != 0)
            {
                warehouseItem.CategoryName = lstCateSearch.Where(n => n.Value.Equals(warehouseItem.CategoryId.ToString())).First().Text;
            }
            else
            {
                warehouseItem.CategoryId   = null;
                warehouseItem.CategoryName = null;
            }

            if (warehouseItem.MadeIn.Equals("0"))
            {
                warehouseItem.MadeIn = null;
            }

            if (warehouseItem.Quantity < 0)
            {
                warehouseItem.Quantity = 0;
            }

            if (warehouseItem.PriceTax < 0)
            {
                warehouseItem.PriceTax = 0;
            }

            if (warehouseItem.Quantity != null && warehouseItem.PriceTax != null)
            {
                warehouseItem.Amount = warehouseItem.Quantity * warehouseItem.PriceTax;
            }
            else
            {
                warehouseItem.Amount = 0;
            }

            if (ModelState.IsValid)
            {
                try
                {
                    warehouseItem.Id = Guid.NewGuid();
                    db.WareHouseItems.Add(warehouseItem);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return(Json(warehouseItem, JsonRequestBehavior.AllowGet));
        }
示例#8
0
        public void SearchAndSave(SearchProductInfo item, string ItemCode, int SearchQuantity = 1, Guid?StoregeJPId = null)
        {
            StorageItemJP model = new StorageItemJP()
            {
                Amount       = item.PriceTax * SearchQuantity,
                CategoryId   = item.CategoryId,
                CategoryName = item.CategoryName,
                CreatedAt    = DateTime.Now,
                CreatedBy    = user.Staff.UserName,
                Id           = Guid.NewGuid(),
                Image        = item.Image,
                JanCode      = item.JanCode,
                LinkWeb      = item.LinkWeb,
                MadeIn       = "JAPAN",
                Material     = item.Material,
                NameEN       = item.NameEN,
                NameJP       = item.NameJP,
                Notes        = item.Notes,
                PriceTax     = item.PriceTax,
                ProductCode  = item.ProductCode,
                Quantity     = SearchQuantity,
                StatusId     = 1,
                StoregeJPId  = StoregeJPId,
                UpdatedAt    = DateTime.Now,
                UpdatedBy    = user.Staff.UserName
            };

            if (db.StorageItemJPs.Where(n => n.ProductCode == model.ProductCode && n.StoregeJPId == StoregeJPId).Count() == 0)
            {
                db.StorageItemJPs.Add(model);
            }

            WareHouseItem items = new WareHouseItem()
            {
                Amount       = item.PriceTax * SearchQuantity,
                CategoryId   = item.CategoryId,
                CategoryName = item.CategoryName,
                CreatedAt    = DateTime.Now,
                CreatedBy    = user.Staff.UserName,
                Id           = Guid.NewGuid(),
                Image        = item.Image,
                JanCode      = item.JanCode,
                LinkWeb      = item.LinkWeb,
                MadeIn       = "JAPAN",
                Material     = item.Material,
                NameEN       = item.NameEN,
                NameJP       = item.NameJP,
                Notes        = item.Notes,
                PriceTax     = item.PriceTax,
                ProductCode  = item.ProductCode,
                Quantity     = SearchQuantity,
                UpdatedAt    = DateTime.Now,
                UpdatedBy    = user.Staff.UserName
            };

            if (db.WareHouseItems.Where(n => n.ProductCode == model.ProductCode).Count() == 0)
            {
                db.WareHouseItems.Add(items);
            }
            db.SaveChanges();
        }
示例#9
0
        static void Main1(string[] args)
        {
            string[] fileArray = Directory.GetFiles(@"C:\FILES\");
            foreach (var itemFile in fileArray)
            {
                try
                {
                    // Opening the Excel template...
                    FileStream fs = new FileStream(itemFile, FileMode.Open, FileAccess.Read);
                    // Getting the complete workbook...
                    ISheet sheet     = null;
                    string flighCode = "";
                    if (itemFile.Contains(".xlsx"))
                    {
                        XSSFWorkbook templateWorkbook = new XSSFWorkbook(itemFile);
                        sheet     = templateWorkbook.GetSheet("INVOICE");
                        flighCode = templateWorkbook.GetSheet("INFO").GetRow(4).Cells[8].StringCellValue.Trim();
                    }
                    else if (itemFile.Contains(".xls"))
                    {
                        HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs, true);
                        sheet     = templateWorkbook.GetSheet("INVOICE");
                        flighCode = templateWorkbook.GetSheet("INFO").GetRow(4).Cells[8].StringCellValue.Trim();
                    }
                    WebsiteHelpers     websiteHelper = new WebsiteHelpers();
                    string             namejp        = "";
                    List <ProductItem> lst           = new List <ProductItem>();
                    for (int row = 11; row <= sheet.LastRowNum; row++)
                    { // Ignoring first row as headers.
                        namejp = sheet.GetRow(row).GetCell(1).StringCellValue;
                        if (namejp != "" && namejp != null && namejp.Trim().Length > 0)
                        {
                            ProductItem p = new ProductItem();
                            p.NameJP       = namejp;
                            p.NameEN       = sheet.GetRow(row).GetCell(2).StringCellValue;
                            p.CategoryName = sheet.GetRow(row).GetCell(3).StringCellValue;
                            p.Link         = sheet.GetRow(row).GetCell(4).StringCellValue;
                            p.Price        = sheet.GetRow(row).GetCell(5).NumericCellValue;
                            try
                            {
                                string ImageUrl = websiteHelper.GetImage(p.Link);
                                p.ImageUrl    = ImageUrl;
                                p.ImageBase64 = ImageUtils.Images(ImageUrl);
                            }
                            catch { }
                            p.ShippingMark = sheet.GetRow(row).GetCell(6).StringCellValue;
                            try
                            {
                                p.JanCode = sheet.GetRow(row).GetCell(7).NumericCellValue + "";
                            }
                            catch
                            {
                                p.JanCode = sheet.GetRow(row).GetCell(7) == null ? "" : sheet.GetRow(row).GetCell(7).StringCellValue;
                            }
                            p.Quantity = (int)sheet.GetRow(row).GetCell(8).NumericCellValue;
                            p.MadeIn   = sheet.GetRow(row).GetCell(9).StringCellValue;
                            try
                            {
                                p.Note1 = sheet.GetRow(row).GetCell(10).NumericCellValue + "";
                            }
                            catch
                            {
                                p.Note1 = sheet.GetRow(row).GetCell(10).StringCellValue;
                            }
                            try
                            {
                                p.Note2 = sheet.GetRow(row).GetCell(11).NumericCellValue + "";
                            }
                            catch
                            {
                                p.Note2 = sheet.GetRow(row).GetCell(11).StringCellValue;
                            }
                            p.Amount = sheet.GetRow(row).GetCell(12).NumericCellValue;
                            lst.Add(p);
                        }
                    }
                    foreach (var item in lst)
                    {
                        WareHouseItem warehouse = new WareHouseItem()
                        {
                            Amount         = item.Amount,
                            CategoryId     = getCategory(item.CategoryName).Id,
                            CategoryName   = item.CategoryName,
                            CreatedAt      = DateTime.Now,
                            CreatedBy      = "blf",
                            Id             = Guid.NewGuid(),
                            Image          = item.ImageUrl,
                            JanCode        = item.JanCode,
                            LinkWeb        = item.Link,
                            ImageBase64    = item.ImageBase64,
                            Component      = "",
                            ComponentImage = "",
                            MadeIn         = getMadeIn(item.MadeIn).Id + "",
                            Material       = item.Note1,
                            NameEN         = item.NameEN,
                            NameJP         = item.NameJP,
                            Notes          = item.Note1,
                            PriceTax       = item.Price,
                            ProductCode    = item.JanCode,
                            Quantity       = item.Quantity,
                            UpdatedAt      = DateTime.Now,
                            UpdatedBy      = "blf",
                            ProductTypeId  = 1,
                            IsDeny         = false,
                            FlightCode     = flighCode
                        };
                        db.WareHouseItems.Add(warehouse);
                    }

                    db.SaveChanges();
                }
                catch { }
            }
            Console.WriteLine("finished");
            Console.ReadLine();
        }