Пример #1
0
        public static void CreateOrUpdate(UserInfo model)
        {
            if (model.Id < 0)
            {
                model.Password = SecurityFactory.GetSecurity().Encrypt(ConfigurationManager.AppSettings["DefaultPassword"].ToString());

                if (SimpleOrmOperator.Create(model))
                {
                    WebTools.Alert("添加成功!");
                }
                else
                {
                    WebTools.Alert("添加失败!");

                }
            }
            else
            {
                if (SimpleOrmOperator.Update(model))
                {
                    WebTools.Alert("修改成功!");
                }
                else
                {
                    WebTools.Alert("修改失败!");

                }
            }
        }
Пример #2
0
        public static string ChangePwd(UserInfo user, string oldpwd, string newpwd)
        {
            if (user.Password != SecurityFactory.GetSecurity().Encrypt(oldpwd))
            {
                return "旧密码输入错误!";
            }
            bool result = DataAccessFactory.GetDataAccess().ExecuteSql("update table_user_info set c_pwd='" + SecurityFactory.GetSecurity().Encrypt(newpwd) + "' where id=" + user.Id);
            if (result)
            {
                LogInfoOperator.LogSystem("修改密码", user.FullName + "修改自己的密码");
                return string.Empty;

            }
            else
                return "修改密码失败!";
        }