Ejemplo n.º 1
0
 public CatIdDataItem(DataItem item)
 {
     this.item = item;
 }
Ejemplo n.º 2
0
        private string StorePix(DataItem dataItem)
        {
            if (dataItem.Picture == null)
                return string.Empty;
            if (!(dataItem.Picture is ExcelPicture))
                return string.Empty;

            var pic = dataItem.Picture as ExcelPicture;
            var name = pic.Name + "." + pic.ImageFormat;
            var complName = storeDir + @"\" + name;

            while (File.Exists(complName))
            {
                name = name.Replace("." + pic.ImageFormat, "1." + pic.ImageFormat); // prida k nazvu suboru "1"..
                complName = storeDir + @"\" + name;
            }

            pic.Image.Save(complName);

            return name;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Nacita dalsi produkt
        /// </summary>
        /// <returns></returns>
        internal bool ProcessNextDataItemRoom31()
        {
            string code = string.Empty;

            // actualRowIndex je na prvom zazname.. obrazok by mal tento prekryvat
            // 7.7.2013 - obrazky pre room31 sa zatial neriesia
            /*object pic = FindPictureForActual();
            if (pic != null)
                New.Picture = pic;*/

            do
            {
                code = (sheet.Cells[actualRowIndex, codesColIndex].Value ?? string.Empty).ToString();
                if (!string.IsNullOrEmpty(code))
                {
                    DataItem New = new DataItem();

                    // kod polozky
                    New.Codes.Add(code);

                    // popis - nazov a velkost
                    var desc = (sheet.Cells[actualRowIndex, descColIndex].Value ?? string.Empty).ToString();
                    if (string.IsNullOrEmpty(New.Description))
                        New.Description = desc;

                    // parsovanie velkosti
                    SetSizesRoom31(New.Sizes);

                    // rrp
                    var rrp = (sheet.Cells[actualRowIndex, rrpColIndex].Value ?? string.Empty).ToString();
                    if (string.IsNullOrEmpty(New.Rrp))
                        New.Rrp = rrp;

                    // supp
                    var supp = (sheet.Cells[actualRowIndex, suppColIndex].Value ?? string.Empty).ToString();
                    if (string.IsNullOrEmpty(New.Supp))
                        New.Supp = supp;

                    // presun na dalasi riadok
                    actualRowIndex++;

                    data.Add(New);
                }
            } while (!string.IsNullOrEmpty(code));

            return true;
        }
Ejemplo n.º 4
0
        private string GetNextLine(DataItem dataItem, bool useinternalcatids)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("\"sk\",");//store
            sb.Append(dataItem.Codes[0] + ",");//sku
            sb.Append("\"Default\",");//_attribute_set
            sb.Append("\"simple\",");//_type
            sb.Append("\"0\",");//magmi:delete
            sb.Append("\"1\",");//status
            sb.Append("\"4\",");//visibility
            var desc = "\"" + dataItem.Description + "\",";
            sb.Append(desc);//name
            sb.Append(desc.ToLower().Replace(' ', '-').RemoveDiacritics());//url_key
            sb.Append("\"\",");//description
            sb.Append("\"\",");//short_description
            sb.Append("\"1\",");//enable_googlecheckout
            sb.Append("\"" + (useinternalcatids ? dataItem.CatId : CategoryIds) + "\",");//category_ids
            sb.Append("\"1\",");//weight
            sb.Append("\"" + dataItem.Rrp + "\",");//price
            sb.Append("\"" + dataItem.Rrp + "\",");//special_price
            sb.Append("\"" + DateTime.Now.ToString("yyyy-MM-dd") +"\",");//special_from_date
            sb.Append("\"2\",");//tax_class_id
            sb.Append("\"0\",");//manage_stock
            sb.Append("\"0\",");//use_config_manage_stock
            sb.Append("\"" + dataItem.Supp + "\",");//brand
            sb.Append("\"" + string.Join("|", dataItem.Sizes.ToArray()) + "\",");//Veľkosť:Dropdown:1

            string picName = StorePix(dataItem);
            var compl = "\"" + picName + "\",";
            sb.Append(compl);//thumbnail
            sb.Append(compl);//small_image
            sb.Append(compl);//image
            sb.Append(compl);//media_gallery
            sb.Append("\"0\"");//media_gallery_reset

            return sb.ToString();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Nacita dalsi produkt
        /// </summary>
        /// <returns></returns>
        internal bool ProcessNextDataItemAdidasSLVR()
        {
            DataItem New = new DataItem();
            string code = string.Empty;

            // actualRowIndex je na prvom zazname.. obrazok by mal tento prekryvat
            object pic = FindPictureForActual();
            if (pic != null)
                New.Picture = pic;

            do
            {
                code = (sheet.Cells[actualRowIndex, codesColIndex].Value ?? string.Empty).ToString();
                if (!string.IsNullOrEmpty(code))
                {
                    // kod polozky
                    New.Codes.Add(code);

                    // popis - nazov a velkost
                    var desc = (sheet.Cells[actualRowIndex, descColIndex].Value ?? string.Empty).ToString();
                    if (string.IsNullOrEmpty(New.Description))
                        New.Description = GetDescription(desc);
                    New.Sizes.Add(GetSize(desc));

                    // rrp
                    var rrp = (sheet.Cells[actualRowIndex, rrpColIndex].Value ?? string.Empty).ToString();
                    if (string.IsNullOrEmpty(New.Rrp))
                        New.Rrp = rrp;

                    // supp
                    var supp = (sheet.Cells[actualRowIndex, suppColIndex].Value ?? string.Empty).ToString();
                    if (string.IsNullOrEmpty(New.Supp))
                        New.Supp = supp;

                    // presun na dalasi riadok
                    actualRowIndex++;
                }
            } while (!string.IsNullOrEmpty(code));

            data.Add(New);

            return true;
        }