コード例 #1
0
        public ActionResult ForgotPassword(VMModel <UserAccount> model)
        {
            var userAccount = this._managementUserAccountService.GetByEmailAddress(model.Record.EmailAddress);

            if (userAccount == null)
            {
                return(HttpNotFound());
            }

            var securityKey = ConfigurationManager.AppSettings["PasswordSecurityKey"];
            var encryptedID = PasswordEncryption.Encrypt($"{securityKey}_{userAccount.FirstOrDefault().ID}");

            this._emailAutomationService.SendEmail(
                to: model.Record.EmailAddress,
                subject: $"Recover Account - {model.Record.EmailAddress}",
                body: UserAccountTemplate.GetForgotPasswordTemplate(
                    encryptedID,
                    ConfigurationManager.AppSettings["Host"],
                    userAccount.FirstOrDefault().FirstName),
                fromName: "Trademarkers LLC.",
                isHtml: true);

            TempData.Add("ForgotPasswordInfo", model.Record.EmailAddress);

            return(RedirectToAction("Index", "Public"));
        }
コード例 #2
0
        private void MoveToGroup(object item)
        {
            ObservableCollection <object> tree = new ObservableCollection <object> ();

            tree.Add(VMModel.GetInstance().RootVMGroup);
            MoveToGroupDialog dlg = new MoveToGroupDialog(tree);

            dlg.Owner = Window1.GetWindow(View.Parent);
            dlg.ShowDialog();
            if (dlg.DialogResult.HasValue && dlg.DialogResult.Value)
            {
                //only VMGroup selected
                VMGroup group = dlg.CheckedItem as VMGroup;
                if ((item is VMGroup) && (ActiveVMList.Count == 0))
                {
                    model.MoveToGroup(item as VMGroup, group);
                    group.Save();
                }
                else
                {//Some VM in Group selected or single VM is selected on tree
                    model.MoveToGroup(ActiveVMList, group);
                    model.ActiveVMList.Clear();
                    group.Save();
                }
            }
        }
コード例 #3
0
        public DetailViewBase(JobListViewModel jlvm)
        {
            InitializeComponent();
            VMModel model = VMModel.GetInstance();

            this.Unloaded += new RoutedEventHandler(DetailViewBase_Unloaded);
            this.Content   = jlvm.View as UserControl;
        }
コード例 #4
0
 public AddHostDialogViewModel(VMModel model)
     : base()
 {
     OKCommand    = new DelegateCommand <List <string> >(OK, CanOK);
     IsSingleHost = true;
     HostName     = "";
     OKAllowed    = false;
 }
コード例 #5
0
        public AddHostDialog()
        {
            AddHostDialogViewModel viewModel = new AddHostDialogViewModel(VMModel.GetInstance());

            this.DataContext       = viewModel;
            viewModel.OKPerformed += new EventHandler <EventArgs>(viewModel_OKPerformed);
            InitializeComponent();
        }
コード例 #6
0
        private object AdminDashboard()
        {
            VMModel model = new VMModel();

            model.Courses = _context.Courses.ToList();
            model.Learner = _context.Learner.Include(x => x.User).ToList();
            return(model);
        }
コード例 #7
0
        private object InstructorDashboard(long userId)
        {
            VMModel model = new VMModel();

            model.Courses = _context.Courses.ToList();
            model.Learner = _context.Learner.Include(x => x.User).ToList();
            return(model);
        }
コード例 #8
0
        public NavigationViewModel(VMModel model)
            : base()
        {
            this.model = model;
            View       = new NavigationControl();
            View.SetViewModel(this);

            //TreeCommandsView = View.
        }
コード例 #9
0
        public ActionResult AccountInformation()
        {
            var session = SessionUtils.GetUserAccount();

            var userAccount = this._service.Get(session.ID);
            var model       = new VMModel <UserAccount>
            {
                Record   = userAccount,
                PageMode = PageMode.View
            };

            return(View("AccountInformationView", model));
        }
