private async void MetroWindow_Loaded(object sender, RoutedEventArgs e) { string strErrorMsg = string.Empty; ClassEditModel classEditModel = new ClassEditModel(); try { classTypeAsyncProxy = await Task.Run(() => ServiceHelper.GetClassTypeService()); classesAsyncProxy = await Task.Run(() => ServiceHelper.GetClassService()); IList <ClassTypeModel> classTypeLists = await classTypeAsyncProxy.CallAsync(c => c.GetAllClassType()); this.cmbClassType.ItemsSource = classTypeLists; if (this.classTypeId != 0) { classTypeModel = await classTypeAsyncProxy.CallAsync(c => c.GetClassTypeById(classTypeId)); } } catch (TimeoutException timeProblem) { strErrorMsg = timeProblem.Message + UIResources.TimeOut + timeProblem.Message; } catch (FaultException <LCFault> af) { strErrorMsg = af.Detail.Message; } catch (FaultException unknownFault) { strErrorMsg = UIResources.UnKnowFault + unknownFault.Message; } catch (CommunicationException commProblem) { strErrorMsg = UIResources.ConProblem + commProblem.Message + commProblem.StackTrace; } catch (Exception ex) { strErrorMsg = ex.Message; } if (strErrorMsg != string.Empty) { await DialogManager.ShowMessageAsync(this, UIResources.MsgError, "初始化界面失败!原因:" + strErrorMsg, MessageDialogStyle.Affirmative, null); return; } if (Om == OperationMode.AddMode) { this.Title = "新增班级"; txtName.IsEnabled = true; BindClassInfo(); } else { this.Title = "修改班级"; //txtName.IsEnabled = false; BindClassInfo(); } }
private async Task bindSchedule() { IAsyncProxy <ITeacherService> teacherAsyncProxy = await Task.Run(() => ServiceHelper.GetTeacherService()); TeacherModel tm = await teacherAsyncProxy.CallAsync(t => t.FindTeacherByUserCode(GlobalObjects.currentLoginUser.UserCode)); this.currentDate = classSchedule.CurrentDate; IAsyncProxy <IScheduleService> scheduleAsyncProxy = await Task.Run(() => ServiceHelper.GetScheduleService()); IList <ScheduleDisplayModel> RM = null; if (tm.Id == 0) { RM = await scheduleAsyncProxy.CallAsync(c => c.FindScheduleByMonth(classSchedule.CurrentDate.ToString("yyyyMM"))); } else { RM = await scheduleAsyncProxy.CallAsync(c => c.FindScheduleByMonthAndTeacher(classSchedule.CurrentDate.ToString("yyyyMM"), tm.Id)); } if (RM != null) { ObservableCollection <ScheduleAppointment> appointments = new ObservableCollection <ScheduleAppointment>(); foreach (ScheduleDisplayModel sdm in RM) { ScheduleAppointment sa = new ScheduleAppointment(); sa.End = sdm.EndTime; sa.ScheduleId = sdm.Id; sa.Start = sdm.StartTime; sa.TeacherName = sdm.TeacherName; sa.AssistantName = sdm.AssistantName; sa.ClassroomName = sdm.ClassroomName; sa.ClassId = sdm.ClassId; sa.Subject = sdm.ClassName + "\r\n" + sdm.SchemasText; if (sdm.Status == "Normal") { //正常上课状态 if (sdm.ClassName.Contains(sdm.TeacherName)) { //教师名字与原班级中所含教师名字一致,则显示任为绿色 sa.Category = new Category("Green Category", new SolidColorBrush(Colors.Green)); } else { //教师名字与原班级名称中所含教师名字不一致 //说明代替上课,则显示蓝色 sa.Category = new Category("Blue Category", new SolidColorBrush(Colors.Blue)); } } else { sa.Category = new Category("Red Category", new SolidColorBrush(Colors.Red)); } appointments.Add(sa); } this.classSchedule.AppointmentsSource = appointments; } }
private async void BindClassInfo() { string strErrorMsg = string.Empty; try { if (classId != 0) { //选择了修改模式 classEditModel = await classesAsyncProxy.CallAsync(c => c.GetClassById(this.classId)); txtName.Text = classEditModel.Name; cmbClassType.Text = classEditModel.TypeName; dateStart.Text = classEditModel.StartDate.ToString("MM/dd/yyyy"); dateEnd.Text = classEditModel.EndDate.ToString("MM/dd/yyyy"); numLastCount.Value = classEditModel.LastCount; cbIsActive.IsChecked = classEditModel.IsActive; } else { //新增模式 if (cmbClassType.Items.Count > 0) { cmbClassType.Text = classTypeModel.Name; numLastCount.Value = classTypeModel.TotalLessons; cbIsActive.IsChecked = true; } } } catch (TimeoutException timeProblem) { strErrorMsg = timeProblem.Message + UIResources.TimeOut + timeProblem.Message; } catch (FaultException <LCFault> af) { strErrorMsg = af.Detail.Message; } catch (FaultException unknownFault) { strErrorMsg = UIResources.UnKnowFault + unknownFault.Message; } catch (CommunicationException commProblem) { strErrorMsg = UIResources.ConProblem + commProblem.Message + commProblem.StackTrace; } catch (Exception ex) { strErrorMsg = ex.Message; } if (strErrorMsg != string.Empty) { await DialogManager.ShowMessageAsync(this, UIResources.MsgError, "绑定班级信息失败!原因:" + strErrorMsg, MessageDialogStyle.Affirmative, null); } }
private async void btnDeleteRole_Click(object sender, RoutedEventArgs e) { if (this.listRole.SelectedItems.Count == 0 || this._roleDisplayModel == null) { await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgInfo, "请选择需要删除的角色!", MessageDialogStyle.Affirmative, null); //AisinoMessageBox.Show("没有选择角色,请选择", "提示", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); return; } MessageDialogResult result = await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgInfo, "确定删除该角色吗?", MessageDialogStyle.AffirmativeAndNegative, null); //MessageBoxResult result = AisinoMessageBox.Show("确定删除该权限吗", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.OK); if (result == MessageDialogResult.Affirmative) { roleAyncProxy = await Task.Run(() => ServiceHelper.GetRoleService()); foreach (RoleDisplayModel roleDisplayModel in this.listRole.SelectedItems) { await roleAyncProxy.CallAsync(d => d.DeleteByCode(roleDisplayModel.Code)); } this._roleDisplayModel = null; bindRoleList(); } }
private async void UserRight() { RoleEditModel roleEditModel = await roleAyncProxy.CallAsync(c => c.GetRoleByCode(_roleDisplayModel.Code)); this.listRight.ItemsSource = roleEditModel.SysRights; this.listUser.ItemsSource = roleEditModel.SysUsers; }
private async Task bindConsultantList() { IAsyncProxy <IConsultantService> ConsultantAsyncProxy = await Task.Run(() => ServiceHelper.GetConsultantService());; IList <ConsultantModel> RM = await ConsultantAsyncProxy.CallAsync(c => c.GetAllConsultant()); this.cmbConsultant.ItemsSource = RM; }
private async void bindRightList() { rightAyncProxy = await Task.Run(() => ServiceHelper.GetRightService()); roleAyncProxy = await Task.Run(() => ServiceHelper.GetRoleService()); IList <RightDisplayModel> allRight = await rightAyncProxy.CallAsync(u => u.GetAllRights()); RoleEditModel roleEditModel = await roleAyncProxy.CallAsync(c => c.GetRoleByCode(this._roleDisplayModel.Code)); for (int i = allRight.Count - 1; i >= 0; i--) { bool flag = true; RightDisplayModel rightDisplayModel = allRight[i]; ListViewItem listViewItem = new ListViewItem(); listViewItem.Content = rightDisplayModel.Name; listViewItem.Tag = rightDisplayModel; foreach (RightEditModel sysRight in roleEditModel.SysRights) { if (rightDisplayModel.Code == sysRight.RightCode) { this.backRight.Items.Add(listViewItem); flag = false; break; } } if (flag) { this.forceRight.Items.Add(listViewItem); } } }
private async void btnUnCheck_Click(object sender, RoutedEventArgs e) { string strErrorMsg = ""; try { StudentDisplayModel sdm = StudentTree.SelectedItem as StudentDisplayModel; IAsyncProxy <IScheduleService> scheduleAsyncProxy = await Task.Run(() => ServiceHelper.GetScheduleService()); await scheduleAsyncProxy.CallAsync(c => c.UnCheckStudent(ScheduleId, sdm.Id, GlobalObjects.currentLoginUser)); this.ShowAutoCloseDialogOwter(UIResources.MsgInfo, "撤销学员上课记录成功!"); this.DialogResult = true; } catch (TimeoutException timeProblem) { strErrorMsg = timeProblem.Message + UIResources.TimeOut + timeProblem.Message; } catch (FaultException <LCFault> af) { strErrorMsg = af.Detail.Message; } catch (FaultException unknownFault) { strErrorMsg = UIResources.UnKnowFault + unknownFault.Message; } catch (CommunicationException commProblem) { strErrorMsg = UIResources.ConProblem + commProblem.Message + commProblem.StackTrace; } if (strErrorMsg != string.Empty) { await DialogManager.ShowMessageAsync(this, UIResources.MsgError, "撤销学员上课记录失败!原因:" + strErrorMsg, MessageDialogStyle.Affirmative, null); } }
private async Task bindClassroomList() { IAsyncProxy <IClassroomService> classroomAyncProxy = await Task.Run(() => ServiceHelper.GetClassroomService());; IList <ClassroomModel> RM = await classroomAyncProxy.CallAsync(c => c.GetAllClassroom()); this.cmbClassroom.ItemsSource = RM; }
private async Task bindTeacherList() { IAsyncProxy <ITeacherService> teacherAsyncProxy = await Task.Run(() => ServiceHelper.GetTeacherService());; IList <TeacherModel> RM = await teacherAsyncProxy.CallAsync(c => c.GetAllTeacher()); this.cmbTeacher.ItemsSource = RM; }
private async Task GetReportResult() { DateTime startDate = dateStart.SelectedDate.Value; DateTime endDate = dateEnd.SelectedDate.Value; int teacherId = (cmbTeacher.SelectedItem as TeacherModel).Id; IAsyncProxy <ITeacherService> _teacherAyncProxy = await Task.Run(() => ServiceHelper.GetTeacherService()); IList <TeacherClassRecordDetailModel> tcrdml = await _teacherAyncProxy.CallAsync(c => c.FindTeacherClassRecordDetailByDate(startDate, endDate, teacherId)); Telerik.Reporting.ObjectDataSource objectDataSource = new Telerik.Reporting.ObjectDataSource(); objectDataSource.DataSource = tcrdml; // GetData returns a DataTable //Creating a new report Telerik.Reporting.Report report1 = new TeacherClassRecordDetailReport(); report1.ReportParameters["StartDate"].Value = startDate.ToString("yyyy-MM-dd"); report1.ReportParameters["EndDate"].Value = endDate.ToString("yyyy-MM-dd"); report1.ReportParameters["Teacher"].Value = cmbTeacher.Text; // Assigning the ObjectDataSource component to the DataSource property of the report. report1.DataSource = objectDataSource; // Use the InstanceReportSource to pass the report to the viewer for displaying Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource(); reportSource.ReportDocument = report1; // Assigning the report to the report viewer. ReportViewer1.ReportSource = reportSource; // Calling the RefreshReport method in case this is a WinForms application. ReportViewer1.RefreshReport(); }
private async void BindGridLog() { aplLogs = await logAsyncProxy.CallAsync(c => c.FindLogByUserAndModuleAndDateWithPage(userCode, moduleCode, dtStart, dtEnd, _paging)); if (aplLogs != null && aplLogs.totalCount > 0) { gvLog.ItemsSource = aplLogs.Entities; rdpLog.ItemCount = aplLogs.totalCount; } else { gvLog.ItemsSource = null; rdpLog.ItemCount = 0; rdpLog.Source = null; } }
private async void Page_Loaded(object sender, RoutedEventArgs e) { string usercode = GlobalObjects.currentLoginUser.UserCode; IAsyncProxy <ISubSystemModelService> asyncProxySubSystem = await Task.Run(() => ServiceHelper.GetSubSystemService()); IList <SubSystemDisplayModel> LstSubSystemDisplayModel = await asyncProxySubSystem.CallAsync(c => c.FindSubSystemByUserCode(usercode.Trim())); foreach (SubSystemDisplayModel ssdm in LstSubSystemDisplayModel) { TextBlock tb = new TextBlock(); tb.TextWrapping = TextWrapping.Wrap; tb.Inlines.Add(new Bold(new Run(ssdm.SubSystemName))); tb.Inlines.Add(new LineBreak()); tb.Inlines.Add(new Run(ssdm.Remark)); Tile tile = new Tile(); //tile.Content = ssdm.SubSystemName; tile.Content = tb; tile.FontSize = 18; tile.Tag = ssdm.SubSystemCode; tile.TileType = ssdm.MetroType == "Single" ? TileType.Single : ssdm.MetroType == "Double" ? TileType.Double : TileType.Quadruple; BrushConverter brushConverter = new BrushConverter(); tile.Background = (Brush)brushConverter.ConvertFromString(ssdm.BackColor); tile.MouseLeftButtonUp += tile_MouseLeftButtonUp; //考虑如何增加图形 //Path path = new Path(); //var gc=new GeometryConverter(); //path.Data = (Geometry)gc.ConvertFromString("F1 M 26.3223,22.7077L 43.3206,22.7077L 43.3206,27.1212L 31.6976,27.1212L 31.6976,35.2485L 42.535,35.2485L 42.535,39.6624L 31.6976,39.6624L 31.6976,52.1595L 26.3223,52.1595L 26.3223,22.7077 Z M 46.073,52.1595L 46.073,21.1345L 51.491,21.1345L 51.491,52.1595L 46.073,52.1595 Z "); MainTileList.Items.Add(tile); } }
private async void bindUserList() { userAyncProxy = await Task.Run(() => ServiceHelper.GetUserService()); roleAyncProxy = await Task.Run(() => ServiceHelper.GetRoleService()); IList <UserDisplayModel> allUser = await userAyncProxy.CallAsync(u => u.GetAllUser()); RoleEditModel roleEditModel = await roleAyncProxy.CallAsync(c => c.GetRoleByCode(this._roleDisplayModel.Code)); for (int i = allUser.Count - 1; i >= 0; i--) { bool flag = true; UserDisplayModel userDisplayModel = allUser[i]; ListViewItem listViewItem = new ListViewItem(); listViewItem.Content = userDisplayModel.Name; listViewItem.Tag = userDisplayModel; foreach (UserEditModel sysUser in roleEditModel.SysUsers) { if (userDisplayModel.Code == sysUser.UserCode) { this.backUser.Items.Add(listViewItem); flag = false; break; } } if (flag) { this.forceUser.Items.Add(listViewItem); } } }
private async Task GetMoney() { IAsyncProxy <IConsultantService> consultantServiceProxy = await Task.Run(() => ServiceHelper.GetConsultantService()); IList <ConsultantCheckModel> tcmList = await consultantServiceProxy.CallAsync(t => t.GetCheckMonthMoney(this.consultantId)); this.gvMoney.ItemsSource = tcmList; }
public async Task <List <ConsultantRecordDetailModel> > ServiceGetConsultantRecordDetails(DateTime startDate, DateTime endDate, int consultantId) { IAsyncProxy <IConsultantService> _consultantAyncProxy = await Task.Run(() => ServiceHelper.GetConsultantService()); IList <ConsultantRecordDetailModel> tcrdml = await _consultantAyncProxy.CallAsync(c => c.FindConsultantRecordDetailByDate(new DateTime(2016, 11, 1), new DateTime(2016, 11, 30), 1006)); return(tcrdml.ToList()); }
private async Task bindSchemasList() { IAsyncProxy <IClassTypeService> _classtypeAyncProxy = await Task.Run(() => ServiceHelper.GetClassTypeService()); IList <SchemasEditModel> RM = await _classtypeAyncProxy.CallAsync(c => c.FindSchemasByClassType(selectClassType.Id)); this.gvSchemas.ItemsSource = RM; }
private async Task bindClassList() { IAsyncProxy <IClassesService> classesAsyncProxy = await Task.Run(() => ServiceHelper.GetClassService()); IList <ClassDisplayModel> RM = await classesAsyncProxy.CallAsync(c => c.FindClassByClassType(selectClassType.Id)); this.gvClasses.ItemsSource = RM; }
private async Task bindClassTypeList() { IAsyncProxy <IClassTypeService> _classtypeAyncProxy = await Task.Run(() => ServiceHelper.GetClassTypeService()); IList <ClassTypeModel> RM = await _classtypeAyncProxy.CallAsync(c => c.GetAllClassType()); this.gvClassTypes.ItemsSource = RM; }
private async void bindRoleList() { roleAyncProxy = await Task.Run(() => ServiceHelper.GetRoleService()); IList <RoleDisplayModel> listRoles = await roleAyncProxy.CallAsync(c => c.GetAllRoles()); this.listRole.ItemsSource = listRoles; }
private async Task bindSysUserList() { IAsyncProxy <IUserModelService> sysuserAsyncProxy = await Task.Run(() => ServiceHelper.GetUserService()); IList <UserDisplayModel> RM = await sysuserAsyncProxy.CallAsync(c => c.GetAllUser()); this.cmbUser.ItemsSource = RM; }
private async void BindUser() { IList <UserDisplayModel> lstUsers = await userAsyncProxy.CallAsync(c => c.GetAllUser()); cmbUser.ItemsSource = lstUsers; cmbUser.DisplayMemberPath = "Name"; cmbUser.SelectedValuePath = "Code"; }
private async void bindCenterList() { IAsyncProxy <ICenterService> _centerAyncProxy = await Task.Run(() => ServiceHelper.GetCenterService()); IList <CenterModel> RM = await _centerAyncProxy.CallAsync(c => c.GetAllCenter()); this.centerList.ItemsSource = RM; }
private async Task GetMoney() { IAsyncProxy <ITeacherService> teacherServiceProxy = await Task.Run(() => ServiceHelper.GetTeacherService()); IList <TeacherCheckModel> tcmList = await teacherServiceProxy.CallAsync(t => t.GetCheckMonthMoney(this.teacherId)); this.gvMoney.ItemsSource = tcmList; }
private async void bindModuleList() { _moduleAyncProxy = await Task.Run(() => ServiceHelper.GetModuleService()); IList <ModuleDisplayModel> RM = await _moduleAyncProxy.CallAsync(c => c.GetAllModules()); this.moduleList.ItemsSource = RM; }
private async Task bindStatusList() { IAsyncProxy <IStatusService> _statusAyncProxy = await Task.Run(() => ServiceHelper.GetStatusService()); IList <StatusModel> RM = await _statusAyncProxy.CallAsync(c => c.FindStatusByCat(GlobalObjects.TeacherStatus)); this.cmbStatus.ItemsSource = RM; }
private async Task bindStudentList() { IAsyncProxy <IStudentService> studentAyncProxy = await Task.Run(() => ServiceHelper.GetStudentService()); IList <StudentDisplayModel> RM = await studentAyncProxy.CallAsync(c => c.GetAll()); this.gvStudent.ItemsSource = RM; }
public async Task <List <TeacherClassRecordDetailModel> > ServiceGetTeacherClassRecordDetails(DateTime startDate, DateTime endDate, int teacherId) { IAsyncProxy <ITeacherService> _teacherAyncProxy = await Task.Run(() => ServiceHelper.GetTeacherService()); IList <TeacherClassRecordDetailModel> tcrdml = await _teacherAyncProxy.CallAsync(c => c.FindTeacherClassRecordDetailByDate(new DateTime(2016, 11, 1), new DateTime(2016, 11, 30), 1006)); return(tcrdml.ToList()); }
private async Task bindClassTypeList() { IAsyncProxy <IClassesService> _classAyncProxy = await Task.Run(() => ServiceHelper.GetClassService()); IList <ClassDisplayModel> RM = await _classAyncProxy.CallAsync(c => c.GetAllActiveClasses()); this.gvClasses.ItemsSource = RM.ToList(); }
private async Task bindStudentList() { IEqualityComparer <StudentDisplayModel> ec = new EntityComparer(); IAsyncProxy <IScheduleService> scheduleAsyncProxy = await Task.Run(() => ServiceHelper.GetScheduleService()); IAsyncProxy <IStudentService> studentAyncProxy = await Task.Run(() => ServiceHelper.GetStudentService()); ScheduleEditModel sem = await scheduleAsyncProxy.CallAsync(c => c.GetScheduleById(ScheduleId)); lbClassName.Content = "ClassName:" + sem.ClassName + " LessonName:" + sem.LessonName; lbClassTime.Content = "StartTime:" + sem.StartTime.ToString("yyyy-MM-dd HH:mm"); lbTeacherName.Content = "Teacher:" + sem.TeacherName; IList <StudentDisplayModel> RM; if (sem.RealDate < DateTime.Now) { //如果选择的为历史,先获取列表 RM = studentAyncProxy.Client.FindStudentsByScheduleId(ScheduleId); if (RM == null || RM.Count == 0) { //说明该课程还没有历史记录,说明没有签到过,则需要根据班级查找 RM = studentAyncProxy.Client.FindStudentsByClassId(ClassId); } else { //考虑可能后期维护的时候增加漏掉的新增学员,需要合并列表 RM = RM.Union(studentAyncProxy.Client.FindStudentsByClassId(ClassId), ec).ToList(); } } else { //绑定该课程所关联班级所有学生列表 RM = studentAyncProxy.Client.FindStudentsByClassId(ClassId); } this.StudentTree.ItemsSource = RM; this.StudentTree.ExpandAll(); //选择当前已经点到学生 if (sem.AttendedStudentIds != null && sem.AttendedStudentIds.Count > 0) { foreach (StudentDisplayModel sdm in StudentTree.Items) { RadTreeViewItem targetItem = StudentTree.GetItemByPath(sdm.Name); if (sem.AttendedStudentIds.Contains(sdm.Id)) { targetItem.IsChecked = true; } } } foreach (StudentDisplayModel sdm in StudentTree.Items) { RadTreeViewItem targetItem = StudentTree.GetItemByPath(sdm.Name); targetItem.ToolTip = sdm.Name + "\r\n" + sdm.Nickname + "\r\n" + sdm.Momsname + "\r\n" + sdm.Momsphone + "\r\n" + sdm.School + "\r\n" + sdm.Grade + "\r\n" + sdm.ExtraInfo; } }