示例#1
0
        public CompetitorTaxRateResponse InsertUpdateCompetitorTaxRate
            (CompetitorTaxRate competitorTaxRate)
        {
            try
            {
                Log.Info("Started call to InsertUpdateCompetitorTaxRate");
                Log.Info("parameter values"
                         + JsonConvert.SerializeObject(competitorTaxRate));
                Command.CommandText = "SP_COMPETITOR_TAX_RATE_MANAGER";
                Command.CommandType = CommandType.StoredProcedure;
                Command.Parameters.Clear();

                Command.Parameters.AddWithValue("@COMPETITOR_TAX_RATE_XML"
                                                , GetXMLFromObject(competitorTaxRate));

                if (competitorTaxRate.AddedBy.HasValue)
                {
                    Command.Parameters.AddWithValue("@USER_ID", competitorTaxRate.AddedBy.Value);
                }
                else if (competitorTaxRate.ModifiedBy.HasValue)
                {
                    Command.Parameters.AddWithValue("@USER_ID", competitorTaxRate.ModifiedBy.Value);
                }
                Connection.Open();
                SqlDataReader reader = Command.ExecuteReader();

                CompetitorTaxRateResponse result = new CompetitorTaxRateResponse();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        result = new CompetitorTaxRateResponse
                        {
                            Message   = reader["ReturnMessage"] != DBNull.Value ? reader["ReturnMessage"].ToString() : null,
                            IsSuccess = Convert.ToBoolean(reader["Result"].ToString())
                        };
                    }
                }
                Log.Info("End call to InsertUpdateCompetitorTaxRate. Result:"
                         + JsonConvert.SerializeObject(result));
                return(result);
            }
            catch (Exception ex)
            {
                Log.Error("Error in InsertUpdateCompetitorTaxRate. Error:"
                          + JsonConvert.SerializeObject(ex));
                LogError(ex);
                throw;
            }
            finally
            {
                Connection.Close();
            }
        }
示例#2
0
 public CompetitorTaxRateResponse InsertUpdateCompetitorTaxRate
     (CompetitorTaxRate competitorTaxRate)
 {
     try
     {
         return(this._masterDA.InsertUpdateCompetitorTaxRate(competitorTaxRate));
     }
     catch (Exception ex)
     {
         throw;
     }
     finally
     {
     }
 }