Beispiel #1
0
 public static bool SetItemType(ShopItemInfo shop, int type, ref int gold, ref int money, ref int offer, ref int gifttoken, ref int medal)
 {
     if (type == 1)
     {
         SqlDataProvider.Data.ItemInfo.GetItemPrice(shop.APrice1, shop.AValue1, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref medal);
         SqlDataProvider.Data.ItemInfo.GetItemPrice(shop.APrice2, shop.AValue2, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref medal);
         SqlDataProvider.Data.ItemInfo.GetItemPrice(shop.APrice3, shop.AValue3, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref medal);
     }
     if (type == 2)
     {
         SqlDataProvider.Data.ItemInfo.GetItemPrice(shop.BPrice1, shop.BValue1, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref medal);
         SqlDataProvider.Data.ItemInfo.GetItemPrice(shop.BPrice2, shop.BValue2, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref medal);
         SqlDataProvider.Data.ItemInfo.GetItemPrice(shop.BPrice3, shop.BValue3, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref medal);
     }
     if (type == 3)
     {
         SqlDataProvider.Data.ItemInfo.GetItemPrice(shop.CPrice1, shop.CValue1, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref medal);
         SqlDataProvider.Data.ItemInfo.GetItemPrice(shop.CPrice2, shop.CValue2, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref medal);
         SqlDataProvider.Data.ItemInfo.GetItemPrice(shop.CPrice3, shop.CValue3, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref medal);
     }
     return(true);
 }
Beispiel #2
0
        /// <summary>
        /// 获取物品花费的金钱
        /// </summary>
        /// <param name="shop">商店物品</param>
        /// <param name="type">购买类型:以时间范围或以数量多少为单位</param>
        /// <param name="gold">花费金币</param>
        /// <param name="money">花费点券</param>
        /// <param name="offer">花费功勋</param>
        /// <param name="gifttoken">花费礼券</param>
        /// <param name="?">兑换物品(物品编号+数量)</param>
        /// <returns>返回</returns>
        public static List<int> SetItemType(ShopItemInfo shop, int type, ref int gold, ref int money, ref int offer, ref int gifttoken)
        {
            double pay = 0;
            int value = 0;
            int iTemplateID = 0;
            int iCount = 0;
            //gold = 0;
            //money = 0;
            //offer = 0;
            //gifttoken = 0;
            List<int> itemsInfo = new List<int>();

            if (type == 1)
            {
                GetItemPrice(shop.APrice1, shop.AValue1, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }


                GetItemPrice(shop.APrice2, shop.AValue2, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }

                GetItemPrice(shop.APrice3, shop.AValue3, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }
            }
            if (type == 2)
            {
                GetItemPrice(shop.BPrice1, shop.BValue1, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }


                GetItemPrice(shop.BPrice2, shop.BValue2, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }

                GetItemPrice(shop.BPrice3, shop.BValue3, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }

            }
            if (type == 3)
            {
                GetItemPrice(shop.CPrice1, shop.CValue1, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }


                GetItemPrice(shop.CPrice2, shop.CValue2, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }

                GetItemPrice(shop.CPrice3, shop.CValue3, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }
            }
            return itemsInfo;
        }
Beispiel #3
0
        /// <summary>
        /// 获取物品花费的金钱
        /// </summary>
        /// <param name="shop">商店物品</param>
        /// <param name="type">购买类型:以时间范围或以数量多少为单位</param>
        /// <param name="gold">花费金币</param>
        /// <param name="money">花费点券</param>
        /// <param name="offer">花费功勋</param>
        /// <param name="gifttoken">花费礼券</param>
        /// <param name="?">兑换物品(物品编号+数量)</param>
        /// <returns>返回</returns>
        public static List <int> SetItemType(ShopItemInfo shop, int type, ref int gold, ref int money, ref int offer, ref int gifttoken)
        {
            double pay         = 0;
            int    value       = 0;
            int    iTemplateID = 0;
            int    iCount      = 0;
            //gold = 0;
            //money = 0;
            //offer = 0;
            //gifttoken = 0;
            List <int> itemsInfo = new List <int>();

            if (type == 1)
            {
                GetItemPrice(shop.APrice1, shop.AValue1, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }


                GetItemPrice(shop.APrice2, shop.AValue2, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }

                GetItemPrice(shop.APrice3, shop.AValue3, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }
            }
            if (type == 2)
            {
                GetItemPrice(shop.BPrice1, shop.BValue1, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }


                GetItemPrice(shop.BPrice2, shop.BValue2, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }

                GetItemPrice(shop.BPrice3, shop.BValue3, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }
            }
            if (type == 3)
            {
                GetItemPrice(shop.CPrice1, shop.CValue1, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }


                GetItemPrice(shop.CPrice2, shop.CValue2, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }

                GetItemPrice(shop.CPrice3, shop.CValue3, shop.Beat, ref gold, ref money, ref offer, ref gifttoken, ref iTemplateID, ref iCount);

                if (iTemplateID > 0)
                {
                    itemsInfo.Add(iTemplateID);
                    itemsInfo.Add(iCount);
                }
            }
            return(itemsInfo);
        }
