Exemple #1
0
        // update all object members on a row in table based on primary key
        // links:
        //  docLink: http://sql2x.org/documentationLink/ce75e72e-fb16-4f4e-a2e6-dbd079dfa206
        public void Update(CrudeClientContract contract)
        {
            var data = new CrudeClientData();

            ContractToData(contract, data);
            data.Update();
        }
Exemple #2
0
        // insert all object members as a new row in table, in a transaction
        // the transaction and or connection state is not changed in any way other than what SqlClient does to it.
        // it is the callers responsibility to commit or rollback the transaction
        // links:
        //  docLink: http://sql2x.org/documentationLink/542f9458-c3b9-4edf-8575-0870086f3a7f
        public void Insert(CrudeClientContract contract, SqlConnection connection, SqlTransaction transaction)
        {
            var data = new CrudeClientData();

            ContractToData(contract, data);
            data.Insert(connection, transaction);
        }
Exemple #3
0
        // insert all object members as a new row in table
        // links:
        //  docLink: http://sql2x.org/documentationLink/75aad010-e6aa-4f19-a6e5-597456aa20d8
        public void Insert(CrudeClientContract contract)
        {
            var data = new CrudeClientData();

            ContractToData(contract, data);
            data.Insert();
        }
Exemple #4
0
        // fetch all rows from table into new List of Contracts, filtered by any column
        // links:
        //  docLink: http://sql2x.org/documentationLink/ce01ef4a-5cd0-4e51-b211-9c0a15b791a0
        public List <CrudeClientContract> FetchWithFilter(System.Guid clientId, string firstName, string middleName, string lastName, System.Guid addressId, System.Guid defaultUserId, string passengerTypeRcd, string nationalityRcd, string genderRcd, string titleRcd, string clientTypeRcd, System.Guid userId, System.DateTime dateTime)
        {
            var list = new List <CrudeClientContract>();
            List <CrudeClientData> dataList = CrudeClientData.FetchWithFilter(
                clientId: clientId,
                firstName: firstName,
                middleName: middleName,
                lastName: lastName,
                addressId: addressId,
                defaultUserId: defaultUserId,
                passengerTypeRcd: passengerTypeRcd,
                nationalityRcd: nationalityRcd,
                genderRcd: genderRcd,
                titleRcd: titleRcd,
                clientTypeRcd: clientTypeRcd,
                userId: userId,
                dateTime: dateTime
                );

            foreach (CrudeClientData data in dataList)
            {
                var crudeClientContract = new CrudeClientContract();
                DataToContract(data, crudeClientContract);
                list.Add(crudeClientContract);
            }

            return(list);
        }
