public static Bill GetBill(string dinningId) { using (SqlConnection conn = Utilities.GetConnection()) { SqlCommand comm = new SqlCommand(@"select Bill.Id,DinningTable.TableId, TotalMoney, BillTime, Note, Name from DinningTable, Bill, BillType where DinningTable.Id = @dinningId and Bill.TypeId = BillType.Id", conn); comm.Parameters.Add("@dinningId", SqlDbType.Char, 10); comm.Parameters["@dinningId"].Value = dinningId; try { conn.Open(); SqlDataReader reader = comm.ExecuteReader(); if (reader.Read()) { List<string> cardId = new List<string>(); cardId.Add(reader["TableId"].ToString()); BillingInfo info = new BillingInfo(); return convertToBill(reader["Id"].ToString(), dinningId, reader.GetDateTime(3),reader["Note"].ToString(),reader.GetDecimal(2), info); } else { throw new HCSMSException("No Type Found"); } } catch (SqlException sqlException) { throw new HCSMSException(sqlException.Message); } finally { if (conn != null) { conn.Close(); } } } }
private static Bill convertToBill(string Id, string dinningId, DateTime billTime,string note, decimal totalMoney, BillingInfo billInfo) { Bill bill = new Bill(); bill.BillingInfo.Add(billInfo); bill.BillingTable.Id = dinningId; bill.BillTime = billTime; bill.Id = Id; bill.Note = note; bill.TotalMoney = totalMoney; return bill; }
public void PayBill( Bill aBill, BillingInfo billingInfo) { throw new NotImplementedException(); }