コード例 #1
0
ファイル: CreditsFacade.cs プロジェクト: xiongeee/BBX
        //public static void Invite(int userId, int mount)
        //{
        //	if (userId > 0)
        //	{
        //		UpdateUserExtCredits(userId, mount, CreditsOperationType.Invite, 1, false);
        //	}
        //}

        public static UserGroup GetCreditsUserGroupId(float credits)
        {
            var       userGroupList  = UserGroup.FindAllWithCache();
            UserGroup userGroupInfo  = null;
            UserGroup userGroupInfo2 = null;

            foreach (var current in userGroupList)
            {
                if (!current.Is管理团队 && current.System == 0 && credits >= (float)current.Creditshigher && credits <= (float)current.Creditslower && (userGroupInfo == null || current.Creditshigher > userGroupInfo.Creditshigher))
                {
                    userGroupInfo = current;
                }
                if (userGroupInfo2 == null || userGroupInfo2.Creditshigher < current.Creditshigher)
                {
                    userGroupInfo2 = current;
                }
            }
            if (userGroupInfo2 != null && (float)userGroupInfo2.Creditshigher < credits)
            {
                userGroupInfo = userGroupInfo2;
            }
            if (userGroupInfo != null)
            {
                return(userGroupInfo);
            }
            return(new UserGroup());
        }
コード例 #2
0
        public void SetUserGroupRaterange(int scoreid)
        {
            bool flag = true;

            foreach (DataRow dataRow in Scoresets.GetScoreSet().Rows)
            {
                if (dataRow["id"].ToString() != "1" && dataRow["id"].ToString() != "2" && dataRow[scoreid + 1].ToString().Trim() != "0")
                {
                    flag = false;
                    break;
                }
            }
            if (flag)
            {
                //foreach (DataRow dataRow2 in UserGroups.GetRateRange(scoreid).Rows)
                //{
                //	UserGroups.UpdateRateRange(dataRow2["raterange"].ToString().Replace(scoreid + ",True,", scoreid + ",False,"), dataRow2["groupid"].ToInt(0));
                //}
                foreach (var item in UserGroup.FindAllWithCache())
                {
                    item.Raterange = item.Raterange.Replace(scoreid + ",True,", scoreid + ",False,");
                    item.Update();
                }
            }
        }
コード例 #3
0
        public void BindData()
        {
            this.DataGrid1.AllowCustomPaging = false;
            this.DataGrid1.TableHeaderName   = "系统组列表";
            List <UserGroup> list = new List <UserGroup>();

            foreach (UserGroup current in UserGroup.FindAllWithCache())
            {
                if (current.System == 1)
                {
                    list.Add(current);
                }
            }
            this.DataGrid1.BindData <UserGroup>(list);
        }
コード例 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         foreach (UserGroup ug in UserGroup.FindAllWithCache())
         {
             if (!ug.Is管理团队)
             {
                 this.sourceusergroup.Items.Add(new ListItem(ug.GroupTitle, ug.ID.ToString()));
                 this.targetusergroup.Items.Add(new ListItem(ug.GroupTitle, ug.ID.ToString()));
             }
         }
         foreach (UserGroup ug in UserGroup.GetAdminAndSpecialGroup())
         {
             this.sourceadminusergroup.Items.Add(new ListItem(ug.GroupTitle, ug.ID.ToString()));
             this.targetadminusergroup.Items.Add(new ListItem(ug.GroupTitle, ug.ID.ToString()));
         }
     }
 }
コード例 #5
0
ファイル: edituser.aspx.cs プロジェクト: xiongeee/BBX
        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);

            this.userInfo = Users.GetUserInfo(DNTRequest.GetInt("uid", -1));

            UserGroup creditsUserGroupId = CreditsFacade.GetCreditsUserGroupId((float)this.userInfo.Credits);

            this.groupid.Items.Add(new ListItem(creditsUserGroupId.GroupTitle, creditsUserGroupId.ID.ToString()));
            foreach (UserGroup current in UserGroup.FindAllWithCache())
            {
                if ((current.System != 0 || current.RadminID != 0) && current.ID != 7)
                {
                    this.groupid.Items.Add(new ListItem(current.GroupTitle, current.ID.ToString()));
                    this.extgroupids.Items.Add(new ListItem(current.GroupTitle, current.ID.ToString()));
                }
            }
            this.templateid.AddTableData(Template.GetValids(), "name", "id");
            this.templateid.Items[0].Text = "默认";
            this.TabControl1.InitTabPage();
            if (Request["uid"] == "")
            {
                base.Response.Redirect("usergrid.aspx");
                return;
            }
            this.LoadCurrentUserInfo(DNTRequest.GetInt("uid", -1));
            this.LoadScoreInf(Request["uid"], Request["fieldname"]);
        }
