Beispiel #1
0
        public bool IsValidated(LoginViewModel loginViewModel)
        {
            LoginViewModel result = new ADRepository <LoginViewModel>().IsExist(loginViewModel);

            if (result != null)
            {
                return(true);
            }
            return(false);
        }
Beispiel #2
0
 static List <Employee> GetEmployeeList()
 {
     if (SqlRepository.HasAdministratorRights)
     {
         return(Properties.Settings.Default.DefaultRepository switch
         {
             "GetSqlEmployeeList" => SqlRepository.GetEmployeeList(),
             "GetSPEmployeeList" => SPRepository.GetEmployeeList(),
             "GetADEmployeeList" => ADRepository.GetEmployeeList(),
             _ => throw new NotImplementedException("Не вернуй параметр " + Properties.Settings.Default.DefaultRepository),
         });
Beispiel #3
0
        public Response <IList <Services> > GetServices()
        {
            Services services = new Services();
            Response <IList <Services> > response = new Response <IList <Services> >();

            IList <Services> servicesList = new ADRepository <Services>().Find(services);

            if (servicesList != null)
            {
                response.Success = true;
                response.Data    = servicesList;
            }
            else
            {
                response.Success = false;
                response.Message = "No se encontraron servicios";
            }
            return(response);
        }
Beispiel #4
0
        private void StartUpdate_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.UserLogin    = UserLogin.Text;
            Properties.Settings.Default.UserPassword = Cryptography.EncryptPassword(UserLogin.Text, UserPassword.Text);

            LogTextBox.Clear();
            MainUpdateSettings.Visible = false;
            SPUpdateSettings.Visible   = false;
            UpdateReady = false;
            CompliteChecker.Start();

            new Task(() =>
            {
                void AppendLog(string text)
                => Invoke(new Action <string>(LogTextBox.AppendText), new object[] { text });

                try
                {
                    if (UpdateSharePoint.Checked || UpdateMSSQL.Checked)
                    {
                        AppendLog("Получение списка сортрудников Active Directory ");
                        var adEmployeeList = ADRepository.GetEmployeeList();
                        AppendLog($"({adEmployeeList.Count} записей)\r\n\r\n");

                        if (UpdateMSSQL.Checked)
                        {
                            AppendLog("Получение списка сортрудников MSSQL ");
                            var sqlEmployeeList = SqlRepository.GetEmployeeList();
                            AppendLog($"({sqlEmployeeList.Count} записей)\r\n");

                            AppendLog($"Поиск различий Active Directory и MSSQL\r\n");
                            (var createEmployeeList, var updateEmployeeList, var deleteEmployeeList) = DefiningDifferences(adEmployeeList, sqlEmployeeList);
                            AppendLog($"\tДобавить: {createEmployeeList.Count}\r\n"
                                      + $"\tИзменить: {updateEmployeeList.Count}\r\n"
                                      + $"\tУдалить: {deleteEmployeeList.Count}\r\n");

                            AppendLog($"Обновление данных MSSQL ");
                            SqlRepository.UpdateEmployeeList(createEmployeeList, updateEmployeeList, deleteEmployeeList);
                            AppendLog($"(Выполнено)\r\n\r\n");
                        }

                        if (UpdateSharePoint.Checked)
                        {
                            AppendLog("Получение списка сортрудников SharePoint ");
                            var spEmployeeList = SPRepository.GetEmployeeList();
                            AppendLog($"({spEmployeeList.Count} записей)\r\n");

                            AppendLog($"Поиск различий Active Directory и SharePoint:\r\n");
                            (var createEmployeeList, var updateEmployeeList, var deleteEmployeeList) = DefiningDifferences(adEmployeeList, spEmployeeList);
                            AppendLog($"\tДобавить: {createEmployeeList.Count}\r\n"
                                      + $"\tИзменить: {updateEmployeeList.Count}\r\n"
                                      + $"\tУдалить: {deleteEmployeeList.Count}\r\n");

                            AppendLog($"Обновление данных SharePoint ");
                            SPRepository.UpdateEmployeeList(createEmployeeList, updateEmployeeList, deleteEmployeeList);
                            AppendLog($"(Выполнено)\r\n\r\n");
                        }
                    }
                    else
                    {
                        AppendLog("Выполнение прервано, так как не указано ни одного хранилища данных.\r\n\r\n");
                    }
                }
                catch (Exception ex)
                {
                    AppendLog("Ошибка при выполнении:\r\n\t" + ex.Message + "\r\n\r\n" + "Трассировка: \r\n\t" + ex.StackTrace);
                }
                finally
                {
                    AppendLog($"Выполнение завершено\r\n");
                    UpdateReady = true;
                }
            }).Start();
        }
Beispiel #5
0
 public List <AdvertismentItem> GetAdvertisment()
 {
     return(ADRepository.GetAdds());
 }