Beispiel #1
0
 private void ValidateBtn_Click(object sender, RoutedEventArgs e)
 {
     if (IsEncrytedStrAvailableOnSol)
     {
         UCEncryptionKey.ValidateKey();
     }
     else
     {
         UCEncryptionKey.CheckKeyCombination();
     }
 }
        private async void SaveKeyBtn_Click(object sender, RoutedEventArgs e)
        {
            if (xForgetRadioButton.IsChecked.Value && UCEncryptionKey.CheckKeyCombination())
            {
                if (Reporter.ToUser(eUserMsgKey.ForgotKeySaveChanges) == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
                {
                    _solution.EncryptionKey = UCEncryptionKey.EncryptionKeyPasswordBox.Password;
                    _solution.SolutionOperations.SaveEncryptionKey();
                    _solution.SolutionOperations.SaveSolution(false);

                    uOkBtn.Visibility      = Visibility.Visible;
                    uSaveKeyBtn.Visibility = Visibility.Collapsed;
                    uCloseBtn.Visibility   = Visibility.Collapsed;

                    xForgetRadioButton.IsEnabled  = false;
                    xReplaceRadioButton.IsEnabled = false;
                    UCEncryptionKey.IsEnabled     = false;
                    validKeyAdded = true;
                    await LoadEncryptedParamtersList();
                }
            }
            else if (xReplaceRadioButton.IsChecked.Value && UCEncryptionKeyPrevious.ValidateKey() && UCEncryptionKey.CheckKeyCombination())
            {
                this.ShowLoader();
                ShowStatusMessage("Updating new encryption key for solution");
                uSaveKeyBtn.Visibility  = Visibility.Collapsed;
                uCloseBtn.Visibility    = Visibility.Collapsed;
                _solution.EncryptionKey = UCEncryptionKey.EncryptionKeyPasswordBox.Password;
                _solution.SolutionOperations.SaveEncryptionKey();
                _solution.SolutionOperations.SaveSolution(false);
                if (WorkSpace.Instance.SolutionRepository == null)
                {
                    WorkSpace.Instance.SolutionRepository = GingerSolutionRepository.CreateGingerSolutionRepository();
                    WorkSpace.Instance.SolutionRepository.Open(_solution.ContainingFolderFullPath);
                    WorkSpace.Instance.Solution = _solution;
                }
                int varReencryptedCount = await HandlePasswordValuesReEncryption(UCEncryptionKeyPrevious.EncryptionKeyPasswordBox.Password);

                this.HideLoader();
                HideStatusMessage();
                if (varReencryptedCount > 0)
                {
                    Reporter.ToUser(eUserMsgKey.StaticInfoMessage, varReencryptedCount + " Variables Re-encrypted using new Encryption key across Solution.\n Please check in all changes to source control");
                }

                xSolutionPasswordsParamtersGrid.Visibility = Visibility.Collapsed;
                validKeyAdded = true;

                _pageGenericWin.Close();
            }
        }
Beispiel #3
0
        public void WizardEvent(WizardEventArgs WizardEventArgs)
        {
            switch (WizardEventArgs.EventType)
            {
            case EventType.Init:
                wiz = (ImportItemWizard)WizardEventArgs.Wizard;
                SetItemsListToImportGridView();
                wiz.ItemTypeListToImport = GetItemTypeListToImport();
                xItemTypesToImportGrid.DataSourceList = wiz.ItemTypeListToImport;
                break;

            case EventType.Active:
                ((WizardWindow)wiz.mWizardWindow).ShowFinishButton(false);

                UCEncryptionKey.mSolution = GlobalSolutionUtils.Instance.GetSolution();
                UCEncryptionKey.mSolution.SolutionOperations = new SolutionOperations(UCEncryptionKey.mSolution);
                if (!string.IsNullOrEmpty(wiz.EncryptionKey))
                {
                    UCEncryptionKey.EncryptionKeyPasswordBox.Password = wiz.EncryptionKey;
                    UCEncryptionKey.ValidateKey();
                }
                break;

            case EventType.LeavingForNextPage:
                if (string.IsNullOrEmpty(UCEncryptionKey.EncryptionKeyPasswordBox.Password))
                {
                    Reporter.ToUser(eUserMsgKey.StaticErrorMessage, "Please provide Solution Encryption Key.");
                    WizardEventArgs.CancelEvent = true;
                    return;
                }
                if (UCEncryptionKey.ValidateKey())
                {
                    wiz.EncryptionKey = UCEncryptionKey.EncryptionKeyPasswordBox.Password;
                    GlobalSolutionUtils.Instance.EncryptionKey = wiz.EncryptionKey;
                }
                else
                {
                    Reporter.ToUser(eUserMsgKey.StaticErrorMessage, "Loading Solution- Error: Encryption key validation failed.");
                    WizardEventArgs.CancelEvent = true;
                    return;
                }
                break;

            default:
                //Nothing to do
                break;
            }
        }
        public ReplaceEncryptionKeyPage()
        {
            InitializeComponent();
            UCEncryptionKeyPrevious.ChangeLabel("Solution Passwords Old Encryption Key");
            UCEncryptionKey.ChangeLabel("Solution Password New Encryption Key");

            xReplaceRadioButton.Click += radioBtn_Click;
            xForgetRadioButton.Click  += radioBtn_Click;

            xSolutionPasswordsParamtersGrid.btnMarkAll.Visibility = Visibility.Collapsed;
            xSolutionPasswordsParamtersGrid.Visibility            = Visibility.Collapsed;
            UCEncryptionKeyPrevious.Visibility = Visibility.Collapsed;
            UCEncryptionKey.Visibility         = Visibility.Collapsed;

            UCEncryptionKeyPrevious.EncryptionKeyPasswordBox.PasswordChanged += PrevEncryptionKeyBox_Changed;
            UCEncryptionKey.EncryptionKeyPasswordBox.PasswordChanged         += EncryptionKeyBox_Changed;
        }
Beispiel #5
0
 private void SaveKeyBtn_Click(object sender, RoutedEventArgs e)
 {
     if (!IsEncrytedStrAvailableOnSol && UCEncryptionKey.CheckKeyCombination())
     {
         mSolution.EncryptionKey             = UCEncryptionKey.EncryptionKeyPasswordBox.Password;
         mSolution.NeedVariablesReEncryption = true;
         mSolution.SolutionOperations.SaveEncryptionKey();
         mSolution.SolutionOperations.SaveSolution(false);
         IsValidEncryptionKeyAdded = true;
         _pageGenericWin.Close();
     }
     else if (IsEncrytedStrAvailableOnSol && UCEncryptionKey.ValidateKey())
     {
         mSolution.SolutionOperations.SaveEncryptionKey();
         IsValidEncryptionKeyAdded = true;
         _pageGenericWin.Close();
     }
 }
        private async void EncryptionKeyBox_Changed(object sender, RoutedEventArgs e)
        {
            //this inner method checks if user is still typing
            async Task <bool> UserKeepsTyping()
            {
                string txt = UCEncryptionKey.EncryptionKeyPasswordBox.Password;
                await Task.Delay(2000);

                return(txt != UCEncryptionKey.EncryptionKeyPasswordBox.Password);
            }

            if (await UserKeepsTyping())
            {
                return;
            }

            UCEncryptionKey.CheckKeyCombination();
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //TODO: replace with robot message
                Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
                //check name and folder inputs exists
                if (SolutionNameTextBox.Text.Trim() == string.Empty || SolutionFolderTextBox.Text.Trim() == string.Empty ||
                    ApplicationTextBox.Text.Trim() == string.Empty ||
                    MainPlatformComboBox.SelectedItem == null || MainPlatformComboBox.SelectedItem.ToString() == "Null" ||
                    UCEncryptionKey.EncryptionKeyPasswordBox.Password.Trim() == string.Empty)
                {
                    Mouse.OverrideCursor = null;
                    Reporter.ToUser(eUserMsgKey.MissingAddSolutionInputs);
                    return;
                }

                Regex regex = new Regex(@"^.*(?=.{8,16})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!*@#$%^&+=]).*$");
                if (!UCEncryptionKey.CheckKeyCombination())
                {
                    Mouse.OverrideCursor = null;
                    UCEncryptionKey.EncryptionKeyPasswordBox.Password = "";
                    return;
                }

                mSolution.ApplicationPlatforms = new ObservableList <ApplicationPlatform>();
                ApplicationPlatform MainApplicationPlatform = new ApplicationPlatform();
                MainApplicationPlatform.AppName  = ApplicationTextBox.Text;
                MainApplicationPlatform.Platform = (ePlatformType)MainPlatformComboBox.SelectedValue;
                mSolution.ApplicationPlatforms.Add(MainApplicationPlatform);
                mSolution.EncryptionKey = UCEncryptionKey.EncryptionKeyPasswordBox.Password;
                //TODO: check AppName and platform validity - not empty + app exist in list of apps


                //make sure main folder exist
                if (!System.IO.Directory.Exists(mSolution.Folder))
                {
                    System.IO.Directory.CreateDirectory(mSolution.Folder);
                }

                //create new folder with solution name
                mSolution.Folder = Path.Combine(mSolution.Folder, mSolution.Name);
                if (!System.IO.Directory.Exists(mSolution.Folder))
                {
                    System.IO.Directory.CreateDirectory(mSolution.Folder);
                }

                //check solution not already exist
                if (System.IO.File.Exists(System.IO.Path.Combine(mSolution.Folder, @"Ginger.Solution.xml")) == false)
                {
                    mSolution.FilePath = System.IO.Path.Combine(mSolution.Folder, @"Ginger.Solution.xml");
                    mSolution.SolutionOperations.SaveEncryptionKey();
                    mSolution.SolutionOperations.SaveSolution(false);
                }
                else
                {
                    //solution already exist
                    Mouse.OverrideCursor = null;
                    Reporter.ToUser(eUserMsgKey.SolutionAlreadyExist);
                    return;
                }

                WorkSpace.Instance.OpenSolution(mSolution.Folder);

                //Create default items
                AddFirstAgentForSolutionForApplicationPlatfrom(MainApplicationPlatform);
                App.OnAutomateBusinessFlowEvent(BusinessFlowWindows.AutomateEventArgs.eEventType.UpdateAppAgentsMapping, null);
                AddDefaultDataSource();
                AddDeafultReportTemplate();
                GingerCoreNET.GeneralLib.General.CreateDefaultEnvironment();
                WorkSpace.Instance.SolutionRepository.AddRepositoryItem(WorkSpace.Instance.GetNewBusinessFlow("Flow 1", true));
                mSolution.SolutionOperations.SetReportsConfigurations();

                //Save again to keep all defualt configurations setup
                mSolution.SolutionOperations.SaveSolution(false);
                //show success message to user
                Mouse.OverrideCursor = null;
                Reporter.ToUser(eUserMsgKey.AddSolutionSucceed);
                _pageGenericWin.Close();
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = null;
                Reporter.ToUser(eUserMsgKey.AddSolutionFailed, ex.Message);
            }
        }
 private void EncryptionKeyBox_Changed(object sender, RoutedEventArgs e)
 {
     UCEncryptionKey.CheckKeyCombination();
 }