Exemple #5
0
        // fetch all rows from table into new List of Contracts, filtered by any column
        // links:
        //  docLink: http://sql2x.org/documentationLink/ce01ef4a-5cd0-4e51-b211-9c0a15b791a0
        public List <CrudeClientContract> FetchWithFilter(System.Guid clientId, string clientTypeRcd, string clientNationalityRcd, string clientGenderRcd, string clientTitleRcd, System.Guid clientAddressId, string firstName, string middleName, string lastName, byte[] image, string imageBlobFilename, System.Guid userId, System.DateTime dateTime)
        {
            var list = new List <CrudeClientContract>();
            List <CrudeClientData> dataList = CrudeClientData.FetchWithFilter(
                clientId: clientId,
                clientTypeRcd: clientTypeRcd,
                clientNationalityRcd: clientNationalityRcd,
                clientGenderRcd: clientGenderRcd,
                clientTitleRcd: clientTitleRcd,
                clientAddressId: clientAddressId,
                firstName: firstName,
                middleName: middleName,
                lastName: lastName,
                image: image,
                imageBlobFilename: imageBlobFilename,
                userId: userId,
                dateTime: dateTime
                );

            foreach (CrudeClientData data in dataList)
            {
                var crudeClientContract = new CrudeClientContract();
                DataToContract(data, crudeClientContract);
                list.Add(crudeClientContract);
            }

            return(list);
        }
 // copy all rows from a List of SOAP Contracts to a List of serialized data objects
 // links:
 //  docLink: http://sql2x.org/documentationLink/1c6c6b9c-e201-4590-8c69-d38a0ad2a9f7
 public static void ContractListToDataList(List <CrudeClientContract> contractList, List <CrudeClientData> dataList)
 {
     foreach (CrudeClientContract contract in contractList)
     {
         var data = new CrudeClientData();
         CrudeClientService.ContractToData(contract, data);
         dataList.Add(data);
     }
 }
 // transfer model list to data list
 // links:
 //  crud definition: https://en.wikipedia.org/wiki/Create,_read,_update_and_delete
 //  docLink: http://sql2x.org/documentationLink/1d6a48d9-fe39-4397-b8fa-a332da164cbf
 // parameters:
 //  CrudeClientData: key of table CrudeClientData
 public static void ModelListToDataList(List <CrudeClientModel> modelList, List <CrudeClientData> dataList)
 {
     foreach (CrudeClientModel model in modelList)
     {
         var data = new CrudeClientData();
         ModelToData(model, data);
         dataList.Add(data);
     }
 }
        // fetch by Search key into current object
        // links:
        //  crud definition: https://en.wikipedia.org/wiki/Create,_read,_update_and_delete
        //  docLink: http://sql2x.org/documentationLink/ad2dd952-e3ec-471a-9e34-f5fc965b8b37
        // parameters:
        //  FirstName: key of table CrudeClientData
        public CrudeClientModel FetchByFirstName(string firstName)
        {
            var dataAccessLayer = new CrudeClientData();
            var model           = new CrudeClientModel();

            dataAccessLayer.FetchByFirstName(firstName);
            DataToModel(dataAccessLayer, model);

            return(model);
        }
        // fetch by Primary key into current object
        // links:
        //  crud definition: https://en.wikipedia.org/wiki/Create,_read,_update_and_delete
        //  docLink: http://sql2x.org/documentationLink/fdcc33b4-08f1-43c3-ae28-95fbf029c3bd
        // parameters:
        //  CrudeClientData: primary key of table CrudeClientData
        public CrudeClientModel FetchByClientId(System.Guid clientId)
        {
            var dataAccessLayer = new CrudeClientData();
            var model           = new CrudeClientModel();

            dataAccessLayer.FetchByClientId(clientId);
            DataToModel(dataAccessLayer, model);

            return(model);
        }
        // fetch by Primary key into current object
        // links:
        //  docLink: http://sql2x.org/documentationLink/bbab4791-c9e7-49bf-90d5-fca19b1fedaa
        // parameters:
        //  clientId: primary key of table client
        public CrudeClientContract FetchByClientId(System.Guid clientId)
        {
            var dataAccessLayer = new CrudeClientData();
            var contract        = new CrudeClientContract();

            dataAccessLayer.FetchByClientId(clientId);
            DataToContract(dataAccessLayer, contract);

            return(contract);
        }
        public CrudeClientContract FetchByFirstName(string firstName)
        {
            var dataAccessLayer = new CrudeClientData();
            var contract        = new CrudeClientContract();

            dataAccessLayer.FetchByFirstName(firstName);
            DataToContract(dataAccessLayer, contract);

            return(contract);
        }
Exemple #12
0
        // fetch all rows from table with an offset, and limit of rows
        // links:
        //  docLink: http://sql2x.org/documentationLink/a87e5c54-b47e-4031-bc3b-837b4cf9f692
        public List <CrudeClientModel> FetchAllWithLimitAndOffset(string limit, string offset)
        {
            var list = new List <CrudeClientModel>();
            List <CrudeClientData> dataList = CrudeClientData.FetchAllWithLimitAndOffset(int.Parse(limit), int.Parse(offset));

            foreach (CrudeClientData crudeClientBusiness in dataList)
            {
                var model = new CrudeClientModel();
                DataToModel(crudeClientBusiness, model);
                list.Add(model);
            }

            return(list);
        }
