Ejemplo n.º 1
0
 public bool Equals(EvaluatedCustomOptions other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other.CustomOptionId == CustomOptionId && other.OptionId == OptionId && Equals(other.CustomOptionTitle, CustomOptionTitle) && Equals(other.OptionTitle, OptionTitle) && other.OptionPriceBc == OptionPriceBc && Equals(other.OptionPriceType, OptionPriceType));
 }
Ejemplo n.º 2
0
        public static IList <EvaluatedCustomOptions> DeserializeFromXml(string xml)
        {
            if (xml == null || string.IsNullOrEmpty(xml.Trim()))
            {
                return(null);
            }

            var res = new List <EvaluatedCustomOptions>();

            var doc = new XmlDocument();

            doc.LoadXml(xml);

            foreach (XmlElement xel in doc.GetElementsByTagName("Option"))
            {
                var xelm = xel.GetElementsByTagName("OptionId")[0];
                if (int.Parse(xelm.InnerText) < 0)
                {
                    continue;
                }
                var evco = new EvaluatedCustomOptions();
                xelm = xel.GetElementsByTagName("CustomOptionId")[0];
                evco.CustomOptionId = int.Parse(xelm.InnerText);

                xelm          = xel.GetElementsByTagName("OptionId")[0];
                evco.OptionId = int.Parse(xelm.InnerText);

                xelm             = xel.GetElementsByTagName("OptionTitle")[0];
                evco.OptionTitle = xelm.InnerText;

                xelm = xel.GetElementsByTagName("CustomOptionTitle")[0];
                evco.CustomOptionTitle = xelm.InnerText;

                xelm = xel.GetElementsByTagName("OptionPriceBC")[0];
                evco.OptionPriceBc = decimal.Parse(xelm.InnerText, CultureInfo.InvariantCulture);

                xelm = xel.GetElementsByTagName("OptionPriceType")[0];
                evco.OptionPriceType = (OptionPriceType)Enum.Parse(typeof(OptionPriceType), xelm.InnerText);

                res.Add(evco);
            }
            return(res);
        }
Ejemplo n.º 3
0
        public static IList<OrderItem> GetOrderItems(int orderId)
        {
            var result = new List<OrderItem>();

            using (var da = new SQLDataAccess())
            {
                da.cmd.CommandText = "[Order].[sp_GetOrderItems]";
                da.cmd.CommandType = CommandType.StoredProcedure;

                da.cmd.Parameters.Clear();
                da.cmd.Parameters.AddWithValue("@OrderID", orderId);

                da.cn.Open();

                using (SqlDataReader reader = da.cmd.ExecuteReader())

                    while (reader.Read())
                    {
                        result.Add(GetOrderItemFromReader(reader));
                    }

                da.cmd.CommandText = "[Order].[sp_GetSelectedOptionsByOrderItemId]";
                da.cmd.CommandType = CommandType.StoredProcedure;

                foreach (OrderItem orditm in result)
                {
                    da.cmd.Parameters.Clear();
                    da.cmd.Parameters.AddWithValue("@OrderItemId", orditm.OrderItemID);
                    var evlist = new List<EvaluatedCustomOptions>();
                    using (var reader = da.cmd.ExecuteReader())
                        while (reader.Read())
                        {
                            var ev = new EvaluatedCustomOptions
                                         {
                                             CustomOptionId = SQLDataHelper.GetInt(reader, "CustomOptionId"),
                                             CustomOptionTitle = SQLDataHelper.GetString(reader, "CustomOptionTitle"),
                                             OptionId = SQLDataHelper.GetInt(reader, "OptionId"),
                                             OptionPriceBc = SQLDataHelper.GetFloat(reader, "OptionPriceBC"),
                                             OptionPriceType =
                                                 (OptionPriceType)SQLDataHelper.GetInt(reader, "OptionPriceType"),
                                             OptionTitle = SQLDataHelper.GetString(reader, "OptionTitle")
                                         };

                            evlist.Add(ev);
                        }

                    orditm.SelectedOptions = evlist;
                }
                da.cnClose();
            }
            return result;
        }
Ejemplo n.º 4
0
        public static IList<EvaluatedCustomOptions> DeserializeFromXml(string xml)
        {
            if (xml == null || string.IsNullOrEmpty(xml.Trim()))
            {
                return null;
            }

            var res = new List<EvaluatedCustomOptions>();

            var doc = new XmlDocument();
            doc.LoadXml(xml);

            foreach (XmlElement xel in doc.GetElementsByTagName("Option"))
            {
                var xelm = xel.GetElementsByTagName("OptionId")[0];
                if (int.Parse(xelm.InnerText) < 0)
                {
                    continue;
                }
                var evco = new EvaluatedCustomOptions();
                xelm = xel.GetElementsByTagName("CustomOptionId")[0];
                evco.CustomOptionId = int.Parse(xelm.InnerText);

                xelm = xel.GetElementsByTagName("OptionId")[0];
                evco.OptionId = int.Parse(xelm.InnerText);

                xelm = xel.GetElementsByTagName("OptionTitle")[0];
                evco.OptionTitle = xelm.InnerText;

                xelm = xel.GetElementsByTagName("CustomOptionTitle")[0];
                evco.CustomOptionTitle = xelm.InnerText;

                xelm = xel.GetElementsByTagName("OptionPriceBC")[0];
                evco.OptionPriceBc = float.Parse(xelm.InnerText, CultureInfo.InvariantCulture);

                xelm = xel.GetElementsByTagName("OptionPriceType")[0];
                evco.OptionPriceType = (OptionPriceType)Enum.Parse(typeof(OptionPriceType), xelm.InnerText);

                res.Add(evco);
            }
            return res;
        }
Ejemplo n.º 5
0
 public bool Equals(EvaluatedCustomOptions other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.CustomOptionId == CustomOptionId && other.OptionId == OptionId && Equals(other.CustomOptionTitle, CustomOptionTitle) && Equals(other.OptionTitle, OptionTitle) && other.OptionPriceBc == OptionPriceBc && Equals(other.OptionPriceType, OptionPriceType);
 }