コード例 #10
0
        public ActionResult UserAccountVerification(int id)
        {
            var userAccount = this._managementUserAccountService.Get(id);

            if (userAccount == null || userAccount.IsActive)
            {
                return(HttpNotFound());
            }

            userAccount.Password = string.Empty;

            var model = new VMModel <UserAccount>();

            model.Record = userAccount;

            return(View(model));
        }
コード例 #11
0
        public ActionResult UserAccountVerification(VMModel <UserAccount> model)
        {
            var userAccount = this._managementUserAccountService.Get(model.Record.ID);

            if (userAccount == null || userAccount.IsActive)
            {
                return(HttpNotFound());
            }

            if (string.IsNullOrWhiteSpace(model.Record.Password) || string.IsNullOrWhiteSpace(model.Record.ConfirmPassword))
            {
                TempData.Add("NoPasswordError", true);
                return(View(model));
            }

            if (!string.Equals(model.Record.Password, model.Record.ConfirmPassword))
            {
                TempData.Add("NotEqualPasswordError", true);
                return(View(model));
            }

            var newPassword = model.Record.Password;

            model.Record          = userAccount;
            model.Record.IsActive = true;
            model.Record.Password = PasswordEncryption.Encrypt(newPassword);
            this._managementUserAccountService.UpdateUserAccount(model.Record);

            this._auditTrailService.Insert(
                new AuditTrail
            {
                ObjectName  = "UserAccount",
                ObjectID    = model.Record.ID,
                Message     = "User Account was verified successfully.",
                UserAccount = new UserAccount
                {
                    ID = model.Record.ID
                },
                CreateDate = SessionUtils.GetCurrentDateTime()
            });

            TempData.Add("UserActivatedInfo", true);

            return(RedirectToAction("Index", "Public"));
        }
コード例 #12
0
        public MainWindowViewModel()
            : base()
        {
            model = VMModel.GetInstance();

            VMHostTreeViewModel hostTree = new VMHostTreeViewModel(model);

            //NavigationViewModel nav = new NavigationViewModel(model);
            VMHostNavigationView  = hostTree.View;
            VMHostTreeActionsView = hostTree.ActionsView;
            VMTreeViewModel vmTree = new VMTreeViewModel(model);

            TreeCommandsView = vmTree.GroupCommandsView;
            VMNavigationView = vmTree.View;
            model.ActiveVMHostGroupChanged +=
                (o, e) =>
            {
                if (HostListExpanded)
                {
                    HostListExpanded = false;
                    HostListExpanded = true;
                }
            };
            model.ActiveVMGroupChanged +=
                (o, e) =>
            {
                VMListViewModel listViewModel = new VMListViewModel(model, model.ActiveVMGroup.VMList);
                DetailsView = listViewModel.View;
                //JobAndTaskCommandsView = listViewModel.JobActionsView;
                listViewModel.JobActionsViewChanged +=
                    (obj, arg) =>
                {
                    JobAndTaskCommandsView = listViewModel.JobActionsView;
                };
                GC.Collect();
            };

            VMCommandsViewModel actionsvm = new VMCommandsViewModel(model);

            ActionsView = actionsvm.View;
            //VMListViewModel vmlstvm = new VMListViewModel(VMModel.GetInstance());
            //DetailsView = vmlstvm.View;
        }
コード例 #13
0
        public ActionResult ForgotPasswordSet(string q)
        {
            var decryptedID = PasswordEncryption.Decrypt(q);
            var splitID     = decryptedID.Split(new char[] { '_' }, 2);

            var userAccount = this._managementUserAccountService.Get(Convert.ToInt32(splitID.Last()));

            if (userAccount == null)
            {
                return(HttpNotFound());
            }

            userAccount.Password = string.Empty;

            var model = new VMModel <UserAccount>();

            model.Record = userAccount;

            return(View(model));
        }
