예제 #1
0
        public IActionResult RefreshMemberList()
        {
            try
            {
                //Access to Azure B2C users
                GetMembersFromAzure GetMember = new GetMembersFromAzure(_configuration);

                //Get a collection of just the members
                IGraphServiceUsersCollectionPage members = GetMember.GetCurrentMembers();

                foreach (User user in members)
                {
                    TextInfo ti = CultureInfo.CurrentCulture.TextInfo;

                    Member member = new Member
                    {
                        DisplayName    = ti.ToTitleCase(user.DisplayName),
                        FirstName      = ti.ToTitleCase(user.GivenName),
                        LastName       = ti.ToTitleCase(user.Surname),
                        AzureId        = user.Id,
                        SeatNumber     = _seatService.GetSeatByAzureID(user.Id),
                        IsActiveMember = true
                    };

                    _logger.LogInformation("{0} Registering Member {1} - {2}, {3}", DateTime.Now, user.Id, user.Surname, user.GivenName);

                    //Add the member to the members table for longterm storage
                    _member.AddMember(member);
                }
                return(RedirectToAction("UploadMemberSeatingPlan", "Admin"));
            }
            catch (Exception ex)
            {
                return(RedirectToAction(nameof(UploadMemberSeatingPlan)));
            }
        }
예제 #2
0
파일: Member.cs 프로젝트: Abnertd/public
    //会员注册
    public void Member_Register()
    {
        string member_nickname         = tools.CheckStr(tools.NullStr(Request.Form["member_nickname"]).Trim());
        string member_email            = tools.CheckStr(tools.NullStr(Request.Form["member_email"]).Trim());
        string member_password         = tools.CheckStr(tools.NullStr(Request.Form["member_password"]).Trim());
        string member_password_confirm = tools.CheckStr(tools.NullStr(Request.Form["member_password_confirm"]).Trim());
        string verifycode  = tools.CheckStr(tools.NullStr(Request.Form["verifycode"]));
        int    Isagreement = tools.CheckInt(tools.NullStr(Request.Form["checkbox_agreement"]));
        int    Member_Type = tools.CheckInt(tools.NullStr(Request["Member_Type"]));
        //string member_mobile = tools.CheckStr(tools.NullStr(Request.Form["member_mobile"]));
        int    DefaultGrade = 1;
        string Member_State = "", Member_City = "", Member_County = "", Member_Name = "", Member_StreetAddress = "", Member_Phone_Number = "", member_mobile = "", U_Member_CompanyName = "", U_Member_CompanyUrl = "";
        int    U_Member_Department = 0, U_Member_CompanyKind = 0, U_Member_CompanyVocation = 0, U_Member_MenAmount = 0, U_Member_BuyType = 0;

        MemberGradeInfo member_grade = GetMemberDefaultGrade();

        if (member_grade != null)
        {
            DefaultGrade = member_grade.Member_Grade_ID;
        }

        if (verifycode != Session["Trade_Verify"].ToString() && verifycode.Length == 0)
        {
            pub.Msg("error", "验证码输入错误", "验证码输入错误", false, "{back}");
        }

        if (member_nickname.Length > 0)
        {
            if (Check_Member_Nickname(member_nickname))
            {
                pub.Msg("error", "该昵称已被使用", "该昵称已被使用。请使用另外一个昵称进行注册", false, "{back}");
            }
        }
        else
        {
            pub.Msg("error", "昵称无效", "请输入有效的昵称", false, "{back}");
        }

        if (tools.CheckEmail(member_email) == false)
        {
            pub.Msg("error", "邮件地址无效", "请输入有效的邮件地址", false, "{back}");
        }
        else
        {
            if (Check_Member_Email(member_email))
            {
                pub.Msg("error", "该邮件地址已被使用", "该邮件地址已被使用。请使用另外一个邮件地址进行注册", false, "{back}");
            }
        }

        if (CheckSsn(member_password) == false)
        {
            pub.Msg("error", "密码包含特殊字符", "密码包含特殊字符,只接受A-Z,a-z,0-9,不要输入空格", false, "{back}");
        }
        else
        {
            if (member_password.Length < 6 || member_password.Length > 20)
            {
                pub.Msg("error", "请输入6~20位密码", "请输入6~20位密码", false, "{back}");
            }
        }

        if (member_password_confirm != member_password)
        {
            pub.Msg("error", "两次密码输入不一致", "两次密码输入不一致,请重新输入", false, "{back}");
        }

        if (Member_Type == 1)
        {
            Member_Name = tools.CheckStr(tools.NullStr(Request["Member_Name"]));
            if (Member_Name == "")
            {
                pub.Msg("error", "信息不能为空", "联系人姓名不能为空", false, "{back}");
            }

            U_Member_Department = tools.CheckInt(tools.NullStr(Request["Member_Department"]));
            if (U_Member_Department == 0)
            {
                pub.Msg("error", "信息提示", "请选择联系人所在部门", false, "{back}");
            }

            Member_Phone_Number = tools.CheckStr(tools.NullStr(Request["Member_Phone_Number"]));
            if (Member_Phone_Number == "")
            {
                pub.Msg("error", "信息提示", "请输入联系人的固定电话", false, "{back}");
            }
            else if (pub.Checkmobile(Member_Phone_Number) == false)
            {
                pub.Msg("error", "信息提示", "电话格式错误,请重新输入!", false, "{back}");
            }

            member_mobile = tools.CheckStr(tools.NullStr(Request["member_mobile"]));

            U_Member_CompanyName = tools.CheckStr(tools.NullStr(Request["U_Member_CompanyName"]));
            if (U_Member_CompanyName == "")
            {
                pub.Msg("error", "信息提示", "请输入公司名称!", false, "{back}");
            }

            Member_State  = tools.CheckStr(tools.NullStr(Request["Member_State"]));
            Member_City   = tools.CheckStr(tools.NullStr(Request["Member_City"]));
            Member_County = tools.CheckStr(tools.NullStr(Request["Member_County"]));
            if (Member_County == "0")
            {
                pub.Msg("error", "信息提示", "请选择公司所在地!", false, "{back}");
            }

            Member_StreetAddress = tools.CheckStr(tools.NullStr(Request["Member_StreetAddress"]));

            U_Member_BuyType = tools.CheckInt(tools.NullStr(Request["Buy_Type"]));
            if (U_Member_BuyType == 0)
            {
                pub.Msg("error", "信息提示", "请选择购买类型/用途!", false, "{back}");
            }

            U_Member_CompanyUrl      = tools.CheckStr(tools.NullStr(Request["U_Member_CompanyUrl"]));
            U_Member_MenAmount       = tools.CheckInt(tools.NullStr(Request["Men_Amount"]));
            U_Member_CompanyVocation = tools.CheckInt(tools.NullStr(Request["Company_Vocation"]));
            U_Member_CompanyKind     = tools.CheckInt(tools.NullStr(Request["Company_Kind"]));
        }

        if (Isagreement != 1)
        {
            pub.Msg("error", "您需要接受用户注册协议", "要完成注册,您需要接受用户注册协议", false, "{back}");
        }

        MemberInfo member = new MemberInfo();

        member.Member_ID                = 0;
        member.Member_Email             = member_email;
        member.Member_Emailverify       = 0;
        member.Member_LoginMobile       = "";
        member.Member_LoginMobileverify = 1;
        member.Member_NickName          = member_nickname;
        member.Member_Password          = encrypt.MD5(member_password);
        member.Member_VerifyCode        = pub.Createvkey();
        member.Member_LoginCount        = 1;
        member.Member_LastLogin_IP      = Request.ServerVariables["remote_addr"];
        member.Member_LastLogin_Time    = DateTime.Now;
        member.Member_CoinCount         = 0;
        member.Member_CoinRemain        = 0;
        member.Member_Addtime           = DateTime.Now;
        member.Member_Trash             = 0;
        member.Member_Grade             = DefaultGrade;
        member.Member_Account           = 0;
        member.Member_Frozen            = 0;
        member.Member_AllowSysEmail     = 1;
        member.Member_Site              = "CN";
        member.Member_Source            = Session["customer_source"].ToString();
        //member.U_Member_Type = Member_Type;

        //添加会员基本信息
        if (MyMember.AddMember(member, pub.CreateUserPrivilege("5d071ec6-31d8-4960-a77d-f8209bbab496")))
        {
            MemberInfo memberinfo = GetMemberInfoByEmail(member_email);
            if (memberinfo != null)
            {
                //添加详细信息
                MemberProfileInfo profile = new MemberProfileInfo();

                profile.Member_Profile_MemberID = memberinfo.Member_ID;
                profile.Member_Name             = "";
                profile.Member_Sex               = -1;
                profile.Member_StreetAddress     = "";
                profile.Member_County            = "0";
                profile.Member_City              = "0";
                profile.Member_State             = "0";
                profile.Member_Country           = "CN";
                profile.Member_Zip               = "";
                profile.Member_Phone_Countrycode = "+86";
                profile.Member_Phone_Areacode    = "";
                profile.Member_Phone_Number      = "";
                profile.Member_Mobile            = "";
                if (Member_Type == 1)
                {
                    profile.Member_County       = Member_County;
                    profile.Member_City         = Member_City;
                    profile.Member_State        = Member_State;
                    profile.Member_Name         = Member_Name;
                    profile.Member_Phone_Number = Member_Phone_Number;
                    profile.Member_Mobile       = member_mobile;
                    //profile.U_Member_BuyType = U_Member_BuyType;
                    //profile.U_Member_CompanyName = U_Member_CompanyName;
                    //profile.U_Member_Department = U_Member_Department;
                    //profile.Member_StreetAddress = Member_StreetAddress;
                    //profile.U_Member_CompanyKind = U_Member_CompanyKind;
                    //profile.U_Member_CompanyUrl = U_Member_CompanyUrl;
                    //profile.U_Member_CompanyVocation = U_Member_CompanyVocation;
                    //profile.U_Member_MenAmount = U_Member_MenAmount;
                }

                MyMember.AddMemberProfile(profile, pub.CreateUserPrivilege("5d071ec6-31d8-4960-a77d-f8209bbab496"));

                Member_Log(memberinfo.Member_ID, "会员注册");

                //MyEmail.DelU_EmailNotifyRequestByEmail(memberinfo.Member_Email, pub.CreateUserPrivilege("83b084ee-1f49-4da0-b28c-8cdaaec1c193"));

                Session["member_id"]             = memberinfo.Member_ID;
                Session["member_email"]          = memberinfo.Member_Email;
                Session["member_nickname"]       = memberinfo.Member_NickName;
                Session["member_logined"]        = true;
                Session["member_emailverify"]    = true;
                Session["member_logincount"]     = memberinfo.Member_LoginCount + 1;
                Session["member_lastlogin_time"] = memberinfo.Member_LastLogin_Time;
                Session["member_lastlogin_ip"]   = memberinfo.Member_LastLogin_IP;
                Session["member_coinremain"]     = memberinfo.Member_CoinRemain;
                Session["member_coincount"]      = memberinfo.Member_CoinCount;
                Session["member_grade"]          = memberinfo.Member_Grade;
                Session["Member_AllowSysEmail"]  = memberinfo.Member_AllowSysEmail;
                // Session["Member_Type"] = memberinfo.U_Member_Type;
                Response.Cookies["member_email"].Expires = DateTime.Now.AddDays(365);
                Response.Cookies["member_email"].Value   = memberinfo.Member_Email;

                //member_register_sendemailverify(memberinfo.Member_Email, memberinfo.Member_VerifyCode);

                //if (memberinfo.Member_Emailverify == 0)
                //{
                Session["member_emailverify"] = memberinfo.Member_Emailverify;
                //Response.Redirect("/member/emailverify.aspx");
                //}
                //else
                //{
                //Response.Redirect("/member/index.aspx");
                //}
                if (Session["url_after_login"] == null)
                {
                    Session["url_after_login"] = "";
                }
                if (tools.NullStr(Session["url_after_login"].ToString()) != "")
                {
                    Response.Redirect(Session["url_after_login"].ToString());
                }
                else
                {
                    Response.Redirect("/member/index.aspx");
                }
            }
            else
            {
                pub.Msg("error", "错误信息", "用户注册失败,请稍后再试!", true, "/index.aspx");
            }
        }
        else
        {
            pub.Msg("error", "错误信息", "用户注册失败,请稍后再试!", true, "/index.aspx");
        }
    }