public FixedDeposit(string name, double principal, int year, FestivalType festival) { _name = name; _principal = principal; _year = year; _festival = festival; }
public FixedDeposit(String name, double amount, int period, FestivalType festival) { _name = name; _amount = amount; _period = period; _festival = festival; }
public NewFestivalTypeWindow() { _errCount = 0; this.newType = new FestivalType(); InitializeComponent(); this.DataContext = newType; }
public FixedDeposit(string name, double principal, int duration, FestivalType festival) { this._name = name; this._principal = principal; this._duration = duration; this._festival = festival; }
/// <summary> /// 获取当前所有活动 /// </summary> /// <param name="type">活动类型</param> /// <returns></returns> public static FestivalInfo GetInfo(FestivalType type) { var list = new ShareCacheStruct <FestivalInfo>().FindAll(); foreach (FestivalInfo info in list) { if (!info.IsStop) { continue; } if (info.StartDate > DateTime.Now) { continue; } //if (info.StartDate.AddHours(info.ContinuedTime) < DateTime.Now) // continue; if (info.EndDate < DateTime.Now) { continue; } if (info.FestivalType == type) { return(info); } } return(null); }
public FixedDeposit(int accNo, string accName, double amount, int years, FestivalType festival) { _accNo = accNo; _accName = accName; _amount = amount; _years = years; _festival = festival; }
public FixedDeposit(string name, double principle, int year, FestivalType festivalType) { _name = name; _principle = principle; _year = year; _festivalType = festivalType; _converToString = new ConverToString(); }
public DiwaliFixedDeposit(int accno, string name, double principal, int years, FestivalType fest) { this._accno = accno; this._name = name; this._principal = principal; this._years = years; this._fest = fest; }
public FixedDeposit(int accountNo, string name, double amount, double principle, int years, FestivalType festival) { _accountNo = accountNo; _name = name; _amount = amount; _principle = principle; _years = years; _festival = festival; }
/// <summary> /// 当前类型的活动是否都已经完成 /// </summary> /// <param name="userID"></param> /// <param name="ftype"></param> /// <returns></returns> public static bool FestivalCompleted(string userID, FestivalType ftype) { var list = new ShareCacheStruct <FestivalInfo>().FindAll(s => s.FestivalType == ftype); foreach (var festival in list) { var fRest = new PersonalCacheStruct <FestivalRestrain>().FindKey(userID, festival.FestivalID); if (fRest != null && fRest.IsReceive) { continue; } return(false); } return(true); }
public string ConvertoString(FestivalType festivalType) { if (FestivalType.HOLI == festivalType) { festival = "Holi"; } if (FestivalType.NEW_YEAR == festivalType) { festival = "New Year"; } if (FestivalType.NORMAL == festivalType) { festival = "Normal"; } return(festival); }
/// <summary> /// 购买精力,庄园加成 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static double SurplusPurchased(string userID, FestivalType festivalType) { double addNum = 1; FestivalInfo info = GetInfo(festivalType); if (info != null && info.FestivalExtend != null && info.FestivalExtend.MinusNum > 0) { var cacheSet = new PersonalCacheStruct <FestivalRestrain>(); FestivalRestrain fRest = cacheSet.FindKey(userID, info.FestivalID); if (fRest == null || fRest.RefreashDate < info.StartDate || (fRest.RefreashDate >= info.StartDate && fRest.RefreashDate <= info.EndDate)) { addNum = info.FestivalExtend.MinusNum; } } return(addNum); }
/// <summary> /// 根据类型获取活动奖励 首充奖励、登入送好礼 /// </summary> /// <param name="userID"></param> /// <param name="type"></param> public static void GetFirstReward(string userID, FestivalType type) { FestivalInfo info = GetInfo(type); if (info != null && info.FestivalExtend != null) { var cacheSet = new PersonalCacheStruct <FestivalRestrain>(); FestivalRestrain fRest = cacheSet.FindKey(userID, info.FestivalID); if (fRest == null) { AppendFestivalRestrain(userID, info.FestivalID, 1); //if (PrizeHelper.GetUserMail(userID, info)) //{ //} } } }
public override int GetHashCode() { int hash = 1; if (FestivalType != 0) { hash ^= FestivalType.GetHashCode(); } if (Key.Length != 0) { hash ^= Key.GetHashCode(); } if (Vector.Length != 0) { hash ^= Vector.GetHashCode(); } return(hash); }
/// <summary> /// 获取当前所有活动 /// </summary> /// <param name="type">活动类型</param> /// <returns></returns> public static FestivalInfo GetInfo(FestivalType type) { var list = new ShareCacheStruct<FestivalInfo>().FindAll(); foreach (FestivalInfo info in list) { if (!info.IsStop) continue; if (info.StartDate > DateTime.Now) continue; //if (info.StartDate.AddHours(info.ContinuedTime) < DateTime.Now) // continue; if (info.EndDate < DateTime.Now) continue; if (info.FestivalType == type) return info; } return null; }
/// <summary> /// 充值获得奖励 首次充值晶石翻倍、充值返利 /// </summary> /// <param name="user"></param> /// <param name="payNum"></param> /// <param name="type"></param> public static void GetPayReward(GameUser user, int payNum, FestivalType type) { var cacheSet = new PersonalCacheStruct <FestivalRestrain>(); var festivalList = new ShareCacheStruct <FestivalInfo>().FindAll(s => s.FestivalType == type); foreach (var info in festivalList) { if (!info.IsStop) { continue; } if (info.StartDate > DateTime.Now) { continue; } if (info.EndDate < DateTime.Now) { continue; } if (info.FestivalType == type) { if (info.FestivalExtend != null) { FestivalRestrain fRest = cacheSet.FindKey(user.UserID, info.FestivalID); UserRecharge userRecharge = new PersonalCacheStruct <UserRecharge>().FindKey(user.UserID); if (type == FestivalType.PayReward) { if (fRest == null && userRecharge != null && userRecharge.TotalGoldNum >= info.RestrainNum) { AppendFestivalRestrain(user.UserID, info.FestivalID, info.RestrainNum); } } else { if (fRest == null && payNum >= info.RestrainNum) { AppendFestivalRestrain(user.UserID, info.FestivalID, payNum); } } } } } }
/// <summary> /// 登入送好礼 /// </summary> /// <param name="userID"></param> /// <param name="type"></param> public static void GetLoginGainReward(string userID, FestivalType type) { FestivalInfo info = GetInfo(type); if (info != null && info.FestivalExtend != null) { var cacheSet = new PersonalCacheStruct <FestivalRestrain>(); FestivalRestrain fRest = cacheSet.FindKey(userID, info.FestivalID); if (fRest == null) { AppendFestivalRestrain(userID, info.FestivalID, 1); } else { var prizeList = info.Reward.FindAll(s => s.RefreshDate.Date == DateTime.Now.Date); if (fRest.RefreashDate.Date != DateTime.Now.Date && prizeList.Count > 0) { fRest.RefreashDate = DateTime.Now; fRest.IsReceive = false; } } } }
public FestivalInfo(FestivalType _type, bool _isChineseFestival, string _desc, FestivalCalcType _calcType, string _timeInfo) { type = _type; isChineseFestival = _isChineseFestival; desc = _desc; calcType = _calcType; timeInfo = _timeInfo; }
public DateTime getFestival(int year, FestivalType type) { DateTime date = DateTime.Now; if (!mapFestivalCalcInfo.ContainsKey(type)) { return(date); } FestivalInfo clacInfo = mapFestivalCalcInfo[type]; if (clacInfo.isChineseFestival) { //农历节日 switch (clacInfo.calcType) { case FestivalCalcType.MonthLastDay: { //某月最后一天 int.TryParse(clacInfo.timeInfo, out int month); if (month == 12) { year += 1; month = 1; } DateTime dtTemp = ChineseDateServer.ins.toDateTime(year, month, 1); dtTemp = dtTemp.AddDays(-1); return(dtTemp); } default: { //指定日期 string[] arr = clacInfo.timeInfo.Split('/'); if (arr.Length < 2) { return(date); } int.TryParse(arr[0], out int month); int.TryParse(arr[1], out int day); DateTime dtTemp = ChineseDateServer.ins.toDateTime(year, month, day); return(dtTemp); } } } else { //阳历节日 switch (clacInfo.calcType) { case FestivalCalcType.Week: { //某月第几个星期几 string[] arr = clacInfo.timeInfo.Split('/'); if (arr.Length < 3) { return(date); } int.TryParse(arr[0], out int month); int.TryParse(arr[1], out int weekCount); int.TryParse(arr[2], out int week); calcWeekFestival(year, month, weekCount, week, out int day); DateTime dtTemp = new DateTime(year, month, day); return(dtTemp); } default: { //指定日期 string[] arr = clacInfo.timeInfo.Split('/'); if (arr.Length < 2) { return(date); } int.TryParse(arr[0], out int month); int.TryParse(arr[1], out int day); DateTime dtTemp = new DateTime(year, month, day); return(dtTemp); } } } }
private void setCalcInfo(FestivalType type, bool isChineseFestival, string desc, FestivalCalcType calcType, string timeInfo) { mapFestivalCalcInfo[type] = new FestivalInfo(type, isChineseFestival, desc, calcType, timeInfo); }
/// <summary> /// 累计消费活动 /// </summary> public static void TriggerFestivalConsume(string userID, int consumeNum, FestivalType festivalType) { FestivalInfo fest = GetInfo(festivalType); if (fest == null) { return; } var cacheSet = new GameDataCacheSet<UserConsume>(); UserConsume userConsume = cacheSet.FindKey(userID); if (userConsume == null) { userConsume = new UserConsume(); userConsume.UserID = userID; userConsume.GameCoin = 0; userConsume.GoldNum = 0; userConsume.EnergyNum = 0; cacheSet.Add(userConsume); cacheSet.Update(); userConsume = new GameDataCacheSet<UserConsume>().FindKey(userID); } //晶石 if (festivalType == FestivalType.SparConsumption) { if (userConsume.GoldDate < fest.StartDate) { userConsume.GoldDate = fest.StartDate; userConsume.GoldNum = consumeNum; } else { userConsume.GoldNum = MathUtils.Addition(userConsume.GoldNum, consumeNum); } } //金币 if (festivalType == FestivalType.GameCoin) { if (userConsume.CoinDate < fest.StartDate) { userConsume.CoinDate = fest.StartDate; userConsume.GameCoin = consumeNum; } else { userConsume.GameCoin = MathUtils.Addition(userConsume.GameCoin, consumeNum); } } //精力 if (festivalType == FestivalType.Energy) { if (userConsume.EnergyDate < fest.StartDate) { userConsume.EnergyDate = fest.StartDate; userConsume.EnergyNum = consumeNum; } else { userConsume.EnergyNum = MathUtils.Addition(userConsume.EnergyNum, consumeNum); } } FestivalInfo[] festivalInfosArray = new ShareCacheStruct<FestivalInfo>().FindAll(m => m.FestivalType == festivalType).ToArray(); foreach (FestivalInfo festivalInfo in festivalInfosArray) { FestivalConsumeCount(festivalInfo, userID); } }
/// <summary> /// 充值获得奖励 首次充值晶石翻倍、充值返利 /// </summary> /// <param name="user"></param> /// <param name="payNum"></param> /// <param name="type"></param> public static void GetPayReward(GameUser user, int payNum, FestivalType type) { var cacheSet = new GameDataCacheSet<FestivalRestrain>(); var festivalList = new ShareCacheStruct<FestivalInfo>().FindAll(s => s.FestivalType == type); foreach (var info in festivalList) { if (!info.IsStop) continue; if (info.StartDate > DateTime.Now) continue; if (info.EndDate < DateTime.Now) continue; if (info.FestivalType == type) { if (info.FestivalExtend != null) { FestivalRestrain fRest = cacheSet.FindKey(user.UserID, info.FestivalID); UserRecharge userRecharge = new GameDataCacheSet<UserRecharge>().FindKey(user.UserID); if (type == FestivalType.PayReward) { if (fRest == null && userRecharge != null && userRecharge.TotalGoldNum >= info.RestrainNum) { AppendFestivalRestrain(user.UserID, info.FestivalID, info.RestrainNum); } } else { if (fRest == null && payNum >= info.RestrainNum) { AppendFestivalRestrain(user.UserID, info.FestivalID, payNum); } } } } } }
/// <summary> /// 登入送好礼 /// </summary> /// <param name="userID"></param> /// <param name="type"></param> public static void GetLoginGainReward(string userID, FestivalType type) { FestivalInfo info = GetInfo(type); if (info != null && info.FestivalExtend != null) { var cacheSet = new GameDataCacheSet<FestivalRestrain>(); FestivalRestrain fRest = cacheSet.FindKey(userID, info.FestivalID); if (fRest == null) { AppendFestivalRestrain(userID, info.FestivalID, 1); } else { var prizeList = info.Reward.FindAll(s => s.RefreshDate.Date == DateTime.Now.Date); if (fRest.RefreashDate.Date != DateTime.Now.Date && prizeList.Count > 0) { fRest.RefreashDate = DateTime.Now; fRest.IsReceive = false; } } } }
/// <summary> /// 累计消费活动 /// </summary> public static void TriggerFestivalConsume(string userID, int consumeNum, FestivalType festivalType) { FestivalInfo fest = GetInfo(festivalType); if (fest == null) { return; } var cacheSet = new PersonalCacheStruct <UserConsume>(); UserConsume userConsume = cacheSet.FindKey(userID); if (userConsume == null) { userConsume = new UserConsume(); userConsume.UserID = userID; userConsume.GameCoin = 0; userConsume.GoldNum = 0; userConsume.EnergyNum = 0; cacheSet.Add(userConsume); cacheSet.Update(); userConsume = new PersonalCacheStruct <UserConsume>().FindKey(userID); } //晶石 if (festivalType == FestivalType.SparConsumption) { if (userConsume.GoldDate < fest.StartDate) { userConsume.GoldDate = fest.StartDate; userConsume.GoldNum = consumeNum; } else { userConsume.GoldNum = MathUtils.Addition(userConsume.GoldNum, consumeNum); } } //金币 if (festivalType == FestivalType.GameCoin) { if (userConsume.CoinDate < fest.StartDate) { userConsume.CoinDate = fest.StartDate; userConsume.GameCoin = consumeNum; } else { userConsume.GameCoin = MathUtils.Addition(userConsume.GameCoin, consumeNum); } } //精力 if (festivalType == FestivalType.Energy) { if (userConsume.EnergyDate < fest.StartDate) { userConsume.EnergyDate = fest.StartDate; userConsume.EnergyNum = consumeNum; } else { userConsume.EnergyNum = MathUtils.Addition(userConsume.EnergyNum, consumeNum); } } FestivalInfo[] festivalInfosArray = new ShareCacheStruct <FestivalInfo>().FindAll(m => m.FestivalType == festivalType).ToArray(); foreach (FestivalInfo festivalInfo in festivalInfosArray) { FestivalConsumeCount(festivalInfo, userID); } }
protected override object this[string index] { get { #region switch (index) { case "FestivalID": return(FestivalID); case "FestivalName": return(FestivalName); case "StartDate": return(StartDate); case "ContinuedTime": return(ContinuedTime); case "RestrainNum": return(RestrainNum); case "Reward": return(Reward); case "IsStop": return(IsStop); case "FestivalDesc": return(FestivalDesc); case "TimePriod": return(TimePriod); case "TaskConfig": return(TaskConfig); case "FestivalExtend": return(FestivalExtend); case "EndDate": return(EndDate); case "FestivalType": return(FestivalType); case "HeadID": return(HeadID); default: throw new ArgumentException(string.Format("FestivalInfo index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "FestivalID": _FestivalID = value.ToInt(); break; case "FestivalName": _FestivalName = value.ToNotNullString(); break; case "StartDate": _StartDate = value.ToDateTime(); break; case "ContinuedTime": _ContinuedTime = value.ToInt(); break; case "RestrainNum": _RestrainNum = value.ToInt(); break; case "Reward": _Reward = ConvertCustomField <CacheList <PrizeInfo> >(value, index); break; case "IsStop": _IsStop = value.ToBool(); break; case "FestivalDesc": _FestivalDesc = value.ToNotNullString(); break; case "TimePriod": _TimePriod = ConvertCustomField <TimePriod>(value, index); // ?? new TimePriod(); break; case "TaskConfig": _TaskConfig = ConvertCustomField <CacheList <TaskConfigInfo> >(value, index); break; case "FestivalExtend": _FestivalExtend = ConvertCustomField <FestivalExtend>(value, index); break; case "EndDate": _EndDate = value.ToDateTime(); break; case "FestivalType": _FestivalType = value.ToEnum <FestivalType>(); break; case "HeadID": _HeadID = value.ToNotNullString(); break; default: throw new ArgumentException(string.Format("FestivalInfo index[{0}] isn't exist.", index)); } #endregion } }
/// <summary> /// 根据类型获取活动奖励 首充奖励、登入送好礼 /// </summary> /// <param name="userID"></param> /// <param name="type"></param> public static void GetFirstReward(string userID, FestivalType type) { FestivalInfo info = GetInfo(type); if (info != null && info.FestivalExtend != null) { var cacheSet = new GameDataCacheSet<FestivalRestrain>(); FestivalRestrain fRest = cacheSet.FindKey(userID, info.FestivalID); if (fRest == null) { AppendFestivalRestrain(userID, info.FestivalID, 1); //if (PrizeHelper.GetUserMail(userID, info)) //{ //} } } }
/// <summary> /// 购买精力,庄园加成 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static double SurplusPurchased(string userID, FestivalType festivalType) { double addNum = 1; FestivalInfo info = GetInfo(festivalType); if (info != null && info.FestivalExtend != null && info.FestivalExtend.MinusNum > 0) { var cacheSet = new GameDataCacheSet<FestivalRestrain>(); FestivalRestrain fRest = cacheSet.FindKey(userID, info.FestivalID); if (fRest == null || fRest.RefreashDate < info.StartDate || (fRest.RefreashDate >= info.StartDate && fRest.RefreashDate <= info.EndDate)) { addNum = info.FestivalExtend.MinusNum; } } return addNum; }
protected override object this[string index] { get { #region switch (index) { case "FestivalID": return FestivalID; case "FestivalName": return FestivalName; case "StartDate": return StartDate; case "ContinuedTime": return ContinuedTime; case "RestrainNum": return RestrainNum; case "Reward": return Reward; case "IsStop": return IsStop; case "FestivalDesc": return FestivalDesc; case "TimePriod": return TimePriod; case "TaskConfig": return TaskConfig; case "FestivalExtend": return FestivalExtend; case "EndDate": return EndDate; case "FestivalType": return FestivalType; case "HeadID": return HeadID; default: throw new ArgumentException(string.Format("FestivalInfo index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "FestivalID": _FestivalID = value.ToInt(); break; case "FestivalName": _FestivalName = value.ToNotNullString(); break; case "StartDate": _StartDate = value.ToDateTime(); break; case "ContinuedTime": _ContinuedTime = value.ToInt(); break; case "RestrainNum": _RestrainNum = value.ToInt(); break; case "Reward": _Reward = ConvertCustomField<CacheList<PrizeInfo>>(value, index); break; case "IsStop": _IsStop = value.ToBool(); break; case "FestivalDesc": _FestivalDesc = value.ToNotNullString(); break; case "TimePriod": _TimePriod = ConvertCustomField<TimePriod>(value, index);// ?? new TimePriod(); break; case "TaskConfig": _TaskConfig = ConvertCustomField<CacheList<TaskConfigInfo>>(value, index); break; case "FestivalExtend": _FestivalExtend = ConvertCustomField<FestivalExtend>(value, index); break; case "EndDate": _EndDate = value.ToDateTime(); break; case "FestivalType": _FestivalType = value.ToEnum<FestivalType>(); break; case "HeadID": _HeadID = value.ToNotNullString(); break; default: throw new ArgumentException(string.Format("FestivalInfo index[{0}] isn't exist.", index)); } #endregion } }
/// <summary> /// 当前类型的活动是否都已经完成 /// </summary> /// <param name="userID"></param> /// <param name="ftype"></param> /// <returns></returns> public static bool FestivalCompleted(string userID, FestivalType ftype) { var list = new ShareCacheStruct<FestivalInfo>().FindAll(s => s.FestivalType == ftype); foreach (var festival in list) { var fRest = new GameDataCacheSet<FestivalRestrain>().FindKey(userID, festival.FestivalID); if (fRest != null && fRest.IsReceive) { continue; } return false; } return true; }