示例#1
0
        public ActionResult SumbitLogon(VOUser user)
        {
            if (string.IsNullOrEmpty(user.UserName) || string.IsNullOrEmpty(user.Password))
            {
                return(RedirectToAction("Logon", "LogonForm", new { message = "登录名,密码不能为空!" }));
            }

            JsonUser jsonUser = UserService.CheckUserPassword(user.UserName, user.Password);

            CookieUtils.AddCookie("LogonID", user.UserName, System.Web.HttpContext.Current);

            if (user.RememberMe)
            {
                HttpCookie cookie = CookieUtils.GetCookie(System.Web.HttpContext.Current, "LogonID");
                cookie.Expires = DateTime.Now.AddDays(7);
            }
            GlobalVariables.CurrentUser = jsonUser;

            if (jsonUser == null)
            {
                return(RedirectToAction("Logon", "LogonForm", new { message = "用户名,密码验证失败!" }));
            }

            return(RedirectToAction("Index", "ParticipateConsultation"));
        }
示例#2
0
        public IUserBuilder <User> From(VOUser user)
        {
            UserName = user.UserName;
            Password = user.Password;
            Role     = user.Role;

            return(this);
        }
        public IActionResult SaveUser([FromBody] VOUser user)
        {
            try
            {
                _userService.InsertUser(user);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
示例#4
0
        //
        // GET: /Login/

        public ActionResult Index(string message)
        {
            VOUser user = new VOUser();

            ViewBag.Message = message;

            HttpCookie cookie = CookieUtils.GetCookie(System.Web.HttpContext.Current, "LogonID");

            if (cookie != null)
            {
                user.UserName   = cookie.Value;
                user.RememberMe = true;
            }
            return(View(user));
        }
示例#5
0
        /// <summary>
        /// Refresh the data of the main activity.
        /// </summary>
        protected override void RefreshData()
        {
            VOUser       user       = logicConnection.GetUser();
            ToggleButton active     = FindViewById <ToggleButton>(Resource.Id.toggleButton1);
            Button       listOrders = FindViewById <Button>(Resource.Id.button1);
            Button       newOrder   = FindViewById <Button>(Resource.Id.button2);

            active.Checked = user.Status == statusAvailable;

            if (user.Role == "Delivery")
            {
                newOrder.Visibility = Android.Views.ViewStates.Invisible;
            }

            active.Click += (sender, e) => Utility.AuthenticateIfNeeded(() =>
            {
                if (active.Checked)
                {
                    logicConnection.ChangeStatus(statusAvailable);
                }
                else
                {
                    logicConnection.ChangeStatus(statusUnavailable);
                }
                RefreshData();
            }, this);

            listOrders.Click += delegate
            {
                Utility.AuthenticateIfNeeded(() =>
                {
                    StartActivity(typeof(OrderListActivity));
                }, this);
            };

            newOrder.Click += delegate
            {
                Utility.AuthenticateIfNeeded(() =>
                {
                    //StartActivity(typeof());
                }, this);
            };
        }
示例#6
0
        public void InsertUser(VOUser user)
        {
            var insertUser = new CommandInsertUser(_userBuilder.From(user).Build(), _userRepository);

            insertUser.Execute();
        }