public void SendCopyToArchive(Document document)
        {
            Document copy     = (Document)document.Clone();
            Chancery chancery = Company.Chancery;

            chancery.Archive.Add(copy);
        }
        public override void Quit()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            //Удаляем созданные неотправленные документы
            foreach (Document document in CreatedDocuments)
            {
                document.Delete();
            }
            CreatedDocuments = null;
            //Направляем необработанные документы обратно в секретариат
            Chancery chancery = Company.Chancery;

            foreach (Document document in PendingDocuments)
            {
                chancery.PendingDocuments.Add(document);
            }
            PendingDocuments = null;
            //Удаляем маркер
            Marker.Delete();
            Marker  = null;
            Working = false;
            dataLists.Secretaries.Remove(this);
            Person person = dataLists.Persons.Find((p) => p.Id == Id);

            person = this;
        }
Example #3
0
 private void InitializeCompany(Company company, DataLists lists)
 {
     if (company.Director != null)
     {
         if (company.Director.InitState == InitializationState.INITIALIZATION_NEEDED)
         {
             int      directorId = SqlCompany_Director.GetDirectorFromCompany(company.Id);
             Director director   = lists.Directors.Find((d) => d.EmployeeId == directorId);
             if (director != null && director.InitState == InitializationState.INITIALIZATION_NEEDED)
             {
                 director.InitState = InitializationState.IN_INITIALIZATION;
                 company.Director   = director;
                 director.Company   = company;
                 InitializeDirector(director, lists);
                 company.Director.InitState = InitializationState.INITIALIZED;
             }
         }
     }
     if (company.Chancery != null && company.Chancery.InitState == InitializationState.INITIALIZATION_NEEDED)
     {
         int      chanceryId = SqlCompany_Chancery.GetChanceryFromCompany(company.Id);
         Chancery chancery   = lists.Chanceries.Find((c) => c.Id == chanceryId);
         if (chancery != null && chancery.InitState == InitializationState.INITIALIZATION_NEEDED)
         {
             chancery.InitState = InitializationState.IN_INITIALIZATION;
             company.Chancery   = chancery;
             chancery.Company   = company;
             InitializeChancery(chancery, lists);
             company.Chancery.InitState = InitializationState.INITIALIZED;
         }
     }
 }
        public void RedirectPendingDocument(Secretary secretary, Document document)
        {
            Chancery chancery = Company.Chancery;

            chancery.PendingDocuments.Remove(document);
            secretary.PendingDocuments.Add(document);
        }
Example #5
0
        private void OpenChanceryEvent(object sender, EventArgs e)
        {
            Chancery         chancery         = company.Chancery;
            ChanceryInfoForm chanceryInfoForm = new ChanceryInfoForm(chancery);

            chanceryInfoForm.Activate();
            chanceryInfoForm.ShowDialog();
        }
Example #6
0
 public Company(Director director, CompanyType type, Chancery companyChancery, string name, string address)
 {
     Director = director;
     Chancery = companyChancery;
     Type     = type;
     Name     = name;
     Address  = address;
 }
 public void RejectDocument(Document document)
 {
     if (document.Sender.Equals(Company))
     {
         Chancery chancery = Company.Chancery;
         chancery.PendingDocuments.Add(document);
     }
     PendingDocuments.Remove(document);
 }
Example #8
0
        public void Delete()
        {
            Director.Quit();
            Director = null;
            Chancery.Delete();
            Chancery = null;
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            dataLists.Companies.Remove(this);
        }
Example #9
0
 private void AddCompanyChanceryRecord(Company company, Chancery chancery)
 {
     if (chancery.Id != 0)
     {
         SqlCompany_Chancery.AddRecord(company.Id, chancery.Id);
     }
     else
     {
         SqlCompany_Chancery.AddRecord(company.Id, null);
     }
 }
Example #10
0
        public static void AddChancery(Chancery chancery)
        {
            string sqlExpression = "INSERT INTO Chancery(Id) VALUES (@id)";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(sqlExpression, connection);
                command.Parameters.Add("@id", SqlDbType.Int);
                command.Parameters["@id"].Value = chancery.Id;
                command.ExecuteNonQuery();
            }
        }
