private void AddProductTypesToDB(SellerData data, MySqlCommand cmd)
        {
            foreach (var productType in data.Products)
            {
                if (productType.Value.Count == 0)
                {
                    continue;
                }
                if (productType.Value[0] == "")
                {
                    continue;
                }

                cmd.CommandText = "INSERT INTO producttype(id, ptype) VALUES(\"" + data.ID + "\", \"" + productType.Key + "\");";
                cmd.ExecuteNonQuery();

                foreach (var product in productType.Value)
                {
                    if (product == "")
                    {
                        continue;
                    }
                    cmd.CommandText = "INSERT INTO product(id, ptype, product) VALUES(\"" + data.ID + "\", \"" + productType.Key + "\", \"" + product + "\");";
                    cmd.ExecuteNonQuery();
                }
            }
        }
 private static void AddProductTypesToXml(SellerData data, XElement root)
 {
     foreach (var productType in data.Products)
     {
         if (productType.Value.Count == 0)
         {
             continue;
         }
         if (productType.Value[0] == "")
         {
             continue;
         }
         XElement productTypeBranch = new XElement("ProductType");
         productTypeBranch.Add(new XAttribute("type", productType.Key));
         foreach (var product in productType.Value)
         {
             if (product == "")
             {
                 continue;
             }
             XElement productBranch = new XElement("Product");
             productBranch.Add(content: product);
             productTypeBranch.Add(productBranch);
         }
         root.Add(productTypeBranch);
     }
 }
 public Task UpdateData(SellerData data)
 {
     dictionaryLocationDataById[data.ID] = data;
     return(Task.CompletedTask);
 }
 public Task AddData(SellerData data)
 {
     dictionaryLocationDataById.Add(data.ID, data);
     return(Task.CompletedTask);
 }
Exemple #5
0
 async Task IDataStorage <SellerData> .UpdateData(SellerData data) => await UpdateDataAsync("SellerData", data);
Exemple #6
0
 async Task IDataStorage <SellerData> .AddData(SellerData data) => await SetDataAsync("SellerData", data);
 public SellerInfo(SellerData seller, double acc)
 {
     sellerData = seller;
     accuracy   = acc;
 }