Beispiel #4
0
 public static XElement CreateShopInfo(ShopItemInfo shop)
 {
     return new XElement("Item", new XAttribute("ID", shop.ID),
         new XAttribute("ShopID", shop.ShopID),
         // GroupID="0"
         new XAttribute("GroupID", shop.GroupID),
         new XAttribute("TemplateID", shop.TemplateID),
         new XAttribute("BuyType", shop.BuyType),
         new XAttribute("IsContinue", shop.IsContinue),
         new XAttribute("IsBind", shop.IsBind),
         new XAttribute("IsVouch", shop.IsVouch),
         new XAttribute("Label", shop.Label),
         new XAttribute("Beat", shop.Beat),
         new XAttribute("AUnit", shop.AUnit),
         new XAttribute("APrice1", shop.APrice1),
         new XAttribute("AValue1", shop.AValue1),
         new XAttribute("APrice2", shop.APrice2),
         new XAttribute("AValue2", shop.AValue2),
         new XAttribute("APrice3", shop.APrice3),
         new XAttribute("AValue3", shop.AValue3),
         new XAttribute("BUnit", shop.BUnit),
         new XAttribute("BPrice1", shop.BPrice1),
         new XAttribute("BValue1", shop.BValue1),
         new XAttribute("BPrice2", shop.BPrice2),
         new XAttribute("BValue2", shop.BValue2),
         new XAttribute("BPrice3", shop.BPrice3),
         new XAttribute("BValue3", shop.BValue3),
         new XAttribute("CUnit", shop.CUnit),
         new XAttribute("CPrice1", shop.CPrice1),
         new XAttribute("CValue1", shop.CValue1),
         new XAttribute("CPrice2", shop.CPrice2),
         new XAttribute("CValue2", shop.CValue2),
         new XAttribute("CPrice3", shop.CPrice3),
         new XAttribute("CValue3", shop.CValue3),
         //IsCheap="false"
         new XAttribute("IsCheap", shop.IsCheap),
         //LimitCount="-1"
         new XAttribute("LimitCount", shop.LimitCount),
         //StartDate="2000-01-01T00:00:00"
         new XAttribute("StartDate", shop.StartDate),
         //EndDate="2050-01-01T00:00:00"
          new XAttribute("EndDate", shop.EndDate));
 }
        public ShopItemInfo[] GetALllShop()
        {
            List<ShopItemInfo> infos = new List<ShopItemInfo>();
            SqlDataReader reader = null;
            try
            {
                db.GetReader(ref reader, "SP_Shop_All");
                while (reader.Read())
                {
                    ShopItemInfo info = new ShopItemInfo();
                    info.ID = int.Parse(reader["ID"].ToString());
                    info.ShopID = int.Parse(reader["ShopID"].ToString());
                    info.GroupID = int.Parse(reader["GroupID"].ToString());
                    info.TemplateID = int.Parse(reader["TemplateID"].ToString());
                    info.BuyType = int.Parse(reader["BuyType"].ToString());
                    info.Sort = int.Parse(reader["Sort"].ToString());
                    info.IsVouch = int.Parse(reader["IsVouch"].ToString());;
                    info.Label = int.Parse(reader["Label"].ToString());
                    info.Beat = decimal.Parse(reader["Beat"].ToString());
                    info.AUnit = int.Parse(reader["AUnit"].ToString());
                    info.APrice1 = int.Parse(reader["APrice1"].ToString());
                    info.AValue1 = int.Parse(reader["AValue1"].ToString());
                    info.APrice2 = int.Parse(reader["APrice2"].ToString());
                    info.AValue2 = int.Parse(reader["AValue2"].ToString());
                    info.APrice3 = int.Parse(reader["APrice3"].ToString());
                    info.AValue3 = int.Parse(reader["AValue3"].ToString());

                    info.BUnit = int.Parse(reader["BUnit"].ToString());
                    info.BPrice1 = int.Parse(reader["BPrice1"].ToString());
                    info.BValue1 = int.Parse(reader["BValue1"].ToString());
                    info.BPrice2 = int.Parse(reader["BPrice2"].ToString());
                    info.BValue2 = int.Parse(reader["BValue2"].ToString());
                    info.BPrice3 = int.Parse(reader["BPrice3"].ToString());
                    info.BValue3 = int.Parse(reader["BValue3"].ToString());

                    info.CUnit = int.Parse(reader["CUnit"].ToString());
                    info.CPrice1 = int.Parse(reader["CPrice1"].ToString());
                    info.CValue1 = int.Parse(reader["CValue1"].ToString());
                    info.CPrice2 = int.Parse(reader["CPrice2"].ToString());
                    info.CValue2 = int.Parse(reader["CValue2"].ToString());
                    info.CPrice3 = int.Parse(reader["CPrice3"].ToString());
                    info.CValue3 = int.Parse(reader["CValue3"].ToString());
                    info.IsContinue = bool.Parse(reader["IsContinue"].ToString());
                    info.IsCheap = bool.Parse(reader["IsCheap"].ToString());
                    info.LimitCount = int.Parse(reader["LimitCount"].ToString());
                    info.StartDate = DateTime.Parse(reader["StartDate"].ToString());
                    info.EndDate = DateTime.Parse(reader["EndDate"].ToString());
                    infos.Add(info);
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("Init", e);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();
            }
            return infos.ToArray();
        }