Example #11
0
        public override bool Equals(object obj)
        {
            if (obj == null || obj == DBNull.Value)
            {
                return(false);
            }
            Chancery chancery = (Chancery)obj;

            if (chancery.Id <= 0 || Id <= 0)
            {
                return(false);
            }
            return(Id == chancery.Id);
        }
Example #12
0
        public static List <Chancery> GetAllChanceries()
        {
            List <Chancery> chanceries    = new List <Chancery>();
            string          sqlExpression = "SELECT * FROM Chancery WHERE Deleted = 0";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand    command = new SqlCommand(sqlExpression, connection);
                SqlDataReader reader  = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        int     id      = (int)reader["Id"];
                        Company company = new Company
                        {
                            Id        = SqlCompany_Chancery.GetCompanyByChancery(id),
                            InitState = InitializationState.INITIALIZATION_NEEDED
                        };
                        List <Document>  archive          = SqlArchive.GetArchivedDocuments(id);
                        List <Document>  pendingDocuments = SqlPendingDocuments.GetPendingDocuments(id);
                        List <Secretary> secretaries      = SqlSecretary.GetCompanySecretaries(company.Id);
                        MainSecretary    mainSecretary    = null;
                        if (SqlMainSecretary.GetCompanyMainSecretary(company.Id) != null)
                        {
                            mainSecretary = new MainSecretary
                            {
                                EmployeeId = SqlMainSecretary.GetCompanyMainSecretary(company.Id).EmployeeId,
                                InitState  = InitializationState.INITIALIZATION_NEEDED
                            };
                        }
                        Chancery chancery = new Chancery(company)
                        {
                            Id               = id,
                            Archive          = archive,
                            PendingDocuments = pendingDocuments,
                            Secretaries      = secretaries,
                            MainSecretary    = mainSecretary
                        };
                        chanceries.Add(chancery);
                    }
                }
            }
            return(chanceries);
        }
Example #13
0
 private void PersistChanceryChanges(Chancery chancery)
 {
     if (chancery.Archive != null)
     {
         foreach (Document document in chancery.Archive)
         {
             if (document.UpdateState == UpdateState.UPDATE_NEEDED)
             {
                 document.UpdateState = UpdateState.IN_UPDATE;
                 PersistDocumentChanges(document);
                 document.UpdateState = UpdateState.UPDATE_UNNECESSARY;
             }
         }
     }
     if (chancery.PendingDocuments != null)
     {
         foreach (Document document in chancery.PendingDocuments)
         {
             if (document.UpdateState == UpdateState.UPDATE_NEEDED)
             {
                 document.UpdateState = UpdateState.IN_UPDATE;
                 PersistDocumentChanges(document);
                 document.UpdateState = UpdateState.UPDATE_UNNECESSARY;
             }
         }
     }
     if (chancery.Secretaries != null)
     {
         foreach (Secretary secretary in chancery.Secretaries)
         {
             if (secretary.UpdateState == UpdateState.UPDATE_NEEDED)
             {
                 secretary.UpdateState = UpdateState.IN_UPDATE;
                 PersistSecretaryChanges(secretary);
                 secretary.UpdateState = UpdateState.UPDATE_UNNECESSARY;
             }
         }
     }
     if (chancery.MainSecretary != null && chancery.MainSecretary.UpdateState == UpdateState.UPDATE_NEEDED)
     {
         chancery.MainSecretary.UpdateState = UpdateState.IN_UPDATE;
         PersistMainSecretaryChanges(chancery.MainSecretary);
         chancery.MainSecretary.UpdateState = UpdateState.UPDATE_UNNECESSARY;
     }
 }
        public void RedirectPendingDocument(Document document)
        {
            Chancery chancery     = Company.Chancery;
            int      maxDocuments = 0;

            foreach (Secretary secretary in chancery.Secretaries)
            {
                if (secretary.PendingDocuments.Count > maxDocuments)
                {
                    maxDocuments = secretary.PendingDocuments.Count;
                }
            }
            foreach (Secretary secretary in chancery.Secretaries)
            {
                if (secretary.PendingDocuments.Count == maxDocuments)
                {
                    chancery.PendingDocuments.Remove(document);
                    secretary.PendingDocuments.Add(document);
                    break;
                }
            }
        }