コード例 #6
0
ファイル: adduser.aspx.cs プロジェクト: xiongeee/BBX
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         foreach (UserGroup current in UserGroup.FindAllWithCache())
         {
             this.groupid.Items.Add(new ListItem(current.GroupTitle, current.ID.ToString()));
         }
         this.AddUserInfo.Attributes.Add("onclick", "return IsValidPost();");
         string text = "var creditarray = new Array(";
         for (int i = 1; i < this.groupid.Items.Count; i++)
         {
             text = text + UserGroup.FindByID(Convert.ToInt32(this.groupid.Items[i].Value)).Creditshigher.ToString() + ",";
         }
         text = text.TrimEnd(',') + ");";
         base.RegisterStartupScript("begin", "<script type='text/javascript'>" + text + "</script>");
         this.groupid.Attributes.Add("onchange", "document.getElementById('" + this.credits.ClientID + "').value=creditarray[this.selectedIndex];");
         this.groupid.Items.RemoveAt(0);
         try
         {
             this.groupid.SelectedValue = "10";
         }
         catch
         {
             this.groupid.SelectedValue = ((CreditsFacade.GetCreditsUserGroupId(0f) != null) ? CreditsFacade.GetCreditsUserGroupId(0f).ID.ToString() : "3");
         }
         try
         {
             UserGroup userGroupInfo = UserGroup.FindByID(Convert.ToInt32(this.groupid.SelectedValue));
             this.credits.Text = userGroupInfo.Creditshigher.ToString();
         }
         catch
         {
         }
     }
 }
コード例 #7
0
ファイル: editusergroup.aspx.cs プロジェクト: xiongeee/BBX
 private void UpdateUserGroupInf_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         var dic = new Dictionary <String, Int32>();
         dic.Add("附件最大尺寸", this.maxattachsize.Text.ToInt(-1));
         dic.Add("每天最大附件总尺寸", this.maxsizeperday.Text.ToInt(-1));
         foreach (var item in dic)
         {
             if (item.Value < 0)
             {
                 base.RegisterStartupScript("", "<script>alert('输入错误," + item.Key + "只能是0或者正整数');window.location.href='editusergroup.aspx';</script>");
                 return;
             }
         }
         if (this.creditshigher.Enabled && (Convert.ToInt32(this.creditshigher.Text) < Convert.ToInt32(this.ViewState["creditshigher"].ToString()) || Convert.ToInt32(this.creditslower.Text) > Convert.ToInt32(this.ViewState["creditslower"].ToString())))
         {
             base.RegisterStartupScript("", "<script>alert('操作失败, 您所输入的积分上下限范围应在" + this.ViewState["creditshigher"].ToString() + "至" + this.ViewState["creditslower"].ToString() + "之间');</script>");
         }
         else
         {
             this.userGroupInfo            = UserGroup.FindByID(DNTRequest.GetInt("groupid", -1));
             this.userGroupInfo.System     = 0;
             this.userGroupInfo.Type       = 0;
             this.userGroupInfo.Readaccess = Convert.ToInt32(this.readaccess.Text);
             this.usergrouppowersetting.GetSetting(ref this.userGroupInfo);
             this.userGroupInfo.GroupTitle    = this.groupTitle.Text;
             this.userGroupInfo.Creditshigher = Convert.ToInt32(this.creditshigher.Text);
             this.userGroupInfo.Creditslower  = Convert.ToInt32(this.creditslower.Text);
             if (this.userGroupInfo.Creditshigher >= this.userGroupInfo.Creditslower)
             {
                 base.RegisterStartupScript("", "<script>alert('操作失败, 积分下限必须小于积分上限');</script>");
                 return;
             }
             if (this.userGroupInfo.AllowBonus && this.userGroupInfo.MinBonusprice >= this.userGroupInfo.MaxBonusprice)
             {
                 base.RegisterStartupScript("", "<script>alert('操作失败, 最低悬赏价格必须小于最高悬赏价格');</script>");
                 return;
             }
             this.userGroupInfo.Stars            = Convert.ToInt32(this.stars.Text);
             this.userGroupInfo.Color            = this.color.Text;
             this.userGroupInfo.Groupavatar      = this.groupavatar.Text;
             this.userGroupInfo.MaxPrice         = Convert.ToInt32(this.maxprice.Text);
             this.userGroupInfo.MaxPmNum         = Convert.ToInt32(this.maxpmnum.Text);
             this.userGroupInfo.MaxSigSize       = Convert.ToInt32(this.maxsigsize.Text);
             this.userGroupInfo.MaxAttachSize    = Convert.ToInt32(this.maxattachsize.Text);
             this.userGroupInfo.MaxSizeperday    = Convert.ToInt32(this.maxsizeperday.Text);
             this.userGroupInfo.AttachExtensions = this.attachextensions.GetSelectString(",");
             try
             {
                 userGroupInfo.UpdateWithCredits();
                 UserGroup.FindAllWithCache();
                 AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新用户组", "组ID:" + DNTRequest.GetInt("groupid", -1));
                 base.RegisterStartupScript("PAGE", "window.location.href='usergroupgrid.aspx';");
             }
             catch (Exception ex)
             {
                 base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + ex.Message + "');window.location.href='usergroupgrid.aspx';</script>");
             }
         }
     }
 }
