예제 #1
0
        private async void grdMain_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            if (e.Column.Header.ToString() == "User Password")
            {
                Database selectedEnvDB = (Database)grdAppDbs.CurrentItem;
                String   intialValue   = selectedEnvDB.Pass;
                if (!string.IsNullOrEmpty(intialValue))
                {
                    bool res = false;
                    if (!EncryptionHandler.IsStringEncrypted(intialValue))
                    {
                        selectedEnvDB.Pass = EncryptionHandler.EncryptString(intialValue, ref res);
                        if (res == false)
                        {
                            selectedEnvDB.Pass = null;
                        }
                    }
                }
            }

            if (e.Column.Header.ToString() == nameof(Database.Name))
            {
                Database selectedDB = (Database)grdAppDbs.CurrentItem;
                if (selectedDB.Name != selectedDB.NameBeforeEdit)
                {
                    await UpdateDatabaseNameChange(selectedDB);
                }
            }
        }
예제 #2
0
 private void param_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == GeneralParam.Fields.Encrypt)
     {
         GeneralParam param       = (GeneralParam)sender;
         String       intialValue = param.Value;
         bool         res         = false;
         if (!string.IsNullOrEmpty(intialValue))
         {
             if (param.Encrypt == true)
             {
                 if (!EncryptionHandler.IsStringEncrypted(intialValue))
                 {
                     param.Value = EncryptionHandler.EncryptString(intialValue, ref res);
                     if (res == false)
                     {
                         param.Value = null;
                     }
                 }
             }
             else
             {
                 if (EncryptionHandler.IsStringEncrypted(intialValue))
                 {
                     param.Value = EncryptionHandler.DecryptString(intialValue, ref res);
                     if (res == false)
                     {
                         param.Value = null;
                     }
                 }
             }
         }
     }
 }
        public void EncryptString()
        {
            //Arrange
            string encryptedString = string.Empty;
            bool   result          = false;

            //Act
            encryptedString = EncryptionHandler.EncryptString("ginger", ref result);

            //Assert
            Assert.AreEqual("mDL33JRKM3Zv1FdtGQMNZg==", encryptedString);
        }
예제 #4
0
        private void txtPasswordValue_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            bool res = false;

            if (!EncryptionHandler.IsStringEncrypted(txtPasswordValue.Text))
            {
                txtPasswordValue.Text = EncryptionHandler.EncryptString(txtPasswordValue.Text, ref res);
                if (res == false)
                {
                    txtPasswordValue.Text = string.Empty;
                }
            }
        }
        private void xSMTPPassTextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            bool res = false;

            if (!EncryptionHandler.IsStringEncrypted(xSMTPPassTextBox.Text))
            {
                xSMTPPassTextBox.Text = EncryptionHandler.EncryptString(xSMTPPassTextBox.Text, ref res);
                if (res == false)
                {
                    xSMTPPassTextBox.Text = string.Empty;
                }
            }
        }
        private void txtPasswordValue_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            bool res, checkValueDecrypt;

            res = false;
            checkValueDecrypt = true;
            EncryptionHandler.DecryptString(txtPasswordValue.Text, ref checkValueDecrypt);

            if (!checkValueDecrypt)
            {
                txtPasswordValue.Text = EncryptionHandler.EncryptString(txtPasswordValue.Text, ref res);
            }
        }