Example #15
0
        public static Chancery GetChancery(int id)
        {
            Chancery chancery      = null;
            string   sqlExpression = "SELECT * FROM Chancery WHERE Id = @id AND Deleted = 0";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(sqlExpression, connection);
                command.Parameters.Add("@id", SqlDbType.Int);
                command.Parameters["@id"].Value = id;
                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Company company = new Company
                        {
                            Id        = SqlCompany_Chancery.GetCompanyByChancery(id),
                            InitState = InitializationState.INITIALIZATION_NEEDED
                        };
                        List <Document>  archive          = SqlArchive.GetArchivedDocuments(id);
                        List <Document>  pendingDocuments = SqlPendingDocuments.GetPendingDocuments(id);
                        List <Secretary> secretaries      = SqlSecretary.GetCompanySecretaries(company.Id);
                        MainSecretary    mainSecretary    = SqlMainSecretary.GetCompanyMainSecretary(company.Id);
                        chancery = new Chancery(company)
                        {
                            Id               = id,
                            Archive          = archive,
                            PendingDocuments = pendingDocuments,
                            Secretaries      = secretaries,
                            MainSecretary    = mainSecretary
                        };
                    }
                }
            }
            return(chancery);
        }
Example #16
0
        private void AddCompanyButton_Click(object sender, EventArgs e)
        {
            bool filled = Utils.CheckFormFilled(this);

            if (filled && director != null)
            {
                String      name    = Utils.FindControl(this, "nameBox").Text;
                String      address = Utils.FindControl(this, "addressBox").Text;
                CompanyType type    = (CompanyType)((ComboBox)Utils.FindControl(this, "typeBox")).SelectedValue;

                bool nameValidated    = CompanyFormValidator.ValidateName(name);
                bool addressValidated = CompanyFormValidator.ValidateAddress(address);
                if (nameValidated && addressValidated)
                {
                    Chancery chancery = new Chancery
                    {
                        Archive          = new List <Document>(),
                        PendingDocuments = new List <Document>(),
                        Secretaries      = new List <Secretary>()
                    };
                    Company company = new Company(director, type, chancery, name, address);
                    company.Persist();
                    DocumentManagementForm form = (DocumentManagementForm)Application.OpenForms["DocumentManagementForm"];
                    form.UpdateCompaniesBox();
                    Close();
                    Dispose();
                }
                else
                {
                    MessageBox.Show("Неправильно введенные данные!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Одно из полей пустое!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public static List <Company> GetAllCompanies()
        {
            List <Company> companies     = new List <Company>();
            string         sqlExpression = "SELECT * FROM Company WHERE Deleted = 0";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand    expression = new SqlCommand(sqlExpression, connection);
                SqlDataReader reader     = expression.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        int      id            = (int)reader["Id"];
                        int      companyTypeId = (int)reader["CompanyTypeId"];
                        string   name          = (string)reader["CompanyName"];
                        string   address       = (string)reader["CompanyAddress"];
                        Director director      = new Director()
                        {
                            InitState = InitializationState.INITIALIZATION_NEEDED
                        };
                        Chancery chancery = new Chancery()
                        {
                            InitState = InitializationState.INITIALIZATION_NEEDED
                        };
                        CompanyType companyType = SqlCompanyType.GetCompanyType(companyTypeId);
                        Company     company     = new Company(director, companyType, chancery, name, address)
                        {
                            Id = id
                        };
                        companies.Add(company);
                    }
                }
            }
            return(companies);
        }
        public static Company GetCompany(int id)
        {
            Company company       = null;
            string  sqlExpression = "SELECT * FROM Company WHERE Id = @id AND Deleted = 0";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(sqlExpression, connection);
                command.Parameters.Add("@id", SqlDbType.Int);
                command.Parameters["@id"].Value = id;
                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        int      companyTypeId = (int)reader["CompanyTypeId"];
                        string   name          = (string)reader["CompanyName"];
                        string   address       = (string)reader["CompanyAddress"];
                        Director director      = new Director()
                        {
                            InitState = InitializationState.INITIALIZATION_NEEDED
                        };
                        Chancery chancery = new Chancery()
                        {
                            InitState = InitializationState.INITIALIZATION_NEEDED
                        };
                        CompanyType companyType = SqlCompanyType.GetCompanyType(companyTypeId);
                        company = new Company(director, companyType, chancery, name, address)
                        {
                            Id = id
                        };
                    }
                }
            }
            return(company);
        }
 public ChanceryInfoForm(Chancery chancery)
 {
     this.chancery = chancery;
     InitializeForm();
 }
