public void AddAEFlatRateRecord(AEFlatRate aeFlatRate) { try { aeFlatRate.Save(); } catch (Exception ex) { WebCommon.LogExceptionInfo(ex); throw new Exception("An error occurred while trying to retrieve the Flat Rate record."); } }
/// <summary>TBD</summary> /// <param name="aeId">TBD</param> /// <param name="companyId">TBD</param> /// <returns>TBD</returns> public static List<AEFlatRate> GetAEFlatRates(string aeId, int companyId) { try { List<AEFlatRate> aeFlatRates = new List<AEFlatRate>(); DataSet historyData; using (IO io = new IO(WebCommon.ConnectionString)) { historyData = io.ExecuteDataSetQuery(IO.CreateCommandFromSql("SELECT * FROM ACCOUNT_EXECUTIVE_FLAT_RATE WHERE LTRIM(RTRIM(ACCOUNT_EXECUTIVE_ID)) = LTRIM(RTRIM('{0}')) AND COMPANY_ID={1} ORDER BY FLAT_RATE_EFFECTIVE_DATE DESC", aeId, companyId)); } if (historyData.Tables[0].Rows.Count == 0) { return aeFlatRates; } AEFlatRate aeFlatRate; foreach (DataRow row in historyData.Tables[0].Rows) { aeFlatRate = new AEFlatRate(); aeFlatRate.FlatRateId = (int)row["FLAT_RATE_ID"]; aeFlatRate.AEId = Convert.ToString(IO.GetDataRowValue(row, "ACCOUNT_EXECUTIVE_ID", "")); aeFlatRate.AEFlatRateAmount = Convert.ToDouble(IO.GetDataRowValue(row, "ACCOUNT_EXECUTIVE_FLAT_RATE", 0.00)); aeFlatRate.FlatRateEffectiveDate = Convert.ToDateTime(IO.GetDataRowValue(row, "FLAT_RATE_EFFECTIVE_DATE", DateTime.MinValue)); aeFlatRate.DateLastModified = Convert.ToDateTime(IO.GetDataRowValue(row, "DATE_LAST_MODIFIED", DateTime.MinValue)); aeFlatRate.FlatRateNew = Convert.ToDouble(IO.GetDataRowValue(row, "FLAT_RATE_NEW", 0.00)); aeFlatRate.FlatRateRenew = Convert.ToDouble(IO.GetDataRowValue(row, "FLAT_RATE_RENEW", 0.00)); aeFlatRate.CompanyId = (int)row["COMPANY_ID"]; aeFlatRates.Add(aeFlatRate); } return aeFlatRates; } catch (Exception ex) { WebCommon.LogExceptionInfo(ex); return new List<AEFlatRate>(); } }