コード例 #8
0
        private void AddUserGroupInf_Click(object sender, EventArgs e)
        {
            if (base.CheckCookie())
            {
                foreach (DictionaryEntry item in new Hashtable
                {
                    {
                        "附件最大尺寸",
                        this.maxattachsize.Text
                    },

                    {
                        "每天最大附件总尺寸",
                        this.maxsizeperday.Text
                    },

                    {
                        "个人空间附件总尺寸",
                        this.maxspaceattachsize.Text
                    },

                    {
                        "相册空间总尺寸",
                        this.maxspacephotosize.Text
                    }
                })
                {
                    if (item.Value.ToInt(-1) < 0)
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误," + item.Key + "只能是0或者正整数');window.location.href='global_editusergroup.aspx';</script>");
                        return;
                    }
                }
                var userGroupInfo = new UserGroup();
                userGroupInfo.System        = 0;
                userGroupInfo.Type          = 0;
                userGroupInfo.Readaccess    = Convert.ToInt32((String.IsNullOrEmpty(this.readaccess.Text)) ? "0" : this.readaccess.Text);
                userGroupInfo.RadminID      = 0;
                userGroupInfo.GroupTitle    = this.groupTitle.Text;
                userGroupInfo.Creditshigher = this.creditshigher.Text.ToInt();
                userGroupInfo.Creditslower  = this.creditslower.Text.ToInt();
                this.usergrouppowersetting.GetSetting(ref userGroupInfo);
                if (userGroupInfo.Creditshigher >= userGroupInfo.Creditslower)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败, 积分下限必须小于积分上限');</script>");
                }
                else
                {
                    if (userGroupInfo.AllowBonus && userGroupInfo.MinBonusprice >= userGroupInfo.MaxBonusprice)
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败, 最低悬赏价格必须小于最高悬赏价格');</script>");
                        return;
                    }
                    userGroupInfo.Stars              = this.stars.Text.ToInt();
                    userGroupInfo.Color              = this.color.Text;
                    userGroupInfo.Groupavatar        = this.groupavatar.Text;
                    userGroupInfo.MaxPrice           = this.maxprice.Text.ToInt();
                    userGroupInfo.MaxPmNum           = this.maxpmnum.Text.ToInt();
                    userGroupInfo.MaxSigSize         = this.maxsigsize.Text.ToInt();
                    userGroupInfo.MaxAttachSize      = this.maxattachsize.Text.ToInt();
                    userGroupInfo.MaxSizeperday      = this.maxsizeperday.Text.ToInt();
                    userGroupInfo.MaxSpaceattachSize = this.maxspaceattachsize.Text.ToInt();
                    userGroupInfo.MaxSpacephotoSize  = this.maxspacephotosize.Text.ToInt();
                    userGroupInfo.AttachExtensions   = this.attachextensions.GetSelectString(",");
                    userGroupInfo.Raterange          = "";
                    //if (AdminUserGroups.AddUserGroupInfo(userGroupInfo))
                    try
                    {
                        userGroupInfo.InsertWithCredits();
                        //XCache.Remove(CacheKeys.FORUM_USER_GROUP_LIST);
                        UserGroup.FindAllWithCache();
                        AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加用户组", "组名:" + this.groupTitle.Text);
                        base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupgrid.aspx';");
                        return;
                    }
                    //if (!String.IsNullOrEmpty(AdminUserGroups.opresult))
                    catch (Exception ex)
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + ex.Message + "');window.location.href='global_usergroupgrid.aspx';</script>");
                        return;
                    }
                    //base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupgrid.aspx';</script>");
                    //return;
                }
                return;
            }
        }