コード例 #14
0
        public VMListViewModel(VMModel vmModel, ObservableCollection <VM> _VMList)
        {
            this.vmModel = vmModel;
            View         = new VMListView();
            this.VMList  = _VMList;
            vmModel.ActiveVMList.Clear();

            //FillVMList();
            RefreshVMListCommand      = new DelegateCommand <ObservableCollection <VM> >(RefreshVMList, CanRefreshVMList);
            SelectAllCommand          = new DelegateCommand <IEnumerable <VMViewModel> >(SelectAll, CanSelectAll);
            UnselectAllCommand        = new DelegateCommand <IEnumerable <VMViewModel> >(UnselectAll, CanUnselectAll);
            ChangeMainNodeNameCommand = new DelegateCommand <string>(ChangeMainNode, CanChangeMainNode);
            CanExecuteRaisers         = new List <Action> {
                RefreshVMListCommand.RaiseCanExecuteChanged,
                SelectAllCommand.RaiseCanExecuteChanged,
                UnselectAllCommand.RaiseCanExecuteChanged
            };
            this.MainNodeName = vmModel.Settings.MainNodeName;

            this.VMList.CollectionChanged +=
                (obj, exp) =>
            {
                RefreshCommands();
                OnPropertyChanged("VMList");
            };
            vmModel.ActiveVMList.CollectionChanged +=
                (obj, exp) =>
            {
                DetailsExpanded    = false;
                PropertiesExpanded = false;
                JobsExpanded       = false;
                GC.Collect();
                UnselectAllCommand.RaiseCanExecuteChanged();
            };
            VMLog.GetInstance().CollectionChanged +=
                (o, e) =>
            {
                LogExpanded = true;
            };
            View.SetViewModel(this);
        }
コード例 #15
0
        //private ViewModelBase viewModel;
        public DetailViewBase()
        {
            InitializeComponent();
            VMModel model = VMModel.GetInstance();

            this.Unloaded += new RoutedEventHandler(DetailViewBase_Unloaded);
            model.SelectedTreeItemChanged +=
                (o, e) =>
            {
                if (model.SelectedTreeItem is VM)
                {
                    VMDetailsViewModel viewModel = new VMDetailsViewModel(model.SelectedTreeItem as VM);
                    this.Content = viewModel.View;
                    GC.Collect();
                    //this.detailContent.Content = viewModel.View;
                }
                else if (model.SelectedTreeItem is VMGroup)
                {
                    // VMListViewModel viewModel = new VMListViewModel(VMModel.GetInstance());
                    //this.Content = viewModel.View;
                    GC.Collect();
                }
            };
        }
コード例 #16
0
        public VMSnapshotViewModel(VMSnapshot _snapshot, VM vm, VMModel _model)
            : base()
        {
            this.model            = _model;
            this.snapshotInstance = _snapshot;
            this.ElementName      = _snapshot.ElementName;
            this.children         = new ObservableCollection <VMSnapshotViewModel>();
            foreach (VMSnapshot child in this.snapshotInstance.ChildSnapshots)
            {
                this.AddChild(new VMSnapshotViewModel(child, vm, model));
            }
            isSelected = false;
            //check if this snapshot is last applied
            VMSnapshot lastAppliedSnapshot = new VMSnapshot(Utility.GetLastAppliedVirtualSystemSnapshot(vm.Instance));

            if (lastAppliedSnapshot.ElementName == this.snapshotInstance.ElementName)
            {
                this.IsLastApplied = true;
            }
            else
            {
                this.IsLastApplied = false;
            }
        }
コード例 #17
0
 private void SetProcessor(object quantity)
 {
     VMModel.GetInstance().SetProcessorVMList(VMList, VirtualQuantity);
 }
コード例 #18
0
        public ActionResult ForgotPassword()
        {
            var model = new VMModel <UserAccount>();

            return(View(model));
        }
