コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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;
                    }
                }
            }
        }
コード例 #3
0
        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;
                    }
                }
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
 private void NewRecord(long RecordID)
 {
     RefreshData();
     SeekHelper.SetListItem <School, long>(RecordID, "ID", olvSzkola);
     //SetListViewItem(RecordID);
 }
コード例 #6
0
 private void NewRecord(long RecordID)
 {
     RefreshData();
     //SetListViewItem(RecordID);
     SeekHelper.SetListItem <SubjectSchemeModel, long>(RecordID, "ID", olvObsada);
 }
コード例 #7
0
 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);
 }
コード例 #8
0
 private void NewPrivilegeRecord(long RecordID)
 {
     GetData(olvPrivilege, GetPrivilegeListAsync((olvUser.SelectedObject as Teacher).ID).Result);
     SeekHelper.SetListItem <Privilege, long>(RecordID, "ID", olvPrivilege);
 }
コード例 #9
0
 private void RefreshData(long RecordID)
 {
     GetData(olvSchoolType);
     SeekHelper.SetListItem <SchoolType, long>(RecordID, "ID", olvSchoolType);
 }
コード例 #10
0
 private void NewRecord(string RecordID)
 {
     RefreshData();
     SeekHelper.SetListItem <User, string>(RecordID, "Login", olvUser);
 }