Exemplo n.º 1
0
 public string CheckMadeIn(StorageItemJP store)
 {
     if (store.MadeIn == null || store.MadeIn == "")
     {
         return("item-deny");
     }
     return("");
 }
Exemplo n.º 2
0
 public string CheckQuantity(StorageItemJP store)
 {
     if (store.Quantity <= 0 || store.Quantity == null)
     {
         return("item-deny");
     }
     return("");
 }
Exemplo n.º 3
0
 public string CheckCategory(StorageItemJP store)
 {
     if (store.CategoryId == null)
     {
         return("item-deny");
     }
     return("");
 }
Exemplo n.º 4
0
 public string CheckPriceTax(StorageItemJP store)
 {
     if (store.PriceTax <= 0 || store.PriceTax == null || store.PriceTax < 50)
     {
         return("item-deny");
     }
     return("");
 }
Exemplo n.º 5
0
 public string CheckImageBase64(StorageItemJP store)
 {
     if (store.ImageBase64 == "" || store.ImageBase64 == null)
     {
         return("item-deny");
     }
     return("");
 }
Exemplo n.º 6
0
 public string CheckLinkWeb(StorageItemJP store)
 {
     if (store.LinkWeb == "" || store.LinkWeb == null)
     {
         return("item-deny");
     }
     return("");
 }
Exemplo n.º 7
0
 //Luu kho
 public string CheckItem(StorageItemJP store)
 {
     if (store.NameEN == null || store.NameEN == "")
     {
         return("item-deny");
     }
     if (store.NameJP == null || store.NameJP == "")
     {
         return("item-deny");
     }
     if (store.JanCode == "" || store.JanCode == null)
     {
         return("item-deny");
     }
     if (store.JanCode.StartsWith("4") == false)
     {
         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("");
 }
Exemplo n.º 8
0
 public string CheckNameEN(StorageItemJP store)
 {
     if (store.NameEN == null || store.NameEN == "")
     {
         return("item-deny");
     }
     else
     {
         foreach (var item in keyEN.ToUpper().Split(','))
         {
             if (store.NameEN.ToUpper().Contains(item))
             {
                 return("item-deny");
             }
         }
     }
     return("");
 }
Exemplo n.º 9
0
        public void getOtherProductsDetail(string ItemCode, int SearchQuantity = 1, Guid?StoregeJPId = null)
        {
            try
            {
                StorageItemJP model = new StorageItemJP()
                {
                    CreatedAt   = DateTime.Now,
                    ProductCode = ItemCode, JanCode = ItemCode,
                    CreatedBy   = user.Staff.UserName,
                    Id          = Guid.NewGuid(),
                    Quantity    = SearchQuantity,
                    StatusId    = 1,
                    StoregeJPId = StoregeJPId,
                    UpdatedAt   = DateTime.Now,
                    UpdatedBy   = user.Staff.UserName
                };
                db.StorageItemJPs.Add(model);

                db.SaveChanges();
            }
            catch (Exception ex) { throw new Exception(ex.Message, ex); }
        }
Exemplo n.º 10
0
 public void Reseach(string SearchCode, int SearchQuantity, Guid StoregeJPId)
 {
     try
     {
         try
         {
             var item = db.WareHouseItems.First(n => n.ProductCode == SearchCode);
             #region create model
             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       = item.MadeIn,
                 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
             };
             #endregion
             db.StorageItemJPs.Add(model);
             db.SaveChanges();
         }
         catch
         {
             #region Research Product Internet
             //rakuten
             try { getRakutenProductsDetail(SearchCode, SearchQuantity, StoregeJPId); }
             catch
             {
                 //amazon
                 try { getAmazonJPProductsDetail(SearchCode, SearchQuantity, StoregeJPId); }
                 catch
                 {
                     //yahoo shopping
                     try { getYahooShoppingProductsDetail(SearchCode, SearchQuantity, StoregeJPId); }
                     catch
                     {
                         //Uniqlo
                         try { getUniqloProductsDetail(SearchCode, SearchQuantity, StoregeJPId); }
                         catch
                         {
                             //yahoo Auction
                             try { getYahooAuctionProductsDetail(SearchCode, SearchQuantity, StoregeJPId); }
                             catch
                             {
                                 getOtherProductsDetail(SearchCode, SearchQuantity, StoregeJPId);
                             }
                         }
                     }
                 }
             }
             #endregion
         }
     }
     catch (Exception ex) { throw new Exception(ex.Message, ex); }
 }
