コード例 #1
0
        protected unsafe void btnAdd_Click(object sender, EventArgs e)
        {
            SiteRoles roles;
            SiteRoles roles2;
            int       num;
            string    str;

            string[] strArray;
            bool     flag;
            int      num2;

            if (PageUtil.CheckValid(this, new string[] { "txt_RoleName#请输入角色名称" }) != null)
            {
                goto Label_0025;
            }
            goto Label_0134;
Label_0025:
            if ((string.IsNullOrEmpty(this.txt_OrderId.Value) == 0) != null)
            {
                goto Label_005D;
            }
            this.txt_OrderId.Value = &SiteRoles.GetNextOrderID(SitePortal.GetCurrentPortalId()).ToString();
Label_005D:
            roles = SiteRoles.GetByName(SitePortal.GetCurrentPortalId(), this.txt_RoleName.Value);
            if (((roles == null) ? 1 : (roles.Id == this.nId)) != null)
            {
                goto Label_00B0;
            }
            PageUtil.WriteAlertAndFocus(this.Page, "该名称已存在,请检查!", this.txt_RoleName.ClientID);
            goto Label_0134;
Label_00B0:
            roles2 = SiteRoles.Get(this.nId);
            if (((roles2 == null) == 0) != null)
            {
                goto Label_00CF;
            }
            roles2 = new SiteRoles();
Label_00CF:
            roles2.PortalId     = SitePortal.GetCurrentPortalId();
            roles2.DepartId     = -1;
            roles2.IsDepartRole = 2;
            if (((PageUtil.CommonModify(this, roles2, roles2.Id, "", "创建失败,请与系统管理员联系!", "") > 0) == 0) != null)
            {
                goto Label_0134;
            }
            str = this.GetRefreshUrl(1, 1);
            PageUtil.WriteAlertAndRet(this.Page, "", str, "");
Label_0134:
            return;
        }
コード例 #2
0
        protected unsafe void btnAdd_Click(object sender, EventArgs e)
        {
            UserInfo info;
            UserInfo info2;
            int      num;
            int      num2;

            UserRoles[] rolesArray;
            UserRoles   roles;
            UserRoles   roles2;
            string      str;

            string[] strArray;
            bool     flag;
            int      num3;

            UserRoles[] rolesArray2;
            int         num4;

            if (PageUtil.CheckValid(this, new string[] { "txt_UserName#请输入用户名" }) != null)
            {
                goto Label_0025;
            }
            goto Label_01CF;
Label_0025:
            if ((string.IsNullOrEmpty(this.txt_OrderId.Value) == 0) != null)
            {
                goto Label_005D;
            }
            this.txt_OrderId.Value = &UserInfo.GetNextId(SitePortal.GetCurrentPortalId()).ToString();
Label_005D:
            info = UserInfo.GetUserInfoByUserName(SitePortal.GetCurrentPortalId(), this.txt_UserName.Value);
            if (((info == null) ? 1 : (info.Id == this.nId)) != null)
            {
                goto Label_00B0;
            }
            PageUtil.WriteAlertAndFocus(this.Page, "该用户名已存在,请检查!", this.txt_UserName.ClientID);
            goto Label_01CF;
Label_00B0:
            info2 = UserInfo.Get(this.nId);
            if (((info2 == null) == 0) != null)
            {
                goto Label_00CF;
            }
            info2 = new UserInfo();
Label_00CF:
            info2.PortalId     = SitePortal.GetCurrentPortalId();
            info2.IsActive     = 1;
            info2.IsSystemUser = 1;
            info2.Status       = 1;
            info2.IsDelete     = 2;
            num = PageUtil.CommonModify(this, info2, info2.Id, "", "创建失败,请与系统管理员联系!", "");
            if (((num > 0) == 0) != null)
            {
                goto Label_01CF;
            }
            num2        = Util.pasteInt(this.sel_Role.SelectedValue, -1);
            rolesArray  = UserRoles.GetUserRolesByUser(num);
            rolesArray2 = rolesArray;
            num4        = 0;
            goto Label_0164;
Label_0148:
            roles = rolesArray2[num4];
            UserRoles.Del(roles.get_id());
            num4 += 1;
Label_0164:
            if ((num4 < ((int)rolesArray2.Length)) != null)
            {
                goto Label_0148;
            }
            roles2              = new UserRoles();
            roles2.RoleID       = num2;
            roles2.UserID       = num;
            roles2.DepartmentID = -1;
            CommonClassDB.Instance(roles2).set(roles2);
            UserInfo.ClearAllUsersHash();
            UserInfo.CleanOnlineUsers();
            str = this.GetRefreshUrl(1, 1);
            PageUtil.WriteAlertAndRet(this.Page, "", str, "");
Label_01CF:
            return;
        }
