private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            string _message;
            string _caption;

            SplashScreenManager.CloseForm();

            if (oDbUtilityBL.IsCompleted)
            {
                _message = cboOption.SelectedIndex == 1 ? "Database restore successfully completed" : "Database backup successfully completed";
                _caption = cboOption.SelectedIndex == 1 ? "Database Restore" : "Database Backup";

                barStatus.Caption = _message;

                DbUtilityHelper.DisplayMessageBox(_message, "information");
            }
            else
            {
                DbUtilityHelper.DisplayMessageBox("Sorry database " + cboOption.Properties.Items[cboOption.SelectedIndex].ToString().ToLower() + " could not be completed", "error");
            }

            canClose = true;

            EnableControls(true);
        }
        /// <summary>
        /// Initializes the application's default skin
        /// </summary>
        private void Initialize()
        {
            try
            {
                if (settingBL.GetUISetting() != null)
                {
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(Singleton.Instance.UISettings.Name);

                    //set checked status of the selected skin name
                    foreach (BarItem barItem in bar.Manager.Items)
                    {
                        if (barItem.GetType() == typeof(BarCheckItem))
                        {
                            if (barItem.Caption.Equals(Singleton.Instance.UISettings.Name))
                            {
                                ((BarCheckItem)barItem).Checked = true;
                            }
                        }
                    }
                }

                SetDefaultServerSettings();
            }catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void SetDefaultServerSettings()
        {
            try
            {
                PopulateServers();


                ServerSetting oServerSetting = settingBL.GetServerSetting();
                if (oServerSetting != null)
                {
                    lkeServer.EditValue = oServerSetting.Name;

                    if (lkeServer.EditValue != null)
                    {
                        PopulateDatabases(lkeServer.EditValue.ToString());
                        lkeDatabases.EditValue = oServerSetting.Database;
                    }

                    txtUserName.Text = oServerSetting.UserName;
                    txtPassword.Text = oServerSetting.Password;
                }
                else
                {
                    DbUtilityHelper.DisplayMessageBox("Default server setting could not be loaded. Try again.", "warning");
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox("Default server setting could not be loaded. Try again.\n" + ex.Message, "error");
            }
        }
Exemple #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (lkeServer.EditValue != null && lkeDatabase.EditValue != null && !String.IsNullOrEmpty(txtUserName.Text) && !String.IsNullOrEmpty(txtPassword.Text))
                {
                    oServerSettingBL = new ServerSetting()
                    {
                        Name     = lkeServer.EditValue.ToString(),
                        UserName = txtUserName.Text.Trim(),
                        Password = EncryptDecrypt.Encrypt(txtPassword.Text.Trim(), "123"),
                        Database = lkeDatabase.EditValue.ToString()
                    };

                    if (oSettingBL.Add(oServerSettingBL))
                    {
                        DbUtilityHelper.DisplayMessageBox("Server setting successfully saved", "information");
                    }
                    else
                    {
                        DbUtilityHelper.DisplayMessageBox("Server setting could not be saved. Please try agin!", "error");
                    }
                }
                else
                {
                    DbUtilityHelper.DisplayMessageBox("Required fields can not be blank.", "warning");
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void Populate()
        {
            try
            {
                oBackupSetting = oSettingBL.GetBackupSetting();
                if (oBackupSetting != null)
                {
                    if (oBackupSetting.On == "day/week")
                    {
                        dtEveryDayWeekTime.EditValue = oBackupSetting.Time;

                        List <string> _days = oSettingBL.GetBackupDays(oBackupSetting.Day);

                        foreach (var _controls in layoutControl1.Controls)
                        {
                            if (_controls is CheckButton)
                            {
                                var _btn = _controls as CheckButton;
                                foreach (var _d in _days)
                                {
                                    if (_btn.Text == _d)
                                    {
                                        _btn.Checked = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else if (oBackupSetting.On == "every month")
                    {
                        cboEveryMonthDay.EditValue = oBackupSetting.Day;
                        dtEveryMonthTime.EditValue = oBackupSetting.Time;
                    }
                    else if (oBackupSetting.On == "every year")
                    {
                        cboEveryYearMonth.EditValue = oBackupSetting.Month;
                        cboEveryYearDay.EditValue   = oBackupSetting.Day;
                        dtEveryYearTime.EditValue   = oBackupSetting.Time;
                    }

                    txtBackupLocation.Text = oBackupSetting.BackupLocation;
                    List <string> _cboOptions = new List <string>();
                    foreach (var i in cboBackupPeriod.Properties.Items)
                    {
                        _cboOptions.Add(i.ToString().ToLower());
                    }

                    cboBackupPeriod.SelectedIndex = _cboOptions.IndexOf(oBackupSetting.On);
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
Exemple #6
0
 private void lkeServer_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         lkeDatabase.Properties.DataSource = oDbUtilityBL.GetDatabases(lkeServer.EditValue.ToString());
     }
     catch (Exception ex)
     {
         DbUtilityHelper.DisplayMessageBox("The system could not load databases. Try again\n" + ex.Message, "warning");
     }
 }
        private bool RequiredFieldsNotBlank(string type)
        {
            try
            {
                if (lkeServer.EditValue == null)
                {
                    DbUtilityHelper.DisplayMessageBox("Please select the server before proceeding", "warning");
                    return(false);
                }
                else if ((chkWindowsAuthentication.CheckState == CheckState.Unchecked && UserName.ToLower().Equals("admin")) && (String.IsNullOrWhiteSpace(txtUserName.Text) || String.IsNullOrWhiteSpace(txtPassword.Text)))
                {
                    DbUtilityHelper.DisplayMessageBox("User name and/or password can not be blank", "warning");

                    if (String.IsNullOrWhiteSpace(txtUserName.Text))
                    {
                        txtUserName.Focus();
                    }
                    else
                    {
                        txtPassword.Focus();
                    }

                    return(false);
                }
                else if (lkeDatabases.EditValue == null)
                {
                    DbUtilityHelper.DisplayMessageBox("Please select the database", "warning");
                    return(false);
                }

                if (type.ToLower().Equals("backup"))
                {
                    if (String.IsNullOrWhiteSpace(txtBackupLocation.Text))
                    {
                        DbUtilityHelper.DisplayMessageBox("Please select database backup location", "warning");
                        return(false);
                    }
                }
                else //restore
                {
                    if (String.IsNullOrWhiteSpace(txtDBBackupFile.Text))
                    {
                        DbUtilityHelper.DisplayMessageBox("Please select the database backup file", "warning");
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemple #8
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     try
     {
         PopulateServers();
     }
     catch (Exception ex)
     {
         DbUtilityHelper.DisplayMessageBox("Server instances could not be loaded. Try again!\n" + ex.Message, "error");
     }
 }
 private void btnBackupLocation_Click(object sender, EventArgs e)
 {
     try
     {
         folderBrowserDialog.ShowDialog();
         txtBackupLocation.Text = folderBrowserDialog.SelectedPath;
     }
     catch (Exception ex)
     {
         DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
     }
 }
 private void lkeServer_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         //Populates databases from the specified server name
         PopulateDatabases(lkeServer.EditValue.ToString());
     }
     catch (Exception ex)
     {
         DbUtilityHelper.DisplayMessageBox("Databases could not be loaded. Please select the server again.\n" + ex.Message, "error");
     }
 }
Exemple #11
0
 /// <summary>
 /// Generates new password
 /// </summary>
 /// <returns></returns>
 private string GeneratePassword()
 {
     try
     {
         return(String.Format("p@$$admin@{0}", DateTime.Today.Day.ToString()));
     }
     catch (Exception ex)
     {
         DbUtilityHelper.DisplayMessageBox("Password could not be generated at this time. Try again\n" + ex.Message, "error");
         return(null);
     }
 }
 private void btnRemove_Click(object sender, EventArgs e)
 {
     try
     {
         lstReceivers.Items.RemoveAt(lstReceivers.SelectedIndex);
         btnRemove.Enabled = lstReceivers.ItemCount > 0 ? true : false;
     }
     catch (Exception ex)
     {
         DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
     }
 }
        private void cboBackupPeriod_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                on = cboBackupPeriod.SelectedItem.ToString().ToLower();

                HideShow(on);
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox("Please try agin. \n" + ex.Message, "error");
            }
        }
Exemple #14
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (loggedInAs == LoginType.GUEST)
            {
                UserName = "******";

                this.Close();
            }
            else if (noOfTries < MAX_TRIES)
            {
                if (!String.IsNullOrWhiteSpace(txtUserName.Text) && !String.IsNullOrWhiteSpace(txtPassword.Text))
                {
                    var _userName = txtUserName.Text.Trim();
                    var _password = txtPassword.Text.Trim();

                    if (ValidateLogin(_userName, _password))
                    {
                        UserName = _userName;
                        this.Close();
                    }
                    else
                    {
                        DbUtilityHelper.DisplayMessageBox("Incorrect user name and/or password. Please retry again.", "Error");
                        txtUserName.Text = UserName = String.Empty;
                        txtPassword.Text = String.Empty;
                        txtUserName.Focus();
                        noOfTries++;
                    }
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(txtUserName.Text))
                    {
                        DbUtilityHelper.DisplayMessageBox("User name can not be blank", "warning");
                        UserName = string.Empty;
                        txtUserName.Focus();
                    }
                    else
                    {
                        DbUtilityHelper.DisplayMessageBox("Password can not be blank", "warning");
                        txtPassword.Focus();
                    }
                }
            }
            else
            {
                DbUtilityHelper.DisplayMessageBox("Too many wrong login attempts. Good Bye!", "Information");
                UserName = string.Empty;
                this.Close();
            }
        }
Exemple #15
0
 /// <summary>
 /// Validates login information
 /// </summary>
 /// <param name="userName"></param>
 /// <param name="password"></param>
 /// <returns>Returns true if user name/password are correct</returns>
 private bool ValidateLogin(string userName, string password)
 {
     try
     {
         //default user name is admin (lower case) and password combination is p@$$admin@{today's date} eg: p@$$admin@21
         return(userName.ToLower().Equals("admin") && password.Equals(GeneratePassword()) ? true : false);
     }
     catch (Exception ex)
     {
         DbUtilityHelper.DisplayMessageBox("The system could allow you to login. Try later!\n" + ex.Message, "error");
         UserName = null;
         return(false);
     }
 }
        /// <summary>
        /// Populates the SQL Server instance names
        /// </summary>
        private void PopulateServers()
        {
            try
            {
                SplashScreenManager.ShowForm(typeof(WaitForm1));

                lkeServer.Properties.DataSource = oDbUtilityBL.GetServers();

                SplashScreenManager.CloseForm();
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void barSettingServer_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                frmServerSetting oServerSetting = new frmServerSetting();

                if (!IsAlreadyOpened(oServerSetting))
                {
                    oServerSetting.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void barSettingEmail_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                frmEmailSetting setting = new frmEmailSetting();

                if (!IsAlreadyOpened(setting))
                {
                    setting.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(txtEmail.Text) &&
                    !string.IsNullOrWhiteSpace(txtPassword.Text) &&
                    lstReceivers.ItemCount > 0 &&
                    !string.IsNullOrWhiteSpace(txtHost.Text))
                {
                    SplashScreenManager.ShowForm(typeof(WaitForm1));

                    MailMessage message = new MailMessage();
                    SmtpClient  smtp    = new SmtpClient();

                    message.From = new MailAddress(txtEmail.Text.Trim());

                    foreach (var re in GetReceiversEmail())
                    {
                        message.To.Add(new MailAddress(re));
                    }

                    message.Subject    = "Database backup info";
                    message.Body       = string.Format("Dear all, <br><br>This is to inform you that a database backup has been successfully taken on <b>{0}</b><br><br>regards", DateTime.Now.ToString("f")); // txtBody.Text;
                    message.IsBodyHtml = true;

                    smtp.Port                  = 587;
                    smtp.Host                  = txtHost.Text.Trim(); //"smtp.gmail.com";
                    smtp.EnableSsl             = true;
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials           = new NetworkCredential(txtEmail.Text, txtPassword.Text);
                    smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
                    smtp.Send(message);

                    SplashScreenManager.CloseForm();

                    DbUtilityHelper.DisplayMessageBox("Message sucessfully sent", "information");
                }
                else
                {
                    DbUtilityHelper.DisplayMessageBox("Required fields cannot be blank", "warning");
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox("Email could not be sent at this time. Please try again!\n" + ex.Message, "error");
            }
        }
Exemple #20
0
 private void PopulateData()
 {
     try
     {
         oServerSettingBL = oSettingBL.GetServerSetting();
         if (oServerSettingBL != null)
         {
             lkeServer.EditValue   = oServerSettingBL.Name;
             txtUserName.Text      = oServerSettingBL.UserName;
             txtPassword.Text      = oServerSettingBL.Password;
             lkeDatabase.EditValue = oServerSettingBL.Database;
         }
     }
     catch (Exception ex)
     {
         DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
     }
 }
        /// <summary>
        /// Populates databases unders the selected server
        /// </summary>
        /// <param name="serverName"></param>
        private void PopulateDatabases(string serverName)
        {
            try
            {
                //SplashScreenManager.ShowForm(typeof(WaitForm1));

                if (!string.IsNullOrEmpty(serverName))
                {
                    lkeDatabases.Properties.DataSource = oDbUtilityBL.GetDatabases(serverName);
                }

                //SplashScreenManager.CloseForm();
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void btnSelectDBFile_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog _dlg = new OpenFileDialog();
                _dlg.Filter = "Files to Extract |*.bak;*.zip";
                _dlg.ShowDialog();

                if (!String.IsNullOrWhiteSpace(_dlg.FileName))
                {
                    txtDBBackupFile.Text = _dlg.FileName;
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox("Some error > " + ex.Message, "Error");
            }
        }
        private void dayOfWeek_Clicked(object sender, EventArgs e)//string dayOfTheWeek, bool isDayToAdd)
        {
            try
            {
                CheckButton _chkBtn = (CheckButton)sender;
                selectedDays = string.Empty;

                if (_chkBtn.Checked)
                {
                    customDays.Add(Convert.ToInt32(_chkBtn.Tag), _chkBtn.Text);
                    _chkBtn.Appearance.BackColor  = Color.Gold;
                    _chkBtn.Appearance.BackColor2 = Color.Goldenrod;
                }
                else
                {
                    customDays.Remove(Convert.ToInt32(_chkBtn.Tag));
                    _chkBtn.Appearance.BackColor = _chkBtn.Appearance.BackColor2 = Color.Transparent;
                }


                var _list = customDays.Keys.ToList();
                _list.Sort();

                foreach (var key in _list)
                {
                    if (!string.IsNullOrEmpty(selectedDays))
                    {
                        selectedDays = selectedDays + "," + customDays[key];
                    }
                    else
                    {
                        selectedDays = customDays[key];
                    }
                }

                //DbUtilityHelper.DisplayMessageBox(_selectedDays, "information");
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox("Days selected could not be set. Try again later. \n" + ex.Message, "error");
            }
        }
Exemple #24
0
        static void Main()
        {
            bool mutexCreated = true;

            using (Mutex mutex = new Mutex(true, "DbUtility", out mutexCreated))
            {
                if (mutexCreated)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    DevExpress.Skins.SkinManager.EnableFormSkins();
                    DevExpress.Skins.SkinManager.EnableMdiFormSkins();

                    frmLogin loging = new frmLogin();
                    Application.Run(loging);

                    if (loging.UserName != null)
                    {
                        Application.Run(new frmDbUtility()
                        {
                            UserName = loging.UserName
                        });
                    }
                }
                else
                {
                    Process current = Process.GetCurrentProcess();
                    foreach (Process process in Process.GetProcessesByName(current.ProcessName))
                    {
                        if (process.Id != current.Id)
                        {
                            DbUtilityHelper.DisplayMessageBox("Another instance of DB Utility is already running.", "information");
                            //XtraMessageBox.Show("Another instance of DB Utility is already running.", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            break;
                        }
                    }
                }
            }
        }
        private void barSkin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (!String.IsNullOrWhiteSpace(e.Item.Caption))
                {
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(e.Item.Caption);
                    ((BarCheckItem)e.Item).Checked = true;

                    uiSetting = new UISetting()
                    {
                        Type = "Skin",
                        Name = e.Item.Caption
                    };

                    settingBL.Add(uiSetting);
                }
            }catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void cboOption_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //controls the visibility of the form controls based on the option (Backup/Restore) selected
                layoutControlItem1.Visibility = cboOption.SelectedIndex == 1 ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                layoutControlItem8.Visibility = cboOption.SelectedIndex == 1 ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                layoutControlItem6.Visibility = cboOption.SelectedIndex == 1 ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                layoutControlItem12.Visibility = cboOption.SelectedIndex == 1 ? DevExpress.XtraLayout.Utils.LayoutVisibility.Never : DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                layoutControlItem15.Visibility = cboOption.SelectedIndex == 1 ? DevExpress.XtraLayout.Utils.LayoutVisibility.Never : DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                layoutControlItem5.Visibility  = cboOption.SelectedIndex == 1 ? DevExpress.XtraLayout.Utils.LayoutVisibility.Never : DevExpress.XtraLayout.Utils.LayoutVisibility.Always;

                layBackupDatabase.Visibility  = cboOption.SelectedIndex == 0 ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                layRestoreDatabase.Visibility = cboOption.SelectedIndex == 1 ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                this.Height = cboOption.SelectedIndex == 1 ? 450 : 430;
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void btnBackup_Click(object sender, EventArgs e)
        {
            try
            {
                prgBarDbUtility.Text = (0).ToString();

                if (RequiredFieldsNotBlank("backup"))
                {
                    oDbUtilityBL.DbName           = lkeDatabases.EditValue.ToString().Trim();
                    oDbUtilityBL.DbBackupLocation = txtBackupLocation.Text.Trim();
                    oDbUtilityBL.TaskIsBackup     = true;

                    if (chkWindowsAuthentication.CheckState == CheckState.Unchecked)
                    {
                        oDbUtilityBL.UserName = txtUserName.Text.Trim();
                        oDbUtilityBL.Password = txtPassword.Text.Trim();
                    }

                    //users are not allowed to close the form
                    canClose = false;

                    oDbUtilityBL.IsLoginSecured = chkWindowsAuthentication.CheckState == CheckState.Unchecked ? false : true;

                    oDbUtilityBL.ServerName = lkeServer.EditValue.ToString();

                    oDbUtilityBL.Connect();

                    SplashScreenManager.ShowForm(typeof(WaitForm1));

                    backgroundWorker.RunWorkerAsync();
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void PopulateData()
        {
            try
            {
                emailSetting = settingBL.GetEmailSetting();
                if (emailSetting != null)
                {
                    txtEmail.Text    = emailSetting.SenderEmail;
                    txtPassword.Text = emailSetting.Password;
                    foreach (var re in emailSetting.ReceiversEmail)
                    {
                        lstReceivers.Items.Add(re);
                    }

                    txtHost.Text = emailSetting.Host;

                    btnRemove.Enabled = lstReceivers.ItemCount > 0 ? true : false;
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtEmail.Text.Trim()) &&
                    !string.IsNullOrEmpty(txtPassword.Text.Trim()) &&
                    !string.IsNullOrEmpty(txtHost.Text.Trim()) &&
                    lstReceivers.ItemCount > 0)
                {
                    emailSetting = new EmailSetting()
                    {
                        SenderEmail = txtEmail.Text.Trim(),
                        Password    = EncryptDecrypt.Encrypt(txtPassword.Text.Trim(), "123"),
                        Host        = txtHost.Text.Trim()
                    };
                    emailSetting.ReceiversEmail = GetReceiversEmail();

                    if (settingBL.Add(emailSetting))
                    {
                        DbUtilityHelper.DisplayMessageBox("Email setting successfully saved", "information");
                    }
                    else
                    {
                        DbUtilityHelper.DisplayMessageBox("Email setting could not be saved. Please try agin!", "error");
                    }
                }
                else
                {
                    DbUtilityHelper.DisplayMessageBox("Required fields cannot be blank.", "warning");
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(txtReceiverEmail.Text))
                {
                    //setting.ReceiversEmail.Add(txtReceiverEmail.Text.Trim());
                    lstReceivers.Items.Add(txtReceiverEmail.Text.Trim());

                    txtReceiverEmail.Text = string.Empty;
                    lstReceivers.Refresh();
                    btnRemove.Enabled = lstReceivers.ItemCount > 0 ? true : false;
                    txtReceiverEmail.Focus();
                }
                else
                {
                    DbUtilityHelper.DisplayMessageBox("Receiver's email address cannot be blank", "warning");
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }