Exemple #1
0
        /// <summary>
        /// 创建一个新的管理组信息
        /// </summary>
        /// <param name="__admingroupsInfo">要添加的管理组信息</param>
        /// <returns>更改记录数</returns>
        public static int CreateAdminGroupInfo(AdminGroupInfo admingroupsInfo)
        {
            SAS.Cache.SASCache.GetCacheService().RemoveObject("/SAS/UserGroupList");
            SAS.Cache.SASCache.GetCacheService().RemoveObject("/SAS/AdminGroupList");

            return SAS.Data.DataProvider.AdminGroups.CreateAdminGroupInfo(admingroupsInfo);
        }
Exemple #2
0
 private static AdminGroupInfo LoadAdminGroupInfo(DataRow dr)
 {
     AdminGroupInfo admingroup = new AdminGroupInfo();
     admingroup.Admingid = int.Parse(dr["pg_id"].ToString());
     admingroup.AdminGroupName = dr["pg_name"].ToString();
     admingroup.Pg_allowSelf = byte.Parse(dr["pg_allowSys"].ToString());
     admingroup.Pg_allowSys = byte.Parse(dr["pg_allowSys"].ToString());
     admingroup.Pg_status = byte.Parse(dr["pg_status"].ToString());
     admingroup.Pg_ext1 = dr["pg_ext1"].ToString();
     admingroup.Alloweditpost = byte.Parse(dr["alloweditpost"].ToString());
     admingroup.Allowstickthread = byte.Parse(dr["allowstickthread"].ToString());
     admingroup.Allowmodpost = byte.Parse(dr["allowmodpost"].ToString());
     admingroup.Allowdelpost = byte.Parse(dr["allowdelpost"].ToString());
     admingroup.Allowmassprune = byte.Parse(dr["allowmassprune"].ToString());
     //admingroup.Allowrefund = byte.Parse(dr["allowrefund"].ToString());
     admingroup.Allowcensorword = byte.Parse(dr["allowcensorword"].ToString());
     admingroup.Allowviewip = byte.Parse(dr["allowviewip"].ToString());
     admingroup.Allowbanip = byte.Parse(dr["allowbanip"].ToString());
     admingroup.Allowedituser = byte.Parse(dr["allowedituser"].ToString());
     admingroup.Allowmoduser = byte.Parse(dr["allowmoduser"].ToString());
     admingroup.Allowbanuser = byte.Parse(dr["allowbanuser"].ToString());
     admingroup.Allowpostannounce = byte.Parse(dr["allowpostannounce"].ToString());
     admingroup.Allowviewlog = byte.Parse(dr["allowviewlog"].ToString());
     admingroup.Allowviewrealname = byte.Parse(dr["allowviewrealname"].ToString());
     return admingroup;
 }
