Ejemplo n.º 1
0
        public static string editPass(int id, string password)
        {
            int          code    = 0;
            string       message = "返回成功";
            StudentsUser user    = new StudentsUser();

            try
            {
                using (StudentsUserBLL bll = new StudentsUserBLL())
                {
                    user          = bll.getStudentsUser(id);
                    user.Password = password;
                    bll.Update(user);
                }
            }
            catch (Exception)
            {
                code    = 0;
                message = "修改密码错误!";
            }
            return(JsonConvert.SerializeObject(new
            {
                code = code,
                message = message
            }));
        }
Ejemplo n.º 2
0
        public static string insterStuUser(string Sfzh, string Password, string Zkzh, string StuName, string StuType, string Mobile, string E_mail)
        {
            int          code = 0;
            int          _list;
            string       message = "错误";
            StudentsUser stuUser = new StudentsUser();

            stuUser.Sfzh           = Sfzh;
            stuUser.Password       = MD5Helper.DesEncrypt(Password);
            stuUser.Zkzh           = Zkzh;
            stuUser.StuName        = StuName;
            stuUser.StuType        = int.Parse(StuType);
            stuUser.Mobile         = Mobile;
            stuUser.E_mail         = E_mail;
            stuUser.Bz             = "";
            stuUser.Certificate    = "";
            stuUser.CheckTime      = DateTime.Parse("1900-01-01");
            stuUser.CriterionCouse = "";
            stuUser.IsCheck        = 0;
            stuUser.IsCriterion    = 0;
            stuUser.IsPlan         = 0;
            stuUser.LastLoginDate  = DateTime.Now;
            stuUser.SignUpNum      = "00";
            stuUser.State          = 1;
            stuUser.RegDate        = DateTime.Now;
            try
            {
                using (StudentsUserBLL bll = new StudentsUserBLL())
                {
                    _list = bll.Insert(stuUser);
                    Random ran     = new Random();
                    int    RandKey = ran.Next(1000, 9999);
                    //stuUser.SignUpNum = RandKey.ToString().PadLeft(6, '0');
                    stuUser.SignUpNum = _list.ToString().PadLeft(6, '0');
                    bll.Update(stuUser);
                    code    = 1;
                    message = "注册成功!用户名为" + bll.getStudentsUserBySignSfzh(stuUser.Sfzh).SignUpNum;
                }
            }
            catch (Exception)
            {
                message = "注册失败!";
            }
            //string str3 = string.Format("{\"code\":\"0\",,\"message\":\"{1}\"}", code, message);//
            string str3 = JsonConvert.SerializeObject(new { code = code, message = message });

            return(str3);
        }
Ejemplo n.º 3
0
        public static string intsertStuUser(string Sfzh, string Password, string Zkzh, string StuName, string StuType, string Mobile, string E_mail)
        {
            int          code    = 0;
            string       message = "错误";
            int          _list;
            StudentsUser stuUser = new StudentsUser();

            stuUser.Sfzh           = Sfzh;
            stuUser.Password       = Password;
            stuUser.Zkzh           = Zkzh;
            stuUser.StuName        = StuName;
            stuUser.StuType        = int.Parse(StuType);
            stuUser.Mobile         = Mobile;
            stuUser.E_mail         = E_mail;
            stuUser.Bz             = "";
            stuUser.Certificate    = "";
            stuUser.CheckTime      = DateTime.Parse("1900-01-01");
            stuUser.CriterionCouse = "";
            stuUser.IsCheck        = 0;
            stuUser.IsCriterion    = 0;
            stuUser.IsPlan         = 0;
            stuUser.LastLoginDate  = DateTime.Now;
            stuUser.LoginCount     = 1;
            stuUser.SignUpNum      = "00";
            stuUser.State          = 1;
            stuUser.RegDate        = DateTime.Now;
            using (StudentsUserBLL bll = new StudentsUserBLL())
            {
                try
                {
                    _list             = bll.Insert(stuUser);
                    stuUser.SignUpNum = _list.ToString().PadLeft(6, '0');
                    bll.Update(stuUser);
                    code    = 1;
                    message = "提交成功 用户名为" + bll.getStudentsSignUpNumBySfzh(stuUser.Sfzh).SignUpNum;
                }
                catch (Exception)
                {
                    code    = 0;
                    message = "提交失败";
                }
            }
            string str = JsonConvert.SerializeObject(new { code = code, message = message });

            return(str);
        }