Exemplo n.º 1
0
 public static List<Models.UserImageManagement> Get(int userId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.UserImageManagementRepository.Get(x => x.UserId == userId);
     }
 }
Exemplo n.º 2
0
 public static List<Models.Script> SearchScripts(string searchString)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.ScriptRepository.Get(s => s.Name.Contains(searchString));
     }
 }
Exemplo n.º 3
0
 public static List<Models.Site> SearchSites(string searchString = "")
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.SiteRepository.Get(searchString);
     }
 }
Exemplo n.º 4
0
 public static Models.CloneDeployUser GetUserByApiId(string apiId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.UserRepository.GetFirstOrDefault(x => x.ApiId == apiId);
     }
 }
Exemplo n.º 5
0
 public static List<Models.ComputerMunki> GetComputersForManifestTemplate(int templateId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.ComputerMunkiRepository.Get(x => x.MunkiTemplateId == templateId);
     }
 }
Exemplo n.º 6
0
        public static Models.ValidationResult AddGroup(Models.Group group, int userId)
        {
            using (var uow = new DAL.UnitOfWork())
            {
                var validationResult = ValidateGroup(group, true);
                if (validationResult.IsValid)
                {
                    uow.GroupRepository.Insert(group);
                    validationResult.IsValid = uow.Save();

                    //If Group management is being used add this group to the allowed users list
                    var userManagedGroups = BLL.UserGroupManagement.Get(userId);
                    if (userManagedGroups.Count > 0)
                        BLL.UserGroupManagement.AddUserGroupManagements(
                            new List<Models.UserGroupManagement>
                            {
                                new Models.UserGroupManagement
                                {
                                    GroupId = group.Id,
                                    UserId = userId
                                }
                            });
                }

                return validationResult;
            }
        }
Exemplo n.º 7
0
 public static List<Models.ComputerMunki> Get(int computerId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.ComputerMunkiRepository.Get(x => x.ComputerId == computerId);
     }
 }
Exemplo n.º 8
0
 public static List<Models.MunkiManifestOptionInstall> GetAllOptionalInstallsForMt(int manifestTemplateId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.MunkiOptionalInstallRepository.Get(s => s.ManifestTemplateId == manifestTemplateId);
     }
 }
Exemplo n.º 9
0
 public static Models.CdVersion Get(int cdVersionId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.CdVersionRepository.GetById(cdVersionId);
     }
 }
Exemplo n.º 10
0
 public static List<Models.Computer> GetGroupMembers(int groupId, string searchString = "")
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.GroupRepository.GetGroupMembers(groupId, searchString);
     }
 }
Exemplo n.º 11
0
 public static List<Models.ImageProfileFileFolder> SearchImageProfileFileFolders(int profileId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.ImageProfileFileFolderRepository.Get(x => x.ProfileId == profileId, orderBy: q => q.OrderBy(t => t.Priority));
     }
 }
Exemplo n.º 12
0
 public static Models.Script GetScript(int scriptId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.ScriptRepository.GetById(scriptId);
     }
 }
Exemplo n.º 13
0
 public static Models.MunkiManifestOptionInstall GetOptionalInstall(int optionalInstallId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.MunkiOptionalInstallRepository.GetById(optionalInstallId);
     }
 }
Exemplo n.º 14
0
 public static string TotalCount(int manifestTemplateId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.MunkiOptionalInstallRepository.Count(x => x.ManifestTemplateId == manifestTemplateId);
     }
 }
Exemplo n.º 15
0
 public static Models.DistributionPoint GetPrimaryDistributionPoint()
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.DistributionPointRepository.GetFirstOrDefault(x => x.IsPrimary == 1);
     }
 }
Exemplo n.º 16
0
 public static int GetAdminCount()
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return Convert.ToInt32(uow.UserRepository.Count(u => u.Membership == "Administrator"));
     }
 }
Exemplo n.º 17
0
 public static CloneDeployUser GetUser(int userId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.UserRepository.GetById(userId);
     }
 }
Exemplo n.º 18
0
 public static CloneDeployUser GetUser(string userName)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.UserRepository.GetFirstOrDefault(u => u.Name == userName);
     }
 }
Exemplo n.º 19
0
 public static Models.Site GetSite(int siteId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.SiteRepository.GetById(siteId);
     }
 }
Exemplo n.º 20
0
 public static string TotalCount()
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.ScriptRepository.Count();
     }
 }
Exemplo n.º 21
0
 public static Models.CloneDeployUser GetUserByToken(string token)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.UserRepository.GetFirstOrDefault(x => x.Token == token);
     }
 }
Exemplo n.º 22
0
 public static bool FirstRunCompleted()
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return Convert.ToBoolean(uow.CdVersionRepository.GetById(1).FirstRunCompleted);
     }
 }
