private void AllPass_Click(object sender, EventArgs e) { #region 将用户调整到相应的用户组 if (this.CheckCookie()) { if (UserCredits.GetCreditsUserGroupID(0) != null) { int tmpGroupID = UserCredits.GetCreditsUserGroupID(0).Groupid; //添加注册用户审核机制后需要修改 //DbHelper.ExecuteNonQuery(CommandType.Text, "UPDATE [" + BaseConfigs.GetTablePrefix + "users] SET [groupid]=" + tmpGroupID.ToString() + " WHERE [groupid]=8"); DatabaseProvider.GetInstance().ChangeUsergroup(8, tmpGroupID); //foreach (DataRow dr in DbHelper.ExecuteDataset("SELECT [uid] FROM [" + BaseConfigs.GetTablePrefix + "users] WHERE [groupid]=8").Tables[0].Rows) foreach (DataRow dr in DatabaseProvider.GetInstance().GetAudituserUid().Tables[0].Rows) { UserCredits.UpdateUserCredits(Convert.ToInt32(dr["uid"].ToString())); } //DbHelper.ExecuteNonQuery(CommandType.Text, "UPDATE [" + BaseConfigs.GetTablePrefix + "userfields] SET [authstr]='' WHERE [uid] IN (SELECT [uid] FROM [" + BaseConfigs.GetTablePrefix + "users] WHERE [groupid]=8 )"); DatabaseProvider.GetInstance().ClearAllUserAuthstr(); } if (sendemail.Checked) { SendEmail(); } base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';"); } #endregion }
public void BuyInviteCode() { if (invitecodecount >= invitationconfiginfo.InviteCodeMaxCountToBuy) { AddErrLine("您所拥有的邀请码数量超过了系统上限,无法再购买"); return; } string[] strExtCredits = Utils.SplitString(invitationconfiginfo.InviteCodePrice, ","); float[] extCredits = new float[8]; for (int i = 0; i < 8; i++) { extCredits[i] = Utils.StrToFloat(strExtCredits[i], 0) * -1; } if (UserCredits.UpdateUserExtCredits(userid, extCredits, false) > 0) { CreateInviteCode(); } else { string addExtCreditsTip = ""; if (EPayments.IsOpenEPayments()) { addExtCreditsTip = "<br/><span><a href=\"usercpcreditspay.aspx\">点击充值积分</a></span>"; } AddErrLine("积分不足,无法购买邀请码" + addExtCreditsTip); return; } }
/// <summary> /// 发帖成功 /// </summary> /// <param name="values">版块积分设置</param> /// <param name="topicinfo">主题信息</param> /// <param name="topicid">主题ID</param> private void PostTopicSucceed(float[] values, TopicInfo topicinfo, int topicid) { if (values != null) ///使用版块内积分 { UserCredits.UpdateUserExtCredits(userid, values, false); if (userid != -1) UserCredits.WriteUpdateUserExtCreditsCookies(values); } else ///使用默认积分 { UserCredits.UpdateUserCreditsByPostTopic(userid); if (userid != -1) UserCredits.WriteUpdateUserExtCreditsCookies(Scoresets.GetUserExtCredits(CreditsOperationType.PostTopic)); } //当使用伪aspx if (config.Aspxrewrite == 1) SetUrl(topicinfo.Special == 4 ? ShowDebateAspxRewrite(topicid) : ShowTopicAspxRewrite(topicid, 0)); else SetUrl((topicinfo.Special == 4 ? ShowDebateAspxRewrite(topicid) : ShowTopicAspxRewrite(topicid, 0)) + "&forumpage=" + forumpageid); ForumUtils.WriteCookie("postmessage", ""); ForumUtils.WriteCookie("clearUserdata", "forum"); SetLastPostedForumCookie(); SetMetaRefresh(); MsgForward("posttopic_succeed"); AddMsgLine("发表主题成功, 返回该主题<br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, forumpageid) + "\">点击这里返回 " + forum.Name + "</a>)<br />"); //通知应用有新主题 Sync.NewTopic(topicid.ToString(), topicinfo.Title, topicinfo.Poster, topicinfo.Posterid.ToString(), topicinfo.Fid.ToString(), ""); }
public Pop3Settings() { pop3UserCredits = new UserCredits(); smtpUserCredits = new UserCredits(); pop3UserCredits.Validate(); smtpUserCredits.Validate(); }
protected void Page_Load(object sender, EventArgs e) { var graph = PXGraph.CreateInstance <ARSetupMaint>(); var graphExt = graph.GetExtension <ARSetupMaint_Extension>(); UserCredits row = graphExt.userCreditsRec.Select().FirstOrDefault(); if (row == null) { var newUser = new UserCredits() { Userid = graph.Accessinfo.UserID, Credits = 1 }; graphExt.userCreditsRec.Insert(newUser); } else { row.Credits = row.Credits + 1; graphExt.userCreditsRec.Update(row); } graph.Actions.PressSave(); }
private static void ValidationTestCore(UserCredits userCredits) { Assert.AreEqual("The Username field is required.", userCredits.GetErrors(nameof(UserCredits.UserName)).Single().ErrorMessage); userCredits.UserName = "******"; Assert.IsFalse(userCredits.HasErrors); }
private void AllPass_Click(object sender, EventArgs e) { #region 将用户调整到相应的用户组 if (this.CheckCookie()) { if (UserCredits.GetCreditsUserGroupId(0) != null) { int tmpGroupId = Discuz.Forum.UserCredits.GetCreditsUserGroupId(0).Groupid; //添加注册用户审核机制后需要修改 UserGroups.ChangeAllUserGroupId(8, tmpGroupId);; foreach (DataRow dr in Users.GetUserListByGroupid(8).Rows) { UserCredits.UpdateUserCredits(Convert.ToInt32(dr["uid"].ToString())); } Users.ClearUsersAuthstrByUncheckedUserGroup(); } if (sendemail.Checked) { Users.SendEmailForUncheckedUserGroup(); } base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';"); } #endregion }
private void SelectPass_Click(object sender, EventArgs e) { #region 将选中用户调整到相应的用户组 if (this.CheckCookie()) { string uidList = DNTRequest.GetString("uid"); if (uidList != "") { //将用户调整到相应的用户组 if (Discuz.Forum.UserCredits.GetCreditsUserGroupId(0) != null) { int tmpGroupId = UserCredits.GetCreditsUserGroupId(0).Groupid; //添加注册用户审核机制后需要修改 Users.UpdateUserGroupByUidList(tmpGroupId, uidList); foreach (string uid in uidList.Split(',')) { UserCredits.UpdateUserCredits(Convert.ToInt32(uid)); } Users.ClearUsersAuthstr(uidList); } if (sendemail.Checked) { Users.SendEmailForAccountCreateSucceed(uidList); } base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('请选择相应的用户!');window.location='forum_audituser.aspx';</script>"); } } #endregion }
/// <summary>创建用户</summary> public static UserInfo CreateUser(this HttpContextBase context, GeneralConfigInfo config, IPKSPrincipal principal, bool isAdmin) { var userInfo = CreateUser(config, principal, isAdmin); #region 发送欢迎信息 if (config.Welcomemsg == 1) { // 收件箱 PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo(); privatemessageinfo.Message = config.Welcomemsgtxt; privatemessageinfo.Subject = "欢迎您的加入! (请勿回复本信息)"; privatemessageinfo.Msgto = userInfo.Username; privatemessageinfo.Msgtoid = userInfo.Uid; privatemessageinfo.Msgfrom = PrivateMessages.SystemUserName; privatemessageinfo.Msgfromid = 0; privatemessageinfo.New = 1; privatemessageinfo.Postdatetime = userInfo.Joindate; privatemessageinfo.Folder = 0; PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0); } #endregion //发送同步数据给应用程序 Sync.UserRegister(userInfo.Uid, userInfo.Username, userInfo.Password, ""); //SetUrl("index.aspx"); //SetShowBackLink(false); //SetMetaRefresh(config.Regverify == 0 ? 2 : 5); Statistics.ReSetStatisticsCache(); //if (inviteCode != null) //{ // Invitation.UpdateInviteCodeSuccessCount(inviteCode.InviteId); // if (config.Regstatus == 3) // { // if (inviteCode.SuccessCount + 1 >= inviteCode.MaxCount) // Invitation.DeleteInviteCode(inviteCode.InviteId); // } //} var oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout); if (config.Regverify == 0) { UserCredits.UpdateUserCredits(userInfo.Uid); //ForumUtils.WriteUserCookie(user, -1, config.Passwordkey); OnlineUsers.UpdateAction(oluserinfo.Olid, UserAction.Register.ActionID, 0, config.Onlinetimeout); //MsgForward("register_succeed"); //AddMsgLine("注册成功, 返回登录页"); } else { if (config.Regverify == 1) { //AddMsgLine("注册成功, 请您到您的邮箱中点击激活链接来激活您的帐号"); } else if (config.Regverify == 2) { //AddMsgLine("注册成功, 但需要系统管理员审核您的帐户后才可登录使用"); } } //ManyouApplications.AddUserLog(userInfo.Uid, UserLogActionEnum.Add); return(userInfo); }
private void SetPostInfo_Click(object sender, EventArgs e) { #region 除选中的帖子 if (this.CheckCookie()) { if (DNTRequest.GetString("pid") != "") { string pidlist = DNTRequest.GetString("pid"); string posttableid = ViewState["posttablename"].ToString().Trim().Replace(BaseConfigs.GetTablePrefix + "posts", ""); posttableid = (posttableid == "" ? "1" : posttableid); foreach (string idlist in DNTRequest.GetString("pid").Split(',')) { int pid = int.Parse(idlist.Split('|')[0]); int tid = int.Parse(idlist.Split('|')[1]); #region 更新用户金币金币 PostInfo post = Posts.GetPostInfo(tid, pid); ForumInfo forum = Forums.GetForumInfo(post.Fid); int Losslessdel = Utils.StrDateDiffHours(post.Postdatetime, config.Losslessdel * 24); // 通过验证的用户可以删除帖子,如果是主题贴则另处理 if (post.Layer == 0) { TopicAdmins.DeleteTopics(tid.ToString(), byte.Parse(forum.Recyclebin.ToString()), false); //重新统计论坛帖数 Forums.SetRealCurrentTopics(forum.Fid); } else { int reval = Posts.DeletePost(posttableid, Convert.ToInt32(pid), false, true); if (reval > 0 && Losslessdel < 0) { UserCredits.UpdateUserCreditsByPosts(post.Posterid, -1); } // 删除主题游客缓存 ForumUtils.DeleteTopicCacheFile(tid.ToString()); //再次确保回复数精确 Topics.UpdateTopicReplies(tid); } #endregion } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量删帖", "帖子ID:" + pidlist); base.RegisterStartupScript("PAGE", "window.location.href='forum_searchpost.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_searchpost.aspx';</script>"); } } #endregion }
public void ValidationTest() { UserCredits userCredits = new UserCredits(); Assert.AreEqual("The Username field is required.", userCredits.Validate(nameof(UserCredits.UserName))); userCredits.UserName = "******"; Assert.AreEqual("", userCredits.Validate(nameof(UserCredits.UserName))); }
/// <summary> /// 更新用户金币 /// </summary> /// <param name="postTableId">分表id</param> /// <param name="pidlist">通过审核帖子的Pid列表</param> private void UpdateUserCredits(string tidlist, string pidlist) { string[] tidarray = tidlist.Split(','); string[] pidarray = pidlist.Split(','); float[] values = null; ForumInfo forum = null; PostInfo post = null; int fid = -1; for (int i = 0; i < pidarray.Length; i++) { //Topics.get post = Posts.GetPostInfo(int.Parse(tidarray[i]), int.Parse(pidarray[i])); //获取帖子信息 if (fid != post.Fid) //当上一个和当前主题不在一个版块内时,重新读取版块的金币设置 { fid = post.Fid; forum = Forums.GetForumInfo(fid); if (!forum.Replycredits.Equals("")) { int index = 0; float tempval = 0; values = new float[8]; foreach (string ext in Utils.SplitString(forum.Replycredits, ",")) { if (index == 0) { if (!ext.Equals("True")) { values = null; break; } index++; continue; } tempval = Utils.StrToFloat(ext, 0.0f); values[index - 1] = tempval; index++; if (index > 8) { break; } } } } if (values != null) { ///使用版块内金币 UserCredits.UpdateUserCreditsByPosts(post.Posterid, values); } else { ///使用默认金币 UserCredits.UpdateUserCreditsByPosts(post.Posterid); } } }
private void CalculatorScore_Click(object sender, EventArgs e) { #region 计算金币 if (this.CheckCookie()) { credits.Text = UserCredits.GetUserCreditsByUid(DNTRequest.GetInt("uid", -1)).ToString(); } #endregion }
public PaginatedItemsResponse <UserCredits> GetTransactionsPaginated(PaginatedRequest model) { List <UserCredits> TransactionsList = null; PaginatedItemsResponse <UserCredits> response = null; DataProvider.ExecuteCmd(GetConnection, "dbo.UserCredits_SelectAll" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@CurrentPage", model.CurrentPage); paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage); paramCollection.AddWithValue("@Query", model.Query); }, map : delegate(IDataReader reader, short set) { if (set == 0) { UserCredits data = new UserCredits(); int startingIndex = 0; //startingOrdinal data.Id = reader.GetSafeInt32(startingIndex++); data.UserId = reader.GetSafeString(startingIndex++); data.Amount = reader.GetSafeDecimal(startingIndex++); data.TransactionId = reader.GetSafeInt32(startingIndex++); data.JobId = reader.GetSafeInt32(startingIndex++); data.DateAdded = reader.GetSafeDateTime(startingIndex++); UserMini User = new UserMini(); User.FirstName = reader.GetSafeString(startingIndex++); User.LastName = reader.GetSafeString(startingIndex++); User.Email = reader.GetSafeString(startingIndex++); User.Phone = reader.GetSafeString(startingIndex++); User.Url = reader.GetSafeString(startingIndex++); data.User = User; if (TransactionsList == null) { TransactionsList = new List <UserCredits>(); } TransactionsList.Add(data); } else if (set == 1) { response = new PaginatedItemsResponse <UserCredits>(); response.TotalItems = reader.GetSafeInt32(0); } } ); response.Items = TransactionsList; response.CurrentPage = model.CurrentPage; response.ItemsPerPage = model.ItemsPerPage; return(response); }
public NotifyPage() { if (EPayments.CheckPayment(DNTRequest.GetString("notify_id")))//验证请求是否来自支付宝,或者是伪造的 { //获取需要的信息 int orderStatus = EPayments.ConvertAlipayTradeStatus(DNTRequest.GetString("trade_status")); string orderCode = DNTRequest.GetString("out_trade_no", true); string tradeNo = DNTRequest.GetString("trade_no", true); if (string.IsNullOrEmpty(orderCode) || string.IsNullOrEmpty(tradeNo) || orderStatus <= 0) { return; } CreditOrderInfo orderInfo = CreditOrders.GetCreditOrderInfoByOrderCode(orderCode); //如果订单状态为未成功交易 if (orderInfo != null && orderInfo.OrderStatus < 2) { float[] extcredits = new float[8]; extcredits[orderInfo.Credit - 1] = orderInfo.Amount; if (UserCredits.UpdateUserExtCredits(orderInfo.Uid, extcredits, true) != 1) { orderStatus = 0; } CreditsLogs.AddCreditsLog(orderInfo.Uid, orderInfo.Uid, orderInfo.Credit, orderInfo.Credit, 0, orderInfo.Amount, Utils.GetDateTime(), 3);//添加积分兑换转账和充值记录 NoticeInfo notice = new NoticeInfo(); notice.Postdatetime = Utils.GetDateTime(); notice.Type = NoticeType.GoodsTradeNotice; notice.Poster = "系统"; notice.Posterid = 0; notice.Uid = orderInfo.Uid; notice.Note = string.Format("您购买的积分 {0} 已经成功充值,请<a href=\"usercpcreaditstransferlog.aspx\">查收</a>!(支付宝订单号:{1})", ForumUtils.ConvertCreditAndAmountToWord(orderInfo.Credit, orderInfo.Amount), tradeNo); Notices.CreateNoticeInfo(notice); CreditOrders.UpdateCreditOrderInfo(orderInfo.OrderId, tradeNo, orderStatus, Utils.GetDateTime());//修改积分订单记录状态 } //判断当前请求是支付宝GET式(直接跳转)或者是服务器POST式(需返回success使得支付宝停止继续发送通知) if (DNTRequest.IsPost()) { HttpContext.Current.Response.Write("success"); } else { HttpContext.Current.Response.Redirect("../usercpcreaditstransferlog.aspx?paysuccess=true"); } } else { HttpContext.Current.Response.Write("fail"); } }
public void ValidationTest() { var userCredits = new UserCredits(); userCredits.Validate(); var clone = userCredits.Clone(); ValidationTestCore(userCredits); ValidationTestCore(clone); }
public void PropertiesTest() { var userCredits = new UserCredits(); AssertHelper.PropertyChangedEvent(userCredits, x => x.UserName, () => userCredits.UserName = "******"); Assert.AreEqual("bill", userCredits.UserName); AssertHelper.PropertyChangedEvent(userCredits, x => x.Password, () => userCredits.Password = "******"); Assert.AreEqual("secret", userCredits.Password); }
/// <summary> /// 更新用户金币 /// </summary> /// <param name="tidlist">通过审核主题的Tid列表</param> private void UpdateUserCredits(string tidlist) { string[] tidarray = tidlist.Split(','); float[] values = null; ForumInfo forum = null; TopicInfo topic = null; int fid = -1; foreach (string tid in tidarray) { topic = Topics.GetTopicInfo(int.Parse(tid)); //获取主题信息 if (fid != topic.Fid) //当上一个和当前主题不在一个版块内时,重新读取版块的金币设置 { fid = topic.Fid; forum = Forums.GetForumInfo(fid); if (!forum.Postcredits.Equals("")) { int index = 0; float tempval = 0; values = new float[8]; foreach (string ext in Utils.SplitString(forum.Postcredits, ",")) { if (index == 0) { if (!ext.Equals("True")) { values = null; break; } index++; continue; } tempval = Utils.StrToFloat(ext, 0); values[index - 1] = tempval; index++; if (index > 8) { break; } } } } if (values != null) { ///使用版块内金币 UserCredits.UpdateUserCreditsByPostTopic(topic.Posterid, values); } else { ///使用默认金币 UserCredits.UpdateUserCreditsByPostTopic(topic.Posterid); } } }
public void CloneTest() { var userCredits = new UserCredits() { UserName = "******", Password = "******" }; var clone = userCredits.Clone(); Assert.AreNotEqual(userCredits, clone); Assert.AreEqual(userCredits.UserName, clone.UserName); Assert.AreEqual(userCredits.Password, clone.Password); }
private void StopTalk_Click(object sender, EventArgs e) { #region 设置禁言 if (this.CheckCookie()) { userInfo = AdminUsers.GetUserInfo(DNTRequest.GetInt("uid", -1)); if (!AllowEditUserInfo(DNTRequest.GetInt("uid", -1), true)) { return; } if (ViewState["Groupid"].ToString() != "4") //当用户不是系统禁言组时 { if (userInfo.Uid > 1) //判断是不是当前uid是不是系统初始化时生成的uid { if (AlbumPluginProvider.GetInstance() != null) { AlbumPluginProvider.GetInstance().Ban(userInfo.Uid); } if (SpacePluginProvider.GetInstance() != null) { SpacePluginProvider.GetInstance().Ban(userInfo.Uid); } Users.UpdateUserToStopTalkGroup(userInfo.Uid.ToString()); base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败,你要禁言的用户是系统初始化时的用户,因此不能操作!');window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';</script>"); } } else { if (UserCredits.GetCreditsUserGroupId(0) != null) { int tmpGroupID = UserCredits.GetCreditsUserGroupId(userInfo.Credits).Groupid; Users.UpdateUserGroup(userInfo.Uid, tmpGroupID); base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败,系统未能找到合适的用户组来调整当前用户所处的组!');window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';</script>"); } } OnlineUsers.DeleteUserByUid(userInfo.Uid); } #endregion }
private void DoBanUserOperation() { string actions = string.Empty; string reason = DNTRequest.GetString("reason"); if (reason == string.Empty) { AddErrLine("请填写操作原因"); return; } switch (DNTRequest.GetInt("bantype", -1)) { case 0: //正常状态 Discuz.Forum.Users.UpdateUserGroup(operateduid, UserCredits.GetCreditsUserGroupID(operateduser.Credits).Groupid); actions = "解除禁止用户"; AddMsgLine("已根据金币将用户归组, 将返回之前页面"); break; case 1: //禁止发言 Discuz.Forum.Users.UpdateUserGroup(operateduid, 4); actions = "禁止用户发言"; AddMsgLine("已成功禁止所选用户发言, 将返回之前页面"); break; case 2: //禁止发言 Discuz.Forum.Users.UpdateUserGroup(operateduid, 5); actions = "禁止用户访问"; AddMsgLine("已成功禁止所选用户访问, 将返回之前页面"); break; default: AddErrLine("错误的禁止类型"); return; } AdminModeratorLogs.InsertLog(userid.ToString(), username, usergroupid.ToString(), usergroupinfo.Grouptitle, DNTRequest.GetIP(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "0", string.Empty, "0", string.Empty, actions, reason); RedirectURL(); }
protected override void ShowPage() { pagetitle = "用户帐号激活"; SetUrl("index.aspx"); SetMetaRefresh(); SetShowBackLink(false); string authstr = Utils.HtmlEncode(DNTRequest.GetString("authstr").Trim()).Replace("'", "''"); if (authstr != null && authstr != "") { DataTable dt = Discuz.Forum.Users.GetUserIdByAuthStr(authstr); if (dt.Rows.Count > 0) { int uid = Convert.ToInt32(dt.Rows[0][0].ToString()); //将用户调整到相应的用户组 if (UserCredits.GetCreditsUserGroupID(0) != null) { int tmpGroupID = UserCredits.GetCreditsUserGroupID(0).Groupid; //添加注册用户审核机制后需要修改 Discuz.Forum.Users.UpdateUserGroup(uid, tmpGroupID); } //更新激活字段 Discuz.Forum.Users.UpdateAuthStr(uid, "", 0); AddMsgLine("您当前的帐号已经激活,稍后您将以相应身份返回首页"); ForumUtils.WriteUserCookie(uid, Utils.StrToInt(DNTRequest.GetString("expires"), -1), config.Passwordkey); OnlineUsers.UpdateAction(olid, UserAction.ActivationUser.ActionID, 0, config.Onlinetimeout); } else { AddMsgLine("您当前的激活链接无效,稍后您将以游客身份返回首页"); OnlineUsers.DeleteRows(olid); ForumUtils.ClearUserCookie(); } } else { AddMsgLine("您当前的激活链接无效,稍后您将以游客身份返回首页"); OnlineUsers.DeleteRows(olid); ForumUtils.ClearUserCookie(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { #region 初始化控件 groupid.AddTableData(DatabaseProvider.GetInstance().GetGroupInfo()); AddUserInfo.Attributes.Add("onclick", "return IsValidPost();"); //将金币设置数据加载到Javascript数组,在前台改变 string scriptText = "var creditarray = new Array("; for (int i = 1; i < groupid.Items.Count; i++) { scriptText += AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(groupid.Items[i].Value)).Creditshigher.ToString() + ","; } scriptText = scriptText.TrimEnd(',') + ");"; this.RegisterStartupScript("begin", "<script type='text/javascript'>" + scriptText + "</script>"); groupid.Attributes.Add("onchange", "document.getElementById('" + credits.ClientID + "').value=creditarray[this.selectedIndex];"); groupid.Items.RemoveAt(0); try { groupid.SelectedValue = "10"; } catch { if (UserCredits.GetCreditsUserGroupID(0) != null) { groupid.SelectedValue = UserCredits.GetCreditsUserGroupID(0).Groupid.ToString(); } else { groupid.SelectedValue = "3"; } } try { UserGroupInfo _usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(groupid.SelectedValue)); credits.Text = _usergroupinfo.Creditshigher.ToString(); } catch { ; } #endregion } }
private void InitializeComponent() { this.StopTalk.Click += new EventHandler(this.StopTalk_Click); this.DelPosts.Click += new EventHandler(this.DelPosts_Click); this.SaveUserInfo.Click += new EventHandler(this.SaveUserInfo_Click); this.ResetPassWord.Click += new EventHandler(this.ResetPassWord_Click); this.IsEditUserName.CheckedChanged += new EventHandler(this.IsEditUserName_CheckedChanged); this.DelUserInfo.Click += new EventHandler(this.DelUserInfo_Click); this.ReSendEmail.Click += new EventHandler(this.ReSendEmail_Click); this.CalculatorScore.Click += new EventHandler(this.CalculatorScore_Click); this.ResetUserDigestPost.Click += new EventHandler(this.ResetUserDigestPost_Click); this.ResetUserPost.Click += new EventHandler(this.ResetUserPost_Click); this.GivenMedal.Click += new EventHandler(this.GivenMedal_Click); //UserCredits.UpdateUserCredits(DNTRequest.GetInt("uid", -1)); userInfo = AdminUsers.GetUserInfo(DNTRequest.GetInt("uid", -1)); UserGroupInfo tmpUserGroupInfo = UserCredits.GetCreditsUserGroupId(userInfo.Credits); groupid.Items.Add(new ListItem(UserGroups.GetUserGroupInfo(tmpUserGroupInfo.Groupid).Grouptitle, tmpUserGroupInfo.Groupid.ToString())); foreach (UserGroupInfo userGroupInfo in UserGroups.GetUserGroupList()) { //if (userGroupInfo.System == 0 && userInfo.Groupid != userGroupInfo.Groupid || userGroupInfo.Groupid == 7) // continue; if ((userGroupInfo.System == 0 && userGroupInfo.Radminid == 0) || userGroupInfo.Groupid == 7) { continue; } groupid.Items.Add(new ListItem(userGroupInfo.Grouptitle, userGroupInfo.Groupid.ToString())); extgroupids.Items.Add(new ListItem(userGroupInfo.Grouptitle, userGroupInfo.Groupid.ToString())); } templateid.AddTableData(Templates.GetValidTemplateList(), "name", "templateid"); templateid.Items[0].Text = "默认"; TabControl1.InitTabPage(); if (DNTRequest.GetString("uid") == "") { Response.Redirect("global_usergrid.aspx"); return; } LoadCurrentUserInfo(DNTRequest.GetInt("uid", -1)); LoadScoreInf(DNTRequest.GetString("uid"), DNTRequest.GetString("fieldname")); }
/// <summary> /// 创建短消息 /// </summary> /// <param name="folder">所属文件夹(0:收件箱,1:发件箱,2:草稿箱)</param> /// <param name="saveToSendBox">是否保存到发件箱</param> /// <param name="url">跳转链接</param> /// <param name="msg">提示信息</param> private void CreatePM(int folder, int saveToSendBox, string url, string msg) { if (folder != 2) { UserInfo touser = Users.GetUserInfo(msgtoid); // 检查接收人的短消息是否已超过接收人用户组的上限,管理组不受接收人短消息上限限制 int radminId = UserGroups.GetUserGroupInfo(usergroupid).Radminid; if (!(radminId > 0 && radminId <= 3) && PrivateMessages.GetPrivateMessageCount(msgtoid, -1) >= UserGroups.GetUserGroupInfo(touser.Groupid).Maxpmnum) { AddErrLine("抱歉,接收人的短消息已达到上限,无法接收"); return; } if (!Utils.InArray(Convert.ToInt32(touser.Newsletter).ToString(), "2,3,6,7")) { AddErrLine("抱歉,接收人拒绝接收短消息"); return; } } // 检查发送人的短消息是否已超过发送人用户组的上限 if (url != "usercpinbox.aspx" && PrivateMessages.GetPrivateMessageCount(userid, -1) >= usergroupinfo.Maxpmnum) { AddErrLine("抱歉,您的短消息已达到上限,无法保存到发件箱"); return; } pm.Folder = folder; if (UserCredits.UpdateUserCreditsBySendpms(base.userid) == -1) { AddErrLine("您的积分不足, 不能发送短消息"); return; } pm.Pmid = PrivateMessages.CreatePrivateMessage(pm, saveToSendBox); //发送邮件通知 if (DNTRequest.GetString("emailnotify") == "on") { SendNotifyEmail(Users.GetUserInfo(msgtoid).Email.Trim(), pm); } SetUrl(url); SetMetaRefresh(); SetShowBackLink(true); MsgForward("usercppostpm_succeed"); AddMsgLine(msg); }
public static List <UserCreditsForJobs> GetCreditsForJobPage(string UserId) { List <UserCreditsForJobs> list = null; DataProvider.ExecuteCmd(GetConnection, "dbo.Coupons_GetCreditsForJob" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@UserId", UserId); }, map : delegate(IDataReader reader, short set) { int startingIndex = 0; UserCreditsForJobs t = new UserCreditsForJobs(); t.Id = reader.GetSafeInt32(startingIndex++); t.DateCreated = reader.GetSafeDateTime(startingIndex++); t.Used = reader.GetSafeDateTimeNullable(startingIndex++); t.TokenHash = reader.GetSafeGuid(startingIndex++); t.UserId = reader.GetSafeString(startingIndex++); t.TokenType = reader.GetSafeInt32(startingIndex++); t.CouponId = reader.GetSafeInt32(startingIndex++); t.Email = reader.GetSafeString(startingIndex++); UserCredits UserCredits = new UserCredits(); UserCredits.Id = reader.GetSafeInt32(startingIndex++); UserCredits.UserId = reader.GetSafeString(startingIndex++); UserCredits.Amount = reader.GetSafeDecimal(startingIndex++); UserCredits.TransactionId = reader.GetSafeInt32(startingIndex++); UserCredits.JobId = reader.GetSafeInt32(startingIndex++); UserCredits.DateAdded = reader.GetSafeDateTime(startingIndex++); t.UserCredits = UserCredits; if (list == null) { list = new List <UserCreditsForJobs>(); } list.Add(t); }); return(list); }
/// <summary> /// 更新用户积分 /// </summary> /// <param name="values">版块积分设置</param> private void UpdateUserCredits(float[] values) { if (values != null) { UserCredits.UpdateUserExtCredits(userid, values, false);//使用版块内积分 if (userid != -1) { UserCredits.WriteUpdateUserExtCreditsCookies(values); } } else { UserCredits.UpdateUserCreditsByPosts(userid);//使用默认积分 if (userid != -1) { UserCredits.WriteUpdateUserExtCreditsCookies(Scoresets.GetUserExtCredits(CreditsOperationType.PostReply)); } } }
private void AllPass_Click(object sender, EventArgs e) { #region 将用户调整到相应的用户组 if (this.CheckCookie()) { if (UserCredits.GetCreditsUserGroupID(0) != null) { int tmpGroupID = UserCredits.GetCreditsUserGroupID(0).Groupid; //添加注册用户审核机制后需要修改 DatabaseProvider.GetInstance().ChangeUsergroup(8, tmpGroupID); foreach (DataRow dr in DatabaseProvider.GetInstance().GetAudituserUid().Tables[0].Rows) { UserCredits.UpdateUserCredits(Convert.ToInt32(dr["uid"].ToString())); } DatabaseProvider.GetInstance().ClearAllUserAuthstr(); } base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';"); } #endregion }
/// <summary> /// 不论是否提交都有的权限检查 /// </summary> /// <returns></returns> private bool CheckPermission() { // 如果是受灌水限制用户, 则判断是否是灌水 AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(useradminid); if (admininfo == null || admininfo.Disablepostctrl != 1) { int Interval = Utils.StrDateDiffSeconds(lastpostpmtime, config.Postinterval * 2); if (Interval < 0) { AddErrLine(string.Format("系统规定发帖或发短消息间隔为{0}秒, 您还需要等待 {1} 秒", (config.Postinterval * 2).ToString(), (Interval * -1).ToString())); return(false); } } if (!UserCredits.CheckUserCreditsIsEnough(userid, 1, CreditsOperationType.SendMessage, -1)) { AddErrLine("您的金币不足, 不能发送短消息"); return(false); } return(true); }
private void SelectPass_Click(object sender, EventArgs e) { #region 将选中用户调整到相应的用户组 if (this.CheckCookie()) { string uidlist = DNTRequest.GetString("uid"); if (uidlist != "") { //将用户调整到相应的用户组 if (UserCredits.GetCreditsUserGroupID(0) != null) { int tmpGroupID = UserCredits.GetCreditsUserGroupID(0).Groupid; //添加注册用户审核机制后需要修改 //DbHelper.ExecuteNonQuery(CommandType.Text, "UPDATE [" + BaseConfigs.GetTablePrefix + "users] SET [groupid]=" + tmpGroupID.ToString() + " WHERE [uid] IN (" + uidlist + ")"); DatabaseProvider.GetInstance().ChangeUserGroupByUid(tmpGroupID, uidlist); foreach (string uid in uidlist.Split(',')) { UserCredits.UpdateUserCredits(Convert.ToInt32(uid)); } //DbHelper.ExecuteNonQuery(CommandType.Text, "UPDATE [" + BaseConfigs.GetTablePrefix + "userfields] SET [authstr]='' WHERE [uid] IN (" + uidlist + ")"); DatabaseProvider.GetInstance().ClearAuthstrByUidlist(uidlist); } if (sendemail.Checked) { SendEmail(uidlist); } base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('请选择相应的用户!');window.location='forum_audituser.aspx';</script>"); } } #endregion }