Exemple #1
0
        public GeneralSettingsForm()
        {
            InitializeComponent();
            RBEnablevatNo.Checked = true;
            gms = new GeneralSettingsManager();
            gs=gms.GetGeneralSettings();
            txtbxvatAmount.Text = gs.Vat.ToString();
            txtbxCurrency.Text = gs.Currency;

            RBenabledVat.Checked = gs.IsVatEnabled;

            tempDataSet = new DataSet();
            tempDataSet.ReadXml("Config/VatRegisterNo.xml");
            txtBoxVatRegistrationID.Text = tempDataSet.Tables[0].Rows[0]["des"].ToString();
        }
Exemple #2
0
        public CResult GetGeneralSettings()
        {
            CResult tempResult = new CResult();
            string sSql = SqlQueries.GetQuery(Query.GetGeneralSetting);

            try
            {

                this.OpenConnection();
                IDataReader oReader = this.ExecuteReader(sSql);

                GeneralSettings gSettings = new GeneralSettings();

                while (oReader.Read())
                {
                    gSettings.Vat = Convert.ToDouble(oReader[1]);
                    gSettings.IsVatEnabled = Convert.ToBoolean(oReader[2]);
                    gSettings.Currency = oReader[3].ToString(); ;
                }
                tempResult.Data = gSettings;

            }

            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in GetGeneralSettings()", LogLevel.Error, "Database");
                if (ex.GetType().Equals(typeof(SqlException)))
                {
                    SqlException oSQLEx = ex as SqlException;
                    if (oSQLEx.Number != 7619)
                        throw new Exception("Exception occured at GetGeneralSettings()", ex);
                }
                else
                {
                    throw new Exception("Exception occure at GetGeneralSettings()", ex);
                }
            }
            finally
            {
                this.CloseConnection();
            }

            return tempResult;
        }