示例#1
0
        /*Admin/LockByMonth
         * 1、获取按月份冻结用户的参数(月份 int or string)
         * 2、通过UserManager-LockByMonth冻结指定条件的用户
         * 3、返回操作结果*/
        public ActionResult LockByMonth(string month)
        {
            DateTime datetime = new IPManager().GetDateTime();

            datetime = datetime.AddMonths(-Convert.ToInt32(month));

            string date = datetime.ToString("yyy-MM-dd");

            if (new UserManager().LockStudentByMonth(date))
            {
                return(Content("success"));
            }
            else
            {
                return(Content("fail"));
            }
        }
示例#2
0
        /*Admin/AddStudent
         * 1、获取学生信息(url参数)
         * 2、利用UserManager-AddStudent添加学生并返回学号、
         * 2、返回添加结果*/
        public ActionResult AddStudent(string name, string phone, string idcard, string sex, DateTime birthday, string address, string college_id, string major_id)
        {
            DateTime datetime     = new IPManager().GetDateTime();
            string   year         = datetime.ToString("yyyy");
            string   date         = datetime.ToString("yyyy-MM-dd");
            string   latestnumber = new UserManager().SelectTheLatestData(major_id, year);
            string   newnumber    = "";

            if (latestnumber == "0")
            {
                newnumber = year + major_id + "001";
            }
            else
            {
                string start = latestnumber.Substring(0, 8);
                string end   = latestnumber.Remove(0, 8);
                newnumber = start + Convert.ToString(string.Format("{0:d3}", Convert.ToInt32(end) + 1));
            }

            string password = phone.Substring(3, 8);

            SLogin slogin = new SLogin();
            SBasic sbasic = new SBasic();

            College college = new College();

            college.CollegeId = college_id;
            Major major = new Major();

            major.MajorId = major_id;
            Status status = new Status();

            status.StatusId = 0;
            State state = new State();

            state.StateId = 1;

            sbasic.SNumber     = newnumber;
            sbasic.SName       = name;
            sbasic.SIDNumber   = idcard;
            sbasic.SCollege    = college;
            sbasic.SMajor      = major;
            sbasic.SEnrollment = Convert.ToDateTime(date);
            sbasic.SStatus     = status;
            sbasic.SSex        = sex;
            sbasic.SPhone      = phone;
            sbasic.SBirthday   = birthday;
            sbasic.SAddress    = address;
            sbasic.SPicAddress = "default";

            slogin.SNumber   = sbasic;
            slogin.SPassword = password;
            slogin.State     = state;

            if (new UserManager().AddStudent(slogin) == newnumber)
            {
                return(Content(newnumber));
            }
            else
            {
                return(Content("0"));
            }
        }