Exemple #13
0
        // copy all rows from a List of serialized data objects in CrudeClientData to a List of SOAP Contracts
        // links:
        //  docLink: http://sql2x.org/documentationLink/3d3e60c3-69e4-43d6-8bd5-14a67a6ecf58
        public List <CrudeClientModel> FetchAll()
        {
            var list = new List <CrudeClientModel>();
            List <CrudeClientData> dataList = CrudeClientData.FetchAll();

            foreach (CrudeClientData crudeClientBusiness in dataList)
            {
                var model = new CrudeClientModel();
                DataToModel(crudeClientBusiness, model);
                list.Add(model);
            }

            return(list);
        }
        // copy all rows from a List of serialized data objects to a List of SOAP Contracts,
        //  with a limit on number of returned rows and order by columns, starting at a specific row
        // links:
        //  docLink: http://sql2x.org/documentationLink/3fe9f1b3-97b6-4f58-a0f2-adfcbd973bfc
        public List <CrudeClientContract> FetchAllWithLimitAndOffset(int limit, int offset)
        {
            var list = new List <CrudeClientContract>();
            List <CrudeClientData> dataList = CrudeClientData.FetchAllWithLimitAndOffset(limit, offset);

            foreach (CrudeClientData crudeClient in dataList)
            {
                var contract = new CrudeClientContract();
                DataToContract(crudeClient, contract);
                list.Add(contract);
            }

            return(list);
        }
        // copy all rows from a List of serialized data objects in CrudeClientData to a List of SOAP Contracts
        // links:
        //  docLink: http://sql2x.org/documentationLink/9204c68e-93b8-4c77-af3c-3181985ff75f
        public List <CrudeClientContract> FetchAll()
        {
            var list = new List <CrudeClientContract>();
            List <CrudeClientData> dataList = CrudeClientData.FetchAll();

            foreach (CrudeClientData crudeClient in dataList)
            {
                var contract = new CrudeClientContract();
                DataToContract(crudeClient, contract);
                list.Add(contract);
            }

            return(list);
        }
Exemple #16
0
        // fetch all from table into new List of class instances, filtered by any column
        // links:
        //  docLink: http://sql2x.org/documentationLink/db27658d-4d23-46d7-9970-7bbaef8634b0
        public List <CrudeClientModel> FetchWithFilter(System.Guid clientId, string firstName, string middleName, string lastName, System.Guid addressId, System.Guid defaultUserId, string passengerTypeRcd, string nationalityRcd, string genderRcd, string titleRcd, string clientTypeRcd, System.Guid userId, System.DateTime dateTime)
        {
            var list = new List <CrudeClientModel>();
            List <CrudeClientData> dataList = CrudeClientData.FetchWithFilter(clientId, firstName, middleName, lastName, addressId, defaultUserId, passengerTypeRcd, nationalityRcd, genderRcd, titleRcd, clientTypeRcd, userId, dateTime);

            foreach (CrudeClientData data in dataList)
            {
                var crudeClientBusinessModel = new CrudeClientModel();
                DataToModel(data, crudeClientBusinessModel);
                list.Add(crudeClientBusinessModel);
            }

            return(list);
        }
Exemple #17
0
 // transfer model object to data object
 // links:
 //  docLink: http://sql2x.org/documentationLink/95875d99-b7f7-4a9e-baa4-3fbe9925d8a2
 public static void ModelToData(CrudeClientModel model, CrudeClientData data)
 {
     data.ClientId         = model.ClientId;
     data.FirstName        = model.FirstName;
     data.MiddleName       = model.MiddleName;
     data.LastName         = model.LastName;
     data.AddressId        = model.AddressId;
     data.DefaultUserId    = model.DefaultUserId;
     data.PassengerTypeRcd = model.PassengerTypeRcd;
     data.NationalityRcd   = model.NationalityRcd;
     data.GenderRcd        = model.GenderRcd;
     data.TitleRcd         = model.TitleRcd;
     data.ClientTypeRcd    = model.ClientTypeRcd;
     data.UserId           = model.UserId;
     data.DateTime         = model.DateTime;
 }
