Esempio n. 1
0
        internal static MiscRateEntity GetMiscRates()
        {
            MiscRateEntity rates = null;
            DataSet result = null;
            try
            {
                result = SQLHelper.ExecuteStoredProcedure(StoredProcedures.GetMiscRates, null);

                if (result == null || result.Tables == null || result.Tables.Count == 0 || result.Tables[0].Rows.Count == 0)
                {
                    return rates;
                }
                rates = new MiscRateEntity();
                rates.NotchRate = double.Parse(result.Tables[0].Rows[0][ColumnNames.NOTCH_RATE].ToString());
                rates.HingeRate = double.Parse(result.Tables[0].Rows[0][ColumnNames.HINGE_RATE].ToString());
                rates.PatchRate = double.Parse(result.Tables[0].Rows[0][ColumnNames.PATCH_RATE].ToString());
                rates.MinimumTotalSqft = double.Parse(result.Tables[0].Rows[0][ColumnNames.MinimumTotalSqft].ToString());

            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            return rates;
        }
Esempio n. 2
0
        internal static bool UpdateMiscRate(MiscRateEntity miscRate)
        {
            bool result = true;
            try
            {
                SqlParameter pNotchRate = new SqlParameter();
                pNotchRate.ParameterName = "NotchRate";
                pNotchRate.Value = miscRate.NotchRate;

                SqlParameter pHingeRate = new SqlParameter();
                pHingeRate.ParameterName = "HingeRate";
                pHingeRate.Value = miscRate.HingeRate;

                SqlParameter pPatchRate = new SqlParameter();
                pPatchRate.ParameterName = "PatchRate";
                pPatchRate.Value = miscRate.PatchRate;

                SqlParameter pMinimumTotalSqft = new SqlParameter();
                pMinimumTotalSqft.ParameterName = "MinimumTotalSqft";
                pMinimumTotalSqft.Value = miscRate.MinimumTotalSqft;

                SQLHelper.ExecuteStoredProcedure(StoredProcedures.UpdateMiscRate, pNotchRate, pHingeRate, pPatchRate, pMinimumTotalSqft);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                result = false;
            }
            return result;
        }
        private void btnSaveMiscRate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MiscRateEntity miscRate = new MiscRateEntity();
                miscRate.NotchRate = double.Parse(txtNotchRate.Text);
                miscRate.HingeRate = double.Parse(txtHingeRate.Text);
                miscRate.PatchRate = double.Parse(txtPatchRate.Text);
                miscRate.MinimumTotalSqft = double.Parse(txtMinimumTotalSqft.Text);

                if (BusinessLogic.UpdateMiscRate(miscRate))
                {
                    Helper.ShowInformationMessageBox("Misc Rates updated successfully!");
                }
                else
                {
                    Helper.ShowErrorMessageBox("Error while saving Misc Rates. Kindly contact your vendor.");
                }
                txtNotchRate.IsReadOnly = true;
                txtHingeRate.IsReadOnly = true;
                txtPatchRate.IsReadOnly = true;
                txtMinimumTotalSqft.IsReadOnly = true;

                btnEditMiscRate.IsEnabled = true;
                btnSaveMiscRate.IsEnabled = false;
                btnCancelMiscRate.IsEnabled = false;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
        }