예제 #1
0
        //-记得修改stuid
        public string GetMyTask(int stuId)
        {
            //int stuId = (int)Session["userId"];
            //int stuId = 4;
            string where = "StuId = " + stuId;

            DALT_Event_MyTask     dal  = new DALT_Event_MyTask();
            List <T_Event_MyTask> list = new List <T_Event_MyTask>();

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

            string res = "";

            foreach (T_Event_MyTask 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);
        }
        public List <T_Search_Event> SearchMyTask(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 = "StuId = " + searchid + wtitel + wstart;


            DALT_Event_MyTask     dal  = new DALT_Event_MyTask();
            List <T_Event_MyTask> lst  = dal.GetAllList(where);
            List <T_Search_Event> list = new List <T_Search_Event>();

            #region 转换成现实格式
            foreach (T_Event_MyTask 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);
        }