Exemple #18
0
 // copy all columns from a serialized data object to a SOAP Contract
 // links:
 //  docLink: http://sql2x.org/documentationLink/7553d6dd-da65-4a72-84c8-81f2f99ef4f5
 public static void DataToContract(CrudeClientData data, CrudeClientContract contract)
 {
     contract.ClientId         = data.ClientId;
     contract.FirstName        = data.FirstName;
     contract.MiddleName       = data.MiddleName;
     contract.LastName         = data.LastName;
     contract.AddressId        = data.AddressId;
     contract.DefaultUserId    = data.DefaultUserId;
     contract.PassengerTypeRcd = data.PassengerTypeRcd;
     contract.NationalityRcd   = data.NationalityRcd;
     contract.GenderRcd        = data.GenderRcd;
     contract.TitleRcd         = data.TitleRcd;
     contract.ClientTypeRcd    = data.ClientTypeRcd;
     contract.UserId           = data.UserId;
     contract.DateTime         = data.DateTime;
 }
Exemple #19
0
 // transfer data object to model object
 // links:
 //  docLink: http://sql2x.org/documentationLink/43d57600-5ff5-4ef8-9330-123773d100d3
 public static void DataToModel(CrudeClientData data, CrudeClientModel model)
 {
     model.ClientId         = data.ClientId;
     model.FirstName        = data.FirstName;
     model.MiddleName       = data.MiddleName;
     model.LastName         = data.LastName;
     model.AddressId        = data.AddressId;
     model.DefaultUserId    = data.DefaultUserId;
     model.PassengerTypeRcd = data.PassengerTypeRcd;
     model.NationalityRcd   = data.NationalityRcd;
     model.GenderRcd        = data.GenderRcd;
     model.TitleRcd         = data.TitleRcd;
     model.ClientTypeRcd    = data.ClientTypeRcd;
     model.UserId           = data.UserId;
     model.DateTime         = data.DateTime;
 }
 // copy all columns from a serialized data object to a SOAP Contract
 // links:
 //  docLink: http://sql2x.org/documentationLink/7553d6dd-da65-4a72-84c8-81f2f99ef4f5
 public static void DataToContract(CrudeClientData data, CrudeClientContract contract)
 {
     contract.ClientId             = data.ClientId;
     contract.ClientTypeRcd        = data.ClientTypeRcd;
     contract.ClientNationalityRcd = data.ClientNationalityRcd;
     contract.ClientGenderRcd      = data.ClientGenderRcd;
     contract.ClientTitleRcd       = data.ClientTitleRcd;
     contract.ClientAddressId      = data.ClientAddressId;
     contract.FirstName            = data.FirstName;
     contract.MiddleName           = data.MiddleName;
     contract.LastName             = data.LastName;
     contract.Image             = data.Image;
     contract.ImageBlobFilename = data.ImageBlobFilename;
     contract.UserId            = data.UserId;
     contract.DateTime          = data.DateTime;
 }
 // copy all columns from a SOAP Contract to a serialized data object
 // links:
 //  docLink: http://sql2x.org/documentationLink/10700d38-2227-4021-be12-2f4f206f5dd9
 public static void ContractToData(CrudeClientContract contract, CrudeClientData data)
 {
     data.ClientId             = contract.ClientId;
     data.ClientTypeRcd        = contract.ClientTypeRcd;
     data.ClientNationalityRcd = contract.ClientNationalityRcd;
     data.ClientGenderRcd      = contract.ClientGenderRcd;
     data.ClientTitleRcd       = contract.ClientTitleRcd;
     data.ClientAddressId      = contract.ClientAddressId;
     data.FirstName            = contract.FirstName;
     data.MiddleName           = contract.MiddleName;
     data.LastName             = contract.LastName;
     data.Image             = contract.Image;
     data.ImageBlobFilename = contract.ImageBlobFilename;
     data.UserId            = contract.UserId;
     data.DateTime          = contract.DateTime;
 }