예제 #7
0
        private void grdMain_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            if (e.Column.Header.ToString() == GeneralParam.Fields.Name)
            {
                GeneralParam changedParam = (GeneralParam)grdAppParams.CurrentItem;
                if (changedParam.Name != changedParam.NameBeforeEdit)
                {
                    //ask user if want us to update the parameter name in all BF's
                    if (Reporter.ToUser(eUserMsgKeys.ChangingEnvironmentParameterValue) == MessageBoxResult.Yes)
                    {
                        UpdateVariableNameChange(changedParam);
                    }
                }
            }
            else if (e.Column.Header.ToString() == GeneralParam.Fields.Value)
            {
                GeneralParam selectedEnvParam = (GeneralParam)grdAppParams.CurrentItem;

                String intialValue = selectedEnvParam.Value;
                if (intialValue != null)
                {
                    if (selectedEnvParam.Encrypt == true)
                    {
                        bool   res   = false;
                        String value = selectedEnvParam.Value;
                        UpdateVariableNameChange(selectedEnvParam);
                        selectedEnvParam.Value = null;
                        selectedEnvParam.Value = EncryptionHandler.EncryptString(intialValue, ref res);
                    }
                    else if (selectedEnvParam.Encrypt == false)
                    {
                        bool res = false;


                        String deCryptValue = EncryptionHandler.DecryptString(intialValue, ref res);

                        if (res == true)
                        {
                            selectedEnvParam.Value = null;
                        }

                        else
                        {
                            selectedEnvParam.Value = null;
                            selectedEnvParam.Value = intialValue;
                        }
                    }
                }
            }
        }
예제 #8
0
        private void grdMain_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            if (e.Column.Header.ToString() == GeneralParam.Fields.Name)
            {
                GeneralParam changedParam = (GeneralParam)grdAppParams.CurrentItem;
                if (changedParam.Name != changedParam.NameBeforeEdit)
                {
                    //ask user if want us to update the parameter name in all BF's
                    if (Reporter.ToUser(eUserMsgKeys.ChangingEnvironmentParameterValue) == Amdocs.Ginger.Common.MessageBoxResult.Yes)
                    {
                        UpdateVariableNameChange(changedParam);
                    }
                }
            }
            else if (e.Column.Header.ToString() == GeneralParam.Fields.Value)
            {
                GeneralParam selectedEnvParam = (GeneralParam)grdAppParams.CurrentItem;

                String intialValue = selectedEnvParam.Value;
                bool   res         = false;
                if (!string.IsNullOrEmpty(intialValue))
                {
                    if (selectedEnvParam.Encrypt == true)
                    {
                        //UpdateVariableNameChange(selectedEnvParam); // why is that needed here?
                        if (!EncryptionHandler.IsStringEncrypted(intialValue))
                        {
                            selectedEnvParam.Value = EncryptionHandler.EncryptString(intialValue, ref res);
                            if (res == false)
                            {
                                selectedEnvParam.Value = null;
                            }
                        }
                    }
                    else
                    {
                        if (EncryptionHandler.IsStringEncrypted(intialValue))
                        {
                            selectedEnvParam.Value = EncryptionHandler.DecryptString(intialValue, ref res);
                            if (res == false)
                            {
                                selectedEnvParam.Value = null;
                            }
                        }
                    }
                }
            }
        }
예제 #9
0
        private void param_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == GeneralParam.Fields.Name)
            {
                // loop
            }
            if (e.PropertyName == GeneralParam.Fields.Value)
            {
            }
            if (e.PropertyName == GeneralParam.Fields.Encrypt)
            {
                GeneralParam param   = (GeneralParam)sender;
                bool         Envalue = param.Encrypt;

                String intialValue = param.Value;

                if (intialValue != null)
                {
                    if (Envalue == true)
                    {
                        bool res = false;

                        param.Value = null;
                        param.Value = EncryptionHandler.EncryptString(intialValue, ref res);
                    }

                    else if (Envalue == false)
                    {
                        bool res = false;


                        String deCryptValue = EncryptionHandler.DecryptString(intialValue, ref res);

                        if (res == true)
                        {
                            param.Value = null;
                        }

                        else
                        {
                            param.Value = null;
                            param.Value = intialValue;
                        }
                    }
                }
            }
        }
예제 #10
0
 private void grdMain_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
 {
     if (e.Column.Header.ToString() == "User Password")
     {
         Database selectedEnvDB = (Database)grdAppDbs.CurrentItem;
         String   intialValue   = selectedEnvDB.Pass;
         if (intialValue != null)
         {
             bool   res          = false;
             String deCryptValue = EncryptionHandler.DecryptString(intialValue, ref res);
             selectedEnvDB.Pass = null;
             if (res == false)
             {
                 selectedEnvDB.Pass = EncryptionHandler.EncryptString(intialValue, ref res);;
             }
         }
     }
 }