Пример #1
0
        private static string EditPeople()
        {
            string strReturn;
            string userName = NetSchool.Common.Library.GetPostBack.GetPostBackStr("userName");
            string realName = NetSchool.Common.Library.GetPostBack.GetPostBackStr("realName");

            if ("" == userName)
            {
                strReturn = JsonConvert.SerializeObject(new { state = "error", msg = "获取用户名失败" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                {
                    DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                });
            }
            else
            {
                if ("" == realName)
                {
                    strReturn = JsonConvert.SerializeObject(new { state = "error", msg = "没有填写姓名" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                    {
                        DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                    });
                }
                else
                {
                    NetSchool.Model.People peopleInfo = NetSchool.BLL.People.GetModel(userName);
                    peopleInfo.RealName   = realName;
                    peopleInfo.TelePhone  = NetSchool.Common.Library.GetPostBack.GetPostBackStr("telephone");
                    peopleInfo.Email      = NetSchool.Common.Library.GetPostBack.GetPostBackStr("Email");
                    peopleInfo.Permission = NetSchool.Common.Library.GetPostBack.GetPostBackStr("permission");
                    if (NetSchool.BLL.People.Update(peopleInfo))
                    {
                        strReturn = JsonConvert.SerializeObject(new { state = "success", msg = "OK" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                        {
                            DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                        });
                    }
                    else
                    {
                        strReturn = JsonConvert.SerializeObject(new { state = "error", msg = "添加失败" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                        {
                            DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                        });
                    }
                }
            }

            return(strReturn);
        }
Пример #2
0
        private static string GetInfo()
        {
            string strReturn;
            string userName = NetSchool.Common.Library.GetPostBack.GetPostBackStr("userName");

            if ("" != userName)
            {
                NetSchool.Model.People peopleInfo = NetSchool.BLL.People.GetModel(UserName: userName);
                strReturn = JsonConvert.SerializeObject(new { state = "success", msg = "OK", peopleInfo = peopleInfo }, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                {
                    DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                });
            }
            else
            {
                strReturn = JsonConvert.SerializeObject(new { state = "error", msg = "获取用户名失败" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                {
                    DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                });
            }
            return(strReturn);
        }
Пример #3
0
        private static string ChangePassword()
        {
            string strReturn;
            var    oldPassword = NetSchool.Common.Library.GetPostBack.GetPostBackStr("oldPassword");
            var    newPassword = NetSchool.Common.Library.GetPostBack.GetPostBackStr("newPassword");
            var    userName    = NetSchool.Common.Info.CurUserInfo.Username;

            if (NetSchool.BLL.People.GetModel(userName).Password == Common.EnDeCryption.Base64.Encode(Common.EnDeCryption.JCode.Encode(oldPassword)))
            {
                NetSchool.Model.People peopleInfo = NetSchool.BLL.People.GetModel(userName);
                peopleInfo.Password = Common.EnDeCryption.Base64.Encode(Common.EnDeCryption.JCode.Encode(newPassword));
                if (NetSchool.BLL.People.Update(peopleInfo))
                {
                    strReturn = JsonConvert.SerializeObject(new { state = "success", msg = "OK" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                    {
                        DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                    });
                }
                else
                {
                    strReturn = JsonConvert.SerializeObject(new { state = "error", msg = "修改失败" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                    {
                        DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                    });
                }
            }
            else
            {
                strReturn = JsonConvert.SerializeObject(new { state = "error", msg = "密码错误" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                {
                    DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                });
            }

            return(strReturn);
        }