Пример #1
0
        /// <summary>
        /// Ts the generate member roles list from reader.
        /// </summary>
        /// <param name="returnData">The return data.</param>
        /// <param name="memberRoleList">The member roles list.</param>
        private static void GenerateProjectMemberRoleListFromReader(SqlDataReader returnData,
                                                                    ref List <MemberRoles> memberRoleList)
        {
            while (returnData.Read())
            {
                int  i;
                bool found = false;
                for (i = 0; i < memberRoleList.Count; i++)
                {
                    if (!memberRoleList[i].Username.Equals((string)returnData.GetValue(0)))
                    {
                        continue;
                    }
                    memberRoleList[i].AddRole((string)returnData.GetValue(1));
                    found = true;
                }

                if (found)
                {
                    continue;
                }

                var memberRoles = new MemberRoles((string)returnData.GetValue(0), (string)returnData.GetValue(1));
                memberRoleList.Add(memberRoles);
            }
        }
Пример #2
0
        public IActionResult MemberRole()
        {
            IList <MemberRoles> list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0);

            Core.Admin.WriteLogActions("查看用户组列表;");
            return(View(list));
        }
Пример #3
0
        public IActionResult EditMember(int id)
        {
            IList <MemberRoles> list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0);

            ViewBag.RoleList = list;

            Member entity = Member.Find(Core.Member._.Id == id);

            if (entity == null)
            {
                return(EchoTipPage("系统找不到本记录!"));
            }
            ViewBag.allmember = Member.FindAll(Member._.Id > 0 & Member._.IsLock != 1 & Member._.Id != entity.Id, null, null, 0, 0);
            //获取用户余额变化记录
            IList <BalanceChangeLog> listbalancelogs = BalanceChangeLog.FindAll(BalanceChangeLog._.UId == entity.Id, null, null, 0, 0);

            ViewBag.listbalancelogs = listbalancelogs;

            IList <RebateChangeLog> listrechargebalancelogs = RebateChangeLog.FindAll(RebateChangeLog._.UId == entity.Id, null, null, 0, 0);

            ViewBag.listrechargebalancelogs = listrechargebalancelogs;



            Core.Admin.WriteLogActions($"查看/编辑用户({entity.UserName});");
            return(View(entity));
        }
Пример #4
0
        public IActionResult Members()
        {
            //加载用户组
            IList <MemberRoles> list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0);

            ViewBag.RoleList = list;
            Core.Admin.WriteLogActions("查看用户列表;");
            return(View());
        }
Пример #5
0
 public void ApproveUser(ATAEntities context, string userName, MemberRoles newMemberRole)
 {
     Member memberToBeApproved = context.Members.Where(x => x.UserName.Equals(userName)).FirstOrDefault();
     ActivationCode ac = GenerateNewActivationCode();
     memberToBeApproved.ActivationCodes.Add(ac);
     memberToBeApproved.UserMemberRole = newMemberRole;
     memberToBeApproved.StatusId = (int)Statuses.PendingActivation;
     SendActivationEmail(memberToBeApproved);
     context.SaveChanges();
 }
Пример #6
0
        public void ApproveUser(ATAEntities context, string userName, MemberRoles newMemberRole)
        {
            Member         memberToBeApproved = context.Members.Where(x => x.UserName.Equals(userName)).FirstOrDefault();
            ActivationCode ac = GenerateNewActivationCode();

            memberToBeApproved.ActivationCodes.Add(ac);
            memberToBeApproved.UserMemberRole = newMemberRole;
            memberToBeApproved.StatusId       = (int)Statuses.PendingActivation;
            SendActivationEmail(memberToBeApproved);
            context.SaveChanges();
        }
Пример #7
0
        public IActionResult EditMemberRole(int id)
        {
            MemberRoles entity = MemberRoles.Find(MemberRoles._.Id == id);

            if (entity == null)
            {
                return(EchoTipPage("系统找不到本记录!", 0, true, ""));
            }
            Core.Admin.WriteLogActions($"查看/编辑用户组({id})详情;");
            return(View(entity));
        }
Пример #8
0
        public IActionResult AddMember()
        {
            IList <MemberRoles> list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0);

            ViewBag.RoleList  = list;
            ViewBag.allmember = Member.FindAll(Member._.Id > 0 & Member._.IsLock != 1, null, null, 0, 0);

            Core.Admin.WriteLogActions($"查看添加用户页面;");
            Member model = new Member();

            return(View(model));
        }
