Esempio n. 1
0
        /// <summary>
        /// 保存考勤
        /// </summary>
        /// <returns></returns>
        public JsonResult saveStudentAttendance()
        {
            AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载

            ajax.status = EnumAjaxStatus.Error;           //默认失败
            ajax.msg    = "保存考勤失败!";                      //前台获取,用于显示提示信息
            var data = Request["data"];                   //获取前台传递的数据,主要序列化

            if (string.IsNullOrEmpty(data))
            {
                return(Json(ajax));
            }
            List <AttendanceRecord> cls = (List <AttendanceRecord>)(JsonConvert.DeserializeObject(data.ToString(), typeof(List <AttendanceRecord>)));

            cls = cls.Where(t => t != null && t.AttendanceTypeID != 1).ToList();
            if (cls.Count() > 0)
            {
                string    _classid    = cls.FirstOrDefault().ClassID;
                int       _classindex = cls.FirstOrDefault().ClassIndex;
                ClassList cl          = ClassListData.GetOneByid(_classid, _classindex);
                if (cl.ClassDate.Date > DateTime.Now.Date)
                {
                    ajax.msg = "你要处理的考勤时间还未发生!";
                    return(Json(ajax));
                }
            }
            if (AttendaceData.saveStudentAttendance(cls, UserSession.userid))
            {
                ajax.status = EnumAjaxStatus.Success;
                ajax.msg    = "保存考勤成功";
            }

            return(Json(ajax));
        }
Esempio n. 2
0
        /// <summary>
        /// 新增排班表 ClassList
        /// </summary>
        /// <returns></returns>
        public JsonResult ClassListSave()
        {
            AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载

            ajax.status = EnumAjaxStatus.Error;           //默认失败
            ajax.msg    = "新增失败!";                        //前台获取,用于显示提示信息
            //var TIme = Request["Date"];//获取前台传递的数据,主要序列化
            var data = Request["data"];                   //获取前台传递的数据,主要序列化

            if (string.IsNullOrEmpty(data))
            {
                return(Json(ajax));
            }

            Weekday   Weekday = (Weekday)(JsonConvert.DeserializeObject(data.ToString(), typeof(Weekday)));     //星期
            Classes   Classes = (Classes)(JsonConvert.DeserializeObject(data.ToString(), typeof(Classes)));     //班级
            Date      Date    = (Date)(JsonConvert.DeserializeObject(data.ToString(), typeof(Date)));           //时间
            ClassList Clas    = (ClassList)(JsonConvert.DeserializeObject(data.ToString(), typeof(ClassList))); //排课表
            var       v       = Date.Start_Date;

            Clas.StateID    = 1;                                          //状态
            Clas.CreateTIme = DateTime.Now;                               //创建时间
            Clas.CreatorId  = UserSession.userid;                         //创建人

            if (ClassListData.AddClassList(Clas, Date, Classes, Weekday)) //注意时间类型,而且需要在前台把所有的值
            {
                ajax.msg    = "新增成功!";
                ajax.status = EnumAjaxStatus.Success;
            }
            return(Json(ajax));
        }
Esempio n. 3
0
        /// <summary>
        /// 新增时钟(字典表)
        /// </summary>
        /// <returns></returns>
        public JsonResult addTime_save()
        {
            AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载

            ajax.status = EnumAjaxStatus.Error;           //默认失败
            ajax.msg    = "新增失败!";                        //前台获取,用于显示提示信息
            var data = Request["data"];                   //获取前台传递的数据,主要序列化

            if (string.IsNullOrEmpty(data))
            {
                return(Json(ajax));
            }
            Date Date = (Date)(JsonConvert.DeserializeObject(data.ToString(), typeof(Date)));

            DictionaryItem item      = new DictionaryItem();
            int            DicItemID = CommonData.Getnumber(8);             //获取行号

            item.DicTypeID   = 8;                                           //时钟类别
            item.DicItemID   = DicItemID + 1;                               //行号
            item.CreateTime  = DateTime.Now;                                //创建时间
            item.Sort        = 0;                                           //是否启用类别
            item.recordState = 0;                                           //状态
            item.DicItemName = Date.addtime_start + "-" + Date.addtime_End; //值

            if (ClassListData.AddDictionaryItemt(item))                     //注意时间类型,而且需要在前台把所有的值
            {
                ajax.msg = "新增成功!";



                JObject jsonObj = new JObject();
                jsonObj.Add("DicItemID", item.DicItemID);
                jsonObj.Add("DicItemName", item.DicItemName);

                string aa = JsonConvert.SerializeObject(jsonObj); //序列化,不序列化前台获取不到值

                ajax.data   = aa;                                 //返回新增加的时钟
                ajax.status = EnumAjaxStatus.Success;
            }

            return(Json(ajax));
        }
