public CResult updateBookingInfo(CBooking inBookingInfo) { try { m_oResult = Database.Instance.BookingInfo.UpdateBookingInfo(inBookingInfo); m_oResult.Message = "Data Read Successful"; } catch (Exception ex) { System.Console.WriteLine("Exception occuer at updateBookingInfo() : " + ex.Message); m_oResult.IsException = true; m_oResult.Action = EERRORNAME.EXCEPTION_OCCURE; m_oResult.SetParams(ex.Message); m_oResult.Message = ex.Message; Logger.Write("Exception : " + ex + " in updateBookingInfo()", LogLevel.Error, "COrderManager"); } return m_oResult; }
private CBooking ReaderToBooking(IDataReader oReader) { CBooking oBookingInfo = new CBooking(); int tempTables = 0; int tempGuests = 0; if (oReader["booking_id"] != null) oBookingInfo.BookingID = Int64.Parse(oReader["booking_id"].ToString()); if (oReader["customer_id"] != null) oBookingInfo.CustomerID = Int64.Parse(oReader["customer_id"].ToString()); if (oReader["booking_time"] != null) oBookingInfo.BookingTime = Int64.Parse(oReader["booking_time"].ToString()); if (oReader["booking_type"] != null) oBookingInfo.BookingType = oReader["booking_type"].ToString(); if (oReader["status"] != null) oBookingInfo.Status = oReader["status"].ToString(); if (oReader["comments"] != null) oBookingInfo.Comments = oReader["comments"].ToString(); if (oReader["guest_count"] != null) { int.TryParse(oReader["guest_count"].ToString(), out tempGuests); oBookingInfo.GuestCount = tempGuests; } if (oReader["table_count"] != null) { int.TryParse(oReader["table_count"].ToString(), out tempTables); oBookingInfo.TableCount = tempTables; } if (oReader["name"] != null) oBookingInfo.CustomerName = oReader["name"].ToString(); if (oReader["phone"] != null) oBookingInfo.Phone = oReader["phone"].ToString(); if (oReader["address"] != null) oBookingInfo.Address = oReader["address"].ToString(); return oBookingInfo; }
public CResult GetBookingInfoByID(Int64 inBookingID) { CResult tempResult = new CResult(); CBooking oBookingList = new CBooking(); try { CCommonConstants oTempConstant = ConfigManager.GetConfig<CCommonConstants>(); this.OpenConnection(); string sSql = string.Format(SqlQueries.GetQuery(Query.BookingInfoGetByID), inBookingID); IDataReader oReader = this.ExecuteReader(sSql); CBooking oBooking = new CBooking(); if (oReader != null) { while (oReader.Read()) { oBooking = ReaderToBooking(oReader); } } tempResult.Data = oBooking; tempResult.IsSuccess = true; this.CloseConnection(); } catch (Exception ex) { Console.Write("###" + ex + "###"); tempResult.IsException = true; Logger.Write("Exception : " + ex + " in GetBookingInfoAll()", LogLevel.Error, "Database"); if (ex.GetType().Equals(typeof(SqlException))) { SqlException oSQLEx = ex as SqlException; if (oSQLEx.Number != 7619) throw new Exception("Exception occure at GetBookingInfoAll()", ex); } else { throw new Exception("Exception occure at GetBookingInfoAll()", ex); } } finally { this.CloseConnection(); } return tempResult; }
public CResult UpdateBookingInfo(CBooking inBookingInfo) { CResult tempResult = new CResult(); try { CCommonConstants oTempConstant = ConfigManager.GetConfig<CCommonConstants>(); this.OpenConnection(); string sSql = string.Format(SqlQueries.GetQuery(Query.BookingInfoUpdate), inBookingInfo.BookingID, inBookingInfo.BookingType, inBookingInfo.BookingTime, inBookingInfo.CustomerID, inBookingInfo.GuestCount, inBookingInfo.Status, inBookingInfo.Comments, inBookingInfo.TableCount); this.ExecuteNonQuery(sSql); tempResult.IsSuccess = true; this.CloseConnection(); } catch (Exception ex) { Console.Write("###" + ex + "###"); tempResult.IsException = true; Logger.Write("Exception : " + ex + " in DeleteBookingInfo()", LogLevel.Error, "Database"); if (ex.GetType().Equals(typeof(SqlException))) { SqlException oSQLEx = ex as SqlException; if (oSQLEx.Number != 7619) throw new Exception("Exception occure at DeleteBookingInfo()", ex); } else { throw new Exception("Exception occure at DeleteBookingInfo()", ex); } } finally { this.CloseConnection(); } return tempResult; }
private CBooking ReaderToBooking(IDataReader oReader) { CBooking oBookingInfo = new CBooking(); int tempTables = 0; int tempGuests = 0; if (oReader["booking_id"] != null) oBookingInfo.BookingID = Int64.Parse(oReader["booking_id"].ToString()); if (oReader["customer_id"] != null) oBookingInfo.CustomerID = Int64.Parse(oReader["customer_id"].ToString()); if (oReader["booking_time"] != null) oBookingInfo.BookingTime = Int64.Parse(oReader["booking_time"].ToString()); if (oReader["booking_type"] != null) oBookingInfo.BookingType = oReader["booking_type"].ToString(); if (oReader["status"] != null) oBookingInfo.Status = oReader["status"].ToString(); if (oReader["comments"] != null) oBookingInfo.Comments = oReader["comments"].ToString(); if (oReader["guest_count"] != null) { int.TryParse(oReader["guest_count"].ToString(), out tempGuests); oBookingInfo.GuestCount = tempGuests; } if (oReader["table_count"] != null) { int.TryParse(oReader["table_count"].ToString(), out tempTables); oBookingInfo.TableCount = tempTables; } if (oReader["name"] != null) oBookingInfo.CustomerName = oReader["name"].ToString(); if (oReader["floororapt_number"] != null) oBookingInfo.FloorAptNumber = oReader["floororapt_number"].ToString(); if (oReader["building_name"] != null) oBookingInfo.BuildingName = oReader["building_name"].ToString(); if (oReader["house_number"] != null) oBookingInfo.HouseNumber = oReader["house_number"].ToString(); if (oReader["phone"] != null) oBookingInfo.Phone = oReader["phone"].ToString(); if (oReader["postal_code"] != null) oBookingInfo.CustomerPostalCode = oReader["postal_code"].ToString(); if (oReader["town"] != null) oBookingInfo.CustomerTown = oReader["town"].ToString(); if (oReader["country"] != null) oBookingInfo.CustomerCountry = oReader["country"].ToString(); if (oReader["street_name"] != null) oBookingInfo.StreetName = oReader["street_name"].ToString(); return oBookingInfo; }