internal static int Add(Tax taxEntity)
{
using (SqlConnection sqlConnection = new SqlConnection(CMSCoreBase.CMSCoreConnectionString))
{
SqlCommand sqlCommand = new SqlCommand(SN_TAX_ADD, sqlConnection);
sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
SqlParameter sqlParameter = null;
sqlParameter = new SqlParameter(PN_TAX_ID, System.Data.SqlDbType.Int);
sqlParameter.Direction = System.Data.ParameterDirection.Output;
sqlParameter.Value = taxEntity.ID;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TAX_PORTAL_ID, System.Data.SqlDbType.Int);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = taxEntity.PortalID;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TAX_RATE, System.Data.SqlDbType.Decimal);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = taxEntity.Rate;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TAX_IS_ENABLED, System.Data.SqlDbType.Bit);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = taxEntity.IsEnabled;
sqlCommand.Parameters.Add(sqlParameter);
try
{
sqlCommand.Connection.Open();
sqlCommand.ExecuteNonQuery();
sqlCommand.Connection.Close();
taxEntity.ID = Convert.ToInt32(sqlCommand.Parameters[PN_TAX_ID].Value);
}
catch (Exception ex)
{
throw ex;
}
}
return taxEntity.ID;
}