コード例 #3
0
        protected unsafe void btnSubmit_ServerClick(object sender, EventArgs e)
        {
            int      num;
            string   str;
            string   str2;
            string   str3;
            string   str4;
            UserInfo info;
            string   str5;
            int      num2;

            UserRoles[] rolesArray;
            UserRoles   roles;
            string      str6;
            bool        flag;

            string[] strArray;
            DateTime time;

            UserRoles[] rolesArray2;
            int         num3;

            num = SitePortal.GetCurrentPortalId();
            this.m_strPassword  = this.txt_PasswordCustom.Value.Trim();
            this.m_strPassword2 = this.txt_PasswordCustom2.Value.Trim();
            if (((this.m_strPassword != this.m_strPassword2) == 0) != null)
            {
                goto Label_006F;
            }
            PageUtil.WriteAlertAndFocus(this.Page, "两次输入密码必须一致,请修改!", this.txt_PasswordCustom2.ClientID);
            goto Label_02D9;
            Label_006F :;
            if (PageUtil.CheckValid(this, new string[] { "txt_UserName#请输入登录用户名", "txt_Mobile#请输入手机号", "txtYZM#请输入验证码" }) != null)
            {
                goto Label_00A5;
            }
            goto Label_02D9;
Label_00A5:
            str  = this.txtYZM.Value.Trim();
            str2 = PageUtil.VerifySmartJoinCode(this.Page, str);
            if ((("ok" != str2) == 0) != null)
            {
                goto Label_00F9;
            }
            PageUtil.WriteAlertAndFocus(this.Page, "验证码不正确,请修改!", this.txtYZM.ClientID);
            goto Label_02D9;
Label_00F9:
            CommonClassDB.ClearAllCache();
            str3 = this.txt_UserName.Value.Trim();
            str4 = this.txt_Mobile.Value.Trim();
            if ((UserInfo.GetUserInfoByUserName(num, str3) == null) != null)
            {
                goto Label_0158;
            }
            PageUtil.WriteAlertAndFocus(this.Page, "用户名已存在,请修改!", this.txt_UserName.ClientID);
            goto Label_02D9;
Label_0158:
            if ((UserInfo.GetUserInfoByMobile(num, str4) == null) != null)
            {
                goto Label_018F;
            }
            PageUtil.WriteAlertAndFocus(this.Page, "手机号已存在,请修改!", this.txt_Mobile.ClientID);
            goto Label_02D9;
Label_018F:
            str5              = MD5Encrypt.PasswordEncrypt(this.m_strPassword);
            info              = new UserInfo();
            info.PortalId     = num;
            info.IsDelete     = 2;
            info.IsActive     = 1;
            info.IsSystemUser = 1;
            info.CreateTime   = &DateTime.Now.Ticks;
            info.RealName     = str3;
            info.Password     = str5;
            num2              = PageUtil.CommonModify(this, info, info.get_id(), "", "", "");
            if (((num2 < 1) == 0) != null)
            {
                goto Label_022E;
            }
            PageUtil.WriteAlert(this.Page, "创建失败,请与管理员联系!");
            goto Label_02D9;
Label_022E:
            rolesArray = UserRoles.GetUserRolesByUser(num2);
            if ((rolesArray == null) != null)
            {
                goto Label_0276;
            }
            rolesArray2 = rolesArray;
            num3        = 0;
            goto Label_0267;
Label_024D:
            roles = rolesArray2[num3];
            UserRoles.Del(roles.get_id());
            num3 += 1;
Label_0267:
            if ((num3 < ((int)rolesArray2.Length)) != null)
            {
                goto Label_024D;
            }
Label_0276:
            UserRoles.SetUserRole("注册用户", -1, 0, num2);
            FunUtil.AutoLloginUser(this.Page, info);
            str6 = Util.GetString(base.Request, "returl", "");
            if ((string.IsNullOrEmpty(str6) == 0) != null)
            {
                goto Label_02C1;
            }
            str6 = "../../../Index.aspx";
Label_02C1:
            PageUtil.WriteAlertAndRet(this.Page, "用户注册成功!", str6, "");
Label_02D9:
            return;
        }