Example #1
0
        public static List <CouponObject> GetUserCoupons(UserObject user)
        {
            List <CouponObject> lists = new List <CouponObject>();

#if DEBUG
            Console.WriteLine("开始执行获取用户抵购券时间!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
#endif
            string xml = hiPiaoSrv.QueryUserCoupon(user);
#if DEBUG
            Console.WriteLine("结束执行获取用户抵购券时间!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
#endif
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);
#if DEBUG
            Console.WriteLine("加载返回结果到XmlDocument文档中!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
#endif
            XmlNodeList  couponNodes = doc.SelectNodes("//couponInfo");
            XmlNode      useRuleNode;
            CouponObject coupon;
            for (int i = 0; i < couponNodes.Count; i++)
            {
#if DEBUG
                Console.WriteLine("初始化抵购券对象时间!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
#endif
                coupon = new CouponObject();

                /*
                 * coupon.CardId = couponNodes[i].Attributes["cardId"].Value;
                 #if DEBUG
                 * Console.WriteLine("抵扣券ID:"+coupon.CardId);
                 #endif
                 * coupon.Period = couponNodes[i].Attributes["period"].Value;
                 * coupon.UseDate = couponNodes[i].Attributes["useDate"].Value;
                 * coupon.Status = Convert.ToInt32(couponNodes[i].Attributes["status"].Value);
                 #if DEBUG
                 * Console.WriteLine("初始化抵购券对象时间2!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                 #endif
                 * useRuleNode=couponNodes[i].SelectSingleNode("useRule");
                 * if(useRuleNode!=null)
                 * {
                 *  coupon.UseCinema = useRuleNode.Attributes["useDate"]==null?string.Empty:useRuleNode.Attributes["useDate"].Value;
                 *  coupon.Enable3D = useRuleNode.Attributes["is3D"].Value == "1";
                 *  coupon.EveryDayTime = useRuleNode.Attributes["everyDayTime"].Value;
                 *  coupon.WeekEnd = useRuleNode.Attributes["weekEnd"].Value == "1";
                 *  coupon.FileRule = useRuleNode.Attributes["fileRule"]==null?string.Empty:useRuleNode.Attributes["fileRule"].Value;
                 *  coupon.Type = Convert.ToInt32(useRuleNode.Attributes["type"].Value);
                 *
                 * }
                 * */
#if DEBUG
                Console.WriteLine("初始化抵购券对象时间3!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
#endif
                lists.Add(coupon);
            }
            return(lists);
        }
Example #2
0
        private List <CouponObject> MockCoupon(int num)
        {
            List <CouponObject> lists = new List <CouponObject>();
            int type = 1;

            for (int i = 0; i < num; i++)
            {
                if (i % 2 != 0)
                {
                    type = 2;
                }
                CouponObject coupon = new CouponObject();
                coupon.Name = "10元抵用券";
                //Random rd = new Random();
                //type = rd.Next(0, 3);
                coupon.Type = type;

                lists.Add(coupon);
            }
            return(lists);
        }
Example #3
0
        private List<CouponObject> MockCoupon(int num)
        {
            List<CouponObject> lists=new List<CouponObject>();
            int type = 1;

            for (int i = 0; i < num; i++)
            {
                if (i%2 != 0)
                {
                    type = 2;
                }
                CouponObject coupon = new CouponObject();
                coupon.Name = "10元抵用券";
                //Random rd = new Random();
                //type = rd.Next(0, 3);
                coupon.Type = type;

                lists.Add(coupon);
            }
            return lists;
        }
Example #4
0
        public static List<CouponObject> GetUserCoupons(UserObject user)
        {
            List<CouponObject> lists = new List<CouponObject>();
            #if DEBUG
            Console.WriteLine("开始执行获取用户抵购券时间!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            #endif
            string xml = hiPiaoSrv.QueryUserCoupon(user);
            #if DEBUG
            Console.WriteLine("结束执行获取用户抵购券时间!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            #endif
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);
            #if DEBUG
            Console.WriteLine("加载返回结果到XmlDocument文档中!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            #endif
            XmlNodeList couponNodes = doc.SelectNodes("//couponInfo");
            XmlNode useRuleNode;
            CouponObject coupon;
            for (int i = 0; i < couponNodes.Count; i++)
            {
            #if DEBUG
                Console.WriteLine("初始化抵购券对象时间!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            #endif
                coupon = new CouponObject();
                /*
                coupon.CardId = couponNodes[i].Attributes["cardId"].Value;
            #if DEBUG
                Console.WriteLine("抵扣券ID:"+coupon.CardId);
            #endif
                coupon.Period = couponNodes[i].Attributes["period"].Value;
                coupon.UseDate = couponNodes[i].Attributes["useDate"].Value;
                coupon.Status = Convert.ToInt32(couponNodes[i].Attributes["status"].Value);
            #if DEBUG
                Console.WriteLine("初始化抵购券对象时间2!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            #endif
                useRuleNode=couponNodes[i].SelectSingleNode("useRule");
                if(useRuleNode!=null)
                {
                    coupon.UseCinema = useRuleNode.Attributes["useDate"]==null?string.Empty:useRuleNode.Attributes["useDate"].Value;
                    coupon.Enable3D = useRuleNode.Attributes["is3D"].Value == "1";
                    coupon.EveryDayTime = useRuleNode.Attributes["everyDayTime"].Value;
                    coupon.WeekEnd = useRuleNode.Attributes["weekEnd"].Value == "1";
                    coupon.FileRule = useRuleNode.Attributes["fileRule"]==null?string.Empty:useRuleNode.Attributes["fileRule"].Value;
                    coupon.Type = Convert.ToInt32(useRuleNode.Attributes["type"].Value);

                }
                 * */
            #if DEBUG
                Console.WriteLine("初始化抵购券对象时间3!" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            #endif
                lists.Add(coupon);

            }
            return lists;
        }