コード例 #1
0
        public ActionResult RegisterParty(PartyLoginModel registerModel)
        {
            IUserInformation user = new UserInformation();

            if (ModelState.IsValid)
            {
                if (user.CheckPartyNameUnique(registerModel.PartyName))
                {
                    if (user.PartyRegister(registerModel))
                    {
                        return(Content("<script type='text/JavaScript'>alert('注册成功!');window.location='/Account/PartyLoginIndex'</script>"));
                    }
                    else
                    {
                        Response.Write("<script type='text/JavaScript'>alert('未按规定的格式注册!')</script>");
                    }
                }
                else
                {
                    Response.Write("<script type='text/JavaScript'>alert('该社团已经被注册过了!')</script>");
                }
            }

            return(View("PartyLoginIndex"));
        }
コード例 #2
0
        /// <summary>
        /// 社团注册
        /// </summary>
        /// <param name="registerModel"></param>
        /// <returns></returns>
        public bool PartyRegister(PartyLoginModel registerModel)
        {
            try
            {
                T009社团账号表 t001 = new T009社团账号表();
                t001.PartyName = registerModel.PartyName;
                t001.Password  = Encryption.Encrype.GetMD5(registerModel.Password);

                t001.State = "未认证";
                operateContext.BLLSession.IT009社团账号表BLL.Add(t001);

                T004社团信息表 t004 = new T004社团信息表();
                t004.PartyName    = registerModel.PartyName;
                t004.Property     = Properties.Resources.PartyDefaultValue.ToString();
                t004.Purpose      = Properties.Resources.PartyDefaultValue.ToString();
                t004.Task         = Properties.Resources.PartyDefaultValue.ToString();
                t004.FoundingTime = Properties.Resources.PartyDefaultValue.ToString();
                t004.Members      = Properties.Resources.PartyDefaultValue.ToString();
                t004.Activities   = Properties.Resources.PartyDefaultValue.ToString();
                t004.Describe     = Properties.Resources.PartyDefaultValue.ToString();
                operateContext.BLLSession.IT004社团信息表BLL.Add(t004);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #3
0
        public ActionResult LoginParty(PartyLoginModel loginmodel)
        {
            IUserInformation user = new UserInformation();

            if (user.PartyLogin(loginmodel.PartyName, loginmodel.Password))
            {
                FormsAuthentication.SetAuthCookie(loginmodel.PartyName, true);

                return(RedirectToAction("PartyIndex", "PartyActivities"));
            }
            else
            {
                Response.Write("<script type='text/JavaScript'>alert('用户名或密码错误!')</script>");
            }

            return(View("PartyLoginIndex"));
        }