private void OnPremiseLogin_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (txtServerOnPremise.Text.Equals(string.Empty) ||
             txtDomainOnPremise.Text.Equals(string.Empty) ||
             txtUserNameOnPremise.Text.Equals(string.Empty) ||
             txtPasswordOnPremise.Password.Equals(string.Empty))
         {
             MessageBox.Show("Unable to login, please provide required details.");
         }
         else
         {
             string strAuthType  = cmbAuthType.SelectedValue.ToString();
             string strServerUrl = txtServerOnPremise.Text;
             AppendOrgnaisationName(ref strServerUrl);
             string strDomain            = txtDomainOnPremise.Text;
             string strUserName          = txtUserNameOnPremise.Text;
             string strPassword          = txtPasswordOnPremise.Password.ToString();
             string strConnectionString  = $"AuthType={strAuthType};Url={strServerUrl};Domain={strDomain};Username={strUserName};Password={strPassword}";
             string strConStringKeyValue = ConfigurationManager.AppSettings["DynamicsConnectionStringOnPremise"];
             if (strConStringKeyValue != strConnectionString)
             {
                 UpdateConnectionStringValue(strConnectionString, ConnectionType.OnPremise);
             }
             PBOnpremiseLogin.Visibility = Visibility.Visible;
             Tuple <string> strErrorMessage = new Tuple <string>(string.Empty);
             Task <bool>    TaskConnection  = Task.Run((async() => await CrmHelper.ConnectUsingConnectionStringAsync(strConnectionString, strErrorMessage)));
             if (TaskConnection.Result)
             {
                 var parentWindow = Window.GetWindow(this) as MainWindow;
                 parentWindow.dockPanel.Children.Clear();
                 FaceIdentify cntrlFaceIdentify = new FaceIdentify();
                 cntrlFaceIdentify.CloseInitiated += new Close(parentWindow.ClosePanel);
                 parentWindow.dockPanel.Children.Add(cntrlFaceIdentify);
                 parentWindow.dockPanel.Visibility = Visibility.Visible;
                 PBOnpremiseLogin.Visibility       = Visibility.Hidden;
             }
             else
             {
                 MessageBox.Show("Unable to login :"******"\r\n" + strErrorMessage);
                 PBOnpremiseLogin.Visibility = Visibility.Hidden;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }