private decimal FindVatCstRate(string ProductID, bool IsVat) { try { decimal Rate = 0M; Dictionary <int, SqlParameter> sqlParam = new Dictionary <int, SqlParameter>(); sqlParam[0] = new SqlParameter("@nvarcharProductID", ProductID); if (IsVat) { Rate = 5; sqlParam[1] = new SqlParameter("@intIsVat", 1); } else { Rate = 2; sqlParam[1] = new SqlParameter("@intIsVat", 2); } decimal result = 0M; DataTable dt = SqlUtility.ExecuteQueryWithDT(GetConnectionString(), "sp_FindVatCstRate", sqlParam); foreach (DataRow dr in dt.Rows) { result = Converter.ToDecimal(dr["Rate"]); break; } if (result > 0) { return(result); } return(Rate); } catch (Exception ex) { throw ex; } }