Beispiel #1
0
        protected override bool OnViewSubmit()
        {
            var request = new ServiceRequest();

            Q.ServiceCall(new ServiceCallOptions
            {
                Url = Q.ResolveUrl("~/Administration/User/getUser"),

                Request   = request.As <ServiceRequest>(),
                OnSuccess = response =>
                {
                    dynamic obj = response;
                    UserRow t   = (UserRow)obj;
                    user_name   = t.Username;
                    admin_lv    = obj.adminlv;
                    if (i_refresh == 1)
                    {
                        i_refresh = 0;
                        Refresh();
                    }
                }
            });

            var req = (ListRequest)view.Params;

            req.EqualityFilter = req.EqualityFilter ?? new JsDictionary <string, object>();
            //if (admin_lv == "1")
            //    req.EqualityFilter["By_User"] = "";
            //else
            //    req.EqualityFilter["By_User"] = user_name;
            req.EqualityFilter["Submit"] = "1";
            return(true);
        }
Beispiel #2
0
        public UserDialog()
        {
            var request = new ServiceRequest();

            Q.ServiceCall(new ServiceCallOptions
            {
                Url = Q.ResolveUrl("~/Administration/User/getUser"),

                Request   = request.As <ServiceRequest>(),
                OnSuccess = response =>
                {
                    dynamic obj = response;
                    UserRow t   = (UserRow)obj;
                    user_name   = t.Username;
                    admin_lv    = obj.adminlv;
                    //Q.Log("user_name:  " + user_name + "  admin_lv:" + admin_lv);
                    if (i_refresh == 1)
                    {
                        i_refresh = 0;
                        this.ReloadById();
                    }
                }
            });

            form = new UserForm(this.IdPrefix);

            form.Password.AddValidationRule(this.uniqueName, e =>
            {
                if (form.Password.Value.Length < 7)
                {
                    return("Password must be at least 7 characters!");
                }

                return(null);
            });

            form.PasswordConfirm.AddValidationRule(this.uniqueName, e =>
            {
                if (form.Password.Value != form.PasswordConfirm.Value)
                {
                    return("The passwords entered doesn't match!");
                }

                return(null);
            });
        }