public int InsertPointPacketConfig(PointPacketConfig pointpacketconfig) { int rs = 0; ctx.PointPacketConfigs.Add(pointpacketconfig); rs = ctx.SaveChanges(); return(rs); }
public int UpdatePointPacketConfig(PointPacketConfig pointpacketconfig) { int rs = 0; DbEntityEntry <PointPacketConfig> packetentry = ctx.Entry(pointpacketconfig); packetentry.State = EntityState.Modified; rs = ctx.SaveChanges(); return(rs); }
/// <summary> /// 删除 /// </summary> /// <param name="PointPacketConfig">要删除的 实际使用ConfigId删除</param> /// <returns></returns> public ActionResult DelPointPacketConfig(PointPacketConfig PointPacketConfig) { int rs = CampEventsBll.DeletePointPacketConfig(PointPacketConfig); //记录日志 Log(string.Format("删除[PointPacketConfig]数据:{0}", PointPacketConfig.ToString())); return(DelResult(rs, "PointPacketConfigList")); }
public ActionResult EditPointPacketConfig(PointPacketConfig PointPacketConfig) { int rs = CampEventsBll.UpdatePointPacketConfig(PointPacketConfig); //记录日志 Log(string.Format("编辑[PointPacketConfig]数据:{0}", PointPacketConfig.ToString())); return(EditResult(rs, "操作失败", "PointPacketConfigList")); }
public ActionResult AddPointPacketConfig(PointPacketConfig PointPacketConfig) { int rs = CampEventsBll.InsertPointPacketConfig(PointPacketConfig); //记录日志 Log(string.Format("新增PointPacketConfig 数据:{0}", PointPacketConfig.ToString())); return(EditResult(rs, "操作失败", "PointPacketConfigList")); }
/// <summary> /// 增加 /// </summary> /// <returns></returns> public ActionResult AddPointPacketConfig() { PointPacketConfig PointPacketConfig = new PointPacketConfig(); //记录日志 Log(string.Format("查看[PointPacketConfig]新增页面")); return(View(PointPacketConfig)); }
public ResultInfo ExchangePointPacket(UserInfo userinfo) { string source = "CampEvents_ExchangePointPacket"; ResultInfo resultinfo = new ResultInfo() { Result = ErrorCode.PacketFailed, IsNotice = false, PacketName = "" }; int CampId = ctx.UserCampLogs.Where(p => p.AreaId == userinfo.AreaId && p.UserId == userinfo.UserId && p.AvatarId == userinfo.AvatarId).Select(p => p.CampId).SingleOrDefault(); if (CampId == default(int)) { resultinfo.Result = ErrorCode.NoCampFailed; return(resultinfo); } int TotalPoints = ctx.Wallets.Where(p => p.AreaId == userinfo.AreaId && p.UserId == userinfo.UserId && p.AvatarId == userinfo.AvatarId).Sum(p => (int?)p.DailyGetPoints).GetValueOrDefault(); //阵营不同个人积分奖励不同 //PointPacketConfig packetlist = ctx.PointPacketConfigs.Where(p => p.CampId == CampId && p.NeedPoints <= TotalPoints && p.ShowId == userinfo.ExchangeID).SingleOrDefault(); //阵营不同个人积分奖励相同 PointPacketConfig packetlist = ctx.PointPacketConfigs.Where(p => p.NeedPoints <= TotalPoints && p.ShowId == userinfo.ExchangeID).SingleOrDefault(); if (packetlist == null) { resultinfo.Result = ErrorCode.NoPoints; return(resultinfo); } bool IsExistRecord = ctx.PointPacketExchangeLogs.Any(p => p.AreaId == userinfo.AreaId && p.UserId == userinfo.UserId && p.AvatarId == userinfo.AvatarId && p.PointPacketConfigId == packetlist.ConfigId); if (IsExistRecord) { resultinfo.Result = ErrorCode.RepeatedFailed; return(resultinfo); } PointPacketExchangeLog exchangelog = new PointPacketExchangeLog() { UserId = userinfo.UserId, AreaId = userinfo.AreaId, AvatarId = userinfo.AvatarId, AvatarName = userinfo.AvatarName, Sex = userinfo.Sex, LoginName = userinfo.LoginName, CurrentPoints = TotalPoints, PointPacketConfigId = packetlist.ConfigId }; ctx.PointPacketExchangeLogs.Add(exchangelog); PacketQueue packetqueue = new PacketQueue() { UserId = userinfo.UserId, AreaId = userinfo.AreaId, AvatarId = userinfo.AvatarId, Sex = userinfo.Sex, PacketId = packetlist.PacketId, Source = source, FromId = exchangelog.Id }; ctx.PacketQueues.Add(packetqueue); int rs = ctx.SaveChanges(); if (rs == 2) { resultinfo.Result = ErrorCode.Succuess; resultinfo.IsNotice = packetlist.IsNotice; resultinfo.PacketName = packetlist.PacketName; } return(resultinfo); }
/// <summary> /// 查看 ] 编辑页面 /// </summary> /// <param name="ConfigId">要查看的ConfigId</param> /// <returns></returns> public ActionResult EditPointPacketConfig(int ConfigId) { DataPage dp = new DataPage { PageIndex = 1, PageSize = 0 }; PointPacketConfig PointPacketConfig = CampEventsBll.GetPointPacketConfigsList(ref dp).Where(p => p.ConfigId == ConfigId).Single(); //记录日志 Log(string.Format("查看[PointPacketConfig]]编辑页面 数据:{0}", ConfigId)); return(View("AddPointPacketConfig", PointPacketConfig)); }
public int DeletePointPacketConfig(PointPacketConfig pointpacketconfig) { int rs = 0; PointPacketConfig packetentry = ctx.PointPacketConfigs.Find(pointpacketconfig.ConfigId); if (packetentry == null) { return(rs); } ctx.PointPacketConfigs.Remove(packetentry); rs = ctx.SaveChanges(); return(rs); }
public int DeletePointPacketConfig(PointPacketConfig pointpacketconfig) { _admin = new CampEventsAdminService.CampEventsAdminServiceClient(); try { int rs = _admin.DeletePointPacketConfig(pointpacketconfig); _admin.Close(); return(rs); } catch (Exception ex) { _admin.CloseCatch(ex, "DeletePointPacketConfig failed"); return(0); } }
public int DeletePointPacketConfig(PointPacketConfig pointpacketconfig) { return(_dal.DeletePointPacketConfig(pointpacketconfig)); }
public int UpdatePointPacketConfig(PointPacketConfig pointpacketconfig) { return(_dal.UpdatePointPacketConfig(pointpacketconfig)); }
public int InsertPointPacketConfig(PointPacketConfig pointpacketconfig) { return(_dal.InsertPointPacketConfig(pointpacketconfig)); }