Esempio n. 1
0
        private void btn_save_salutation_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsNewRecord && !hasAccessUpdate)
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "You have no save rights.", "Access Denied");
                    return;
                }

                if (txt_new_salutation.IsNotEmpty())
                {
                    using (DataTable Table = new BL_Salutation().select(new ML_Salutation {
                        Salutation = txt_new_salutation.Text
                    }))
                    {
                        if (Table.Rows.Count < 1)
                        {
                            if (IsNewRecord)
                            {
                                new BL_Salutation().insert(new ML_Salutation {
                                    Salutation = txt_new_salutation.Text.Trim(), UserKey = UniversalVariables.UserKey
                                });
                            }
                            else if (SelectedID > 0)
                            {
                                new BL_Salutation().update(new ML_Salutation {
                                    Key = SelectedID, Salutation = txt_new_salutation.Text.Trim(), UserKey = UniversalVariables.UserKey
                                });
                            }

                            BindSalutation();
                            ResetForm(false, true, true, hasAccessInsert, hasAccessDelete, true);
                            SetPrevious();
                        }
                        else
                        {
                            ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "The entered salutation is already in the database. Please re-check!", "Error");
                        }
                    }
                }
                else
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Exclamation, "Null value detected for salutation. Please re-check!", "Error!");
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
Esempio n. 2
0
 private int BindSalutation()
 {
     using (DataTable dt = new BL_Salutation().select(new ML_Salutation {
         Salutation = null
     }))
     {
         lst_salutations.UnSelectAll();
         lst_salutations.DataSource    = dt;
         lst_salutations.DisplayMember = "Salutation";
         lst_salutations.ValueMember   = "Key";
         return(dt.Rows.Count);
     }
 }
Esempio n. 3
0
        private void bindInitialData()
        {
            using (DataTable dt = new BL_Salutation().select(new OBALog.Model.ML_Salutation {
                Salutation = null
            }))
            {
                cbo_salutation.Properties.DataSource    = dt;
                cbo_salutation.Properties.DisplayMember = "Salutation";
                cbo_salutation.Properties.ValueMember   = "Key";
            }

            using (DataTable dt = new BL_Country().select(new OBALog.Model.ML_Country {
                Country = null
            }))
            {
                cbo_country.Properties.DataSource    = dt;
                cbo_country.Properties.DisplayMember = "Country";
                cbo_country.Properties.ValueMember   = "Key";
            }
        }