public override void NavigatedToEvent(object sender, IDictionary <string, object> kwargs) { base.NavigatedToEvent(sender, kwargs); if (kwargs != null) { ID = kwargs["id"] as string; } if (ID != null) { var res = User.Api["api/classes"][ID].Retrieve(); if (res.statuslike("2**")) { //这里比较麻烦。需要手动请求所有学生的记录然后拼接起来。 var datas = new JArray(); //先得到所有学生的学号列表。 var studatas = res.instance["as_student_set"] as JArray; foreach (var stu in studatas) { ConnectNewRecordForAttendance(ref datas, stu.ToString()); } list_temp.UpdateData(datas); //然后能用了。 list_temp.UpdateData(datas); } } }
public override void NavigatedToEvent(object sender, IDictionary <string, object> kwargs) { base.NavigatedToEvent(sender, kwargs); if (User.Get().HasAuthorityOrRoot(Authority.Instructor)) { template.Args.filter("as_instructor_set__username", User.Get().authentication.username); } else { template.Args.getFilter().Clear(); } template.UpdateData(); }
public override void NavigatedToEvent(object sender, IDictionary <string, object> kwargs) { base.NavigatedToEvent(sender, kwargs); if (ID != null) { template.Args.instance = ID; template.UpdateData(); //更新按钮。 template.Args.custombutton = new CustomButton[0]; if (User.Get().HasAuthorityOrRoot(Authority.CourseManage)) { template.Args.custombutton = template.Args.custombutton.append(new CustomButton("", () => {//[pencil] NavigatorPage.NavigatorGoto("course-modify", new Dictionary <string, object>() { { "id", ID } }); }, Tips: "修改")); } if (User.Get().BelongQuery("course", ID) == BelongRelation.Parent || User.Get().HasAuthorityOrRoot(Authority.CourseManage)) { template.Args.custombutton = template.Args.custombutton.append(new CustomButton("", () => {//[people] NavigatorPage.NavigatorGoto("course-detail", new Dictionary <string, object>() { { "id", ID } }); }, Tips: "出勤记录")); } template.ConstructCustomButton(); //更新学生列表。 var res = User.Api["api/courses/basic/"][ID].Retrieve(); if (res.statuslike("2**")) { var data = res.instance; //构建有关学生的列表。 var datas = new JArray(); var idset = data["as_student_set"].map(j => j.ToString()) as string[]; var nameset = data["student_name_related"].map(j => j.ToString()) as string[]; for (int i = 0; i < idset.Length && i < nameset.Length; ++i) { var jo = new JObject(); jo["id"] = new JValue(idset[i]); jo["name"] = new JValue(nameset[i]); datas.Add(jo); } list_temp.UpdateData(datas); } } }
public override void NavigatedToEvent(object sender, IDictionary <string, object> kwargs) { base.NavigatedToEvent(sender, kwargs); if (kwargs != null) { var ID = kwargs["id"] as string; template.Args.instance = ID; list_temp.Args.filter("system_schedule", ID); list_temp.Args.createargs.param["system_schedule"] = $@"""{ID}"""; } template.UpdateData(); list_temp.UpdateData(); InstanceGrid.Children.Clear(); }
public override void NavigatedToEvent(object sender, IDictionary <string, object> kwargs) { base.NavigatedToEvent(sender, kwargs); if (kwargs != null) { ID = kwargs["id"] as string; } if (ID != null) { template.Args.instance = ID; template.UpdateData(); template2.Args.instance = ID; template2.UpdateData(); //修改按钮。 template.Args.custombutton = new CustomButton[0]; if (User.Get().HasAuthorityOrRoot(Authority.StudentManage)) { template.Args.custombutton = template.Args.custombutton.append(new CustomButton("", () => { NavigatorPage.NavigatorGoto("student-manager-document", new Dictionary <string, object>() { { "id", ID } }); })); } template.ConstructCustomButton(); //列出学习的课程。 var res = User.Api["api/auth/students/"][ID].Retrieve(); if (res.statuslike("2**")) { var idset = res.instance["course_set"].map(j => j.ToString()) as string[]; var nameset = res.instance["course_name_related"].map(j => j.ToString()) as string[]; var jdata = new JArray(); for (int i = 0; i < idset.Length && i < nameset.Length; ++i) { var jo = new JObject(); jo["id"] = new JValue(idset[i]); jo["name"] = new JValue(nameset[i]); jdata.Add(jo); } list_temp.UpdateData(jdata); } else { NavigatorPage.MsgSystem.Show(null, "错误", res.content); } } }
public admin_schedule_instance() { InitializeComponent(); //生成概要信息区域 template = new InstanceTemplate(); var args = new InstanceArgs("api/schedule/system-schedules/", null, User.Api, Title); args.margin = new Thickness(0, 10, 0, 10); args.items.Add(new InstanceArgs.Item("id", "编号", "text")); args.items.Add(new InstanceArgs.Item("year", "学年", "text", EditAbleStatus.Writeable)); args.items.Add(new InstanceArgs.Item("term", "学期", "text", EditAbleStatus.Writeable)); args.items.Add(new InstanceArgs.Item("begin", "开始时间", "text", EditAbleStatus.Writeable)); args.items.Add(new InstanceArgs.Item("end", "结束时间", "text", EditAbleStatus.Writeable)); template.Construct(args); ContentGrid.Children.Add(template); //生成列表区域 list_temp = new ListTemplate(); var clargs = new CreateArgs("api/schedule/system-schedule-items/", User.Api, "创建时间表项"); clargs.items.Add(new CreateArgs.Item("no", "节次", "text")); clargs.items.Add(new CreateArgs.Item("begin", "上课时间", "text")); clargs.items.Add(new CreateArgs.Item("end", "下课时间", "text")); clargs.items.Add(new CreateArgs.Item("system_schedule", "系统时间表", "hidden", data: "system_schedule")); var largs = new ListArgs("api/schedule/system-schedule-items/", User.Api, "时间表项", Createable: true, Createargs: clargs); largs.columns.Add(new ListArgs.Column("id", "编号", customaction: UpdateScheduleItemInstance)); largs.columns.Add(new ListArgs.Column("no", "节次", customaction: UpdateScheduleItemInstance)); largs.columns.Add(new ListArgs.Column("begin", "上课时间")); largs.columns.Add(new ListArgs.Column("end", "下课时间")); list_temp.Construct(largs); ListGrid.Children.Add(list_temp); //生成项的详情区域 instance_temp = new InstanceTemplate(); var iargs = new InstanceArgs("api/schedule/system-schedule-items/", null, User.Api, "表项信息"); iargs.items.Add(new InstanceArgs.Item("id", "编号", "text")); iargs.items.Add(new InstanceArgs.Item("no", "节次", "text", EditAbleStatus.Writeable)); iargs.items.Add(new InstanceArgs.Item("begin", "上课时间", "text", EditAbleStatus.Writeable)); iargs.items.Add(new InstanceArgs.Item("end", "下课时间", "text", EditAbleStatus.Writeable)); iargs.deleteaction = () => { //当按下子项的删除按钮时 InstanceGrid.Children.Clear(); //仅仅是不显示该区域。 list_temp.UpdateData(); //刷新列表。 }; instance_temp.Construct(iargs); }
public override void NavigatedToEvent(object sender, IDictionary <string, object> kwargs) { base.NavigatedToEvent(sender, kwargs); if (kwargs != null) { ID = kwargs["id"] as string; } if (ID != null) { var res = User.Api["api/courses/manage"][ID].Retrieve(); if (res.statuslike("2**")) { var datas = res.instance["attendance_record_set"] as JArray; list_temp.UpdateData(datas); } } }
public override void NavigatedToEvent(object sender, IDictionary <string, object> kwargs) { base.NavigatedToEvent(sender, kwargs); if (kwargs != null) { ID = kwargs["id"] as string; } if (ID != null) { template.Args.instance = ID; template.UpdateData(); //更新按钮。 template.Args.custombutton = new CustomButton[0]; if (User.Get().HasAuthorityOrRoot(Authority.ClassroomManage)) { template.Args.custombutton = template.Args.custombutton.append(new CustomButton("", () => {//[pencil] NavigatorPage.NavigatorGoto("classroom-modify", new Dictionary <string, object>() { { "id", ID } }); }, Tips: "修改")); list_temp.Args.filter("classroom_manage", ID); //如果是管理者,那么还可以查看到教室使用记录。 list_temp.UpdateData(); if (ListGrid.Children.Count <= 0) { ListGrid.Children.Add(list_temp); } } else if (ListGrid.Children.Count > 0) { ListGrid.Children.Clear(); } template.ConstructCustomButton(); } }
public override void NavigatedToEvent(object sender, IDictionary <string, object> kwargs) { base.NavigatedToEvent(sender, kwargs); template.UpdateData(); }
public override void NavigatedToEvent(object sender, IDictionary <string, object> kwargs) { base.NavigatedToEvent(sender, kwargs); template.Args.filter("student__username", User.Get().authentication.username); template.UpdateData(); }