Esempio n. 4
0
        /// <summary>
        /// 刷新排课记录,用于补漏
        /// </summary>
        /// <returns></returns>
        public JsonResult ClassListRefresh()
        {
            AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载

            ajax.status = EnumAjaxStatus.Error;           //默认失败
            ajax.msg    = "刷新排课失败!";                      //前台获取,用于显示提示信息
            string classid = Request["classid"];          //班级ID

            if (string.IsNullOrEmpty(classid))
            {
                return(Json(ajax));
            }

            if (ClassListData.RefreshClassList(classid, UserSession.userid))
            {
                ajax.msg    = "刷新排课成功!";
                ajax.status = EnumAjaxStatus.Success;
            }
            return(Json(ajax));
        }
Esempio n. 5
0
        /// <summary>
        /// 新增加课功能 ClassList
        /// </summary>
        /// <returns></returns>
        public JsonResult AddClassesSAVA()
        {
            AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载

            ajax.status = EnumAjaxStatus.Error;           //默认失败
            ajax.msg    = "新增失败!";                        //前台获取,用于显示提示信息
            //var TIme = Request["Date"];//获取前台传递的数据,主要序列化
            var data = Request["data"];                   //获取前台传递的数据,主要序列化

            if (string.IsNullOrEmpty(data))
            {
                return(Json(ajax));
            }


            ClassList Clas = (ClassList)(JsonConvert.DeserializeObject(data.ToString(), typeof(ClassList))); //排课表

            Clas.StateID    = 1;                                                                             //状态
            Clas.CreateTIme = DateTime.Now;                                                                  //创建时间
            Clas.CreatorId  = UserSession.userid;                                                            //创建人


            Clas.ClassDate = DateTime.Parse(Clas.ClassDate.ToShortDateString() + ClassListData.GetStartTimePeriodByid(Clas.TimePeriod.Value)); //因为这个开课时间是根据选择的时间和时段拼接成的,所有要处理一下
            if (ClassListData.GetClassListnumber(Clas.ClassID, Clas.ClassDate) > 0)                                                            //根据班级ID和时间来判断是否已经存在数据,如果已经添加,那不能重复添加
            {
                ajax.msg    = "该班级这个时间段已经存在相应的课程,请您不要重复添加!";
                ajax.data   = 1;
                ajax.status = EnumAjaxStatus.Success;
            }
            else
            {
                if (ClassListData.AddClassesSAVA(Clas))//注意时间类型,而且需要在前台把所有的值
                {
                    ajax.msg    = "新增成功!";
                    ajax.status = EnumAjaxStatus.Success;
                }
            }


            return(Json(ajax));
        }
Esempio n. 6
0
        /// <summary>
        /// 停课操作
        /// </summary>
        /// <returns></returns>
        public ActionResult StopClass()
        {
            AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载

            ajax.status = EnumAjaxStatus.Error;           //默认失败
            ajax.msg    = "保存失败!";                        //前台获取,用于显示提示信息
            var classid    = Request["classid"];          //班级ID
            var classindex = Request["classindex"];       //班级序号

            if (string.IsNullOrEmpty(classid))
            {
                return(Json(ajax));
            }
            if (string.IsNullOrEmpty(classindex))
            {
                return(Json(ajax));
            }
            //找到对应的班次,如果状态是已上课,则不允许停课
            ClassList cl_this = ClassListData.GetOneByid(classid.ToString(), int.Parse(classindex));

            if (cl_this.StateID == 2)//本课次已上
            {
                ajax.msg = "本课次已上,不允许停课!";
                return(Json(ajax));
            }
            DateTime newtime = ClassListData.StopClass(classid.ToString(), int.Parse(classindex));

            if (newtime > DateTime.MinValue.AddYears(1))
            {
                ajax.status = EnumAjaxStatus.Success;
                ajax.msg    = "停课成功";
                ajax.data   = ajax.msg;
            }

            return(Json(ajax));
        }
Esempio n. 7
0
        /// <summary>
        /// 保存调课信息
        /// </summary>
        /// <returns></returns>
        public JsonResult saveModifyClass()
        {
            AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载

            ajax.status = EnumAjaxStatus.Error;           //默认失败
            ajax.msg    = "保存失败!";                        //前台获取,用于显示提示信息
            var data = Request["data"];                   //获取前台传递的数据,主要序列化

            if (string.IsNullOrEmpty(data))
            {
                return(Json(ajax));
            }
            ClassList btn = (ClassList)(JsonConvert.DeserializeObject(data.ToString(), typeof(ClassList)));
            int       obj = ClassListData.UpdateClassList(btn);

            if (obj > 0)
            {
                ajax.status = EnumAjaxStatus.Success;
                ajax.msg    = "保存成功";
                ajax.data   = ajax.msg;
            }

            return(Json(ajax));
        }