Example #20
0
 private void InitializeChancery(Chancery chancery, DataLists lists)
 {
     if (chancery.Company != null && chancery.Company.InitState == InitializationState.INITIALIZATION_NEEDED)
     {
         chancery.Company.InitState = InitializationState.IN_INITIALIZATION;
         InitializeCompany(chancery.Company, lists);
         chancery.Company.InitState = InitializationState.INITIALIZED;
     }
     if (chancery.Archive != null)
     {
         List <Document> archiveTemporal = new List <Document>();
         foreach (Document document in chancery.Archive)
         {
             archiveTemporal.Add(lists.Documents.Find((d) => d.Id == document.Id));
         }
         chancery.Archive = archiveTemporal;
         foreach (Document document in chancery.Archive)
         {
             if (document.InitState == InitializationState.INITIALIZATION_NEEDED)
             {
                 document.InitState = InitializationState.IN_INITIALIZATION;
                 InitializeDocument(document, lists);
                 document.InitState = InitializationState.INITIALIZED;
             }
         }
     }
     if (chancery.PendingDocuments != null)
     {
         List <Document> pendingDocumentsTemporal = new List <Document>();
         foreach (Document document in chancery.PendingDocuments)
         {
             pendingDocumentsTemporal.Add(lists.Documents.Find((d) => d.Id == document.Id));
         }
         chancery.PendingDocuments = pendingDocumentsTemporal;
         foreach (Document document in chancery.PendingDocuments)
         {
             if (document.InitState == InitializationState.INITIALIZATION_NEEDED)
             {
                 document.InitState = InitializationState.IN_INITIALIZATION;
                 InitializeDocument(document, lists);
                 document.InitState = InitializationState.INITIALIZED;
             }
         }
     }
     if (chancery.Secretaries != null)
     {
         List <Secretary> secretariesTemporal = new List <Secretary>();
         foreach (Secretary secretary in chancery.Secretaries)
         {
             secretariesTemporal.Add(lists.Secretaries.Find((s) => s.EmployeeId == secretary.EmployeeId));
         }
         chancery.Secretaries = secretariesTemporal;
         foreach (Secretary secretary in chancery.Secretaries)
         {
             if (secretary.InitState == InitializationState.INITIALIZATION_NEEDED)
             {
                 secretary.InitState = InitializationState.IN_INITIALIZATION;
                 InitializeSecretary(secretary, lists);
                 secretary.InitState = InitializationState.INITIALIZED;
             }
         }
     }
     if (chancery.MainSecretary != null && chancery.MainSecretary.InitState == InitializationState.INITIALIZATION_NEEDED)
     {
         chancery.MainSecretary.InitState = InitializationState.IN_INITIALIZATION;
         chancery.MainSecretary           = lists.MainSecretaries.Find((ms) => ms.EmployeeId == chancery.MainSecretary.EmployeeId);
         InitializeMainSecretary(chancery.MainSecretary, lists);
         chancery.MainSecretary.InitState = InitializationState.INITIALIZED;
     }
 }
