public string GetOneMyTask(int id) { DALT_Event_MyTask dal = new DALT_Event_MyTask(); T_Event_MyTask item = dal.GetModel(id); string res = "["; int taskAlert = 0; if (item.IsAlert != 0) { taskAlert = (int)item.AlertTime; } res += "{\"type\":\"" + item.Type + "\",\"des\":\"" + item.Description + "\",\"taskAlert\":\"" + taskAlert + "\",\"userid\":\"" + item.StuId + "\"}"; res += ","; if (res.Count() >= 1) { res = res.Substring(0, res.Count() - 1); } res += "]"; return(res); }
//新建我的日程 public int AddMyTask(string title, int type, string des, string start, string end, int alert, int userid = -1, int state = 0) { if (title == "") { return(1); } else if (userid == -1) { return(2); } #region 我的日程创建 DALT_Event_MyTask dal = new DALT_Event_MyTask(); T_Event_MyTask item = new T_Event_MyTask(); item.State = state; item.Name = title; item.Type = type; item.Description = des; item.StuId = userid; item.StartTime = Convert.ToDateTime(start); item.EndTime = Convert.ToDateTime(end); if (alert == 0) { item.IsAlert = 0; } else { item.IsAlert = 1; item.AlertTime = alert; } int res = dal.Add(item); #endregion if (res != 0) { return(0); } else { return(3); } }
//修改我的日程 public int EditMyTask(string title, int type, string des, string start, string end, int alert, int taskid, int userid = -1) { if (title == "") { return(1); } else if (userid == -1) { return(2); } #region 我的日程修改 DALT_Event_MyTask dal = new DALT_Event_MyTask(); T_Event_MyTask item = new T_Event_MyTask(); item.Id = taskid; item.StuId = userid;//学生Id,之后修改 item.Name = title; item.Type = type; item.Description = des; item.StartTime = Convert.ToDateTime(start); item.EndTime = Convert.ToDateTime(end); if (alert == 0) { item.IsAlert = 0; } else { item.IsAlert = 1; item.AlertTime = alert; } bool res = dal.Update(item); #endregion if (res) { return(0); } else { return(3); } }