Exemple #3
0
 /// <summary>
 /// 获得到指定管理组信息
 /// </summary>
 /// <returns>管理组信息</returns>
 public static AdminGroupInfo[] GetAdminGroupList()
 {
     DataTable dt = DatabaseProvider.GetInstance().GetAdminGroupList();
     AdminGroupInfo[] admingroupArray = new AdminGroupInfo[dt.Rows.Count];
     int Index = 0;
     foreach (DataRow dr in dt.Rows)
     {
         admingroupArray[Index] = LoadAdminGroupInfo(dr);
         Index++;
     }
     dt.Dispose();
     return admingroupArray;
 }
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text = Utils.RemoveFontTag(userGroupInfo.ug_name);
            creditshigher.Text = userGroupInfo.ug_scorehight.ToString();
            creditslower.Text = userGroupInfo.ug_scorelow.ToString();
            stars.Text = userGroupInfo.Stars.ToString();
            color.Text = userGroupInfo.ug_color;
            groupavatar.Text = userGroupInfo.ug_logo;
            readaccess.Text = userGroupInfo.ug_readaccess.ToString();
            //maxprice.Text = userGroupInfo.Maxprice.ToString();
            maxpmnum.Text = userGroupInfo.Maxpmnum.ToString();
            maxsigsize.Text = userGroupInfo.ug_maxsigsize.ToString();
            maxattachsize.Text = userGroupInfo.Ug_maxattachsize.ToString();
            maxsizeperday.Text = userGroupInfo.Ug_maxsizeperday.ToString();
            maxspaceattachsize.Text = userGroupInfo.ug_maxspaceattachsize.ToString();
            maxspacephotosize.Text = userGroupInfo.ug_maxspacephotosize.ToString();

            if (groupid > 0 && groupid <= 3) radminid.Enabled = false;

            radminid.SelectedValue = userGroupInfo.ug_pg_id.ToString();

            attachextensions.SetSelectByID(userGroupInfo.ug_attachextensions.Trim());

            //设置用户权限组初始化信息
            adminGroupInfo = AdminUserGroups.AdminGetAdminGroupInfo(userGroupInfo.ug_id);
            usergrouppowersetting.Bind(userGroupInfo);

            if (adminGroupInfo != null)
            {
                //设置管理权限组初始化信息
                admingroupright.SelectedIndex = -1;
                admingroupright.Items[0].Selected = adminGroupInfo.Alloweditpost == 1;
                //admingroupright.Items[1].Selected = adminGroupInfo.Alloweditpoll == 1;
                admingroupright.Items[1].Selected = adminGroupInfo.Allowdelpost == 1;
                admingroupright.Items[2].Selected = adminGroupInfo.Allowmassprune == 1;
                admingroupright.Items[3].Selected = adminGroupInfo.Allowviewip == 1;
                admingroupright.Items[4].Selected = adminGroupInfo.Allowedituser == 1;
                admingroupright.Items[5].Selected = adminGroupInfo.Allowviewlog == 1;
                //admingroupright.Items[7].Selected = adminGroupInfo.Disablepostctrl == 1;
                admingroupright.Items[6].Selected = adminGroupInfo.Allowviewrealname == 1;
                admingroupright.Items[7].Selected = adminGroupInfo.Allowbanuser == 1;
                admingroupright.Items[8].Selected = adminGroupInfo.Allowbanip == 1;
                admingroupright.Items[9].Selected = adminGroupInfo.Allowmodpost == 1;
                admingroupright.Items[10].Selected = adminGroupInfo.Allowpostannounce == 1;
                //GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                //admingroupright.Items[11].Selected = ("," + configInfo.Reportusergroup + ",").IndexOf("," + groupid + ",") != -1; //是否允许接收举报信息
                //admingroupright.Items[admingroupright.Items.Count - 1].Selected = ("," + configInfo.Photomangegroups + ",").IndexOf("," + groupid + ",") != -1;//是否允许管理图片评论
                if (adminGroupInfo.Allowstickthread.ToString() != "") allowstickthread.SelectedValue = adminGroupInfo.Allowstickthread.ToString();

            }

            if (radminid.SelectedValue == "1")
            {
                allowstickthread.Enabled = false;
                allowstickthread.SelectedValue = "3";
            }

            #endregion
        }
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            #region 更新管理组信息

            if (this.CheckCookie())
            {

                Hashtable ht = new Hashtable();
                ht.Add("附件最大尺寸", maxattachsize.Text);
                ht.Add("每天最大附件总尺寸", maxsizeperday.Text);
                ht.Add("个人空间附件总尺寸", maxspaceattachsize.Text);
                ht.Add("相册空间总尺寸", maxspacephotosize.Text);

                foreach (DictionaryEntry de in ht)
                {
                    if (!Utils.IsInt(de.Value.ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误," + de.Key.ToString() + "只能是0或者正整数');window.location.href='global_editadminusergroup.aspx';</script>");
                        return;
                    }

                }
                userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(SASRequest.GetInt("groupid", -1));
                userGroupInfo.ug_isSystem = 0;
                //userGroupInfo.Type = 0;
                userGroupInfo.ug_readaccess = Convert.ToInt32(readaccess.Text);

                int selectradminid = Convert.ToInt32(radminid.SelectedValue);
                //对于当前用户组中,有管理权限的,则设置管理权限
                if (selectradminid > 0 && selectradminid <= 3)
                {
                    adminGroupInfo = new AdminGroupInfo();
                    adminGroupInfo.Admingid = (short)userGroupInfo.ug_id;
                    adminGroupInfo.AdminGroupName = "";
                    //插入相应的管理组
                    adminGroupInfo.Alloweditpost = BoolToByte(admingroupright.Items[0].Selected);
                    //adminGroupInfo.Alloweditpoll = BoolToByte(admingroupright.Items[1].Selected);
                    adminGroupInfo.Allowstickthread = (byte)Convert.ToInt16(allowstickthread.SelectedValue);
                    adminGroupInfo.Allowmodpost = 0;
                    adminGroupInfo.Allowdelpost = BoolToByte(admingroupright.Items[1].Selected);
                    adminGroupInfo.Allowmassprune = BoolToByte(admingroupright.Items[2].Selected);
                    //adminGroupInfo.Allowrefund = 0;
                    adminGroupInfo.Allowcensorword = 0; ;
                    adminGroupInfo.Allowviewip = BoolToByte(admingroupright.Items[3].Selected);
                    adminGroupInfo.Allowbanip = 0;
                    adminGroupInfo.Allowedituser = BoolToByte(admingroupright.Items[4].Selected);
                    adminGroupInfo.Allowmoduser = 0;
                    adminGroupInfo.Allowbanuser = 0;
                    adminGroupInfo.Allowpostannounce = 0;
                    adminGroupInfo.Allowviewlog = BoolToByte(admingroupright.Items[5].Selected);
                    //adminGroupInfo.Disablepostctrl = BoolToByte(admingroupright.Items[7].Selected);
                    adminGroupInfo.Allowviewrealname = BoolToByte(admingroupright.Items[6].Selected);
                    adminGroupInfo.Allowbanuser = BoolToByte(admingroupright.Items[7].Selected);
                    adminGroupInfo.Allowbanip = BoolToByte(admingroupright.Items[8].Selected);
                    adminGroupInfo.Allowmodpost = BoolToByte(admingroupright.Items[9].Selected);
                    adminGroupInfo.Allowpostannounce = BoolToByte(admingroupright.Items[10].Selected);

                    SAS.Logic.AdminGroups.SetAdminGroupInfo(adminGroupInfo, userGroupInfo.ug_id);
                    userGroupInfo.ug_pg_id = selectradminid;
                }
                else
                    userGroupInfo.ug_pg_id = 0;

                AdminGroups.ChangeUserAdminidByGroupid(userGroupInfo.ug_pg_id, userGroupInfo.ug_id);

                userGroupInfo.ug_name = groupTitle.Text;
                userGroupInfo.ug_scorehight = Convert.ToInt32(creditshigher.Text);
                userGroupInfo.ug_scorelow = Convert.ToInt32(creditslower.Text);
                userGroupInfo.Stars = Convert.ToInt32(stars.Text);
                userGroupInfo.ug_color = color.Text;
                userGroupInfo.ug_logo = groupavatar.Text;
                //userGroupInfo.Maxprice = Convert.ToInt32(maxprice.Text);
                userGroupInfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text);
                userGroupInfo.ug_maxsigsize = Convert.ToInt32(maxsigsize.Text);
                userGroupInfo.Ug_maxattachsize = Convert.ToInt32(maxattachsize.Text);
                userGroupInfo.Ug_maxsizeperday = Convert.ToInt32(maxsizeperday.Text);
                userGroupInfo.ug_maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text);
                userGroupInfo.ug_maxspacephotosize = Convert.ToInt32(maxspacephotosize.Text);
                userGroupInfo.ug_attachextensions = attachextensions.GetSelectString(",");

                usergrouppowersetting.GetSetting(ref userGroupInfo);

                if (AdminUserGroups.UpdateUserGroupInfo(userGroupInfo))
                {
                    #region 是否允许接收举报信息和管理图片评论
                    GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                    ////是否允许接收举报信息
                    //int groupid = userGroupInfo.ug_id;
                    //if (admingroupright.Items[13].Selected)
                    //{
                    //    if (("," + configInfo.Reportusergroup + ",").IndexOf("," + groupid + ",") == -1)
                    //    {
                    //        if (configInfo.Reportusergroup == "")
                    //        {
                    //            configInfo.Reportusergroup = groupid.ToString();
                    //        }
                    //        else
                    //        {
                    //            configInfo.Reportusergroup += "," + groupid.ToString();
                    //        }
                    //    }
                    //}
                    //else
                    //{
                    //    string tempstr = "";
                    //    foreach (string report in configInfo.Reportusergroup.Split(','))
                    //    {
                    //        if (report != groupid.ToString())
                    //        {
                    //            if (tempstr == "")
                    //            {
                    //                tempstr = report;
                    //            }
                    //            else
                    //            {
                    //                tempstr += "," + report;
                    //            }
                    //        }
                    //    }
                    //    configInfo.Reportusergroup = tempstr;
                    //}
                    ////是否允许管理图片评论
                    //if (AlbumPluginProvider.GetInstance() != null)
                    //{
                    //    if (admingroupright.Items[admingroupright.Items.Count - 1].Selected)
                    //    {
                    //        if (("," + configInfo.Photomangegroups + ",").IndexOf("," + groupid + ",") == -1)
                    //        {
                    //            if (configInfo.Photomangegroups == "")
                    //            {
                    //                configInfo.Photomangegroups = groupid.ToString();
                    //            }
                    //            else
                    //            {
                    //                configInfo.Photomangegroups += "," + groupid.ToString();
                    //            }
                    //        }
                    //    }
                    //    else
                    //    {
                    //        string tempstr = "";
                    //        foreach (string photomangegroup in configInfo.Photomangegroups.Split(','))
                    //        {
                    //            if (photomangegroup != groupid.ToString())
                    //            {
                    //                if (tempstr == "")
                    //                {
                    //                    tempstr = photomangegroup;
                    //                }
                    //                else
                    //                {
                    //                    tempstr += "," + photomangegroup;
                    //                }
                    //            }
                    //        }
                    //        configInfo.Photomangegroups = tempstr;
                    //    }
                    //}

                    GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config"));
                    #endregion
                    SAS.Cache.SASCache.GetCacheService().RemoveObject("/SAS/UserGroupList");

                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新管理组", "组名:" + groupTitle.Text);
                    base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_adminusergroupgrid.aspx';</script>");
                }
            }

            #endregion
        }