Пример #9
0
        public IActionResult AddMember()
        {
            IList <MemberRoles> list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0);

            ViewBag.RoleList    = list;
            ViewBag.allmember   = Member.FindAll(Member._.Id > 0 & Member._.IsLock != 1, null, null, 0, 0);
            ViewBag.passwordTip = Utils.GetPasswordStrengthTip(_systemSetting.PasswordStrength);
            Core.Admin.WriteLogActions($"查看添加用户页面;");
            Member model = new Member();

            return(View(model));
        }
Пример #10
0
        public IActionResult DelMemberRole(int id)
        {
            MemberRoles entity = MemberRoles.Find(MemberRoles._.Id == id);

            if (entity == null)
            {
                tip.Message = "系统找不到本用户组详情!";
                return(Json(tip));
            }
            if (entity.NotAllowDel == 1)
            {
                tip.Message = "本管理组设定不允许删除,如果需要删除,请先解除限制!";
                return(Json(tip));
            }

            //删除管理组,并删除旗下所有管理员
            Core.Admin.WriteLogActions($"执行删除用户组({entity.Id}:{entity.RoleName})详情;");
            entity.Delete();

            tip.Status  = JsonTip.SUCCESS;
            tip.Message = "删除用户组成功";
            return(Json(tip));
        }
Пример #11
0
        private void ResolveStatus(Member currentMember)
        {
            Statuses currentUserStatus = ATACore.Managers.MemberManager.GetMemberStatus(currentMember);

            ATACore.RegistryManager.WriterCurrentUserToRegistry(currentMember.UserName);
            SettingsAppearanceViewModel aSettings = new SettingsAppearanceViewModel();

            switch (currentUserStatus)
            {
            case Statuses.Active:
                ResetValidationMessage();
                MemberRoles currentRole = ATACore.Managers.MemberRoleManager.GetMemberRoleByUserName(ATACore.Managers.ContextManager.Context, MemberProxy.UserName);
                ATACore.Managers.ContextManager.Context.Dispose();

                if (currentRole.Equals(MemberRoles.Admin))
                {
                    DisplayAdminWindow();
                }
                else
                {
                    DisplayAfterLoginActiveUserWindow();
                }
                break;

            case Statuses.ToBeApproved:
                DisplayValidationMessage(ToBeApprovedMessage);
                break;

            case Statuses.PendingActivation:
                DisplayActivationWindow();
                break;

            default:
                break;
            }
        }
Пример #12
0
        public IActionResult EditMemberRole(MemberRoles model)
        {
            if (model.Id <= 0)
            {
                tip.Message = "错误参数传递!";
                return(Json(tip));
            }

            if (string.IsNullOrEmpty(model.RoleName))
            {
                tip.Message = "用户组名称不能为空!";
                return(Json(tip));
            }

            if (model.CashBack < 0)
            {
                tip.Message = "返现金额格式错误!";
                return(Json(tip));
            }
            if (model.ParentCashBack < 0)
            {
                tip.Message = "父级返现金额格式错误!";
                return(Json(tip));
            }
            if (model.GrandfatherCashBack < 0)
            {
                tip.Message = "爷级返现金额格式错误!";
                return(Json(tip));
            }
            if (model.YearsPerformance < 0)
            {
                tip.Message = "年销售额格式错误!";
                return(Json(tip));
            }
            if (model.JoinPrice < 0)
            {
                tip.Message = "入驻费用格式错误!";
                return(Json(tip));
            }

            MemberRoles entity = MemberRoles.Find(MemberRoles._.Id == model.Id);

            if (entity == null)
            {
                tip.Message = "系统找不到本记录!";
                return(Json(tip));
            }
            entity.RoleName            = model.RoleName;
            entity.RoleDescription     = model.RoleDescription;
            entity.NotAllowDel         = model.NotAllowDel;
            entity.IsHalved            = model.IsHalved;
            entity.Rank                = model.Rank;
            entity.CashBack            = model.CashBack;
            entity.ParentCashBack      = model.ParentCashBack;
            entity.GrandfatherCashBack = model.GrandfatherCashBack;
            entity.YearsPerformance    = model.YearsPerformance;
            entity.JoinPrice           = model.JoinPrice;
            entity.Update();
            tip.Status    = JsonTip.SUCCESS;
            tip.Message   = "编辑用户组成功";
            tip.ReturnUrl = "close";
            Core.Admin.WriteLogActions($"编辑用户组({entity.Id});");
            return(Json(tip));
        }