Exemple #22
0
 // fetch by Search key into current object
 // links:
 //  crud definition: https://en.wikipedia.org/wiki/Create,_read,_update_and_delete
 //  docLink: http://sql2x.org/documentationLink/87368fa6-b618-4f0c-acbb-1fc4e273bb2d
 // parameters:
 //  AddressId: key of table CrudeClientData
 public List <CrudeClientModel> FetchByAddressId(System.Guid addressId)
 {
     return(DataListToModelList(CrudeClientData.FetchByAddressId(addressId)));
 }
 // delete a row in table based on primary key
 // links:
 //  docLink: http://sql2x.org/documentationLink/eb0597e0-8ea0-425c-88af-213a170bbd5e
 public void Delete(System.Guid clientId)
 {
     CrudeClientData.Delete(clientId);
 }
 // get a count of rows in table
 // links:
 //  docLink: http://sql2x.org/documentationLink/7cd5e52c-b3d7-4566-a27a-408d0732dd88
 public int FetchAllCount()
 {
     return(CrudeClientData.FetchAllCount());
 }
Exemple #25
0
        public void PromotionSend(
            Guid servicePackagePromotionId,
            Guid userId
            )
        {
            Logging log =
                Logging.PerformanceTimeStart(
                    "Service",
                    "BusinessLogicLayer",
                    "ServiceService",
                    "PromotionSend",
                    userId
                    );

            using (var connection = new SqlConnection(Conn.ConnectionString)) {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();

                try {
                    var promotionData = CrudeServicePackagePromotionData.GetByServicePackagePromotionId(servicePackagePromotionId);
                    var packageData   = CrudeServicePackageData.GetByServicePackageId(promotionData.ServicePackageId);
                    var clientData    = CrudeClientData.GetByClientId(promotionData.ClientId);
                    var contactData   = CrudeClientContactMethodData.GetCurrentMail(promotionData.ClientId);

                    // todo, assume one hit
                    GetServicePackageData packageDetailsData =
                        new ServiceSearch().GetServicePackage(promotionData.ServicePackageId)[0];

                    string messageText = string.Empty;
                    messageText += "Hi,<br>\r\n";
                    messageText += "<br>\r\n";
                    if (!string.IsNullOrEmpty(packageDetailsData.DepartureAirportName))
                    {
                        messageText += " From: " + packageDetailsData.DepartureAirportName + "<br>\r\n";
                    }
                    if (!string.IsNullOrEmpty(packageDetailsData.ArrivalAirportName))
                    {
                        messageText += " To: " + packageDetailsData.ArrivalAirportName + "<br>\r\n";
                    }
                    if (!string.IsNullOrEmpty(packageDetailsData.CarName))
                    {
                        messageText += " Traveling with: " + packageDetailsData.CarName + "<br>\r\n";
                    }
                    if (!string.IsNullOrEmpty(packageDetailsData.HotelName))
                    {
                        messageText += " Staying at: " + packageDetailsData.HotelName + "<br>\r\n";
                    }
                    if (!string.IsNullOrEmpty(packageDetailsData.ServiceSpecialServiceRequestName))
                    {
                        messageText += " Special Request: " + packageDetailsData.ServiceSpecialServiceRequestName + "<br>\r\n";
                    }

                    List <CrudeDefaultSystemSettingData> systemSettingDatas =
                        CrudeDefaultSystemSettingData.FetchWithFilter(
                            Guid.Empty,
                            DefaultSystemSettingRef.EMailURL,
                            string.Empty,
                            Guid.Empty,
                            DateTime.MinValue
                            );

                    CrudeDefaultSystemSettingData systemSettingData;
                    if (systemSettingDatas.Count > 0)
                    {
                        systemSettingData = systemSettingDatas[0];

                        messageText += "<br>\r\n";
                        messageText += "The package is not yet a booking, click ";
                        // http://localhost:1301/ServicePackagePromotionWithFilter/ServicePackagePromotionMakeBooking?servicePackagePromotionId=4417cd4e-e033-4644-b9fe-74ceec50d903
                        messageText += "<a href=\"" + systemSettingData.DefaultSystemSettingValue;
                        messageText += "/ServicePackagePromotionWithFilter/ServicePackagePromotionMakeBooking";
                        messageText += "?servicePackagePromotionId=" + promotionData.ServicePackagePromotionId.ToString();
                        messageText += "\">here to make it into one</a>. The flight will be the first available one, so fly to the airport :-|<br>\r\n";

                        // change package message
                        messageText += "If you for some reason do not agree with this wonderful package then <br>\r\n";
                        messageText += " it can be ";
                        messageText += "<a href=\"" + systemSettingData.DefaultSystemSettingValue;
                        messageText += "/GetServicePackageLive/ServicePackageEdit";
                        messageText += "?servicePackageId=" + packageData.ServicePackageId.ToString();
                        messageText += "\">changed here</a><br>\r\n";

                        // confirmed message
                        messageText += "<br>\r\n";
                        messageText += "The booking will be confirmed and a new mail message will arrive at this address confirming that fact.<br>\r\n";
                        messageText += "In the confirmation mail you can view the complete booking through web pages or a windows interface<br>\r\n";
                        messageText += "<br>\r\n";
                        messageText += "Thanks for booking through nor-port<br>\r\n";
                        messageText += "<br>\r\n";
                    }
                    messageText += "//nor-port<br>\r\n";

                    SmtpClient client = new SmtpClient();
                    client.Port                  = 587;
                    client.Host                  = "smtp.live.com"; // todo, system setting
                    client.EnableSsl             = true;
                    client.Timeout               = 10000;
                    client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                    client.UseDefaultCredentials = false;

                    // todo, system setting
                    client.Credentials =
                        new System.Net.NetworkCredential(
                            "emailLog",
                            "HU6767Ghvhvj"
                            );

                    MailMessage message =
                        new MailMessage(
                            "emailLog",
                            contactData.ContactMethodWay,
                            "Promotional Package : " + packageData.ServicePackageName,
                            messageText
                            );

                    message.IsBodyHtml = true;

                    message.BodyEncoding = UTF8Encoding.UTF8;
                    message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

                    client.Send(message);

                    transaction.Commit();
                    log.PerformanceTimeStop();
                } catch (Exception ex) {
                    transaction.Rollback();
                    log.Error(ex);
                    throw ex;
                }
            }
        }
 // fetch by Foreign key into new List of class instances
 // links:
 //  docLink: http://sql2x.org/documentationLink/a7599485-4f00-4ebf-974d-53f69c43654e
 public List <CrudeClientContract> FetchByClientAddressId(System.Guid clientAddressId)
 {
     return(DataListToContractList(CrudeClientData.FetchByClientAddressId(clientAddressId)));
 }
 // fetch by Foreign key into new List of class instances
 // links:
 //  docLink: http://sql2x.org/documentationLink/a7599485-4f00-4ebf-974d-53f69c43654e
 public List <CrudeClientContract> FetchByUserId(System.Guid userId)
 {
     return(DataListToContractList(CrudeClientData.FetchByUserId(userId)));
 }
 // fetch by Foreign key into new List of class instances
 // links:
 //  docLink: http://sql2x.org/documentationLink/a7599485-4f00-4ebf-974d-53f69c43654e
 public List <CrudeClientContract> FetchByClientTitleRcd(string clientTitleRcd)
 {
     return(DataListToContractList(CrudeClientData.FetchByClientTitleRcd(clientTitleRcd)));
 }
