Esempio n. 1
0
        //private void BindRoles(AccountsPrincipal user)
        //{
        //    if (user.Permissions.Count > 0)
        //    {
        //        RoleList.Visible = true;
        //        ArrayList Permissions = user.Permissions;
        //        RoleList.Text = "权限列表:<ul>";
        //        for (int i = 0; i < Permissions.Count; i++)
        //        {
        //            RoleList.Text += "<li>" + Permissions[i] + "</li>";
        //        }
        //        RoleList.Text += "</ul>";
        //    }
        //}

        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                string            username = this.lblName.Text.Trim();
                AccountsPrincipal user     = new AccountsPrincipal(username);
                User currentUser           = new YSWL.Accounts.Bus.User(user);
                currentUser.UserName = username;
                currentUser.TrueName = txtTrueName.Text.Trim();
                //if (RadioButton1.Checked)
                //    currentUser.Sex = "1";
                //else
                //    currentUser.Sex = "0";
                //currentUser.Phone = this.txtPhone.Text.Trim();
                currentUser.Email = txtEmail.Text.Trim();
                //currentUser.UserType = dropUserType.SelectedValue;
                //int style = int.Parse(this.dropStyle.SelectedValue);
                //currentUser.Style = style;
                if (!currentUser.Update())
                {
                    Session[YSWL.Common.Globals.SESSIONKEY_ADMIN] = currentUser;
                    YSWL.Common.MessageBox.ShowFailTip(this, Resources.Site.TooltipUpdateError);
                }
                else
                {
                    YSWL.Common.MessageBox.ShowSuccessTip(this, Resources.Site.TooltipSaveOK);
                }
            }
        }
Esempio n. 2
0
 public void UpdateUserInfo(FormCollection collection)
 {
     if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null)
     {
         RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录
     }
     else
     {
         JsonObject json = new JsonObject();
         Model.Members.UsersExpModel model = bllUE.GetUsersModel(CurrentUser.UserID);
         if (null == model)
         {
             RedirectToAction("Login");//去登录
         }
         else
         {
             model.TelPhone = collection["TelPhone"];
             string birthday = collection["Birthday"];
             if (!string.IsNullOrWhiteSpace(birthday) && PageValidate.IsDateTime(birthday))
             {
                 model.Birthday = Globals.SafeDateTime(birthday, DateTime.Now);
             }
             else
             {
                 model.Birthday = null;
             }
             model.Constellation  = collection["Constellation"];  //星座
             model.PersonalStatus = collection["PersonalStatus"]; //职业
             model.Singature      = collection["Singature"];
             model.Address        = collection["Address"];
             User currentUser = new YSWL.Accounts.Bus.User(CurrentUser.UserID);
             currentUser.Sex      = collection["Sex"];
             currentUser.Email    = collection["Email"];
             currentUser.NickName = collection["NickName"];
             currentUser.Phone    = collection["Phone"];
             if (currentUser.Update() && bllUE.Update(model))
             {
                 json.Accumulate("STATUS", "SUCC");
             }
             else
             {
                 json.Accumulate("STATUS", "FAIL");
             }
             Response.Write(json.ToString());
         }
     }
 }
Esempio n. 3
0
 protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Status")
     {
         if (e.CommandArgument != null)
         {
             int      Id   = 0;
             string[] Args = e.CommandArgument.ToString().Split(new char[] { ',' });
             Id = YSWL.Common.Globals.SafeInt(Args[0], 0);
             AccountsPrincipal user = new AccountsPrincipal(Id);
             User currentUser       = new YSWL.Accounts.Bus.User(user);
             bool Status            = YSWL.Common.Globals.SafeBool(Args[1], false);
             currentUser.Activity = Status ? false : true;
             currentUser.Update();
             gridView.OnBind();
         }
     }
 }
Esempio n. 4
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            string            username = this.lblName.Text.Trim();
            AccountsPrincipal user     = new AccountsPrincipal(username);
            User currentUser           = new YSWL.Accounts.Bus.User(user);

            currentUser.UserName = username;
            currentUser.TrueName = txtTrueName.Text.Trim();
            if (txtPassword.Text.Trim() != "")
            {
                currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text);
            }
            //if (RadioButton1.Checked)
            //    currentUser.Sex = "1";
            //else
            //    currentUser.Sex = "0";

            currentUser.UserType = dropUserType.SelectedValue;
            currentUser.Phone    = this.txtPhone.Text.Trim();
            currentUser.Email    = txtEmail.Text.Trim();
            if (txtEmployeeID.Text.Length > 0)
            {
                currentUser.EmployeeID = Convert.ToInt32(txtEmployeeID.Text);
            }
            else
            {
                currentUser.EmployeeID = 0;
            }
            currentUser.Activity = !chkActive.Checked;

            //int style = int.Parse(this.dropStyle.SelectedValue);
            //currentUser.Style = style;

            if (!currentUser.Update())
            {
                this.lblMsg.ForeColor = Color.Red;
                this.lblMsg.Text      = Resources.Site.TooltipUpdateError;
            }
            else
            {
                LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format("编辑用户:【{0}】", username), this);
                Response.Redirect("useradmin.aspx");
            }
        }
Esempio n. 5
0
        public ActionResult UserModify(string txtName, string txtTrueName, string txtEmail)
        {
            AccountsPrincipal user = new AccountsPrincipal(txtName.Trim());

            YSWL.Accounts.Bus.User currentUser = new YSWL.Accounts.Bus.User(user);
            currentUser.UserName = txtName;
            currentUser.TrueName = txtTrueName.Trim();
            currentUser.Email    = txtEmail.Trim();
            JsonObject json = new JsonObject();

            if (currentUser.Update())
            {
                json.Put("Result", "OK");
                return(Json(json));
            }
            else
            {
                json.Put("Result", "NO");
                return(Json(json));
            }
        }