コード例 #1
0
        //-记得修改classid
        public string GetClassTask(int classId)
        {
            //int classId = (int)Session["classid"];
            //int classId = 2;
            string where = "ClassId = " + classId;

            DALT_Event_ClassTask     dal  = new DALT_Event_ClassTask();
            List <T_Event_ClassTask> list = new List <T_Event_ClassTask>();

            list = dal.GetAllList(where);//传参数where

            string res = "";

            foreach (T_Event_ClassTask item in list)
            {
                if (item.State == 1)
                {
                    continue;
                }
                string st = ((DateTime)item.StartTime).ToString("yyyy-MM-dd HH:mm");
                string ed = ((DateTime)item.EndTime).ToString("yyyy-MM-dd HH:mm");
                res += "{\"id\":\"" + item.Id
                       + "\",\"title\":\"" + item.Name
                       + "\",\"start\":\"" + st
                       + "\",\"type\":\"" + item.Type
                       + "\",\"end\":\"" + ed + "\"}";
                res += ",";
            }

            return(res);
        }
コード例 #2
0
        //班级任务修改
        public int EditClassTask(int taskid, string title, int type, string des, string start,
                                 string end, int alert, int isAll, string students, string WPeople, int classid = -1)
        {
            if (title == "")
            {
                return(1);
            }
            else if (classid == -1)
            {
                return(2);
            }

            #region 班级日程修改
            DALT_Event_ClassTask dal  = new DALT_Event_ClassTask();
            T_Event_ClassTask    item = new T_Event_ClassTask();
            item.Id           = taskid;
            item.State        = 0;
            item.Name         = title;
            item.Type         = type;
            item.Description  = des;
            item.ClassId      = classid;
            item.StartTime    = Convert.ToDateTime(start);
            item.EndTime      = Convert.ToDateTime(end);
            item.WPeople      = WPeople;
            item.IsAllStuTask = isAll;

            if (alert == 0)
            {
                item.IsAlert = 0;
            }
            else
            {
                item.IsAlert   = 1;
                item.AlertTime = alert;
            }

            #endregion

            bool res = dal.Update(item);

            #region  除原有的,重新添加
            if (isAll == 0)
            {
                students = students.Substring(0, students.LastIndexOf(","));
                string[] stus = students.Split(',');

                DALT_Event_StuClassTask escDal = new DALT_Event_StuClassTask();
                escDal.EditPartTask(taskid, stus);
            }
            #endregion

            if (res)
            {
                return(0);
            }
            else
            {
                return(3);
            }
        }
コード例 #3
0
        //班级任务删除
        public int DeleteClassTask(int userLevel, int taskid)
        {
            string where = "ClassId = " + taskid;
            if (userLevel == 0)
            {
                DALT_ClassTask_Stu csDal = new DALT_ClassTask_Stu();
                csDal.DeleteWhere(where);
            }
            else
            {
                DALT_ClassTask_Tea csDal = new DALT_ClassTask_Tea();
                csDal.DeleteWhere(where);
            }

            DALT_Event_ClassTask ectDal = new DALT_Event_ClassTask();

            T_Event_ClassTask item = new T_Event_ClassTask();

            item = ectDal.GetModel(taskid);

            if (item.IsAllStuTask == 0)
            {
                DALT_Event_StuClassTask escDal = new DALT_Event_StuClassTask();

                where = "ClassTaskId = " + taskid;
                escDal.DeleteWhere(where);
            }

            ectDal.Delete(taskid);

            return(1);
        }
コード例 #4
0
        public ActionResult TetT()
        {
            if (Session["UserId"] == null)
            {
                return(Redirect("/Login/Login/Index"));
            }

            int Teaid = (int)Session["UserId"];

            List <T_Task_Course> list = FindAllCourse(Teaid);

            DateTime d  = DateTime.Now;                                        //wx
            int      id = (int)Session["UserId"];

            DAL.DALT_Event_MyTask     dal   = new DALT_Event_MyTask();
            DAL.DALT_Event_ClassTask  dal2  = new DALT_Event_ClassTask();
            DAL.DALT_Event_CourseTask dal3  = new DALT_Event_CourseTask();
            List <T_Event_ClassTask>  list3 = dal2.FindListT(d, id);
            List <T_Event_CourseTask> list4 = dal3.FindListT(d, id);
            List <T_Event_MyTask>     list2 = dal.FindList(d, id);

            ViewBag.list2 = list2;
            ViewBag.list3 = list3;
            ViewBag.list4 = list4;

            ViewBag.list = list;
            return(View());
        }
