public static CustomerPointAccount GetCustomerPointAccount(int customerID, int pointAccountID) { var pointAccount = new CustomerPointAccount(); using (var context = ExigoDAL.Sql()) { pointAccount = context.Query <CustomerPointAccount>(@" SELECT cpa.PointAccountID , cpa.CustomerID , cpa.PointBalance , pa.PointAccountDescription , pa.CurrencyCode FROM CustomerPointAccounts cpa LEFT JOIN PointAccounts pa ON cpa.PointAccountID = pa.PointAccountID WHERE cpa.CustomerID = @CustomerID AND cpa.PointAccountID = @PointAccountID ", new { CustomerID = customerID, PointAccountID = pointAccountID }).FirstOrDefault(); } if (pointAccount == null) { return(null); } return(pointAccount); }
public static CustomerPointAccount GetCustomerPointAccount(int customerID, int pointAccountID) { CustomerPointAccount pointAccount = null; using (var context = Sql()) { string sqlProcedure = string.Format("GetPointAccountsBalance {0}, {1}", customerID, pointAccountID); pointAccount = context.Query <CustomerPointAccount>(sqlProcedure).FirstOrDefault(); context.Close(); } if (pointAccount == null) { return(null); } return(pointAccount); }