Exemplo n.º 23
0
 public static Models.MunkiManifestManagedUnInstall GetManagedUnInstall(int managedUnInstallId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.MunkiManagedUnInstallRepository.GetById(managedUnInstallId);
     }
 }
Exemplo n.º 24
0
 public static Models.FileFolder GetFileFolder(int FileFolderId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.FileFolderRepository.GetById(FileFolderId);
     }
 }
Exemplo n.º 25
0
 public static List<Models.MunkiManifestCatalog> GetAllCatalogsForMt(int manifestTemplateId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.MunkiCatalogRepository.Get(s => s.ManifestTemplateId == manifestTemplateId);
     }
 }
Exemplo n.º 26
0
 public static Models.MunkiManifestCatalog GetCatalog(int catalogId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.MunkiCatalogRepository.GetById(catalogId);
     }
 }
Exemplo n.º 27
0
 public static Models.ActiveMulticastSession GetFromPort(int port)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.ActiveMulticastSessionRepository.GetFirstOrDefault(x => x.Port == port);
     }
 }
Exemplo n.º 28
0
 public static List<Models.UserGroupRight> Get(int userGroupId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.UserGroupRightRepository.Get(x => x.UserGroupId == userGroupId);
     }
 }
Exemplo n.º 29
0
 public static Models.PartitionLayout GetPartitionLayout(int partitionLayoutId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.PartitionLayoutRepository.GetById(partitionLayoutId);
     }
 }
Exemplo n.º 30
0
 public static string TotalCount()
 {
     using (var uow = new DAL.UnitOfWork())
     {
         return uow.PartitionLayoutRepository.Count();
     }
 }
Exemplo n.º 31
0
        private void DeleteFund_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            DAL.UnitOfWork oUnitOfWork = null;

            try
            {
                oUnitOfWork = new DAL.UnitOfWork();

                System.Windows.MessageBoxResult oResult =
                    Infrastructure.MessageBox.Show
                    (
                        caption: Infrastructure.MessageBox.Caption.Question,
                        text: "آیا مطمئن به حذف صندوق می‌باشید؟"
                    );

                if (oResult == System.Windows.MessageBoxResult.Yes)
                {
                    Models.Fund oFund = oUnitOfWork.FundRepository
                                        .GetById(Utility.CurrentFund.Id);

                    if (oFund != null)
                    {
                        oUnitOfWork.FundRepository.Delete(oFund);

                        oUnitOfWork.Save();

                        Infrastructure.MessageBox.Show
                        (
                            caption: Infrastructure.MessageBox.Caption.Information,
                            text: "صندوق با موفقیت حذف گردید."
                        );

                        Utility.CurrentFund = null;

                        Utility.MainWindow.RefreshUserInterface();
                    }
                }

                oUnitOfWork.Save();
            }
            catch (System.Exception ex)
            {
                Infrastructure.MessageBox.Show(ex.Message);
            }
            finally
            {
                if (oUnitOfWork != null)
                {
                    oUnitOfWork.Dispose();
                    oUnitOfWork = null;
                }
            }

            this.Close();
        }
        private void DeleteUserClick(object sender, System.Windows.RoutedEventArgs e)
        {
            DAL.UnitOfWork oUnitOfWork = null;

            try
            {
                oUnitOfWork = new DAL.UnitOfWork();

                System.Windows.MessageBoxResult oResult =
                    Infrastructure.MessageBox.Show
                    (
                        caption: Infrastructure.MessageBox.Caption.Question,
                        text: "آیا مطمئن به حذف کاربر از سیستم هستید ؟"
                    );

                if (oResult == System.Windows.MessageBoxResult.Yes)
                {
                    oUnitOfWork.UserRepository.DeleteById(_currentId);

                    oUnitOfWork.Save();

                    Infrastructure.MessageBox.Show
                    (
                        caption: Infrastructure.MessageBox.Caption.Information,
                        text: "کاربر با موفقیت از سیستم حذف گردید."
                    );

                    if (_currentId == Utility.CurrentUser.Id)
                    {
                        UserLoginWindow oUserLoginWindow = new UserLoginWindow();

                        (Utility.MainWindow as MainRibbonWindow).Hide();

                        oUserLoginWindow.Show();
                    }
                }

                oUnitOfWork.Save();
            }
            catch (System.Exception ex)
            {
                Infrastructure.MessageBox.Show(ex.Message);;
            }
            finally
            {
                if (oUnitOfWork != null)
                {
                    oUnitOfWork.Dispose();
                    oUnitOfWork = null;
                }
            }

            RefreshGridControl();
        }
