Пример #1
0
        private DataSet GetSkuPrices(out string skuIds)
        {
            DataSet set = null;

            skuIds = string.Empty;
            XmlDocument document = new XmlDocument();

            try
            {
                document.LoadXml(this.txtPrices.Text);
                XmlNodeList list = document.SelectNodes("//item");
                if ((list == null) || (list.Count == 0))
                {
                    return(null);
                }
                IList <SKUItem> skus = SubSiteProducthelper.GetSkus(this.productIds);
                set = new DataSet();
                DataTable table = new DataTable("skuPriceTable");
                table.Columns.Add("skuId");
                table.Columns.Add("salePrice");
                DataTable table2 = new DataTable("skuMemberPriceTable");
                table2.Columns.Add("skuId");
                table2.Columns.Add("gradeId");
                table2.Columns.Add("memberPrice");
                foreach (XmlNode node in list)
                {
                    string  str = node.Attributes["skuId"].Value;
                    decimal num = decimal.Parse(node.Attributes["salePrice"].Value);
                    skuIds = skuIds + "'" + str + "',";
                    foreach (SKUItem item in skus)
                    {
                        if ((item.SkuId == str) && (item.SalePrice != num))
                        {
                            DataRow row = table.NewRow();
                            row["skuId"]     = str;
                            row["salePrice"] = num;
                            table.Rows.Add(row);
                        }
                    }
                    foreach (XmlNode node2 in node.SelectSingleNode("skuMemberPrices").ChildNodes)
                    {
                        DataRow row2 = table2.NewRow();
                        row2["skuId"]       = node.Attributes["skuId"].Value;
                        row2["gradeId"]     = int.Parse(node2.Attributes["gradeId"].Value);
                        row2["memberPrice"] = decimal.Parse(node2.Attributes["memberPrice"].Value);
                        table2.Rows.Add(row2);
                    }
                }
                set.Tables.Add(table);
                set.Tables.Add(table2);
                if (skuIds.Length > 1)
                {
                    skuIds = skuIds.Remove(skuIds.Length - 1);
                }
            }
            catch
            {
            }
            return(set);
        }
Пример #2
0
 private System.Collections.Generic.Dictionary <string, decimal> GetSkuPrices()
 {
     System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
     System.Collections.Generic.Dictionary <string, decimal> dictionary = null;
     System.Collections.Generic.Dictionary <string, decimal> result;
     try
     {
         xmlDocument.LoadXml(this.txtSkuPrice.Text);
         System.Xml.XmlNodeList xmlNodeList = xmlDocument.SelectNodes("//item");
         if (xmlNodeList != null && xmlNodeList.Count != 0)
         {
             System.Collections.Generic.IList <SKUItem> skus = SubSiteProducthelper.GetSkus(this.productId.ToString());
             dictionary = new System.Collections.Generic.Dictionary <string, decimal>();
             foreach (System.Xml.XmlNode xmlNode in xmlNodeList)
             {
                 string  value = xmlNode.Attributes["skuId"].Value;
                 decimal num   = decimal.Parse(xmlNode.Attributes["price"].Value);
                 foreach (SKUItem current in skus)
                 {
                     if (current.SkuId == value && current.SalePrice != num)
                     {
                         dictionary.Add(value, num);
                     }
                 }
             }
             return(dictionary);
         }
         result = null;
     }
     catch
     {
         return(dictionary);
     }
     return(result);
 }
Пример #3
0
        private Dictionary <string, decimal> GetSkuPrices()
        {
            XmlDocument document = new XmlDocument();
            Dictionary <string, decimal> dictionary = null;

            try
            {
                document.LoadXml(this.txtSkuPrice.Text);
                XmlNodeList list = document.SelectNodes("//item");
                if ((list == null) || (list.Count == 0))
                {
                    return(null);
                }
                IList <SKUItem> skus = SubSiteProducthelper.GetSkus(this.productId.ToString());
                dictionary = new Dictionary <string, decimal>();
                foreach (XmlNode node in list)
                {
                    string  key = node.Attributes["skuId"].Value;
                    decimal num = decimal.Parse(node.Attributes["price"].Value);
                    foreach (SKUItem item in skus)
                    {
                        if ((item.SkuId == key) && (item.SalePrice != num))
                        {
                            dictionary.Add(key, num);
                        }
                    }
                }
            }
            catch
            {
            }
            return(dictionary);
        }
Пример #4
0
 private System.Data.DataSet GetSkuPrices(out string skuIds)
 {
     System.Data.DataSet dataSet = null;
     skuIds = string.Empty;
     System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
     System.Data.DataSet    result;
     try
     {
         xmlDocument.LoadXml(this.txtPrices.Text);
         System.Xml.XmlNodeList xmlNodeList = xmlDocument.SelectNodes("//item");
         if (xmlNodeList != null && xmlNodeList.Count != 0)
         {
             System.Collections.Generic.IList <SKUItem> skus = SubSiteProducthelper.GetSkus(this.productIds);
             dataSet = new System.Data.DataSet();
             System.Data.DataTable dataTable = new System.Data.DataTable("skuPriceTable");
             dataTable.Columns.Add("skuId");
             dataTable.Columns.Add("salePrice");
             System.Data.DataTable dataTable2 = new System.Data.DataTable("skuMemberPriceTable");
             dataTable2.Columns.Add("skuId");
             dataTable2.Columns.Add("gradeId");
             dataTable2.Columns.Add("memberPrice");
             foreach (System.Xml.XmlNode xmlNode in xmlNodeList)
             {
                 string  value = xmlNode.Attributes["skuId"].Value;
                 decimal num   = decimal.Parse(xmlNode.Attributes["salePrice"].Value);
                 skuIds = skuIds + "'" + value + "',";
                 foreach (SKUItem current in skus)
                 {
                     if (current.SkuId == value && current.SalePrice != num)
                     {
                         System.Data.DataRow dataRow = dataTable.NewRow();
                         dataRow["skuId"]     = value;
                         dataRow["salePrice"] = num;
                         dataTable.Rows.Add(dataRow);
                     }
                 }
                 System.Xml.XmlNodeList childNodes = xmlNode.SelectSingleNode("skuMemberPrices").ChildNodes;
                 foreach (System.Xml.XmlNode xmlNode2 in childNodes)
                 {
                     System.Data.DataRow dataRow2 = dataTable2.NewRow();
                     dataRow2["skuId"]       = xmlNode.Attributes["skuId"].Value;
                     dataRow2["gradeId"]     = int.Parse(xmlNode2.Attributes["gradeId"].Value);
                     dataRow2["memberPrice"] = decimal.Parse(xmlNode2.Attributes["memberPrice"].Value);
                     dataTable2.Rows.Add(dataRow2);
                 }
             }
             dataSet.Tables.Add(dataTable);
             dataSet.Tables.Add(dataTable2);
             if (skuIds.Length > 1)
             {
                 skuIds = skuIds.Remove(skuIds.Length - 1);
             }
             return(dataSet);
         }
         result = null;
     }
     catch
     {
         return(dataSet);
     }
     return(result);
 }