コード例 #5
0
        public int GetAllTime(DateTime start, DateTime end, DateTime start_date, int userid, int week_type, int week_number)
        {
            #region 判断课程和课程冲突
            //王一情 需要先找到这个老师所教的所有课程,然后进行冲突判断
            DALT_Event_CourseTask     dal         = new DALT_Event_CourseTask();
            List <T_Event_CourseTask> course_list = dal.GetTeaCourseList2(userid);

            DateTime st    = start_date;
            string   ym    = st.ToString("yyyy-MM-dd");
            string   strSt = ym + " " + start.ToLongTimeString().ToString();
            string   strEn = ym + " " + end.ToLongTimeString().ToString();
            DateTime newSt = Convert.ToDateTime(strSt);
            DateTime newEn = Convert.ToDateTime(strEn);

            foreach (T_Event_CourseTask item in course_list)
            {
                if (item.State == 1)
                {
                    continue;
                }

                DateTime st2    = (DateTime)item.StartWeek;
                string   om     = st2.ToString("yyyy-MM-dd");
                string   strSt2 = om + " " + Convert.ToDateTime(item.StartTime).ToLongTimeString().ToString();
                string   strEn2 = om + " " + Convert.ToDateTime(item.EndTime).ToLongTimeString().ToString();
                DateTime oldSt  = Convert.ToDateTime(strSt2);
                DateTime oldEn  = Convert.ToDateTime(strEn2);

                if (!(newSt >= oldEn || newEn <= oldSt))
                {
                    return(0);
                }
            }
            #endregion

            #region 判断课程和班级冲突
            //王一情
            //需要先通过courseid找到选这个课的学生的班级,然后查找班级日程
            DALT_Event_ClassTask     classdal  = new DALT_Event_ClassTask();
            List <T_Event_ClassTask> classList = classdal.GetTeaClassList2(userid);

            foreach (T_Event_ClassTask item in classList)
            {
                if (item.State == 1)
                {
                    continue;
                }

                if (!(newSt >= item.EndTime || newEn <= item.StartTime))
                {
                    return(0);
                }
            }
            #endregion

            return(1);
        }
コード例 #6
0
        //-班级和课程冲突判定
        public int IsChongtu(int taskid, string start, string end)
        {
            DateTime dt_start = Convert.ToDateTime(start);
            DateTime dt_end   = Convert.ToDateTime(end);

            #region 判断班级和班级冲突

            DALT_Event_ClassTask     dal        = new DALT_Event_ClassTask();
            List <T_Event_ClassTask> class_list = dal.GetAllList();

            foreach (T_Event_ClassTask item in class_list)
            {
                if (taskid == item.Id || item.State == 1)
                {
                    continue;
                }

                if (!(dt_start >= (DateTime)item.EndTime || dt_end <= (DateTime)item.StartTime))
                {
                    return(0);
                }
            }
            #endregion

            #region 判断班级和课程冲突
            DALT_Event_CourseTask     coursedal   = new DALT_Event_CourseTask();
            List <T_Event_CourseTask> course_list = coursedal.GetAllList();

            foreach (T_Event_CourseTask item in course_list)
            {
                if (item.State == 1)
                {
                    continue;
                }

                DateTime st    = (DateTime)item.StartWeek;
                string   ym    = st.ToString("yyyy-MM-dd");
                string   strSt = ym + " " + item.StartTime;
                string   strEn = ym + " " + item.EndTime;
                DateTime newSt = Convert.ToDateTime(strSt);
                DateTime newEn = Convert.ToDateTime(strEn);

                if (!(dt_start >= newEn || dt_end <= newSt))
                {
                    return(0);
                }
            }
            #endregion

            return(1);
        }
コード例 #7
0
        //王一情
        //冲突检测(自己和自己不存在冲突——吴佳洁)
        public int IsCouChongtu2(DateTime start, DateTime end, int taskid, int userid)
        {
            #region 判断课程和课程冲突
            //王一情 需要先找到这个老师所教的所有课程,然后进行冲突判断
            DALT_Event_CourseTask     dal         = new DALT_Event_CourseTask();
            List <T_Event_CourseTask> course_list = dal.GetTeaCourseList2(userid);

            foreach (T_Event_CourseTask item in course_list)
            {
                //王一情
                if (item.State == 1 || taskid == item.Id)
                {
                    continue;
                }

                DateTime st2    = (DateTime)item.StartWeek;
                string   om     = st2.ToString("yyyy-MM-dd");
                string   strSt2 = om + " " + Convert.ToDateTime(item.StartTime).ToLongTimeString().ToString();
                string   strEn2 = om + " " + Convert.ToDateTime(item.EndTime).ToLongTimeString().ToString();
                DateTime oldSt  = Convert.ToDateTime(strSt2);
                DateTime oldEn  = Convert.ToDateTime(strEn2);

                if (!(start >= oldEn || end <= oldSt))
                {
                    return(0);
                }
            }
            #endregion

            #region 判断课程和班级冲突
            //王一情
            //需要先通过courseid找到选这个课的学生的班级,然后查找班级日程
            DALT_Event_ClassTask     classdal  = new DALT_Event_ClassTask();
            List <T_Event_ClassTask> classList = classdal.GetTeaClassList2(userid);

            foreach (T_Event_ClassTask item in classList)
            {
                if (item.State == 1)
                {
                    continue;
                }

                if (!(start >= item.EndTime || end <= item.StartTime))
                {
                    return(0);
                }
            }
            #endregion

            return(1);
        }