Exemplo n.º 11
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();
        }
Exemplo n.º 12
0
        public ActionResult StorageJPFull(string fileName = "")
        {
            //upload file
            HttpPostedFileBase file = Request.Files[0];

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

            if (fileName.Contains(".xlsx"))
            {
                XSSFWorkbook templateWorkbook = new XSSFWorkbook(Server.MapPath("~/Uploads/StorageJP/" + fileName));
                sheet = templateWorkbook.GetSheet("例");
            }
            else if (fileName.Contains(".xls"))
            {
                HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs, true);
                sheet = templateWorkbook.GetSheet("例");
            }
            //read excel
            WebsiteHelpers        websiteHelper     = new WebsiteHelpers();
            List <StorageJP>      lstStorageJP      = new List <StorageJP>();
            List <StorageItemJP>  lstStorageItemJP  = new List <StorageItemJP>();
            List <TrackingDetail> lstTrackingDetail = new List <TrackingDetail>();
            Guid IdTracking = Guid.NewGuid();

            #region read excel

            //check column
            string nameJP       = "";
            string trackingCode = "";
            string urlReport    = ConfigurationManager.AppSettings["url_report_storejp"];
            Guid   storeId      = Guid.NewGuid();
            for (int row = 3; row <= sheet.LastRowNum; row++)
            {
                nameJP       = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Tên Hàng Jp(*)")).StringCellValue;
                trackingCode = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Mã Tracking(*)")).StringCellValue;
                if (nameJP == "" && trackingCode == "")
                {
                    break;
                }
                if (trackingCode != "" && trackingCode != null)
                {
                    IdTracking = Guid.NewGuid();
                    string size = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Size")).StringCellValue;
                    size = size.Replace("cm", "").Trim();
                    double sizeInput = double.Parse(size) / 3;
                    sizeInput = sizeInput - Math.Round(sizeInput / 3);
                    double   dai    = double.Parse(size) - 2 * sizeInput;
                    DateTime revice = new DateTime();
                    try
                    {
                        revice = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Ngày nhận")).DateCellValue;
                    }
                    catch {
                        try
                        {
                            revice = DateTime.ParseExact(sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Ngày nhận")).StringCellValue, "yyyy-MM-dd", null);
                        }
                        catch { }
                    }
                    if (lstStorageJP.Where(n => n.TrackingCode == trackingCode.Trim()).Count() == 0)
                    {
                        storeId = Guid.NewGuid();
                        StorageJP store = new Models.StorageJP()
                        {
                            Id              = storeId,
                            AgencyId        = user.Agency.Id,
                            CreatedAt       = DateTime.Now,
                            CreatedBy       = user.Staff.UserName,
                            DeliveryAddress = "",
                            StatusId        = 6,
                            TrackingCode    = trackingCode.Trim(),
                            ReceivedDate    = revice,
                            Size            = "size-input",
                            SizeInput       = dai + " " + sizeInput + " " + sizeInput,
                            Notes           = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Ghi chú")).StringCellValue,
                            ReceivedHour    = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Giờ nhận")).StringCellValue,
                            Weigh           = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Số Kg")).NumericCellValue
                        };
                        lstStorageJP.Add(store);
                    }
                    TrackingDetail detail = new TrackingDetail()
                    {
                        CreatedAt       = DateTime.Now,
                        CreatedBy       = user.Staff.UserName,
                        Id              = IdTracking,
                        StoregeJPId     = storeId,
                        UpdatedAt       = DateTime.Now,
                        UpdatedBy       = user.Staff.UserName,
                        TrackingSubCode = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Mã Tách Kiện(*)")).StringCellValue
                    };
                    lstTrackingDetail.Add(detail);
                }
                else
                {
                    double price = 0;
                    try
                    {
                        price = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Giá(*)")).NumericCellValue;
                    }
                    catch { }
                    string        namejp      = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Tên Hàng Jp(*)")).StringCellValue;
                    string        nameen      = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Tên Hàng En")).StringCellValue;
                    string        linkweb     = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Weblink")).StringCellValue;
                    string        Image       = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Hình ảnh")).StringCellValue;
                    string        base64Image = "";
                    StorageItemJP storejpItem = new StorageItemJP()
                    {
                        Amount           = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Thành tiền")).NumericCellValue,
                        CategoryId       = getCategory(sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Loại Hàng")).StringCellValue).Id,
                        CategoryName     = getCategory(sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Loại Hàng")).StringCellValue).Name,
                        Component        = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Thành Phần")).StringCellValue,
                        Id               = Guid.NewGuid(),
                        CreatedAt        = DateTime.Now,
                        CreatedBy        = user.Staff.UserName,
                        ImageBase64      = base64Image,
                        Image            = Image,
                        ImageLinkWeb     = Image,
                        JanCode          = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Jan Code")).StringCellValue,
                        Material         = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Chất liệu")).StringCellValue,
                        LinkWeb          = linkweb,
                        MadeIn           = getMadeIn(sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Xuất xứ(*)")).StringCellValue).Id + "",
                        NameEN           = nameen,
                        NameJP           = namejp,
                        PriceTax         = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Giá(*)")).NumericCellValue,
                        ProductCode      = "",
                        Quantity         = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Số Lượng(*)")).NumericCellValue,
                        UpdatedAt        = DateTime.Now,
                        StoregeJPId      = storeId,
                        UpdatedBy        = user.Staff.UserName,
                        TrackingDetailId = IdTracking
                    };
                    lstStorageItemJP.Add(storejpItem);
                }
            }
            #endregion

            //delete all data form db
            var stores = db.StorageJPs.Where(n => n.AgencyId == user.Agency.Id);
            foreach (var items in stores)
            {
                if (PageUtils.Status(items.Id).Value == "1")
                {
                    var details = items.TrackingDetails.ToList();
                    foreach (var item in details)
                    {
                        var storeItems = item.StorageItemJPs.ToList();
                        foreach (var st in storeItems)
                        {
                            db.StorageItemJPs.Remove(st);
                        }
                        db.TrackingDetails.Remove(item);
                    }
                    db.StorageJPs.Remove(items);
                }
            }
            db.SaveChanges();
            //Insert database
            foreach (var items in lstStorageJP)
            {
                db.StorageJPs.Add(items);
                var details = lstTrackingDetail.Where(n => n.StoregeJPId == items.Id);
                foreach (var item in details)
                {
                    db.TrackingDetails.Add(item);
                    var itemstores = lstStorageItemJP.Where(n => n.TrackingDetailId == item.Id);
                    foreach (var store in itemstores)
                    {
                        db.StorageItemJPs.Add(store);
                    }
                }
            }
            db.SaveChanges();
            return(View());
        }
Exemplo n.º 13
0
        public ActionResult StorageJP(Guid id, string fileName = "")
        {
            var StorageJP = db.StorageJPs.Find(id);
            //upload file
            HttpPostedFileBase file = Request.Files[0];

            fileName = file.FileName.DoiTenFile();
            file.SaveAs(Server.MapPath("~/Uploads/StorageJP/" + fileName));
            //read file

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

            if (fileName.Contains(".xlsx"))
            {
                XSSFWorkbook templateWorkbook = new XSSFWorkbook(Server.MapPath("~/Uploads/StorageJP/" + fileName));
                sheet = templateWorkbook.GetSheet("例");
            }
            else if (fileName.Contains(".xls"))
            {
                HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs, true);
                sheet = templateWorkbook.GetSheet("例");
            }
            //read excel
            WebsiteHelpers        websiteHelper     = new WebsiteHelpers();
            List <StorageItemJP>  lstStorageItemJP  = new List <StorageItemJP>();
            List <TrackingDetail> lstTrackingDetail = new List <TrackingDetail>();
            Guid IdTracking = Guid.NewGuid();

            #region read excel

            //check column

            string urlReport = ConfigurationManager.AppSettings["url_report_storejp"];
            for (int row = 4; row <= sheet.LastRowNum; row++)
            {
                double price = 0;
                try
                {
                    price = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "GIA")).NumericCellValue;
                }
                catch (Exception ex) {  }
                string subcode = "";
                try
                {
                    subcode = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "SO KIEN")).StringCellValue;
                    try
                    {
                        subcode = int.Parse(subcode).ToString("00");
                    }
                    catch (Exception ex) { }
                }
                catch (Exception ex) { subcode = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "SO KIEN")).NumericCellValue.ToString("00"); }
                if (price == 0 && subcode != "")
                {
                    IdTracking = Guid.NewGuid();
                    TrackingDetail detail = new TrackingDetail()
                    {
                        CreatedAt       = DateTime.Now,
                        CreatedBy       = user.Staff.UserName,
                        Id              = IdTracking,
                        StoregeJPId     = StorageJP.Id,
                        Weigh           = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "KG")).NumericCellValue,
                        UpdatedAt       = DateTime.Now,
                        UpdatedBy       = user.Staff.UserName,
                        StatusId        = StorageJP.StatusId,
                        TrackingSubCode = subcode
                    };
                    lstTrackingDetail.Add(detail);
                }
                else if (price != 0)
                {
                    string namejp = "";
                    string linkweb = ""; string ImageUrl = "";
                    string ImageBase64 = null;
                    try
                    {
                        namejp  = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "TEN HANG_JP")).CellFormula;
                        namejp  = namejp.Replace("HYPERLINK(", "").Replace(")", "").Replace("\"", "");
                        linkweb = namejp.Split(',')[0];
                        namejp  = namejp.Split(',')[1];
                    }
                    catch (Exception ex)
                    {
                        namejp  = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "TEN HANG_JP")).StringCellValue;
                        linkweb = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "WEBLINK")).StringCellValue;
                    }
                    if (linkweb.ToLower().Contains(urlReport.ToLower()))
                    {
                        string idItem = linkweb.Split('/')[linkweb.Split('/').Length - 1];
                        try
                        {
                            var item = db.StorageItemJPs.Find(Guid.Parse(idItem));
                            ImageBase64 = item.ImageBase64;
                            linkweb     = item.LinkWeb;
                            ImageUrl    = item.ImageLinkWeb;
                        }
                        catch (Exception ex) { }
                    }
                    else
                    {
                        try
                        {
                            ImageUrl    = websiteHelper.GetImage(linkweb);
                            ImageBase64 = ImageUtils.Images(ImageUrl);
                        }
                        catch (Exception ex) { }
                    }
                    string component = "", material = "", JanCode = "";
                    try
                    {
                        component = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "THANH PHAN")).StringCellValue;
                    }
                    catch (Exception ex) { }
                    try
                    {
                        material = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "CHAT LIEU")).StringCellValue;
                    }
                    catch (Exception ex) { }
                    try
                    {
                        JanCode = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Jancode,mavach")).StringCellValue;
                    }
                    catch (Exception ex) { JanCode = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "Jancode,mavach")).NumericCellValue + ""; }
                    StorageItemJP storejpItem = new StorageItemJP()
                    {
                        Amount           = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "THANH TIEN")).NumericCellValue,
                        CategoryId       = getCategory(sheet.GetRow(row).GetCell(getIndexColumn(sheet, "LOAI HANG")).StringCellValue).Id,
                        CategoryName     = getCategory(sheet.GetRow(row).GetCell(getIndexColumn(sheet, "LOAI HANG")).StringCellValue).Name,
                        Component        = component,
                        Id               = Guid.NewGuid(),
                        CreatedAt        = DateTime.Now,
                        CreatedBy        = user.Staff.UserName,
                        ImageBase64      = ImageBase64,
                        ImageLinkWeb     = ImageUrl,
                        JanCode          = JanCode,
                        Material         = material,
                        LinkWeb          = linkweb,
                        MadeIn           = getMadeIn(sheet.GetRow(row).GetCell(getIndexColumn(sheet, "XUAT XU")).StringCellValue).Id + "",
                        NameEN           = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "TEN HANG_EN")).StringCellValue,
                        NameJP           = namejp,
                        PriceTax         = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "GIA")).NumericCellValue,
                        ProductCode      = "",
                        Quantity         = sheet.GetRow(row).GetCell(getIndexColumn(sheet, "SO LUONG")).NumericCellValue,
                        UpdatedAt        = DateTime.Now,
                        StoregeJPId      = StorageJP.Id,
                        UpdatedBy        = user.Staff.UserName,
                        TrackingDetailId = IdTracking
                    };
                    lstStorageItemJP.Add(storejpItem);
                }
            }
            #endregion

            //delete all data form db
            var details = StorageJP.TrackingDetails.ToList();
            foreach (var item in details)
            {
                var stores = item.StorageItemJPs.ToList();
                foreach (var st in stores)
                {
                    db.StorageItemJPs.Remove(st);
                }
                db.TrackingDetails.Remove(item);
            }
            //Insert database
            foreach (var item in lstTrackingDetail)
            {
                db.TrackingDetails.Add(item);
                foreach (var store in lstStorageItemJP.Where(n => n.TrackingDetailId == item.Id))
                {
                    db.StorageItemJPs.Add(store); db.SaveChanges();
                }
            }
            db.SaveChanges();
            return(View());
        }
