Ejemplo n.º 1
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");
            }
        }
Ejemplo n.º 2
0
        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");
            }
        }
Ejemplo n.º 3
0
        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");
            }
        }
Ejemplo n.º 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (cboBackupPeriod.SelectedItem != null && !string.IsNullOrEmpty(txtBackupLocation.Text))
                {
                    oBackupSetting = null;

                    #region Backup on day/week
                    if (cboBackupPeriod.SelectedIndex == 0) //day/week selected
                    {
                        if (customDays.Count <= 0 || dtEveryDayWeekTime.EditValue == null)
                        {
                            DbUtilityHelper.DisplayMessageBox("Please specify the day(s) of the week to take backup on", "warning");
                        }
                        else
                        {
                            oBackupSetting = new BackupSetting()
                            {
                                Month = string.Empty,
                                Day   = selectedDays,
                                Time  = dtEveryDayWeekTime.Text
                            };
                        }
                    }
                    #endregion

                    #region Backup on every month
                    else if (cboBackupPeriod.SelectedIndex == 1) //month selected
                    {
                        if (cboEveryMonthDay.SelectedItem == null || dtEveryDayWeekTime.EditValue == null)
                        {
                            DbUtilityHelper.DisplayMessageBox("Please specify the day and time of the month to take backup", "warning");
                        }
                        else
                        {
                            oBackupSetting = new BackupSetting()
                            {
                                Month = string.Empty,
                                Day   = cboEveryMonthDay.EditValue.ToString(),
                                Time  = dtEveryMonthTime.Text
                            };
                        }
                    }
                    #endregion

                    #region Backup on every year
                    else if (cboBackupPeriod.SelectedIndex == 2) //year selected
                    {
                        if (cboEveryYearMonth.SelectedItem == null || cboEveryYearDay.SelectedItem == null || dtEveryYearTime.EditValue == null)
                        {
                            DbUtilityHelper.DisplayMessageBox("Please specify month, day and time of the year to take backup", "warning");
                        }
                        else
                        {
                            oBackupSetting = new BackupSetting()
                            {
                                Month = cboEveryYearMonth.EditValue.ToString(),
                                Day   = cboEveryYearDay.EditValue.ToString(),
                                Time  = dtEveryYearTime.Text
                            };
                        }
                    }
                    #endregion

                    if (oBackupSetting != null)
                    {
                        oBackupSetting.On             = on;
                        oBackupSetting.BackupLocation = txtBackupLocation.Text.Trim();

                        if (oSettingBL.Add(oBackupSetting))
                        {
                            DbUtilityHelper.DisplayMessageBox("Setting successfully saved", "information");
                            this.Close();
                        }
                        else
                        {
                            DbUtilityHelper.DisplayMessageBox("Setting could not be saved. Please try again.", "error");
                        }
                    }
                }
                else
                {
                    DbUtilityHelper.DisplayMessageBox("Please select backup period", "warning");
                }
            }
            catch (Exception ex)
            {
                DbUtilityHelper.DisplayMessageBox(ex.Message, "error");
            }
        }