private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            ServerCommandProxy serverProxy = null;
            OperationTypeEnum  operation   = OperationTypeEnum.Update;

            txtblockOutput.Inlines.Clear();

            try
            {
                ValidationResult result = ValidateInput(operation);

                if (result.IsValid)
                {
                    string ppcHostname = txtboxPpcServer.Text;
                    string ppcAdminPw  = pwdboxPpcAdminPw.Password;

                    serverProxy = new ServerCommandProxy(ppcHostname, 9191, ppcAdminPw);

                    if (PaperCutProxyWrapper.IsConnectionEstablished(serverProxy))
                    {
                        txtblockOutput.Inlines.Add(Constants.PaperCut.Messages.PaperCutConnectionEstablished);

                        int totalUsers = serverProxy.GetTotalUsers();

                        Console.WriteLine(string.Format(Constants.PaperCut.Messages.NumberOfUsersRetrievedFromPaperCut, totalUsers));
                        Console.WriteLine(Constants.ConsoleSpacing.HashesWithNewLine);

                        PaperCutHelper paperCutHelper = new PaperCutHelper(serverProxy);

                        if (paperCutHelper != null)
                        {
                            int  targetIdField     = cmboxTargetIDField.SelectedIndex;
                            int  numberOfChars     = int.Parse(txtboxIDLength.Text.ToString());
                            bool updateOnlyIfBlank = chckboxUpdateIfBlank.IsChecked.Value;

                            bool mustTargetSpecificUsername = chckboxTargetSpecificUser.IsChecked.Value;

                            if (mustTargetSpecificUsername)
                            {
                                string specificUsername = txtboxTargetSpecificUser.Text;

                                paperCutHelper.UpdateSingleCardNumber(updateOnlyIfBlank, targetIdField, specificUsername, numberOfChars);
                            }
                            else
                            {
                                paperCutHelper.UpdateAllCardNumbers(updateOnlyIfBlank, targetIdField, numberOfChars);
                            }
                        }
                    }
                    else
                    {
                        txtblockOutput.Inlines.Add(Constants.PaperCut.Messages.PaperCutConnectionNotEstablished);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        private void btnSendEmail_Click(object sender, RoutedEventArgs e)
        {
            ServerCommandProxy serverProxy = null;
            OperationTypeEnum  operation   = OperationTypeEnum.SendEmail;

            txtblockOutput.Inlines.Clear();

            try
            {
                ValidationResult result = ValidateInput(operation);

                if (result.IsValid)
                {
                    string ppcHostname = txtboxPpcServer.Text;
                    string ppcAdminPw  = pwdboxPpcAdminPw.Password;

                    serverProxy = new ServerCommandProxy(ppcHostname, 9191, ppcAdminPw);

                    if (PaperCutProxyWrapper.IsConnectionEstablished(serverProxy))
                    {
                        txtblockOutput.Inlines.Add(Constants.PaperCut.Messages.PaperCutConnectionEstablished);

                        int totalUsers = serverProxy.GetTotalUsers();

                        Console.WriteLine(string.Format(Constants.PaperCut.Messages.NumberOfUsersRetrievedFromPaperCut, totalUsers));
                        Console.WriteLine(Constants.ConsoleSpacing.HashesWithNewLine);

                        PaperCutHelper paperCutHelper = new PaperCutHelper(serverProxy);

                        if (paperCutHelper != null)
                        {
                            int    targetIdField = cmboxTargetIDField.SelectedIndex;
                            string smtpHostname  = txtboxSmtpServer.Text;
                            string senderAddress = txtboxSenderAddress.Text;

                            bool mustTargetSpecificUsername = chckboxTargetSpecificUser.IsChecked.Value;

                            if (mustTargetSpecificUsername)
                            {
                                string specificUsername = txtboxTargetSpecificUser.Text;

                                paperCutHelper.SendSingleEmail(smtpHostname, specificUsername, senderAddress, targetIdField);

                                Console.WriteLine(string.Format(Constants.Smtp.Messages.NotificationEmailSentToSingleUser, specificUsername));
                                Console.WriteLine(Constants.ConsoleSpacing.HashesWithNewLine);
                            }
                            else
                            {
                                paperCutHelper.SendEmailsToAllUsers(smtpHostname, senderAddress, targetIdField);

                                Console.WriteLine(string.Format(Constants.Smtp.Messages.NotificationEmailsSentToMultipleUsers, totalUsers));
                                Console.WriteLine(Constants.ConsoleSpacing.HashesWithNewLine);
                            }
                        }
                    }
                    else
                    {
                        txtblockOutput.Inlines.Add(Constants.PaperCut.Messages.PaperCutConnectionNotEstablished);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(Constants.Smtp.Messages.UnableToSendEmail);
            }
        }