public ActionResult Upadate(long AssignID) { PadSYNC.Model.AssignCourse ac = PadSYNC.BLL.AssignCourseBLL.GetById(AssignID); try { ac.Gid = Guid.NewGuid(); //新增必须为0,不为0会更改原纪录 ac.AssignID = 0; //排课状态为排定 ac.AsignStatus = 1; //5表示来源是Pad ac.CourseSourceType = 5; //异常类型 ac.AbnormalReasonType = 0; string json = JsonConvert.SerializeObject(ac); SYNCOperation op = new SYNCOperation(); op.Id = ac.AssignID; op.Gid = ac.Gid; op.Name = "AssignCourse"; op.Status = 0; SYNCOperationBLL.Insert(op); Send.Push(json); string result = "Success"; return(Content(result, "application/json")); } catch (Exception ex) { return(Content(ex.Message, "application/json")); } //return View(); }
public ActionResult UpdateCourseInOne(string data) { string result = "Failed"; try { List <PadSYNC.Model.AssignCourse> list = JsonConvert.DeserializeObject <List <PadSYNC.Model.AssignCourse> >(data); //测试消息队列用 // List<PadSYNC.Model.AssignCourse> list = AssignCourseBLL.Search(@"select top 5 starttime,endtime,* from [CloudCourse].[dbo].[AssignCourse] // where SchoolID=18 and studentuserid=1303839 // order by assignid desc"); if (list != null) { foreach (PadSYNC.Model.AssignCourse ac in list) { //ac.Gid = Guid.NewGuid(); //新增必须为0,不为0会更改原纪录 //ac.AssignID = 0; //排课状态为排定 //ac.AsignStatus = 1; //5表示来源是Pad //ac.CourseSourceType = 5; //异常类型 //ac.AbnormalReasonType = 0; string json = JsonConvert.SerializeObject(ac); SYNCOperation op = new SYNCOperation(); op.Id = ac.AssignID; op.Gid = ac.Gid; op.Name = "AssignCourse"; op.Status = 0; SYNCOperationBLL.Insert(op); Send.Push(json); result = "Success"; } } } catch (Exception ex) { result = ex.Message; } return(Content(result)); }