コード例 #19
0
        public VMCommandsViewModel(VMModel model)
        {
            this.model           = model;
            this.ActiveVMList    = model.ActiveVMList;
            VMListStart          = new DelegateCommand <ObservableCollection <VM> >(StartVMList, CanStartVMList);
            VMListStop           = new DelegateCommand <ObservableCollection <VM> >(StopVMList, CanStopVMList);
            VMListShutdown       = new DelegateCommand <ObservableCollection <VM> >(ShutdownVMList, CanShutdownVMList);
            VMListSuspend        = new DelegateCommand <ObservableCollection <VM> >(SuspendVMList, CanSuspendVMList);
            VMListPause          = new DelegateCommand <ObservableCollection <VM> >(PauseVMList, CanPauseVMList);
            VMListReboot         = new DelegateCommand <ObservableCollection <VM> >(RebootVMList, CanRebootVMList);
            VMConnect            = new DelegateCommand <ObservableCollection <VM> >(ConnectToVM, CanConnectToVM);
            VMListCreateSnapshot = new DelegateCommand <ObservableCollection <VM> >(CreateSnapshot, CanCreateSnapshot);
            VMSnapshotApply      = new DelegateCommand <VMSnapshot>(ApplySnapshot, CanApplySnapshot);
            VMSnapshotRemove     = new DelegateCommand <VMSnapshot>(RemoveSnapshot, CanRemoveSnapshot);
            VMSnapshotTreeRemove = new DelegateCommand <VMSnapshot>(RemoveSnapshotTree, CanRemoveSnapshotTree);
            MoveToVMGroup        = new DelegateCommand <object>(MoveToGroup, CanMoveToGroup);
            CanExecuteRaisers    = new List <Action> {
                vmListStart.RaiseCanExecuteChanged,
                vmListStop.RaiseCanExecuteChanged,
                vmListShutdown.RaiseCanExecuteChanged,
                vmListPause.RaiseCanExecuteChanged,
                vmListReboot.RaiseCanExecuteChanged,
                vmListSuspend.RaiseCanExecuteChanged,
                vmConnect.RaiseCanExecuteChanged,
                vmListCreateSnapshot.RaiseCanExecuteChanged,
                vmSnapshotApply.RaiseCanExecuteChanged,
                vmSnapshotRemove.RaiseCanExecuteChanged,
                vmSnapshotTreeRemove.RaiseCanExecuteChanged,
                moveToVMGroup.RaiseCanExecuteChanged,
            };
            model.SelectedTreeItemChanged +=
                (o, e) =>
            {
                this.ActiveItem = model.SelectedTreeItem;
            };
            model.ActiveVMGroupChanged +=
                (o, e) =>
            {
                this.ActiveVMGroup = model.ActiveVMGroup;
                RefreshCommands();
            };
            model.ActiveVMListChanged +=
                (o, e) =>
            {
                if (e.NewItems != null)
                {
                    this.ActiveVMList = model.ActiveVMList;
                    foreach (VM vm in e.NewItems)
                    {
                        vm.VMStatusChanged += new VMStatusChangedEventHandler(vm_VMStatusChanged);
                    }
                    if (e.OldItems != null)
                    {
                        foreach (VM vm in e.OldItems)
                        {
                            vm.VMStatusChanged -= vm_VMStatusChanged;
                        }
                    }
                }
                RefreshCommands();
            };

            model.SelectedSnapshotItemChanged +=
                (o, e) =>
            {
                ActiveVMSnapshot = (VMSnapshot)model.SelectedSnapshotItem;
                RefreshCommands();
            };
            View = new VMCommandsView();
            View.SetViewModel(this);
        }
コード例 #20
0
 private void SetMemory(object quantity)
 {
     VMModel.GetInstance().SetMemoryVMList(VMList, Size);
 }
コード例 #21
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            TaskListViewModel tl = new TaskListViewModel((value as JobViewModel).Job, VMModel.GetInstance().ActiveVMList,
                                                         (value as JobViewModel).HpcScheduler, (value as JobViewModel).CancelTaskListCommand, (value as JobViewModel).RequeueTaskListCommand);

            return(tl);
        }