Example #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (DownloadImageUrl != null ? DownloadImageUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ThumbnailImageUrl != null ? ThumbnailImageUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (WebImageUrl != null ? WebImageUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ PhotoEventId;
         hashCode = (hashCode * 397) ^ Height;
         hashCode = (hashCode * 397) ^ Width;
         hashCode = (hashCode * 397) ^ (AltText != null ? AltText.GetHashCode() : 0);
         return(hashCode);
     }
 }
Example #2
0
 /// <summary>
 /// Returns the first non-null value of
 /// the many text description values in this SFMediaDetail, in order:
 /// Title, AltText, Caption , Description.
 /// </summary>
 public string GetFirstAltText()
 {
     if (Title.NotNulle())
     {
         return(Title);
     }
     if (AltText.NotNulle())
     {
         return(AltText);
     }
     if (Caption.NotNulle())
     {
         return(Caption);
     }
     if (Description.NotNulle())
     {
         return(Description);
     }
     return(null);
 }
 public string RenderHtml()
 {
     return($"<div class='BannerHero'><a href='{Url}'><img src='{ImageUrl}' alt='{AltText.Replace("\'", "\\\'")}'/></a></div>");
 }
        /* the real thing -> return the table !!! */
        public override DataTable GetTable()
        {
            // reset table just in case
            MainTable.Reset();

            // add column to table
            AddColumn(MainTable, "supplier id");                             // 1
            AddColumn(MainTable, "store name");                              // 2
            AddColumn(MainTable, "sku");                                     // 3
            AddColumn(MainTable, "title");                                   // 4
            AddColumn(MainTable, "description");                             // 5
            AddColumn(MainTable, "shipping weight");                         // 6
            AddColumn(MainTable, "shipping weight unit of measure");         // 7
            AddColumn(MainTable, "primary product category id");             // 8
            AddColumn(MainTable, "product type");                            // 9
            AddColumn(MainTable, "main image location");                     // 10
            AddColumn(MainTable, "standard product id");                     // 11
            AddColumn(MainTable, "standard product id type");                // 12
            AddColumn(MainTable, "availability");                            // 13
            AddColumn(MainTable, "brand");                                   // 14
            AddColumn(MainTable, "launch date");                             // 15
            AddColumn(MainTable, "release date");                            // 16
            AddColumn(MainTable, "product condition");                       // 17
            AddColumn(MainTable, "item package quantity");                   // 18
            AddColumn(MainTable, "number of items");                         // 19
            AddColumn(MainTable, "designer");                                // 20
            AddColumn(MainTable, "package height");                          // 21
            AddColumn(MainTable, "package length");                          // 22
            AddColumn(MainTable, "package width");                           // 23
            AddColumn(MainTable, "package dimension unit of measure");       // 24
            AddColumn(MainTable, "max order quantity");                      // 25
            AddColumn(MainTable, "legal disclaimer");                        // 26
            AddColumn(MainTable, "manufacturer");                            // 27
            AddColumn(MainTable, "mfr part number");                         // 28
            AddColumn(MainTable, "search terms");                            // 29
            AddColumn(MainTable, "parent sku");                              // 30
            AddColumn(MainTable, "secondary product category id");           // 31
            AddColumn(MainTable, "is new product");                          // 32
            AddColumn(MainTable, "alt image location 1");                    // 33
            AddColumn(MainTable, "alt image location 2");                    // 34
            AddColumn(MainTable, "alt image location 3");                    // 35
            AddColumn(MainTable, "alt image location 4");                    // 36
            AddColumn(MainTable, "alt image location 5");                    // 37
            AddColumn(MainTable, "alt image location 6");                    // 38
            AddColumn(MainTable, "alt image location 7");                    // 39
            AddColumn(MainTable, "alt image location 8");                    // 40
            AddColumn(MainTable, "alt image location 9");                    // 41
            AddColumn(MainTable, "video location");                          // 42

            // start loading data
            MainTable.BeginLoadData();
            Connection.Open();

            // add data to each row
            foreach (string sku in SkuList)
            {
                ArrayList list = GetData(sku);
                DataRow   row  = MainTable.NewRow();

                row[0]  = "ashlin_bpg";                       // supplier id
                row[1]  = "nishis_boutique";                  // store name
                row[2]  = sku;                                // sku
                row[3]  = AltText.GetAltWithSkuExist(sku);    // title
                row[4]  = list[1];                            // description
                row[5]  = list[2];                            // shipping weight
                row[6]  = "GM";                               // shipping weight unit of measure
                row[7]  = 151048;                             // primary product category id
                row[8]  = list[6];                            // product type
                row[9]  = list[8];                            // main image location
                row[10] = list[20];                           // standard product id
                row[11] = "UPC";                              // standard product id type
                row[12] = true;                               // availability
                row[13] = "Ashlin®";                          // brand
                row[14] = list[9];                            // launch date
                row[15] = list[19];                           // release date
                row[16] = "NEW";                              // product condition
                row[17] = 1;                                  // item package quantity
                row[18] = 1;                                  // number of items
                row[19] = "Ashlin®";                          // designer
                row[20] = list[3];                            // package height
                row[21] = list[4];                            // package length
                row[22] = list[5];                            // package width
                row[23] = "CM";                               // package dimension unit of measure
                row[24] = 100;                                // max order quantity
                row[25] = "";                                 // legal disclaimer
                row[26] = "Ashlin BPG Marketing INC";         // manufacturer
                row[27] = sku;                                // mfr part number
                row[28] = list[7];                            // search term
                row[29] = sku.Substring(0, sku.IndexOf('-')); // parent sku
                row[30] = 620977;                             // secondary product category id
                row[31] = true;                               // is new product
                row[32] = list[11];                           // alt iamge location 1
                row[33] = list[12];                           // alt iamge location 2
                row[34] = list[13];                           // alt iamge location 3
                row[35] = list[14];                           // alt iamge location 4
                row[36] = list[15];                           // alt iamge location 5
                row[37] = list[16];                           // alt iamge location 6
                row[38] = list[17];                           // alt iamge location 7
                row[39] = list[18];                           // alt iamge location 8
                row[40] = list[19];                           // alt iamge location 9

                MainTable.Rows.Add(row);
                Progress++;
            }

            // finish loading data
            MainTable.EndLoadData();
            Connection.Close();

            return(MainTable);
        }
Example #5
0
        private void backgroundWorkerAddSKU_DoWork(object sender, DoWorkEventArgs e)
        {
            // simulate progress 30% ~ 50%
            for (int j = 30; j <= 50; j++)
            {
                Thread.Sleep(25);
                backgroundWorkerAddSKU.ReportProgress(j);
            }

            // get data from user input
            basePrice = basesPriceTextbox.Text;
            if (basePrice == "")
            {
                basePrice = "0";
            }
            locationFull       = "WH" + location[0] + "-R" + location[1] + "-S" + location[2] + "-C" + location[3];
            trim               = trimTextbox.Text.Replace("'", "''");
            handleMaterial     = handleMaterial.Replace("'", "''");
            caDuty             = caDutyTextbox.Text;
            usDuty             = usDutyTextbox.Text;
            ashlin             = ashlinTextbox.Text.Replace("'", "''");
            magento            = magentoTextbox.Text.Replace("'", "''");
            tsc                = tscTextbox.Text.Replace("'", "''");
            theBay             = theBayTextbox.Text.Replace("'", "''");
            bestbuy            = bestbuyTextbox.Text.Replace("'", "''");
            shopCa             = shopCaTextbox.Text.Replace("'", "''");
            amazonCa           = amazonCaTextbox.Text.Replace("'", "''");
            amazonCom          = amazonComTextbox.Text.Replace("'", "''");
            sears              = searsTextbox.Text.Replace("'", "''");
            staples            = staplesTextbox.Text.Replace("'", "''");
            walmartCa          = walmartCaTextbox.Text.Replace("'", "''");
            walmartCom         = walmartComTextbox.Text.Replace("'", "''");
            distributorCentral = distributorCentralTextbox.Text.Replace("'", "''");
            promoMarketing     = promoMarketingTextbox.Text.Replace("'", "''");
            giantTiger         = giantTigerTextbox.Text.Replace("'", "''");
            asiXid             = asiXidTextbox.Text.Replace("'", "''");

            // simulate progress 50% ~ 70%
            for (int j = 50; j <= 70; j++)
            {
                Thread.Sleep(25);
                backgroundWorkerAddSKU.ReportProgress(j);
            }

            // assgin alt text to image
            int index = 0;

            for (; index < image.Length; index++)
            {
                if (image[index] == "")
                {
                    imageAlt[index] = "";
                }
                else
                {
                    imageAlt[index] = AltText.GetAltWithSkuNotExist(sku).Replace("'", "''");
                }
            }

            // assgin alt text to image
            index = 0;
            for (; index < group.Length; index++)
            {
                if (group[index] == "")
                {
                    groupAlt[index] = "";
                }
                else
                {
                    groupAlt[index] = "Group " + AltText.GetAltWithSkuNotExist(sku).Replace("'", "''");
                }
            }

            // assgin alt text to image
            index = 0;
            for (; index < model.Length; index++)
            {
                if (model[index] == "")
                {
                    modelAlt[index] = "";
                }
                else
                {
                    modelAlt[index] = "Model " + AltText.GetAltWithSkuNotExist(sku).Replace("'", "''");
                }
            }

            // simulate progress 70% ~ 90%
            for (int j = 70; j <= 90; j++)
            {
                Thread.Sleep(25);
                backgroundWorkerAddSKU.ReportProgress(j);
            }

            // connect to database and insert new row
            try
            {
                using (SqlConnection connection = new SqlConnection(Credentials.DesignCon))
                {
                    if (!caHts.Equals("") && !usHts.Equals(""))
                    {
                        SqlCommand command = new SqlCommand("INSERT INTO master_SKU_Attributes (SKU_Ashlin, Design_Service_Code, Material_Code, Colour_Code, SKU_Website, SKU_MAGENTO, SKU_SEARS_CA, SKU_TSC_CA, SKU_THE_BAY, SKU_BESTBUY_CA, SKU_AMAZON_CA, SKU_AMAZON_COM, SKU_SHOP_CA, SKU_STAPLES_CA, SKU_WALMART_CA, SKU_WALMART_COM, SKU_DistributorCentral, SKU_PromoMarketing, SKU_GIANT_TIGER, ASI_XID, Location_WH, Location_Shelf, Location_ColIndex, Location_Rack, Location_Full, Base_Price, UPC_Code_9, UPC_Code_10, Ashlin_URL, HTS_CDN, HTS_US, Duty_CDN, Duty_US, Image_1_Path, Image_2_Path, Image_3_Path, Image_4_Path, Image_5_Path, Image_6_Path, Image_7_Path, Image_8_Path, Image_9_Path, Image_10_Path, Image_Group_1_Path, Image_Group_2_Path, Image_Group_3_Path, Image_Group_4_Path, Image_Group_5_Path, Image_Model_1_Path, Image_Model_2_Path, Image_Model_3_Path, Image_Model_4_Path, Image_Model_5_Path, Active, Date_Added, Alt_Text_Image_1_Path, Alt_Text_Image_2_Path, Alt_Text_Image_3_Path, Alt_Text_Image_4_Path, Alt_Text_Image_5_Path, Alt_Text_Image_6_Path, Alt_Text_Image_7_Path, Alt_Text_Image_8_Path, Alt_Text_Image_9_Path, Alt_Text_Image_10_Path, Alt_Text_Image_Group_1_Path, Alt_Text_Image_Group_2_Path, Alt_Text_Image_Group_3_Path, Alt_Text_Image_Group_4_Path, Alt_Text_Image_Group_5_Path, Alt_Text_Image_Model_1_Path, Alt_Text_Image_Model_2_Path, Alt_Text_Image_Model_3_Path, Alt_Text_Image_Model_4_Path, Alt_Text_Image_Model_5_Path, Template_URL_1, Template_URL_2, Pricing_Tier, Reorder_Quantity, Reorder_Level, Lining_Material, Trim, Handle_Material, Hardware_Colour) "
                                                            + "VALUES (\'" + sku + "\',\'" + designServiceCode + "\',\'" + material + "\',\'" + colorCode + "\',\'" + onWebsite[1] + "\',\'" + magento + "\',\'" + sears + "\',\'" + tsc + "\',\'" + theBay + "\',\'" + bestbuy + "\',\'" + amazonCa + "\',\'" + amazonCom + "\',\'" + shopCa + "\',\'" + staples + "\',\'" + walmartCa + "\',\'" + walmartCom + "\',\'" + distributorCentral + "\',\'" + promoMarketing + "\',\'" + giantTiger + "\',\'" + asiXid + "\',\'" + location[0] + "\',\'" + location[2] + "\',\'" + location[3] + "\',\'" + location[1] + "\', \'" + locationFull + "\'," + basePrice + ',' + upcCode9 + ',' + upcCode10 + ",\'" + ashlin + "\',\'" + caHts + "\',\'" + usHts + "\'," + caDuty + ',' + usDuty + ",\'" + image[0] + "\',\'" + image[1] + "\',\'" + image[2] + "\',\'" + image[3] + "\',\'" + image[4] + "\',\'" + image[5] + "\',\'" + image[6] + "\',\'" + image[7] + "\',\'" + image[8] + "\',\'" + image[9] + "\',\'" + group[0] + "\',\'" + group[1] + "\',\'" + group[2] + "\',\'" + group[3] + "\',\'" + group[4] + "\',\'" + model[0] + "\',\'" + model[1] + "\',\'" + model[2] + "\',\'" + model[3] + "\',\'" + model[4] + "\',\'" + active + "\',\'" + DateTime.Today.ToString("yyyy-MM-dd") + "\',\'" + imageAlt[0] + "\',\'" + imageAlt[1] + "\',\'" + imageAlt[2] + "\',\'" + imageAlt[3] + "\',\'" + imageAlt[4] + "\',\'" + imageAlt[5] + "\',\'" + imageAlt[6] + "\',\'" + imageAlt[7] + "\',\'" + imageAlt[8] + "\',\'" + imageAlt[9] + "\',\'" + groupAlt[0] + "\',\'" + groupAlt[1] + "\',\'" + groupAlt[2] + "\',\'" + groupAlt[3] + "\', \'" + groupAlt[4] + "\',\'" + modelAlt[0] + "\',\'" + modelAlt[1] + "\',\'" + modelAlt[2] + "\',\'" + modelAlt[3] + "\',\'" + modelAlt[4] + "\',\'" + template[0] + "\',\'" + template[1] + "\'," + pricingTier + ',' + reorderQty + ',' + reorderLevel + ",\'" + liningMaterial + "\',\'" + trim + "\',\'" + handleMaterial + "\',\'" + hardwareColor + "\')", connection);
                        connection.Open();
                        command.ExecuteNonQuery();
                    }
                    else
                    {
                        SqlCommand command = new SqlCommand("INSERT INTO master_SKU_Attributes (SKU_Ashlin, Design_Service_Code, Material_Code, Colour_Code, SKU_Website, SKU_MAGENTO, SKU_SEARS_CA, SKU_TSC_CA, SKU_THE_BAY, SKU_BESTBUY_CA, SKU_AMAZON_CA, SKU_AMAZON_COM, SKU_SHOP_CA, SKU_STAPLES_CA, SKU_WALMART_CA, SKU_WALMART_COM, SKU_DistributorCentral, SKU_PromoMarketing, SKU_GIANT_TIGER, ASI_XID, Location_WH, Location_Shelf, Location_ColIndex, Location_Rack, Location_Full, Base_Price, UPC_Code_9, UPC_Code_10, Ashlin_URL, Image_1_Path, Image_2_Path, Image_3_Path, Image_4_Path, Image_5_Path, Image_6_Path, Image_7_Path, Image_8_Path, Image_9_Path, Image_10_Path, Image_Group_1_Path, Image_Group_2_Path, Image_Group_3_Path, Image_Group_4_Path, Image_Group_5_Path, Image_Model_1_Path, Image_Model_2_Path, Image_Model_3_Path, Image_Model_4_Path, Image_Model_5_Path, Active, Date_Added, Alt_Text_Image_1_Path, Alt_Text_Image_2_Path, Alt_Text_Image_3_Path, Alt_Text_Image_4_Path, Alt_Text_Image_5_Path, Alt_Text_Image_6_Path, Alt_Text_Image_7_Path, Alt_Text_Image_8_Path, Alt_Text_Image_9_Path, Alt_Text_Image_10_Path, Alt_Text_Image_Group_1_Path, Alt_Text_Image_Group_2_Path, Alt_Text_Image_Group_3_Path, Alt_Text_Image_Group_4_Path, Alt_Text_Image_Group_5_Path, Alt_Text_Image_Model_1_Path, Alt_Text_Image_Model_2_Path, Alt_Text_Image_Model_3_Path, Alt_Text_Image_Model_4_Path, Alt_Text_Image_Model_5_Path, Template_URL_1, Template_URL_2, Pricing_Tier, Reorder_Quantity, Reorder_Level, Lining_Material, Trim, Handle_Material, Hardware_Colour) "
                                                            + "VALUES (\'" + sku + "\',\'" + designServiceCode + "\',\'" + material + "\',\'" + colorCode + "\',\'" + onWebsite[1] + "\',\'" + magento + "\',\'" + sears + "\',\'" + tsc + "\',\'" + theBay + "\',\'" + bestbuy + "\',\'" + amazonCa + "\',\'" + amazonCom + "\',\'" + shopCa + "\',\'" + staples + "\',\'" + walmartCa + "\',\'" + walmartCom + "\',\'" + distributorCentral + "\',\'" + promoMarketing + "\',\'" + giantTiger + "\',\'" + asiXid + "\',\'" + location[0] + "\',\'" + location[2] + "\',\'" + location[3] + "\',\'" + location[1] + "\', \'" + locationFull + "\', " + basePrice + ',' + upcCode9 + ',' + upcCode10 + ",\'" + ashlin + "\',\'" + image[0] + "\',\'" + image[1] + "\',\'" + image[2] + "\',\'" + image[3] + "\',\'" + image[4] + "\',\'" + image[5] + "\',\'" + image[6] + "\',\'" + image[7] + "\',\'" + image[8] + "\',\'" + image[9] + "\',\'" + group[0] + "\',\'" + group[1] + "\',\'" + group[2] + "\',\'" + group[3] + "\',\'" + group[4] + "\',\'" + model[0] + "\',\'" + model[1] + "\',\'" + model[2] + "\',\'" + model[3] + "\',\'" + model[4] + "\',\'" + active + "\',\'" + DateTime.Today.ToString("yyyy-MM-dd") + "\',\'" + imageAlt[0] + "\',\'" + imageAlt[1] + "\',\'" + imageAlt[2] + "\',\'" + imageAlt[3] + "\',\'" + imageAlt[4] + "\',\'" + imageAlt[5] + "\',\'" + imageAlt[6] + "\',\'" + imageAlt[7] + "\',\'" + imageAlt[8] + "\',\'" + imageAlt[9] + "\',\'" + groupAlt[0] + "\',\'" + groupAlt[1] + "\',\'" + groupAlt[2] + "\',\'" + groupAlt[3] + "\',\'" + groupAlt[4] + "\',\'" + modelAlt[0] + "\',\'" + modelAlt[1] + "\', \'" + modelAlt[2] + "\', \'" + modelAlt[3] + "\',\'" + modelAlt[4] + "\',\'" + template[0] + "\',\'" + template[1] + "\'," + pricingTier + ',' + reorderQty + ',' + reorderLevel + ",\'" + liningMaterial + "\',\'" + trim + "\',\'" + handleMaterial + "\',\'" + hardwareColor + "\')", connection);
                        connection.Open();
                        command.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error happen during database updating:\r\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // simulate progress 90% ~ 100%
            for (int j = 90; j <= 100; j++)
            {
                Thread.Sleep(25);
                backgroundWorkerAddSKU.ReportProgress(j);
            }
        }