コード例 #8
0
        public string GetOneClassTask(int userLevel, int taskid, int userid, int classid)
        {
            DALT_Event_ClassTask dal  = new DALT_Event_ClassTask();
            T_Event_ClassTask    item = dal.GetModel(taskid);

            int    canEdit     = dal.CanEdit(userLevel, userid, taskid);
            string allstudents = GetAllStu(classid);


            #region 连接传回数据
            string res = "[";

            int taskAlert = 0;

            if (item.IsAlert != 0)
            {
                taskAlert = (int)item.AlertTime;
            }

            string students = "";
            if (item.IsAllStuTask != 1)
            {
                //部分学生
                DALT_Event_StuClassTask escDal = new DALT_Event_StuClassTask();
                students = escDal.GetStus(taskid);
            }

            res += "{\"type\":\"" + item.Type
                   + "\",\"des\":\"" + item.Description
                   + "\",\"taskAlert\":\"" + taskAlert
                   + "\",\"students\":\"" + students
                   + "\",\"canEdit\":\"" + canEdit
                   + "\",\"allstudents\":\"" + allstudents
                   + "\",\"isAll\":\"" + item.IsAllStuTask + "\"}";
            res += ",";

            if (res.Count() >= 1)
            {
                res = res.Substring(0, res.Count() - 1);
            }

            res += "]";
            #endregion


            return(res);
        }
コード例 #9
0
        public List <T_Search_Event> SearchClassTask(int searchid, int userLevel, string title, string start)
        {
            string wtitel = "";
            string wstart = "";

            if (title != "")
            {
                wtitel = " and Name like'%" + title + "%'";
            }
            if (start != "")
            {
                wstart = " and convert(varchar(10),StartTime,120) = '" + start + "'";
            }

            string where = "ClassId = " + searchid + wtitel + wstart;

            DALT_Event_ClassTask     dal  = new DALT_Event_ClassTask();
            List <T_Event_ClassTask> lst  = dal.GetAllList(where);
            List <T_Search_Event>    list = new List <T_Search_Event>();

            #region 转换成现实格式
            foreach (T_Event_ClassTask item in lst)
            {
                T_Search_Event now = new T_Search_Event();
                now.Name        = item.Name;
                now.StartTime   = (DateTime)item.StartTime;
                now.EndTime     = (DateTime)item.EndTime;
                now.Description = item.Description;

                if (item.IsAlert == 1)
                {
                    now.AlertTime = (int)item.AlertTime;
                }
                else
                {
                    now.AlertTime = 0;
                }
                now.Type = item.Type;

                list.Add(now);
            }
            #endregion

            return(list);
        }
コード例 #10
0
        //班干部 and 老师
        //班级任务添加-记得修改stuid
        public int AddClassTask(string title, int type, string des, string start, string end,
                                int alert, int isAll, string students, string WPeople, int userLevel, int classid = -1, int userid = -1, int state = 0)
        {
            if (title == "")
            {
                return(1);
            }
            else if (classid == -1)
            {
                return(2);
            }

            #region 班级日程创建
            DALT_Event_ClassTask dal  = new DALT_Event_ClassTask();
            T_Event_ClassTask    item = new T_Event_ClassTask();
            item.State        = state;
            item.Name         = title;
            item.Type         = type;
            item.Description  = des;
            item.ClassId      = classid;
            item.StartTime    = Convert.ToDateTime(start);
            item.EndTime      = Convert.ToDateTime(end);
            item.WPeople      = WPeople;
            item.IsAllStuTask = isAll;

            if (alert == 0)
            {
                item.IsAlert = 0;
            }
            else
            {
                item.IsAlert   = 1;
                item.AlertTime = alert;
            }

            #endregion

            int res = 0;
            if (userLevel == 0)
            {
                res = dal.AddTaskStu(item, userid);//res也是taskid
            }
            else
            {
                res = dal.AddTaskTea(item, userid);
            }

            #region 部分学生的班级日程添加
            if (isAll == 0)
            {
                students = students.Substring(0, students.LastIndexOf(","));
                string[] stus = students.Split(',');

                DALT_Event_StuClassTask escDal = new DALT_Event_StuClassTask();
                escDal.AddPartTask(res, stus);
            }
            #endregion

            if (res != 0)
            {
                return(0);
            }
            else
            {
                return(3);
            }
        }