Example #21
0
        public void UpdateCollections(DataLists oldDataLists, DataLists dataLists)
        {
            List <Person> oldPersons = oldDataLists.Persons;
            List <Person> persons    = dataLists.Persons;

            foreach (Person person in persons)
            {
                //Если не было этой персоны то добавить
                if (oldPersons.Contains(person) == false)
                {
                    SqlPerson.AddPerson(person);
                }
            }
            foreach (Person oldPerson in oldPersons)
            {
                //Если персона была удалена то удалить
                if (persons.Contains(oldPerson) == false)
                {
                    SqlPerson.DeletePerson(oldPerson.Id);
                }
            }

            List <Company> oldCompanies = oldDataLists.Companies;
            List <Company> companies    = dataLists.Companies;

            foreach (Company company in companies)
            {
                if (oldCompanies.Contains(company) == false)
                {
                    SqlCompany.AddCompany(company);
                }
            }
            foreach (Company oldCompany in oldCompanies)
            {
                if (companies.Contains(oldCompany) == false)
                {
                    SqlCompany_Director.DeleteFromCompany(oldCompany.Id);
                    SqlCompany_Chancery.DeleteFromCompany(oldCompany.Id);
                    SqlCompany.DeleteCompany(oldCompany.Id);
                }
            }

            List <Chancery> oldChanceries = oldDataLists.Chanceries;
            List <Chancery> chanceries    = dataLists.Chanceries;

            foreach (Chancery chancery in chanceries)
            {
                if (oldChanceries.Contains(chancery) == false)
                {
                    SqlChancery.AddChancery(chancery);
                    AddCompanyChanceryRecord(chancery.Company, chancery);
                    foreach (Document document in chancery.PendingDocuments)
                    {
                        SqlPendingDocuments.AddPendingDocument(chancery.Id, document.Id);
                    }
                    foreach (Document document in chancery.Archive)
                    {
                        SqlArchive.AddArchivedDocument(chancery.Id, document.Id);
                    }
                }
                else
                {
                    Chancery oldChancery = oldChanceries.Find((oc) => oc.Id == chancery.Id);
                    foreach (Document document in chancery.PendingDocuments)
                    {
                        if (oldChancery.PendingDocuments.Contains(document) == false)
                        {
                            SqlPendingDocuments.AddPendingDocument(chancery.Id, document.Id);
                        }
                    }
                    foreach (Document oldDocument in oldChancery.PendingDocuments)
                    {
                        if (chancery.PendingDocuments.Contains(oldDocument) == false)
                        {
                            SqlPendingDocuments.DeletePendingDocument(chancery.Id, oldDocument.Id);
                        }
                    }
                    foreach (Document document in chancery.Archive)
                    {
                        if (oldChancery.Archive.Contains(document) == false)
                        {
                            SqlArchive.AddArchivedDocument(chancery.Id, document.Id);
                        }
                    }
                    foreach (Document oldDocument in oldChancery.Archive)
                    {
                        if (chancery.Archive.Contains(oldDocument) == false)
                        {
                            SqlArchive.DeleteArchivedDocument(chancery.Id, oldDocument.Id);
                        }
                    }
                }
            }
            foreach (Chancery oldChancery in oldChanceries)
            {
                if (chanceries.Contains(oldChancery) == false)
                {
                    SqlCompany_Chancery.GetCompanyByChancery(oldChancery.Id);
                    SqlChancery.DeleteChancery(oldChancery.Id);
                }
            }
            List <Director> oldDirectors = oldDataLists.Directors;
            List <Director> directors    = dataLists.Directors;

            foreach (Director director in directors)
            {
                if (oldDirectors.Contains(director) == false)
                {
                    SqlDirector.AddDirector(director);
                    AddCompanyDirectorRecord(director.Company, director);
                    foreach (Document document in director.PendingDocuments)
                    {
                        SqlDirectorPendingDocuments.AddPendingDocument(director.EmployeeId, document.Id);
                    }
                }
                else
                {
                    Director oldDirector = oldDirectors.Find((od) => od.EmployeeId == director.EmployeeId);
                    foreach (Document document in director.PendingDocuments)
                    {
                        if (oldDirector.PendingDocuments.Contains(document) == false)
                        {
                            SqlDirectorPendingDocuments.AddPendingDocument(director.EmployeeId, document.Id);
                        }
                    }
                    foreach (Document oldDocument in oldDirector.PendingDocuments)
                    {
                        if (director.PendingDocuments.Contains(oldDocument) == false)
                        {
                            SqlDirectorPendingDocuments.DeletePendingDocument(director.EmployeeId, oldDocument.Id);
                        }
                    }
                }
            }
            foreach (Director oldDirector in oldDirectors)
            {
                if (directors.Contains(oldDirector) == false)
                {
                    foreach (Document oldDocument in oldDirector.PendingDocuments)
                    {
                        SqlDirectorPendingDocuments.DeletePendingDocument(oldDirector.EmployeeId, oldDocument.Id);
                    }
                    SqlCompany_Director.GetCompanyByDirector(oldDirector.EmployeeId);
                    SqlDirector.DeleteDirector(oldDirector.EmployeeId);
                }
            }
            List <Secretary> oldSecretaries = oldDataLists.Secretaries;
            List <Secretary> secretaries    = dataLists.Secretaries;

            //документи не додаються
            foreach (Secretary secretary in secretaries)
            {
                if (oldSecretaries.Contains(secretary) == false)
                {
                    SqlSecretary.AddSecretary(secretary);
                    foreach (Document document in secretary.PendingDocuments)
                    {
                        SqlSecretaryPendingDocuments.AddPendingDocument(secretary.EmployeeId, document.Id);
                    }
                    foreach (Document document in secretary.CreatedDocuments)
                    {
                        SqlSecretaryCreatedDocuments.AddCreatedDocument(secretary.EmployeeId, document.Id);
                    }
                }
                else
                {
                    Secretary oldSecretary = oldSecretaries.Find((os) => os.EmployeeId == secretary.EmployeeId);
                    foreach (Document document in secretary.PendingDocuments)
                    {
                        if (oldSecretary.PendingDocuments.Contains(document) == false)
                        {
                            SqlSecretaryPendingDocuments.AddPendingDocument(secretary.EmployeeId, document.Id);
                        }
                    }
                    foreach (Document oldDocument in oldSecretary.PendingDocuments)
                    {
                        if (secretary.PendingDocuments.Contains(oldDocument) == false)
                        {
                            SqlSecretaryPendingDocuments.DeletePendingDocument(secretary.EmployeeId, oldDocument.Id);
                        }
                    }
                    foreach (Document document in secretary.CreatedDocuments)
                    {
                        if (oldSecretary.CreatedDocuments.Contains(document) == false)
                        {
                            SqlSecretaryCreatedDocuments.AddCreatedDocument(secretary.EmployeeId, document.Id);
                        }
                    }
                    foreach (Document oldDocument in oldSecretary.CreatedDocuments)
                    {
                        if (secretary.PendingDocuments.Contains(oldDocument) == false)
                        {
                            SqlSecretaryCreatedDocuments.DeleteCreatedDocument(secretary.EmployeeId, oldDocument.Id);
                        }
                    }
                }
            }
            foreach (Secretary oldSecretary in oldSecretaries)
            {
                if (secretaries.Contains(oldSecretary) == false)
                {
                    foreach (Document oldDocument in oldSecretary.PendingDocuments)
                    {
                        SqlSecretaryPendingDocuments.DeletePendingDocument(oldSecretary.EmployeeId, oldDocument.Id);
                    }
                    foreach (Document oldDocument in oldSecretary.CreatedDocuments)
                    {
                        SqlSecretaryCreatedDocuments.DeleteCreatedDocument(oldSecretary.EmployeeId, oldDocument.Id);
                    }
                    SqlSecretary.DeleteSecretary(oldSecretary.EmployeeId);
                }
            }
            List <MainSecretary> oldMainSecretaries = oldDataLists.MainSecretaries;
            List <MainSecretary> mainSecretaries    = dataLists.MainSecretaries;

            foreach (MainSecretary mainSecretary in mainSecretaries)
            {
                if (oldMainSecretaries.Contains(mainSecretary) == false)
                {
                    SqlMainSecretary.AddMainSecretary(mainSecretary);
                }
            }
            foreach (MainSecretary oldMainSecretary in oldMainSecretaries)
            {
                if (mainSecretaries.Contains(oldMainSecretary) == false)
                {
                    SqlMainSecretary.DeleteMainSecretary(oldMainSecretary.EmployeeId);
                }
            }
            List <Document> oldDocuments = oldDataLists.Documents;
            List <Document> documents    = dataLists.Documents;

            foreach (Document document in documents)
            {
                if (oldDocuments.Contains(document) == false)
                {
                    SqlDocument.AddDocument(document);
                }
            }
            foreach (Document oldDocument in oldDocuments)
            {
                if (documents.Contains(oldDocument) == false)
                {
                    SqlDocument.DeleteDocument(oldDocument.Id);
                }
            }
            List <Marker> oldMarkers = oldDataLists.Markers;
            List <Marker> markers    = dataLists.Markers;

            foreach (Marker marker in markers)
            {
                if (oldMarkers.Contains(marker) == false)
                {
                    SqlMarker.AddMarker(marker);
                }
            }
            foreach (Marker oldMarker in oldMarkers)
            {
                if (markers.Contains(oldMarker) == false)
                {
                    SqlMarker.DeleteMarker(oldMarker.Id);
                }
            }
        }