/// <summary> /// /// </summary> /// <param name="AwardCode"></param> /// <param name="PayUID"></param> /// <returns></returns> public static JsonModel PayAward_Helper(int Code, string PayUID, string PrizeContent) { JsonModel jsm = null; try { List <Award_Public> Award_Public_List = Constant.Award_Public_List; List <Operation_Record> Operation_Record_List = Constant.Operation_Record_List; Award_Public award_Public = Award_Public_List.FirstOrDefault(p => p.Code == Code); if (award_Public != null) { List <Operation_Record> recordList = (from op in Operation_Record_List where op.AwardCode == Code select op).ToList(); if (award_Public.IsCompleate == (int)IsCompleate.No) { foreach (var record in recordList) { AwardDealWidth(award_Public, record, PrizeContent); } } jsm = JsonModel.GetJsonModel(0, "派奖成功"); Award_Public award_Edit_clone = Constant.Clone <Award_Public>(award_Public); award_Edit_clone.PrizeContent = PrizeContent; award_Edit_clone.EndTime = DateTime.Now; award_Edit_clone.IsCompleate = (int)IsCompleate.Yes; jsm = Constant.Award_Public_S.Update(award_Edit_clone); if (jsm.errNum == 0) { award_Public.PrizeContent = PrizeContent; award_Public.EndTime = DateTime.Now; award_Public.IsCompleate = (int)IsCompleate.Yes; jsm = JsonModel.GetJsonModel(0, "操作成功"); } else { jsm = JsonModel.GetJsonModel(300, "操作失败"); } } else { jsm = JsonModel.GetJsonModel(300, "该期不存在"); } } catch (Exception ex) { LogHelper.Error(ex); } return(jsm); }
public static Operation_Record_S Get_Operation_Record_S(Operation_Record record, Award_Public award, Globe_Clue clue, UserInfo user, List <Globe> Globe_List) { Operation_Record_S Operation_Record_S = new Operation_Record_S(); try { Operation_Record_S = new Operation_Record_S() { Id = (int)record.Id, AwardCode = (int)record.AwardCode, ClueCode = (int)record.ClueCode, Buy_Content = record.Buy_Content, Buy_Content2 = record.Buy_Content2, BuyPayReturn = record.BuyPayReturn, BuyPayReturn2 = record.BuyPayReturn2, UnitPrice = (int)record.UnitPrice, CreateTime = (DateTime)record.CreateTime, Operation_Time = (DateTime)record.Operation_Time, IsWin = (int)record.IsWin, UserID = record.UserID, Get_Money = (decimal)record.Get_Money, Araw_ReturnMoney = (decimal)record.Araw_ReturnMoney, Araw_RetrunContent = record.Araw_RetrunContent, Using_Money = (decimal)record.Using_Money, Return_Money = (decimal)record.Return_Money, Win_Money = (decimal)(record.Get_Money + record.Araw_ReturnMoney + record.Return_Money - record.Using_Money), Year = award.Year, award_Name = award.Name, PrizeContent = award.PrizeContent, First_Name = clue.First_Name, Second_Name = clue.Second_Name, user_Name = user.Name, GlobeList = Globe_S.GetBase(award.PrizeContent, Globe_List), }; } catch (Exception ex) { LogHelper.Error(ex); } return(Operation_Record_S); }
public static void MoneyAnsys(Operation_Record Operation_Record , decimal Using_Money, UserInfo userInfo, MoneyType MoneyType, string Araw_RetrunContent) { try { List <Award_Public> Award_Public_List = Constant.Award_Public_List; List <Operation_Record> Operation_Record_List = Constant.Operation_Record_List; List <Globe_Clue> Globe_Clue_List = Constant.Globe_Clue_List; List <UserInfo> UserInfo_List = Constant.userInfo_List; List <Globe> Globe_List = Constant.Globe_List; List <MoneyLog> MoneyLog_List = Constant.MoneyLog_List; MoneyLog MoneyLog = MoneyLog = new MoneyLog() { UserID = userInfo.LoginName, UserName = userInfo.Name, O_Money = Using_Money, CreateTime = DateTime.Now, OperationType = (int)MoneyType, CreateUID = userInfo.LoginName, IsDelete = 0, IsEnable = (int)IsEnable.Enable, }; if (MoneyType == TLC_Model.Enums.MoneyType.充值) { MoneyLog.Type = (int)MoneyLogType.Add; MoneyLog.O_Content = "操作内容:" + "充值" + ";金额:" + Using_Money; } else if (MoneyType == TLC_Model.Enums.MoneyType.提现) { MoneyLog.Type = (int)MoneyLogType.Reduce; MoneyLog.O_Content = "操作内容:" + "提现" + ";金额:" + Using_Money; } else { //为了做支出支入做统计 Globe_Clue clue = Globe_Clue_List.FirstOrDefault(i => i.Code == Operation_Record.ClueCode); Award_Public Award_Public = Award_Public_List.FirstOrDefault(i => i.Code == Operation_Record.AwardCode); Operation_Record_S os = OperationManage.Get_Operation_Record_S(Operation_Record, Award_Public, clue, userInfo, Globe_List); OperationManage.SetContent(clue, os); switch (MoneyType) { case MoneyType.注: MoneyLog.Type = (int)MoneyLogType.Reduce; MoneyLog.O_Content = "操作内容:" + "下注->" + "年号->" + Award_Public.Year + "期号->" + Award_Public.Name + clue.First_Name + "->" + clue.Second_Name + "->下注内容(" + os.BuyDisplay + os.BuyDisplay2 + ")->下注单价(" + Operation_Record.UnitPrice + ")" + ";金额:" + Using_Money; break; case MoneyType.返还奖金: MoneyLog.Type = (int)MoneyLogType.Add; MoneyLog.O_Content = "操作内容:" + "返水->" + "年号->" + Award_Public.Year + "期号->" + Award_Public.Name + clue.First_Name + "->" + clue.Second_Name + "->下注内容(" + os.BuyDisplay + os.BuyDisplay2 + ")->下注单价(" + Operation_Record.UnitPrice + ")" + ";金额:" + Using_Money; break; case MoneyType.中奖: MoneyLog.Type = (int)MoneyLogType.Add; MoneyLog.O_Content = "操作内容:" + "中奖->" + "年号->" + Award_Public.Year + "期号->" + Award_Public.Name + clue.First_Name + "->" + clue.Second_Name + "->下注内容(" + os.BuyDisplay + os.BuyDisplay2 + ")->下注单价(" + Operation_Record.UnitPrice + ")" + ")->派奖内容【" + Araw_RetrunContent + "】" + ";金额:" + Using_Money; break; case MoneyType.综合: MoneyLog.Type = (int)MoneyLogType.Add; MoneyLog.O_Content = "操作内容:" + "和局->" + "年号->" + Award_Public.Year + "期号->" + Award_Public.Name + clue.First_Name + "->" + clue.Second_Name + "->下注内容(" + os.BuyDisplay + os.BuyDisplay2 + ")->下注单价(" + Operation_Record.UnitPrice + ")" + ")->派奖内容【" + Araw_RetrunContent + "】" + ";金额:" + Using_Money; break; case MoneyType.充值: default: break; } } var jsm = Constant.MoneyLog_S.Add(MoneyLog); if (jsm.errNum == 0) { MoneyLog.Id = Convert.ToInt32(jsm.retData); MoneyLog_List.Add(MoneyLog); } } catch (Exception ex) { LogHelper.Error(ex); } }
/// <summary> /// 结果处理 /// </summary> /// <param name="Award_Public"></param> /// <param name="record"></param> public static void AwardDealWidth(Award_Public Award_Public, Operation_Record record, string PrizeContent) { try { List <UserInfo> UserInfo_List = Constant.UserInfo_List; Globe_Clue clue = Constant.Globe_Clue_List.FirstOrDefault(i => i.Code == record.ClueCode); decimal getMoney = 0; List <Araw_Return_S> Araw_Return_Ss = new List <Araw_Return_S>(); List <string> NoAwardList = new List <string>(); List <string> AwardList = new List <string>(); int paytype = 0; if (!string.IsNullOrEmpty(PrizeContent)) { if (clue != null) { switch ((GlobeClueType)clue.First_Type) { case GlobeClueType.Special: getMoney = SpecialModel.GetAward(PrizeContent, record, Constant.Globe_List, Constant.Size_Special_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList, ref paytype); break; case GlobeClueType.Normal: getMoney = NormalModel.GetAward(PrizeContent, record, Constant.Globe_List, ref AwardList); break; case GlobeClueType.SpecialNormal: getMoney = SpecialNormalModel.GetAward(clue, PrizeContent, record, Constant.Globe_List, Constant.Size_SpecialNormal_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList, ref paytype); break; case GlobeClueType.NormalSix: getMoney = NormalSixModel.GetAward(PrizeContent, record, Constant.Size_Six_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList); break; case GlobeClueType.Line: getMoney = LineModel.GetAward(clue, PrizeContent, record, ref AwardList); break; case GlobeClueType.Wave: getMoney = WaveModel.GetAward(PrizeContent, record, Constant.Wave_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList); break; case GlobeClueType.Detail: getMoney = Globe_ClueDetail.GetAward(PrizeContent, record, Constant.Animal_Info_List, Constant.Detail_List, ref AwardList); break; case GlobeClueType.SpecialAnimal: getMoney = SpecialAnimalModel.GetAward(PrizeContent, record, Constant.Animal_Info_List, ref AwardList); break; case GlobeClueType.CombineAnimal: getMoney = Globe_ClueCombineAnimal.GetAward(PrizeContent, record, Constant.Animal_Info_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList); break; case GlobeClueType.LineAnimal: getMoney = LineAnimalModel.GetAward(clue, PrizeContent, record, Constant.Animal_Info_List, ref AwardList); break; case GlobeClueType.LineDetail: getMoney = LineDetaillModel.GetAward(clue, PrizeContent, record, Constant.Detail_List, ref AwardList); break; case GlobeClueType.NotAll: getMoney = NotAllModel.GetAward(PrizeContent, record); break; default: break; } } } //最终完成【结束】 Operation_Record record_Clone = Constant.Clone <Operation_Record>(record); if (paytype == 1) { //返率的钱 record_Clone.Return_Money = (decimal)(clue.Return_Pay2 * record_Clone.Using_Money); } else { //返率的钱 record_Clone.Return_Money = (decimal)(clue.Return_Pay * record_Clone.Using_Money); } //获奖的钱 record_Clone.Get_Money = (decimal)getMoney; if (Araw_Return_Ss.Count > 0) { #region 和局的情况下 //record_Clone.IsWin = (int)IsWinType.综合; //record_Clone.Araw_ReturnMoney = 0; //record_Clone.Araw_RetrunContent = "和局:("; //for (int i = 0; i < Araw_Return_Ss.Count ; i++) //{ // //和局返的钱 // record_Clone.Araw_ReturnMoney += Araw_Return_Ss[i].Araw_Money; // if (i != Araw_Return_Ss.Count - 1) // { // record_Clone.Araw_RetrunContent += Araw_Return_Ss[i].Name += ","; // } // else // { // record_Clone.Araw_RetrunContent += Araw_Return_Ss[i].Name += ")"; // } //} //if (NoAwardList.Count > 0) //{ // record_Clone.Araw_RetrunContent += "、不中奖:("; // for (int i = 0; i < NoAwardList.Count; i++) // { // if (i != NoAwardList.Count - 1) // { // record_Clone.Araw_RetrunContent += NoAwardList[i] += ","; // } // else // { // record_Clone.Araw_RetrunContent += NoAwardList[i] += ")"; // } // } //} //if (AwardList.Count > 0) //{ // record_Clone.Araw_RetrunContent += "、中奖:("; // for (int i = 0; i < AwardList.Count; i++) // { // if (i != AwardList.Count - 1) // { // record_Clone.Araw_RetrunContent += AwardList[i] += ","; // } // else // { // record_Clone.Araw_RetrunContent += AwardList[i] += ")"; // } // } //} #endregion } else if (record_Clone.Get_Money > 0) { record_Clone.IsWin = (int)IsWinType.获奖; if (AwardList.Count > 0) { record_Clone.Araw_RetrunContent += "中奖:("; for (int i = 0; i < AwardList.Count; i++) { if (i != AwardList.Count - 1) { record_Clone.Araw_RetrunContent += AwardList[i] += ","; } else { record_Clone.Araw_RetrunContent += AwardList[i] += ")"; } } } } else { record_Clone.IsWin = (int)IsWinType.未获奖; } var jsm = Constant.Operation_Record_S.Update(record_Clone); if (jsm.errNum == 0) { record.Get_Money = record_Clone.Get_Money; record.Return_Money = record_Clone.Return_Money; record.Araw_ReturnMoney = record_Clone.Araw_ReturnMoney; record.Araw_RetrunContent = record_Clone.Araw_RetrunContent; record.IsWin = record_Clone.IsWin; UserInfo user = UserInfo_List.FirstOrDefault(u => u.LoginName == record.UserID); if (user != null) { UserInfo userinfo_Clone = Constant.Clone <UserInfo>(user); userinfo_Clone.Money += record_Clone.Get_Money; userinfo_Clone.Money += record.Araw_ReturnMoney; userinfo_Clone.Money += record.Return_Money; var jsm2 = Constant.UserInfo_S.Update(userinfo_Clone); if (jsm2.errNum == 0) { user.Money += record_Clone.Get_Money; user.Money += record.Araw_ReturnMoney; user.Money += record.Return_Money; if (record.Get_Money > 0) { //支出支入 Constant.MoneyAnsys(record, (decimal)record.Get_Money, user, MoneyType.中奖, record.Araw_RetrunContent); } if (record.Araw_ReturnMoney > 0) { //支出支入 //Constant.MoneyAnsys(record, (decimal)record.Araw_ReturnMoney, user, MoneyType.综合, record.Araw_RetrunContent); } if (record.Return_Money > 0) { //支出支入 Constant.MoneyAnsys(record, (decimal)record.Return_Money, user, MoneyType.返还奖金, ""); } } else { jsm = JsonModel.GetJsonModel(300, "操作失败"); } } else { jsm = JsonModel.GetJsonModel(300, "操作失败"); } } else { jsm = JsonModel.GetJsonModel(300, "操作失败"); } } catch (Exception ex) { LogHelper.Error(ex); } }
public static JsonModel EditAward_Helper(int Id, string EditUID, int Year, int Name, string PrizeContent, DateTime StartTime, DateTime EndTime, DateTime CloseTime) { JsonModel jsm = null; try { List <Award_Public> Award_Public_List = Constant.Award_Public_List; Award_Public award_Edit = Award_Public_List.FirstOrDefault(award => award.Id == Id); if (award_Edit != null) { Award_Public award_Public = Award_Public_List.FirstOrDefault(p => p.Year == Year && p.Name == Name && p.Id != Id); if (award_Public == null) { var Eva_Regular_Lists = (from award in Award_Public_List where award.Id != Id select award).ToList(); bool hasAcross = false; foreach (Award_Public regu in Eva_Regular_Lists) { //if (StartTime <= regu.StartTime && EndTime >= regu.CloseTime) //{ // hasAcross = true; // break; //} if (StartTime >= regu.StartTime && StartTime <= regu.CloseTime) { hasAcross = true; break; } //if (EndTime >= regu.StartTime && EndTime <= regu.CloseTime) //{ // hasAcross = true; // break; //} } if (!hasAcross) { Award_Public award_Edit_clone = Constant.Clone <Award_Public>(award_Edit); award_Edit_clone.EditUID = EditUID; award_Edit_clone.Year = Year; award_Edit_clone.Name = Name; award_Edit_clone.PrizeContent = PrizeContent; award_Edit_clone.EndTime = EndTime; award_Edit_clone.StartTime = StartTime; award_Edit_clone.CloseTime = CloseTime; jsm = Constant.Award_Public_S.Update(award_Edit_clone); if (jsm.errNum == 0) { award_Edit.EditUID = EditUID; award_Edit.Year = Year; award_Edit.Name = Name; award_Edit.PrizeContent = PrizeContent; award_Edit.EndTime = EndTime; award_Edit.StartTime = StartTime; award_Edit.CloseTime = CloseTime; jsm = JsonModel.GetJsonModel(0, "操作成功"); } else { jsm = JsonModel.GetJsonModel(300, "操作失败"); } } else { jsm = JsonModel.GetJsonModel(300, "和已知的奖项时间交叉"); } } else { jsm = JsonModel.GetJsonModel(300, "该期已存在"); } } else { jsm = JsonModel.GetJsonModel(300, "该奖项不存在"); } } catch (Exception ex) { LogHelper.Error(ex); } return(jsm); }
public static JsonModel AddAward_Helper(string CreateUID, int Year, int Name, string PrizeContent, DateTime StartTime, DateTime EndTime, DateTime CloseTime) { JsonModel jsm = null; try { List <Award_Public> Award_Public_List = Constant.Award_Public_List; int prize_lastCode = Award_Public_List.Count > 0 ? Award_Public_List.Max(p => (int)p.Code) : 1; Award_Public award_Public = Award_Public_List.FirstOrDefault(p => p.Year == Year && p.Name == Name); if (award_Public == null) { bool hasAcross = false; foreach (Award_Public regu in Award_Public_List) { //if (StartTime <= regu.StartTime && EndTime >= regu.CloseTime) //{ // hasAcross = true; // break; //} if (StartTime >= regu.StartTime && StartTime <= regu.CloseTime) { hasAcross = true; break; } //if (EndTime >= regu.StartTime && EndTime <= regu.CloseTime) //{ // hasAcross = true; // break; //} } if (!hasAcross) { Award_Public award_Public_new = new TLC_Model.Award_Public() { CreateUID = CreateUID, Year = Year, Name = Name, PrizeContent = PrizeContent, Code = prize_lastCode + 1, EndTime = EndTime, StartTime = StartTime, CloseTime = CloseTime, IsCompleate = (int)IsCompleate.No, CreateTime = DateTime.Now, IsEnable = (int)IsEnable.Enable, IsDelete = 0, }; jsm = Constant.Award_Public_S.Add(award_Public_new); if (jsm.errNum == 0) { award_Public_new.Id = Convert.ToInt32(jsm.retData); Constant.Award_Public_List.Add(award_Public_new); } else { jsm = JsonModel.GetJsonModel(300, "操作失败"); } } else { jsm = JsonModel.GetJsonModel(300, "和已知的奖项时间交叉"); } } else { jsm = JsonModel.GetJsonModel(300, "该期已存在"); } } catch (Exception ex) { LogHelper.Error(ex); } return(jsm); }