Exemple #29
0
        public void PromotionMakeBooking(
            Guid servicePackagePromotionId,
            Guid userId
            )
        {
            Logging log =
                Logging.PerformanceTimeStart(
                    "Service",
                    "BusinessLogicLayer",
                    "ServiceService",
                    "PromotionMakeBooking",
                    userId
                    );

            using (var connection = new SqlConnection(Conn.ConnectionString)) {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();

                var promotionData = CrudeServicePackagePromotionData.GetByServicePackagePromotionId(servicePackagePromotionId);
                var packageData   = CrudeServicePackageData.GetByServicePackageId(promotionData.ServicePackageId);
                var clientData    = CrudeClientData.GetByClientId(promotionData.ClientId);
                var contactData   = CrudeClientContactMethodData.GetCurrentMail(promotionData.ClientId);

                // get flights
                // make booking
                var             bookingService = new BookingService();
                BookingContract booking        = bookingService.GetBookingEmpty(userId);

                // save booking
                // todo, transaction
                booking.Booking.BookingId =
                    bookingService.UpdateBooking(
                        booking.Booking.BookingId,
                        booking.Booking.BookingSourceRcd,
                        booking.BookingIdentifier.BookingIdentifierValue,
                        contactData.ContactMethodWay,
                        "PromotionMakeBooking",
                        string.Empty,
                        booking.Booking.FinancialCurrencyId,
                        booking.Booking.FinancialCostcentreId,
                        userId
                        );

                // flights
                if (packageData.DepartureAirportId != Guid.Empty)
                {
                    Guid flightId =
                        Flight.GetFlightMatching(
                            packageData.DepartureAirportId,
                            packageData.ArrivalAirportId
                            );

                    if (flightId != Guid.Empty)
                    {
                        bookingService.FlightAdd(
                            booking.Booking.BookingId,
                            flightId,
                            userId
                            );
                    }
                }

                // passengers
                bookingService.PassengerAdd(
                    booking.Booking.BookingId,
                    PassengerTypeRef.Adult,
                    clientData.FirstName + ' ' + clientData.MiddleName + ' ' + clientData.LastName,
                    userId
                    );

                // services (SSR)
                if (packageData.ServiceSpecialServiceRequestId != Guid.Empty)
                {
                    bookingService.BookingServiceSpecialServiceRequestAdd(
                        booking.Booking.BookingId,
                        packageData.ServiceSpecialServiceRequestId,
                        userId
                        );
                }

                // services (Hotel)
                if (packageData.ServiceHotelId != Guid.Empty)
                {
                    bookingService.BookingServiceHotelAdd(
                        booking.Booking.BookingId,
                        packageData.ServiceHotelId,
                        userId
                        );
                }

                // services (Car)
                if (packageData.ServiceCarRentalId != Guid.Empty)
                {
                    bookingService.BookingServiceCarRentalAdd(
                        booking.Booking.BookingId,
                        packageData.ServiceCarRentalId,
                        userId
                        );
                }

                // confirm booking
                bookingService.BookingConfirm(
                    booking.Booking.BookingId,
                    userId
                    );

                try {
                    transaction.Commit();
                    log.PerformanceTimeStop();
                } catch (Exception ex) {
                    transaction.Rollback();
                    log.Error(ex);
                    throw ex;
                }
            }
        }
Exemple #30
0
 // fetch by Search key into current object
 // links:
 //  crud definition: https://en.wikipedia.org/wiki/Create,_read,_update_and_delete
 //  docLink: http://sql2x.org/documentationLink/87368fa6-b618-4f0c-acbb-1fc4e273bb2d
 // parameters:
 //  DefaultUserId: key of table CrudeClientData
 public List <CrudeClientModel> FetchByDefaultUserId(System.Guid defaultUserId)
 {
     return(DataListToModelList(CrudeClientData.FetchByDefaultUserId(defaultUserId)));
 }