Exemplo n.º 33
0
 public static List <Models.Group> SearchGroups(string searchString = "")
 {
     using (var uow = new DAL.UnitOfWork())
     {
         var listOfGroups = uow.GroupRepository.Get(g => g.Name.Contains(searchString));
         foreach (var group in listOfGroups)
         {
             group.Image = BLL.Image.GetImage(group.ImageId);
         }
         return(listOfGroups);
     }
 }
Exemplo n.º 34
0
 public static List <CloneDeployUser> SearchUsers(string searchString)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         var users = uow.UserRepository.Get(u => u.Name.Contains(searchString));
         foreach (var user in users)
         {
             user.UserGroup = BLL.UserGroup.GetUserGroup(user.UserGroupId);
         }
         return(users);
     }
 }
Exemplo n.º 35
0
        private void Button_Click_1(object sender, System.Windows.RoutedEventArgs e)
        {
            DAL.UnitOfWork oUnitOfWork = new DAL.UnitOfWork();

            Utility.CurrentLoan = oUnitOfWork.LoanRepository
                                  .GetById(LoanId);

            ShowInstallmentsListPerLoanWindow oShowInstallmentsListPerLoanWindow =
                new ShowInstallmentsListPerLoanWindow();

            oShowInstallmentsListPerLoanWindow.ShowDialog();
        }
Exemplo n.º 36
0
 public static Models.Computer GetComputer(int computerId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         var computer = uow.ComputerRepository.GetById(computerId);
         if (computer != null)
         {
             computer.Image = BLL.Image.GetImage(computer.ImageId);
         }
         return(computer);
     }
 }
Exemplo n.º 37
0
        public static bool AddUserGroupRights(List <Models.UserGroupRight> listOfRights)
        {
            using (var uow = new DAL.UnitOfWork())
            {
                foreach (var right in listOfRights)
                {
                    uow.UserGroupRightRepository.Insert(right);
                }

                return(uow.Save());
            }
        }
Exemplo n.º 38
0
        public static bool AddUserGroupGroupManagements(List <Models.UserGroupGroupManagement> listOfGroups)
        {
            using (var uow = new DAL.UnitOfWork())
            {
                foreach (var group in listOfGroups)
                {
                    uow.UserGroupGroupManagementRepository.Insert(group);
                }

                return(uow.Save());
            }
        }
Exemplo n.º 39
0
        public static bool AddMunkiTemplates(List <Models.GroupMunki> listOfTemplates)
        {
            using (var uow = new DAL.UnitOfWork())
            {
                foreach (var template in listOfTemplates)
                {
                    uow.GroupMunkiRepository.Insert(template);
                }

                return(uow.Save());
            }
        }
Exemplo n.º 40
0
 public static Models.Group GetGroup(int groupId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         var group = uow.GroupRepository.GetById(groupId);
         if (group != null)
         {
             group.Image = BLL.Image.GetImage(group.ImageId);
         }
         return(group);
     }
 }
Exemplo n.º 41
0
 public static Models.ImageProfile ReadProfile(int profileId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         var imageProfile = uow.ImageProfileRepository.GetById(profileId);
         if (imageProfile != null)
         {
             imageProfile.Image = BLL.Image.GetImage(imageProfile.ImageId);
         }
         return(imageProfile);
     }
 }
Exemplo n.º 42
0
        public static bool UpdateSetting(List <Models.Setting> listSettings)
        {
            using (var uow = new DAL.UnitOfWork())
            {
                foreach (var setting in listSettings)
                {
                    uow.SettingRepository.Update(setting, setting.Id);
                }

                uow.Save();
            }
            return(true);
        }
Exemplo n.º 43
0
        public static Models.ValidationResult UpdateScript(Models.Script script)
        {
            using (var uow = new DAL.UnitOfWork())
            {
                var validationResult = ValidateScript(script, false);
                if (validationResult.IsValid)
                {
                    uow.ScriptRepository.Update(script, script.Id);
                    validationResult.IsValid = uow.Save();
                }

                return(validationResult);
            }
        }
Exemplo n.º 44
0
        public static Models.ValidationResult AddBootTemplate(Models.BootTemplate bootTemplate)
        {
            using (var uow = new DAL.UnitOfWork())
            {
                var validationResult = ValidateTemplate(bootTemplate, true);
                if (validationResult.IsValid)
                {
                    uow.BootTemplateRepository.Insert(bootTemplate);
                    validationResult.IsValid = uow.Save();
                }

                return(validationResult);
            }
        }
Exemplo n.º 45
0
        public static Models.ValidationResult AddScript(Models.Script script)
        {
            using (var uow = new DAL.UnitOfWork())
            {
                var validationResult = ValidateScript(script, true);
                if (validationResult.IsValid)
                {
                    uow.ScriptRepository.Insert(script);
                    validationResult.IsValid = uow.Save();
                }

                return(validationResult);
            }
        }