public FoodDTO MapRow(MySqlDataReader reader) { FoodDTO food = new FoodDTO(); food.ID = reader.GetInt64("id"); food.Name = reader.GetString("name"); food.Price = reader.GetInt64("price"); food.Discount = reader.GetInt32("discount"); food.Status = reader.GetInt32("status"); CategoryDTO category = new CategoryDTO(); if (MapperUtils.HasColumn("categoryname", reader)) { category.Name = reader.GetString("categoryname"); } category.ID = reader.GetInt64("categoryid"); food.Category = category; if (reader["createddate"] != DBNull.Value) { food.CreatedDate = reader.GetDateTime("createddate"); } if (reader["createdby"] != DBNull.Value) { food.CreatedBy = reader.GetString("createdby"); } if (reader["modifieddate"] != DBNull.Value) { food.ModifiedDate = reader.GetDateTime("modifieddate"); } if (reader["modifiedby"] != DBNull.Value) { food.ModifiedBy = reader.GetString("modifiedby"); } return(food); }
public OrderDTO MapRow(MySqlDataReader reader) { OrderDTO order = new OrderDTO(); order.ID = reader.GetInt64("id"); order.TotalPrice = reader.GetInt64("totalprice"); order.Status = reader.GetInt32("status"); SaleDTO sale = new SaleDTO(); sale.ID = reader.GetInt64("saleid"); if (MapperUtils.HasColumn("salename", reader)) { sale.Name = reader.GetString("salename"); } if (MapperUtils.HasColumn("discount", reader)) { sale.Discount = reader.GetInt32("discount"); } order.Sale = sale; TableDTO table = new TableDTO(); table.ID = reader.GetInt64("tableid"); if (MapperUtils.HasColumn("tablename", reader)) { table.Name = reader.GetString("tablename"); } if (MapperUtils.HasColumn("seats", reader)) { table.Seats = reader.GetInt32("seats"); } order.Table = table; if (reader["createddate"] != DBNull.Value) { order.CreatedDate = reader.GetDateTime("createddate"); } if (reader["createdby"] != DBNull.Value) { order.CreatedBy = reader.GetString("createdby"); } if (reader["modifieddate"] != DBNull.Value) { order.ModifiedDate = reader.GetDateTime("modifieddate"); } if (reader["modifiedby"] != DBNull.Value) { order.ModifiedBy = reader.GetString("modifiedby"); } return(order); }
public OrderDetailDTO MapRow(MySqlDataReader reader) { OrderDetailDTO orderDetail = new OrderDetailDTO(); orderDetail.ID = reader.GetInt64("id"); orderDetail.UnitPrice = reader.GetInt64("unitprice"); orderDetail.Quantity = reader.GetInt32("quantity"); OrderDTO order = new OrderDTO(); order.ID = reader.GetInt64("orderid"); orderDetail.Order = order; FoodDTO food = new FoodDTO(); food.ID = reader.GetInt64("foodid"); if (MapperUtils.HasColumn("price", reader)) { food.Price = reader.GetInt64("price"); } if (MapperUtils.HasColumn("discount", reader)) { food.Discount = reader.GetInt32("discount"); } if (MapperUtils.HasColumn("name", reader)) { food.Name = reader.GetString("name"); } orderDetail.Food = food; if (reader["createddate"] != DBNull.Value) { orderDetail.CreatedDate = reader.GetDateTime("createddate"); } if (reader["createdby"] != DBNull.Value) { orderDetail.CreatedBy = reader.GetString("createdby"); } if (reader["modifieddate"] != DBNull.Value) { orderDetail.ModifiedDate = reader.GetDateTime("modifieddate"); } if (reader["modifiedby"] != DBNull.Value) { orderDetail.ModifiedBy = reader.GetString("modifiedby"); } return(orderDetail); }
public UserDTO MapRow(MySqlDataReader reader) { UserDTO user = new UserDTO(); user.ID = reader.GetInt64("id"); user.FullName = reader.GetString("fullname"); user.UserName = reader.GetString("username"); user.PassWord = reader.GetString("password"); user.Phone = reader.GetString("phone"); user.Address = reader.GetString("address"); user.Email = reader.GetString("email"); user.Dob = reader.GetDateTime("dob"); user.Gender = reader.GetString("gender"); user.Status = reader.GetInt16("status"); RoleDTO role = new RoleDTO(); role.ID = reader.GetInt64("roleid"); if (MapperUtils.HasColumn("name", reader)) { role.Name = reader.GetString("name"); } if (MapperUtils.HasColumn("code", reader)) { role.Code = reader.GetString("code"); } user.Role = role; if (reader["createddate"] != DBNull.Value) { user.CreatedDate = reader.GetDateTime("createddate"); } if (reader["createdby"] != DBNull.Value) { user.CreatedBy = reader.GetString("createdby"); } if (reader["modifieddate"] != DBNull.Value) { user.ModifiedDate = reader.GetDateTime("modifieddate"); } if (reader["modifiedby"] != DBNull.Value) { user.ModifiedBy = reader.GetString("modifiedby"); } return(user); }