public int UploadBookingAmendmentForm(TourBookingHrdBDto tourBookingHrd) { Database db = null; DbCommand dbCmd = null; int Result = 0; try { db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING); dbCmd = db.GetStoredProcCommand("dbo.USP_BOOKING_TOUR_BOOKING_HRD_UPLOAD_AMENDMENT_FORM"); db.AddInParameter(dbCmd, "@BOOKING_ID", DbType.Int32, tourBookingHrd.BookingId); if (tourBookingHrd.TourTypeId != 0) db.AddInParameter(dbCmd, "@TOUR_TYPE_ID", DbType.Int32, tourBookingHrd.TourTypeId); else db.AddInParameter(dbCmd, "@TOUR_TYPE_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.TourId != 0) db.AddInParameter(dbCmd, "@TOUR_ID", DbType.Int32, tourBookingHrd.TourId); else db.AddInParameter(dbCmd, "@TOUR_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.AmendmentForm != null) db.AddInParameter(dbCmd, "@AMENDMENT_FORM", DbType.Binary, tourBookingHrd.AmendmentForm); else db.AddInParameter(dbCmd, "@AMENDMENT_FORM", DbType.Binary, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.AmendmentFormContentType)) db.AddInParameter(dbCmd, "@AMENDMENT_FORM_CONTENT_TYPE", DbType.String, tourBookingHrd.AmendmentFormContentType); else db.AddInParameter(dbCmd, "@AMENDMENT_FORM_CONTENT_TYPE", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.AmendmentFormFileName)) db.AddInParameter(dbCmd, "@AMENDMENT_FORM_FILE_NAME", DbType.String, tourBookingHrd.AmendmentFormFileName); else db.AddInParameter(dbCmd, "@AMENDMENT_FORM_FILE_NAME", DbType.String, DBNull.Value); Result = db.ExecuteNonQuery(dbCmd); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } finally { DALHelper.Destroy(ref dbCmd); } return Result; }
public int UpdateCustomerBooking(TourBookingHrdBDto tourBookingHrd) { Database db = null; DbCommand dbCmd = null; int Result = 0; try { db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING); dbCmd = db.GetStoredProcCommand(DALHelper.USP_BOOKING_TOUR_BOOKING_HRD_UPDATE); db.AddInParameter(dbCmd, "@BOOKING_ID", DbType.Int32, tourBookingHrd.BookingId); if (tourBookingHrd.TourTypeId != 0) db.AddInParameter(dbCmd, "@TOUR_TYPE_ID", DbType.Int32, tourBookingHrd.TourTypeId); else db.AddInParameter(dbCmd, "@TOUR_TYPE_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.TourId != 0) db.AddInParameter(dbCmd, "@TOUR_ID", DbType.Int32, tourBookingHrd.TourId); else db.AddInParameter(dbCmd, "@TOUR_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.BookingDate != DateTime.MinValue) db.AddInParameter(dbCmd, "@BOOKING_DATE", DbType.DateTime, tourBookingHrd.BookingDate); else db.AddInParameter(dbCmd, "@BOOKING_DATE", DbType.DateTime, DBNull.Value); if (tourBookingHrd.SalesExecutiveId != 0) db.AddInParameter(dbCmd, "@SALES_EXECUTIVE_ID", DbType.Int32, tourBookingHrd.SalesExecutiveId); else db.AddInParameter(dbCmd, "@SALES_EXECUTIVE_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.BranchId != 0) db.AddInParameter(dbCmd, "@BRANCH_ID", DbType.Int32, tourBookingHrd.BranchId); else db.AddInParameter(dbCmd, "@BRANCH_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.AgentId != 0) db.AddInParameter(dbCmd, "@AGENT_ID", DbType.Int32, tourBookingHrd.AgentId); else db.AddInParameter(dbCmd, "@AGENT_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.CustomerId != 0) db.AddInParameter(dbCmd, "@CUSTOMER_ID", DbType.Int32, tourBookingHrd.CustomerId); else db.AddInParameter(dbCmd, "@CUSTOMER_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.InquiryId != 0) db.AddInParameter(dbCmd, "@INQUIRY_ID", DbType.Int32, tourBookingHrd.InquiryId); else db.AddInParameter(dbCmd, "@INQUIRY_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.NoOfAdult != 0) db.AddInParameter(dbCmd, "@NO_OF_ADULT", DbType.Int32, tourBookingHrd.NoOfAdult); else db.AddInParameter(dbCmd, "@NO_OF_ADULT", DbType.Int32, DBNull.Value); if (tourBookingHrd.NoOfChildWithBed != 0) db.AddInParameter(dbCmd, "@NO_OF_CHILD_WITH_BED", DbType.Int32, tourBookingHrd.NoOfChildWithBed); else db.AddInParameter(dbCmd, "@NO_OF_CHILD_WITH_BED", DbType.Int32, DBNull.Value); if (tourBookingHrd.NoOfChildWithoutBed != 0) db.AddInParameter(dbCmd, "@NO_OF_CHILD_WITHOUT_BED", DbType.Int32, tourBookingHrd.NoOfChildWithoutBed); else db.AddInParameter(dbCmd, "@NO_OF_CHILD_WITHOUT_BED", DbType.Int32, DBNull.Value); if (tourBookingHrd.AdultCost != 0) db.AddInParameter(dbCmd, "@ADULT_COST", DbType.Decimal, tourBookingHrd.AdultCost); else db.AddInParameter(dbCmd, "@ADULT_COST", DbType.Decimal, DBNull.Value); if (tourBookingHrd.ChildCostWithBed != 0) db.AddInParameter(dbCmd, "@CHILD_COST_WITH_BED", DbType.Decimal, tourBookingHrd.ChildCostWithBed); else db.AddInParameter(dbCmd, "@CHILD_COST_WITH_BED", DbType.Decimal, DBNull.Value); if (tourBookingHrd.ChildCostWithoutBed != 0) db.AddInParameter(dbCmd, "@CHILD_COST_WITHOUT_BED", DbType.Decimal, tourBookingHrd.ChildCostWithoutBed); else db.AddInParameter(dbCmd, "@CHILD_COST_WITHOUT_BED", DbType.Decimal, DBNull.Value); if (tourBookingHrd.BoardingFrom != 0) db.AddInParameter(dbCmd, "@BOARDING_FROM", DbType.Int32, tourBookingHrd.BoardingFrom); else db.AddInParameter(dbCmd, "@BOARDING_FROM", DbType.Int32, DBNull.Value); if (tourBookingHrd.ArrivalTo != 0) db.AddInParameter(dbCmd, "@ARRIVAL_TO", DbType.Int32, tourBookingHrd.ArrivalTo); else db.AddInParameter(dbCmd, "@ARRIVAL_TO", DbType.Int32, DBNull.Value); if (tourBookingHrd.DepartureDate != DateTime.MinValue) db.AddInParameter(dbCmd, "@DEPARTURE_DATE", DbType.DateTime, tourBookingHrd.DepartureDate); else db.AddInParameter(dbCmd, "@DEPARTURE_DATE", DbType.DateTime, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.EmergencyPersonName)) db.AddInParameter(dbCmd, "@EMERGENCY_CONTACT_PERSON_NAME", DbType.String, tourBookingHrd.EmergencyPersonName); else db.AddInParameter(dbCmd, "@EMERGENCY_CONTACT_PERSON_NAME", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.EmergencyPersonAddress)) db.AddInParameter(dbCmd, "@EMERGENCY_CONTACT_PERSON_ADDRESS", DbType.String, tourBookingHrd.EmergencyPersonAddress); else db.AddInParameter(dbCmd, "@EMERGENCY_CONTACT_PERSON_ADDRESS", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.EmergencyPhoneNo)) db.AddInParameter(dbCmd, "@EMERGENCY_PHONE_NO", DbType.String, tourBookingHrd.EmergencyPhoneNo); else db.AddInParameter(dbCmd, "@EMERGENCY_PHONE_NO", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.EmergencyMobileNo)) db.AddInParameter(dbCmd, "@EMERGENCY_MOBILE_NO", DbType.String, tourBookingHrd.EmergencyMobileNo); else db.AddInParameter(dbCmd, "@EMERGENCY_MOBILE_NO", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.EmergencyEmail)) db.AddInParameter(dbCmd, "@EMERGENCY_EMAIL", DbType.String, tourBookingHrd.EmergencyEmail); else db.AddInParameter(dbCmd, "@EMERGENCY_EMAIL", DbType.String, DBNull.Value); if (tourBookingHrd.MarginAmount != 0) db.AddInParameter(dbCmd, "@MARGIN_AMOUNT", DbType.Decimal, tourBookingHrd.MarginAmount); else db.AddInParameter(dbCmd, "@MARGIN_AMOUNT", DbType.Decimal, DBNull.Value); db.AddInParameter(dbCmd, "@IS_PERCENT", DbType.Boolean, tourBookingHrd.IsPercent); if (tourBookingHrd.AmountDeposite != 0) db.AddInParameter(dbCmd, "@AMOUNT_DEPOSIT", DbType.Decimal, tourBookingHrd.AmountDeposite); else db.AddInParameter(dbCmd, "@AMOUNT_DEPOSIT", DbType.Decimal, DBNull.Value); if (tourBookingHrd.BalanceToBePaid != 0) db.AddInParameter(dbCmd, "@BALANCE_TO_BE_PAY", DbType.Decimal, tourBookingHrd.BalanceToBePaid); else db.AddInParameter(dbCmd, "@BALANCE_TO_BE_PAY", DbType.Decimal, DBNull.Value); if (tourBookingHrd.ModeOfPayment != 0) db.AddInParameter(dbCmd, "@MODE_OF_PAYMENT", DbType.Int32, tourBookingHrd.ModeOfPayment); else db.AddInParameter(dbCmd, "@MODE_OF_PAYMENT", DbType.Int32, DBNull.Value); if (tourBookingHrd.BankId != 0) db.AddInParameter(dbCmd, "@BANK_ID", DbType.Int32, tourBookingHrd.BankId); else db.AddInParameter(dbCmd, "@BANK_ID", DbType.Int32, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.BankBranchName)) db.AddInParameter(dbCmd, "@BANK_BRANCH_NAME", DbType.String, tourBookingHrd.BankBranchName); else db.AddInParameter(dbCmd, "@BANK_BRANCH_NAME", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.ReceiptNoChequeNoDdNo)) db.AddInParameter(dbCmd, "@RECEPT_NO_CHQNO_DDNO", DbType.String, tourBookingHrd.ReceiptNoChequeNoDdNo); else db.AddInParameter(dbCmd, "@RECEPT_NO_CHQNO_DDNO", DbType.String, DBNull.Value); if (tourBookingHrd.Amount != 0) db.AddInParameter(dbCmd, "@AMOUNT", DbType.Decimal, tourBookingHrd.Amount); else db.AddInParameter(dbCmd, "@AMOUNT", DbType.Decimal, DBNull.Value); if (tourBookingHrd.MarginAmount != 0) db.AddInParameter(dbCmd, "@USER_ID", DbType.Int32, tourBookingHrd.UserId); else db.AddInParameter(dbCmd, "@USER_ID", DbType.Int32, DBNull.Value); Result = db.ExecuteNonQuery(dbCmd); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } finally { DALHelper.Destroy(ref dbCmd); } return Result; }
public DataTable GetTourBookingDetails(TourBookingHrdBDto tourBookingHrd, CustomerBDto customer) { Database db = null; DbCommand dbCmd = null; DataTable dt = null; DataSet ds = null; try { db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING); dbCmd = db.GetStoredProcCommand(DALHelper.USP_BOOKING_TOUR_BOOKING_HDR_SELECT); if (tourBookingHrd.TourTypeId != 0) db.AddInParameter(dbCmd, "@TOUR_TYPE_ID", DbType.Int32, tourBookingHrd.TourTypeId); else db.AddInParameter(dbCmd, "@TOUR_TYPE_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.TourId != 0) db.AddInParameter(dbCmd, "@TOUR_ID", DbType.Int32, tourBookingHrd.TourId); else db.AddInParameter(dbCmd, "@TOUR_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.BookingDate != DateTime.MinValue) db.AddInParameter(dbCmd, "@BOOKING_DATE", DbType.DateTime, tourBookingHrd.BookingDate); else db.AddInParameter(dbCmd, "@BOOKING_DATE", DbType.DateTime, DBNull.Value); if (tourBookingHrd.SalesExecutiveId != 0) db.AddInParameter(dbCmd, "@SALES_EXECUTIVE_ID", DbType.Int32, tourBookingHrd.SalesExecutiveId); else db.AddInParameter(dbCmd, "@SALES_EXECUTIVE_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.BranchId != 0) db.AddInParameter(dbCmd, "@BRANCH_ID", DbType.Int32, tourBookingHrd.BranchId); else db.AddInParameter(dbCmd, "@BRANCH_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.AgentId != 0) db.AddInParameter(dbCmd, "@AGENT_ID", DbType.Int32, tourBookingHrd.AgentId); else db.AddInParameter(dbCmd, "@AGENT_ID", DbType.Int32, DBNull.Value); if (tourBookingHrd.BoardingFrom != 0) db.AddInParameter(dbCmd, "@BOARDING_FROM", DbType.Int32, tourBookingHrd.BoardingFrom); else db.AddInParameter(dbCmd, "@BOARDING_FROM", DbType.Int32, DBNull.Value); if (tourBookingHrd.ArrivalTo != 0) db.AddInParameter(dbCmd, "@ARRIVAL_TO", DbType.Int32, tourBookingHrd.ArrivalTo); else db.AddInParameter(dbCmd, "@ARRIVAL_TO", DbType.Int32, DBNull.Value); if (tourBookingHrd.DepartureDate != DateTime.MinValue) db.AddInParameter(dbCmd, "@DEPARTURE_DATE", DbType.DateTime, tourBookingHrd.DepartureDate); else db.AddInParameter(dbCmd, "@DEPARTURE_DATE", DbType.DateTime, DBNull.Value); if (!String.IsNullOrEmpty(customer.UniqueId)) db.AddInParameter(dbCmd, "@CUSTOMER_ID", DbType.String, customer.UniqueId); else db.AddInParameter(dbCmd, "@CUSTOMER_ID", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(customer.Name)) db.AddInParameter(dbCmd, "@CUSTOMER_FIRST_NAME", DbType.String, customer.Name); else db.AddInParameter(dbCmd, "@CUSTOMER_FIRST_NAME", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(customer.SurName)) db.AddInParameter(dbCmd, "@CUSTOMER_LAST_NAME", DbType.String, customer.SurName); else db.AddInParameter(dbCmd, "@CUSTOMER_LAST_NAME", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.EmergencyPersonName)) db.AddInParameter(dbCmd, "@EMERGENCY_CONTACT_PERSON_NAME", DbType.String, tourBookingHrd.EmergencyPersonName); else db.AddInParameter(dbCmd, "@EMERGENCY_CONTACT_PERSON_NAME", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.EmergencyMobileNo)) db.AddInParameter(dbCmd, "@EMERGENCY_MOBILE_NO", DbType.String, tourBookingHrd.EmergencyMobileNo); else db.AddInParameter(dbCmd, "@EMERGENCY_MOBILE_NO", DbType.String, DBNull.Value); if (!String.IsNullOrEmpty(tourBookingHrd.EmergencyEmail)) db.AddInParameter(dbCmd, "@EMERGENCY_EMAIL", DbType.String, tourBookingHrd.EmergencyEmail); else db.AddInParameter(dbCmd, "@EMERGENCY_EMAIL", DbType.String, DBNull.Value); ds = db.ExecuteDataSet(dbCmd); using (ds) { if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; } } } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } finally { DALHelper.Destroy(ref dbCmd); } return dt; }