Exemplo n.º 14
0
        public int CheckItemCountOneColumn(StorageItemJP store, string type = "nameen")
        {
            int i = 0;

            switch (type)
            {
            case "namejp":
            {
                if (store.NameJP == null || store.NameJP == "")
                {
                    i += 1;
                }
                else
                {
                    foreach (var item in keyJP.ToUpper().Split(','))
                    {
                        if (store.NameJP.ToUpper().Contains(item))
                        {
                            i += 1; break;
                        }
                    }
                }
                break;
            }

            case "nameen":
            {
                if (store.NameEN == null || store.NameEN == "")
                {
                    i += 1;
                }
                else
                {
                    foreach (var item in keyJP.ToUpper().Split(','))
                    {
                        if (store.NameEN.ToUpper().Contains(item))
                        {
                            i += 1; break;
                        }
                    }
                }
                break;
            }

            case "category":
            {
                if (store.CategoryId == null)
                {
                    return(i += 1);
                }
                break;
            }

            case "image":
            {
                if (store.ImageBase64 == "" || store.ImageBase64 == null)
                {
                    return(i += 1);
                }
                break;
            }

            case "jancode":
            {
                if (store.JanCode != null && store.JanCode != "")
                {
                    if (store.JanCode.StartsWith("4") == false)
                    {
                        i += 1;
                    }
                    else
                    {
                        if (store.JanCode.Length != 13)
                        {
                            i += 1;
                        }
                        else
                        {
                            if (store.MadeIn != null && store.MadeIn == "108")
                            {
                                if (store.JanCode.StartsWith("450") == false)
                                {
                                    if (store.JanCode.StartsWith("451") == false)
                                    {
                                        if (store.JanCode.StartsWith("452") == false)
                                        {
                                            if (store.JanCode.StartsWith("453") == false)
                                            {
                                                if (store.JanCode.StartsWith("454") == false)
                                                {
                                                    if (store.JanCode.StartsWith("455") == false)
                                                    {
                                                        if (store.JanCode.StartsWith("456") == false)
                                                        {
                                                            if (store.JanCode.StartsWith("457") == false)
                                                            {
                                                                if (store.JanCode.StartsWith("458") == false)
                                                                {
                                                                    if (store.JanCode.StartsWith("459") == false)
                                                                    {
                                                                        if (store.JanCode.StartsWith("490") == false)
                                                                        {
                                                                            if (store.JanCode.StartsWith("491") == false)
                                                                            {
                                                                                if (store.JanCode.StartsWith("492") == false)
                                                                                {
                                                                                    if (store.JanCode.StartsWith("493") == false)
                                                                                    {
                                                                                        if (store.JanCode.StartsWith("494") == false)
                                                                                        {
                                                                                            if (store.JanCode.StartsWith("495") == false)
                                                                                            {
                                                                                                if (store.JanCode.StartsWith("496") == false)
                                                                                                {
                                                                                                    if (store.JanCode.StartsWith("497") == false)
                                                                                                    {
                                                                                                        if (store.JanCode.StartsWith("498") == false)
                                                                                                        {
                                                                                                            if (store.JanCode.StartsWith("499") == false)
                                                                                                            {
                                                                                                                i += 1;
                                                                                                            }
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            }

            case "quantity":
            {
                if (store.Quantity <= 0 || store.Quantity == null)
                {
                    i += 1;
                }
                break;
            }

            case "price":
            {
                if (store.PriceTax <= 0 || store.PriceTax == null || store.PriceTax < 50)
                {
                    i += 1;
                }
                break;
            }

            case "linkweb":
            {
                if (store.LinkWeb == "" || store.LinkWeb == null)
                {
                    return(i += 1);
                }
                break;
            }

            case "madein":
            {
                if (store.MadeIn == null || store.MadeIn == "")
                {
                    return(i += 1);
                }
                break;
            }
            }
            return(i);
        }
Exemplo n.º 15
0
 public string CheckJanCode(StorageItemJP store)
 {
     if (store.JanCode != null && store.JanCode != "")
     {
         if (store.JanCode.StartsWith("4") == false)
         {
             return("item-deny");
         }
         else
         {
             if (store.JanCode.Length != 13)
             {
                 return("item-deny");
             }
             else
             {
                 if (store.MadeIn != null && store.MadeIn == "108")
                 {
                     if (store.JanCode.StartsWith("450") == false)
                     {
                         if (store.JanCode.StartsWith("451") == false)
                         {
                             if (store.JanCode.StartsWith("452") == false)
                             {
                                 if (store.JanCode.StartsWith("453") == false)
                                 {
                                     if (store.JanCode.StartsWith("454") == false)
                                     {
                                         if (store.JanCode.StartsWith("455") == false)
                                         {
                                             if (store.JanCode.StartsWith("456") == false)
                                             {
                                                 if (store.JanCode.StartsWith("457") == false)
                                                 {
                                                     if (store.JanCode.StartsWith("458") == false)
                                                     {
                                                         if (store.JanCode.StartsWith("459") == false)
                                                         {
                                                             if (store.JanCode.StartsWith("490") == false)
                                                             {
                                                                 if (store.JanCode.StartsWith("491") == false)
                                                                 {
                                                                     if (store.JanCode.StartsWith("492") == false)
                                                                     {
                                                                         if (store.JanCode.StartsWith("493") == false)
                                                                         {
                                                                             if (store.JanCode.StartsWith("494") == false)
                                                                             {
                                                                                 if (store.JanCode.StartsWith("495") == false)
                                                                                 {
                                                                                     if (store.JanCode.StartsWith("496") == false)
                                                                                     {
                                                                                         if (store.JanCode.StartsWith("497") == false)
                                                                                         {
                                                                                             if (store.JanCode.StartsWith("498") == false)
                                                                                             {
                                                                                                 if (store.JanCode.StartsWith("499") == false)
                                                                                                 {
                                                                                                     return("item-deny");
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return("");
 }
Exemplo n.º 16
0
        public int CheckItemCount(StorageItemJP store)
        {
            int i = 0;

            if (store.NameEN == null)
            {
                store.NameEN = "";
            }

            if (store.JanCode != null && store.JanCode != "")
            {
                if (store.JanCode.StartsWith("4") == false)
                {
                    i += 1;
                }
                else
                {
                    if (store.JanCode.Length != 13)
                    {
                        i += 1;
                    }
                    else
                    {
                        if (store.MadeIn != null && store.MadeIn == "108")
                        {
                            if (store.JanCode.StartsWith("450") == false)
                            {
                                if (store.JanCode.StartsWith("451") == false)
                                {
                                    if (store.JanCode.StartsWith("452") == false)
                                    {
                                        if (store.JanCode.StartsWith("453") == false)
                                        {
                                            if (store.JanCode.StartsWith("454") == false)
                                            {
                                                if (store.JanCode.StartsWith("455") == false)
                                                {
                                                    if (store.JanCode.StartsWith("456") == false)
                                                    {
                                                        if (store.JanCode.StartsWith("457") == false)
                                                        {
                                                            if (store.JanCode.StartsWith("458") == false)
                                                            {
                                                                if (store.JanCode.StartsWith("459") == false)
                                                                {
                                                                    if (store.JanCode.StartsWith("490") == false)
                                                                    {
                                                                        if (store.JanCode.StartsWith("491") == false)
                                                                        {
                                                                            if (store.JanCode.StartsWith("492") == false)
                                                                            {
                                                                                if (store.JanCode.StartsWith("493") == false)
                                                                                {
                                                                                    if (store.JanCode.StartsWith("494") == false)
                                                                                    {
                                                                                        if (store.JanCode.StartsWith("495") == false)
                                                                                        {
                                                                                            if (store.JanCode.StartsWith("496") == false)
                                                                                            {
                                                                                                if (store.JanCode.StartsWith("497") == false)
                                                                                                {
                                                                                                    if (store.JanCode.StartsWith("498") == false)
                                                                                                    {
                                                                                                        if (store.JanCode.StartsWith("499") == false)
                                                                                                        {
                                                                                                            i += 1;
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (store.NameJP == null || store.NameJP == "")
            {
                i += 1;
            }
            else
            {
                foreach (var item in keyJP.ToUpper().Split(','))
                {
                    if (store.NameJP.ToUpper().Contains(item))
                    {
                        i += 1; break;
                    }
                }
            }
            if (store.NameEN == null || store.NameEN == "")
            {
                i += 1;
            }
            else
            {
                foreach (var item in keyJP.ToUpper().Split(','))
                {
                    if (store.NameEN.ToUpper().Contains(item))
                    {
                        i += 1; break;
                    }
                }
            }
            if (store.Quantity <= 0 || store.Quantity == null)
            {
                i += 1;
            }
            if (store.PriceTax <= 0 || store.PriceTax == null || store.PriceTax < 50)
            {
                i += 1;
            }
            if (store.LinkWeb == "" || store.LinkWeb == null)
            {
                i += 1;
            }
            if (store.ImageBase64 == "" || store.ImageBase64 == null)
            {
                i += 1;
            }
            if (store.CategoryId == null)
            {
                i += 1;
            }
            if (store.MadeIn == null || store.MadeIn == "")
            {
                i += 1;
            }
            return(i);
        }