예제 #1
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);
        }
예제 #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 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);
        }
예제 #4
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);
            }
        }