Exemple #6
0
 /// <summary>
 /// 设置管理组信息
 /// </summary>
 /// <param name="__admingroupsInfo">管理组信息</param>
 /// <returns>更改记录数</returns>
 public static int SetAdminGroupInfo(AdminGroupInfo admingroupsInfo, int userGroupId)
 {
     //当已有记录时
     if (AdminGroups.GetAdminGroupInfo(userGroupId) != null)
     {
         //更新相应的管理组
         return SAS.Data.DataProvider.AdminGroups.SetAdminGroupInfo(admingroupsInfo);
     }
     else
     {
         //建立相应的用户组
         return CreateAdminGroupInfo(admingroupsInfo);
     }
 }
Exemple #7
0
 /// <summary>
 /// 创建一个新的管理组信息
 /// </summary>
 /// <param name="__admingroupsInfo">要添加的管理组信息</param>
 /// <returns>更改记录数</returns>
 public int CreateAdminGroupInfo(AdminGroupInfo adminGroupsInfo)
 {
     DbParameter[] parms = {
                                DbHelper.MakeInParam("@admingid",(DbType)SqlDbType.SmallInt,2,adminGroupsInfo.Admingid),
                                DbHelper.MakeInParam("@pg_name",(DbType)SqlDbType.NChar,50,adminGroupsInfo.AdminGroupName),
                                DbHelper.MakeInParam("@pg_allowSelf",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Pg_allowSelf),
                                DbHelper.MakeInParam("@pg_allowSys",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Pg_allowSys),
                                DbHelper.MakeInParam("@pg_ext1",(DbType)SqlDbType.Text,0,adminGroupsInfo.Pg_ext1),
                                DbHelper.MakeInParam("@pg_status",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Pg_status),
                                DbHelper.MakeInParam("@alloweditpost",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Alloweditpost),
                                DbHelper.MakeInParam("@allowstickthread",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowstickthread),
                                DbHelper.MakeInParam("@allowmodpost",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowmodpost),
                                DbHelper.MakeInParam("@allowdelpost",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowdelpost),
                                DbHelper.MakeInParam("@allowmassprune",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowmassprune),
                                DbHelper.MakeInParam("@allowcensorword",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowcensorword),
                                DbHelper.MakeInParam("@allowviewip",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowviewip),
                                DbHelper.MakeInParam("@allowbanip",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowbanip),
                                DbHelper.MakeInParam("@allowedituser",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowedituser),
                                DbHelper.MakeInParam("@allowmoduser",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowmoduser),
                                DbHelper.MakeInParam("@allowbanuser",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowbanuser),
                                DbHelper.MakeInParam("@allowpostannounce",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowpostannounce),
                                DbHelper.MakeInParam("@allowviewlog",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowviewlog),
                                DbHelper.MakeInParam("@allowviewrealname",(DbType)SqlDbType.TinyInt,1,adminGroupsInfo.Allowviewrealname)
                            };
     return DbHelper.ExecuteNonQuery(CommandType.StoredProcedure, string.Format("{0}createadmingroup", BaseConfigs.GetTablePrefix), parms);
 }
Exemple #8
0
 /// <summary>
 /// 设置管理组信息
 /// </summary>
 /// <param name="admingroupsInfo">管理组信息</param>
 /// <returns>更改记录数</returns>
 public static int SetAdminGroupInfo(AdminGroupInfo admingroupsInfo)
 {
     return DatabaseProvider.GetInstance().SetAdminGroupInfo(admingroupsInfo);
 }