예제 #1
0
        //
        // GET: /Account/

        public ActionResult Login(string useremail, string userpwd, bool?rememberme)
        {
            if (string.IsNullOrEmpty(useremail) && string.IsNullOrEmpty(userpwd))
            {
                return(View());
            }
            //服务端开始验证数据
            if (string.IsNullOrWhiteSpace(useremail))
            {
                ViewBag.emailError = "请输入您的邮箱";
            }
            else
            {
                Regex reg = new Regex(@"^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})");
                if (!reg.IsMatch(useremail))
                {
                    ViewBag.emailError = "请输入正确的邮箱地址";
                }

                //检查是否存在这个用户
                Enterprise existEnterprise = BLLEnterprise.ExistEnterprise(useremail);
                if (existEnterprise == null)
                {
                    ViewBag.emailError = "该邮箱地址不存在";
                }
            }
            if (string.IsNullOrWhiteSpace(userpwd))
            {
                ViewBag.pwdError = "请输入您的密码";
            }
            if (!string.IsNullOrEmpty(ViewBag.emailError) || !string.IsNullOrEmpty(ViewBag.pwdError))
            {
                return(View());
            }
            //检查用户输入是否正确
            Enterprise _enterprise = BLLEnterprise.IsLogin(useremail, userpwd);
            string     loginError  = string.Empty;

            if (_enterprise == null)
            {
                loginError = "邮箱密码错误";
            }
            else if (!_enterprise.EnterpriseActive.HasValue || !_enterprise.EnterpriseActive.Value)
            {
                loginError = "您的账户未激活,请联系网站内部人员";
            }
            if (!string.IsNullOrEmpty(loginError))
            {
                return(View());
            }
            return(Redirect("~/Home/Index"));
        }
예제 #2
0
        protected void Application_BeginRequest(Object sender, EventArgs e)
        {
            bool isEnterpriseBg = false;

            if (Request.Url.ToString().IndexOf("http://" + Request.Url.Host + ":" + Request.Url.Port + "/EnterpriseBg") > -1)
            {
                isEnterpriseBg = true;
            }
            if (Request.Url.ToString().IndexOf("http://" + Request.Url.Host + "/EnterpriseBg") > -1)
            {
                isEnterpriseBg = true;
            }

            if (!BLLEnterprise.IsLogin() && isEnterpriseBg)
            {
                Response.Redirect("~/Home");
            }
        }
예제 #3
0
        public ActionResult EnterpriseBrief(string action, string brief)
        {
            if (!BLLEnterprise.IsLogin())
            {
                return(Redirect("~/Home"));
            }

            ViewBag.MenuGroup = "Info";
            ViewBag.PageTitle = "企业简介";

            if (action == "Save")
            {
                brief = (brief == null ? "" : brief);
                BLLEnterprise.SetEnterpriseBrief(BLLEnterprise.Current.EnterpriseID, brief);
            }

            ViewBag.CurrentEnterprise = BLLEnterprise.Current;

            return(View());
        }
예제 #4
0
        public ActionResult EnterpriseInfoEdit(string enterpriseName, string enterpriseUrl, int?templateID, string enterpriseAddress, string enterpriseTelphoneNumber, string enterpriseEmail, string EnterpriseBriefShort, string enterpriseLogo_f)
        {
            ViewBag.MenuGroup = "Info";
            ViewBag.PageTitle = "编辑企业信息";

            bool validData = true;

            validData = validData && (!string.IsNullOrEmpty(enterpriseName) && new Regex(@"^([\w]|[\u4E00-\u9FA5]){2,20}$").IsMatch(enterpriseName));
            validData = validData && (!string.IsNullOrEmpty(enterpriseEmail) && new Regex(@"^(([\w-\s]+)|([\w-]+(?:\.[\w-]+)*)|([\w-\s]+)([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)", RegexOptions.IgnoreCase).IsMatch(enterpriseEmail));
            validData = validData && (!string.IsNullOrEmpty(enterpriseTelphoneNumber) && new Regex(@"^\+?(\d[\d\-\+\(\) ]{5,}\d$)").IsMatch(enterpriseTelphoneNumber));
            validData = validData && (!string.IsNullOrEmpty(enterpriseAddress));

            if (validData)
            {
                if (templateID == null)
                {
                    templateID = 0;
                }

                if (BLLEnterprise.SaveEnterpriseInfoChanges(BLLEnterprise.Current.EnterpriseID, enterpriseName, enterpriseUrl, templateID.Value, enterpriseAddress, enterpriseTelphoneNumber, enterpriseEmail, EnterpriseBriefShort, enterpriseLogo_f))
                {
                    return(Redirect("~/EnterpriseBg/EnterpriseInfo"));
                }
            }

            if (!BLLEnterprise.IsLogin())
            {
                return(Redirect("~/Home"));
            }

            ViewBag.CurrentEnterprise = BLLEnterprise.Current;
            List <Templates> TemplatesList = BLLTemplate.GetTemplateList();

            ViewBag.TemplatesList = TemplatesList;

            return(View());
        }