Пример #13
0
        public IActionResult AddMemberRole(IFormCollection fc)
        {
            string RoleName            = fc["RoleName"];
            string RoleDescription     = fc["RoleDescription"];
            string NotAllowDel         = fc["NotAllowDel"];
            string Rank                = fc["Rank"];
            string CashBack            = fc["CashBack"];
            string ParentCashBack      = fc["ParentCashBack"];
            string GrandfatherCashBack = fc["GrandfatherCashBack"];
            string IsHalved            = fc["IsHalved"];
            string YearsPerformance    = fc["YearsPerformance"];
            string JoinPrice           = fc["JoinPrice"];

            if (string.IsNullOrEmpty(RoleName))
            {
                tip.Message = "用户组名称不能为空!";
                return(Json(tip));
            }
            if (!Utils.IsInt(Rank))
            {
                tip.Message = "排序只能是数字!";
                return(Json(tip));
            }
            if (!Utils.IsDecimal(CashBack))
            {
                tip.Message = "返现金额格式错误!";
                return(Json(tip));
            }
            if (!Utils.IsDecimal(ParentCashBack))
            {
                tip.Message = "父级返现金额格式错误!";
                return(Json(tip));
            }
            if (!Utils.IsDecimal(ParentCashBack))
            {
                tip.Message = "爷级返现金额格式错误!";
                return(Json(tip));
            }
            if (!Utils.IsDecimal(YearsPerformance))
            {
                tip.Message = "年销售额格式错误!";
                return(Json(tip));
            }
            if (!Utils.IsDecimal(JoinPrice))
            {
                tip.Message = "入驻费用格式错误!";
                return(Json(tip));
            }
            MemberRoles entity = new MemberRoles();

            entity.RoleName            = RoleName;
            entity.RoleDescription     = RoleDescription;
            entity.NotAllowDel         = !string.IsNullOrEmpty(NotAllowDel) && NotAllowDel == "1" ? 1 : 0;
            entity.IsHalved            = !string.IsNullOrEmpty(IsHalved) && IsHalved == "1" ? 1 : 0;
            entity.Rank                = int.Parse(Rank);
            entity.CashBack            = decimal.Parse(CashBack);
            entity.ParentCashBack      = decimal.Parse(ParentCashBack);
            entity.GrandfatherCashBack = decimal.Parse(GrandfatherCashBack);
            entity.YearsPerformance    = decimal.Parse(YearsPerformance);
            entity.JoinPrice           = decimal.Parse(JoinPrice);
            entity.Insert();
            tip.Status    = JsonTip.SUCCESS;
            tip.Message   = "添加用户组成功";
            tip.ReturnUrl = "close";
            Core.Admin.WriteLogActions($"添加新用户组({entity.Id});");
            return(Json(tip));
        }
    public override string ToString()
    {
        var  sb      = new StringBuilder("SquareMemberSearchOption(");
        bool __first = true;

        if (__isset.membershipState)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("MembershipState: ");
            MembershipState.ToString(sb);
        }
        if (MemberRoles != null && __isset.memberRoles)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("MemberRoles: ");
            MemberRoles.ToString(sb);
        }
        if (DisplayName != null && __isset.displayName)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("DisplayName: ");
            DisplayName.ToString(sb);
        }
        if (__isset.ableToReceiveMessage)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("AbleToReceiveMessage: ");
            AbleToReceiveMessage.ToString(sb);
        }
        if (__isset.ableToReceiveFriendRequest)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("AbleToReceiveFriendRequest: ");
            AbleToReceiveFriendRequest.ToString(sb);
        }
        if (ChatMidToExcludeMembers != null && __isset.chatMidToExcludeMembers)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ChatMidToExcludeMembers: ");
            ChatMidToExcludeMembers.ToString(sb);
        }
        if (__isset.includingMe)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("IncludingMe: ");
            IncludingMe.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }