void EditTeacher() { try { if (olvSubject.SelectedObject == null) { return; } using (var dlg = new dlgTeacher()) { var T = (Teacher)olvSubject.SelectedObject; FillDialog(dlg, T); if (dlg.ShowDialog() == DialogResult.OK) { //IsqlCommand cmd = new SqlCommand(); if (UpdateTeacherAsync(dlg, T.ID).Result > 0) { //cmd.CommitTransaction(); GetData(olvSubject); SeekHelper.SetListItem <Teacher, int>(T.ID, "ID", olvSubject); return; } throw new Exception("Aktualizacja danych nie powiodła się!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void EditPrivilege() { var P = olvPrivilege.SelectedObject as Privilege; using (var dlg = new dlgPrivilegeEdition()) { FillDialog(dlg, P); if (dlg.ShowDialog() == DialogResult.OK) { try { if (UpdatePrivilegeAsync(dlg, P.ID).Result > 0) { GetData(olvPrivilege, GetPrivilegeListAsync(P.TeacherID).Result); SeekHelper.SetListItem <Privilege, int>(P.ID, "ID", olvPrivilege); return; } throw new Exception("Aktualizacja danych nie powiodła się!"); } catch (Exception) { throw; } } } }
private void EditExclusion() { var E = olvExclusion.SelectedObject as ExclusionDetails; var P = (olvPrivilege.Objects as ISet <Privilege>).Where(x => x.ID == E.PrivilegeID).First(); using (var dlg = new dlgExclusionEdition()) { FillDialog(dlg, E, P); if (dlg.ShowDialog() == DialogResult.OK) { try { if (UpdateExclusionAsync(dlg, E.AllocationID, E.PrivilegeID).Result > 0) { GetData(olvExclusion, GetExclusionListAsync(P.TeacherID).Result); SeekHelper.SetListItem <ExclusionDetails, int, int>(E.AllocationID, E.PrivilegeID, "AllocationID", "PrivilegeID", olvExclusion); return; } throw new Exception("Aktualizacja danych nie powiodła się!"); } catch (Exception) { throw; } } } }
void EditSchoolType() { try { if (olvSchoolType.SelectedObject == null) { return; } using (var dlg = new dlgSchoolType()) { var T = (SchoolType)olvSchoolType.SelectedObject; FillDialog(dlg, T); if (dlg.ShowDialog() == DialogResult.OK) { if (UpdateSchoolTypeAsync(dlg, T.ID).Result > 0) { GetData(olvSchoolType); SeekHelper.SetListItem <SchoolType, int>(T.ID, "ID", olvSchoolType); return; } throw new Exception("Aktualizacja danych nie powiodła się!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void NewRecord(long RecordID) { RefreshData(); SeekHelper.SetListItem <School, long>(RecordID, "ID", olvSzkola); //SetListViewItem(RecordID); }
private void NewRecord(long RecordID) { RefreshData(); //SetListViewItem(RecordID); SeekHelper.SetListItem <SubjectSchemeModel, long>(RecordID, "ID", olvObsada); }
private void NewExclusionRecord(Exclusion e) { GetData(olvExclusion, GetExclusionListAsync((olvUser.SelectedObject as Teacher).ID).Result); SeekHelper.SetListItem <ExclusionDetails, int, int>(e.AllocationID, e.PrivilegeID, "AllocationID", "PrivilegeID", olvExclusion); }
private void NewPrivilegeRecord(long RecordID) { GetData(olvPrivilege, GetPrivilegeListAsync((olvUser.SelectedObject as Teacher).ID).Result); SeekHelper.SetListItem <Privilege, long>(RecordID, "ID", olvPrivilege); }
private void RefreshData(long RecordID) { GetData(olvSchoolType); SeekHelper.SetListItem <SchoolType, long>(RecordID, "ID", olvSchoolType); }
private void NewRecord(string RecordID) { RefreshData(); SeekHelper.SetListItem <User, string>(RecordID, "Login", olvUser); }