Exemplo n.º 1
1
        public AppointmentGetResponse AppointmentGet(AppointmentGetRequest request)
        {
            AppointmentGetResponse response = new AppointmentGetResponse();

            try
            {
                //Request body-header object validation
                response.Errors = GetErrorDataListFromRequestTransactionHeader(request.TransactionHeader);
                if (response.Errors != null)
                {
                    response.TransactionHeader = new Data.v2.Common.Common.TransactionHeader();
                    return response;
                }
                response.Errors = GetErrorDataListFromRequest(request.AppointmentGet);
                if (response.Errors != null)
                {
                    response.TransactionHeader = request.TransactionHeader;
                    return response;
                }

                using (Appointment_Biz biz = new Appointment_Biz())
                {
                    response = biz.AppointmentGet(request);
                }
            }
            catch (Exception ex)
            {
                response.Errors = GetErrorDataListFromException(ex);
                WA.Standard.IF.Logger.Log.Log.RootLogger.ErrorFormat("AppointmentGetResponse Error {0}: ", ex);
            }

            return response;
        }
Exemplo n.º 2
0
        public AppointmentGetResponse AppointmentGet(AppointmentGetRequest request)
        {
            AppointmentGetResponse response = new AppointmentGetResponse();

            //DMS information set by dealer information
            string proxypath = string.Format("{0}.{1}.{2}",
                request.TransactionHeader.DocumentVersion,
                request.TransactionHeader.DMSCode,
                request.TransactionHeader.DMSVersion);

            switch (proxypath)
            {
                case "v2.WA.v2":
                    {
                        WA.v2.ProxyService proxyservice = new WA.v2.ProxyService();
                        response = proxyservice.AppointmentGet(request);
                    }
                    break;
                case "v2.1C.v8241":
                    {
                        _1C.v8241.ProxyService proxyservice = new _1C.v8241.ProxyService();
                        response = proxyservice.AppointmentGet(request);
                    }
                    break;
                default: response.TransactionHeader = request.TransactionHeader; response.Errors = new List<Error>() { new Error() { Code = ResponseCode.WA_NoMatchedProxy, Message = ResponseMessage.NoMatchedProxy } };
                    break;
            }

            return response;
        }
Exemplo n.º 3
0
        public AppointmentGetResponse AppointmentGet(AppointmentGetRequest request)
        {
            AppointmentGetResponse response = new AppointmentGetResponse();

            try
            {
                WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "WA AppointmentGetRequest XML", request);

                //Request body-header object validation
                response.Errors = GetErrorDataListFromRequestTransactionHeader(request.TransactionHeader);
                if (response.Errors != null)
                {
                    response.TransactionHeader = new Data.v2.Common.Common.TransactionHeader();
                }
                response.Errors = GetErrorDataListFromRequest(request.AppointmentGet);
                if (response.Errors != null)
                {
                    response.TransactionHeader = request.TransactionHeader;
                }

                if (response.Errors == null)
                {
                    using (Appointment_Biz biz = new Appointment_Biz())
                    {
                        response = biz.AppointmentGet(request);
                    }

                    WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "WA AppointmentGetResponse XML", response);
                }
            }
            catch (Exception ex)
            {
                response.Errors = GetErrorDataListFromException(ex);
                WA.Standard.IF.Logger.Log.Log.SaveErrorLog(null, "AppointmentGet", request, ex.Message, ex);
            }

            return response;
        }
Exemplo n.º 4
0
        public AppointmentGetResponse AppointmentGet(AppointmentGetRequest request)
        {
            AppointmentGetResponse response = new AppointmentGetResponse();

            if (WA.Standard.IF.Logger.Log.Log.RunningMode.Equals(WA.Standard.IF.Data.v2.Common.Common.RunningMode.Mapper))
            {
                #region For Mapper Process
                WA.Standard.IF.Proxy.v2.Common.Appointment_Proxy proxy = new Proxy.v2.Common.Appointment_Proxy();
                response = proxy.AppointmentGet(request);
                #endregion
            }
            else if (WA.Standard.IF.Logger.Log.Log.RunningMode.Equals(WA.Standard.IF.Data.v2.Common.Common.RunningMode.XMLDMS))
            {
                response.TransactionHeader = request.TransactionHeader;

                #region For XML Process
                List<Appointment> Appointments = Util.DataHelper.GetListByElementName<Appointment>(System.Web.HttpContext.Current.Server.MapPath("/v2/Repository/Appointments.xml"), "Appointment");

                if (Appointments != null && Appointments.Count > 0)
                {
                    List<Appointment> resultlist = Appointments
                        .Where(item =>
                            ((request.AppointmentGet.AppointmentDateTimeFromLocal == null || item.AppointmentDateTimeLocal >= request.AppointmentGet.AppointmentDateTimeFromLocal)
                                && (request.AppointmentGet.AppointmentDateTimeToLocal == null || item.AppointmentDateTimeLocal <= request.AppointmentGet.AppointmentDateTimeToLocal) && (string.IsNullOrEmpty(request.AppointmentGet.DMSAppointmentID) || item.DMSAppointmentID == request.AppointmentGet.DMSAppointmentID)
                                && (string.IsNullOrEmpty(request.AppointmentGet.DMSAppointmentNo) || item.DMSAppointmentNo == request.AppointmentGet.DMSAppointmentNo)
                                && (string.IsNullOrEmpty(request.AppointmentGet.DMSAppointmentStatus) || item.DMSAppointmentStatus == request.AppointmentGet.DMSAppointmentStatus)
                                && (request.AppointmentGet.LastModifiedDateTimeFromUTC == null || item.ManagementFields.LastModifiedDateTimeUTC >= request.AppointmentGet.LastModifiedDateTimeFromUTC)
                                && (request.AppointmentGet.LastModifiedDateTimeToUTC == null || item.ManagementFields.LastModifiedDateTimeUTC <= request.AppointmentGet.LastModifiedDateTimeToUTC)
                                && (string.IsNullOrEmpty(request.AppointmentGet.SAEmployeeID) || item.SAEmployeeID == request.AppointmentGet.SAEmployeeID)
                                && (string.IsNullOrEmpty(request.AppointmentGet.SAEmployeeName) || item.SAEmployeeName == request.AppointmentGet.SAEmployeeName)
                                && (string.IsNullOrEmpty(request.AppointmentGet.TCEmployeeID) || item.TCEmployeeID == request.AppointmentGet.TCEmployeeID)
                                && (string.IsNullOrEmpty(request.AppointmentGet.TCEmployeeName) || item.TCEmployeeName == request.AppointmentGet.TCEmployeeName)
                                //Need to add condition, Contacts
                            )
                            &&
                            (request.AppointmentGet.Vehicle == null || (request.AppointmentGet.Vehicle != null
                                && (string.IsNullOrEmpty(request.AppointmentGet.Vehicle.DMSVehicleNo) || request.AppointmentGet.Vehicle.DMSVehicleNo == item.Vehicle.DMSVehicleNo)
                                && (string.IsNullOrEmpty(request.AppointmentGet.Vehicle.LastSixVIN) || request.AppointmentGet.Vehicle.LastSixVIN == item.Vehicle.LastSixVIN)
                                && (string.IsNullOrEmpty(request.AppointmentGet.Vehicle.VIN) || request.AppointmentGet.Vehicle.VIN == item.Vehicle.VIN))
                            )
                            ).ToList<Appointment>();

                    response.Appointments = resultlist;

                    if(resultlist.Count >0)
                        response.ResultMessage = GetResultMessageData(ResponseCode.Success, ResponseMessage.Success);
                    else
                        response.ResultMessage = GetResultMessageData(ResponseCode.NoResult, ResponseMessage.NoResult);
                }
                else
                {
                    response.ResultMessage = GetResultMessageData(ResponseCode.NoResult, ResponseMessage.NoResult);
                }
                #endregion
            }
            else if (WA.Standard.IF.Logger.Log.Log.RunningMode.Equals(WA.Standard.IF.Data.v2.Common.Common.RunningMode.DBDMS))
            {
                #region For DB Process
                /* For DB Process

                    DataSet resultDS = new DataSet();
                    using (Appointment_Dac dac = new Appointment_Dac())
                    {
                        if (request.AppointmentGet.Customer != null && request.AppointmentGet.Customer.Contacts != null)
                        {
                            foreach (WA.Standard.IF.Data.v2.Common.Appointment.Contact contact in request.AppointmentGet.Customer.Contacts)
                            {
                                DataSet ds = dac.SelectAppointment(request.TransactionHeader.CountryID
                                                                    , request.TransactionHeader.DistributorID
                                                                    , request.TransactionHeader.GroupID
                                                                    , request.TransactionHeader.DealerID
                                                                    , request.TransactionHeader.Language // Need to check
                                                                    , contact.ContactType
                                                                    , contact.ContactValue
                                                                    , request.AppointmentGet
                                                                    );
                                //Merging all data. Because same appointment could be return from sql server.
                                resultDS.Merge(ds);
                            }

                            //Remove duplicate rows by key field
                            if (resultDS.Tables != null)
                            {
                                for (int i = 0; i < resultDS.Tables.Count; i++)
                                {
                                    if (i == 0)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSAppointmentNo");
                                    else if (i == 1)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSJobNo");
                                    else if (i == 2)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSRONo");
                                    else if (i == 3)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSCustomerNo");
                                    else if (i == 4)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSAddressNo");
                                    else if (i == 5)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSContactNo");
                                    else if (i == 6)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSCorporateNo");
                                    else if (i == 7)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSVehicleNo");
                                    else if (i == 8)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSCampaignNo");
                                    else if (i == 9)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSAdditionalFieldNo");
                                    else if (i == 10)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSOptionNo");
                                    else if (i == 11)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "ServiceLineNumber");
                                    else if (i == 12)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "SequenceNumber");
                                    else if (i == 13)
                                        Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSPriceTypeNo");
                                }
                            }
                        }
                        else
                        {
                            resultDS = dac.SelectAppointment(request.TransactionHeader.CountryID
                                                                    , request.TransactionHeader.DistributorID
                                                                    , request.TransactionHeader.GroupID
                                                                    , request.TransactionHeader.DealerID
                                                                    , request.TransactionHeader.Language // Need to check
                                                                    , null //contact.ContactType
                                                                    , null //contact.ContactValue
                                                                    , request.AppointmentGet
                                                                    );
                        }
                    }

                    //0.Appointment & ManagementField
                    //1.JobRefs
                    //2.RORefs
                    //3.Customers
                    //4.Addresses
                    //5.Contacts
                    //6.CorporateInfos
                    //7.Vehicle
                    //8.Campaigns
                    //9.AdditionalFields
                    //10.Options
                    //11.RequestItems
                    //12.RequestItem Comments & Descriptions
                    //12.OPCodes & Descriptions & Causes & Corrections
                    //12.Parts & Descriptions
                    //12.MISCs & Descriptions
                    //12.Sublets & Descriptions
                    //13.AppointmentPrice & RequestItemPrice & OPPrice & PartPrice & MISCPrice & SubletPrice

                    //List<RODocument> RODocuments = null;
                    //List<RepairOrder> Appointments = null;
                    //List<AppointmentRef> AppointmentRefs = null;
                    //List<CustomerPart> CustomerParts = null;

                    List<Appointment> Appointments = null;
                    if (resultDS.Tables.Count > 0 && resultDS.Tables[0].Rows.Count > 0)
                    {
                        #region AppointmentGet

                        #region Appointments
                        Appointments = resultDS.Tables[0].AsEnumerable()
                            .Select(row =>
                        new Appointment
                        {
                            AppointmentChannel = Util.DataHelper.ConvertObjectToString(row["AppointmentChannel"]),
                            AppointmentDateTimeLocal = Util.DataHelper.ConvertObjectToDateTime(row["AppointmentDateTimeLocal"]),
                            CloseDateTimeLocal = Util.DataHelper.ConvertObjectToDateTime(row["CloseDateTimeLocal"]),
                            CustomerComment = Util.DataHelper.ConvertObjectToString(row["CustomerComment"]),
                            DeliveryDateTimeLocal = Util.DataHelper.ConvertObjectToDateTime(row["DeliveryDateTimeLocal"]),
                            DMSAppointmentID = Util.DataHelper.ConvertObjectToString(row["DMSAppointmentID"]),
                            DMSAppointmentNo = Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"]),
                            DMSAppointmentStatus = Util.DataHelper.ConvertObjectToString(row["DMSAppointmentStatus"]),
                            InMileage = Util.DataHelper.ConvertObjectToString(row["InMileage"]),
                            OpenDateTimeLocal = Util.DataHelper.ConvertObjectToDateTime(row["OpenDateTimeLocal"]),
                            PaymentMethod = Util.DataHelper.ConvertObjectToString(row["PaymentMethod"]),
                            SAEmployeeID = Util.DataHelper.ConvertObjectToString(row["SAEmployeeID"]),
                            SAEmployeeName = Util.DataHelper.ConvertObjectToString(row["SAEmployeeName"]),
                            ServiceType = Util.DataHelper.ConvertObjectToString(row["ServiceType"]),
                            TCEmployeeID = Util.DataHelper.ConvertObjectToString(row["TCEmployeeID"]),
                            TCEmployeeName = Util.DataHelper.ConvertObjectToString(row["TCEmployeeName"]),
                            WorkType = Util.DataHelper.ConvertObjectToString(row["WorkType"]),
                            ManagementFields = new ManagementFields()
                            {
                                CreateDateTimeUTC = Util.DataHelper.ConvertObjectToDateTime(row["CreateDateTimeUTC"]),
                                LastModifiedDateTimeUTC = Util.DataHelper.ConvertObjectToDateTime(row["LastModifiedDateTimeUTC"])
                            },
                            JobRefs = new List<JobRef>(),
                            RORefs = new List<RORef>(),
                            AdditionalFields = new List<AdditionalField>(),
                            Options = new List<Option>(),
                            PriceType = new PriceType(),
                            Customers = new List<Data.v2.Common.Customer.Customer>(),
                            Vehicle = new Data.v2.Common.Vehicle.Vehicle(),
                            RequestItems = new List<RequestItem>(),
                        }).ToList();
                        #endregion

                        if (Appointments != null && Appointments.Count > 0)
                        {
                            foreach (Appointment appointment in Appointments)
                            {
                                if (resultDS.Tables.Count > 1 && resultDS.Tables[1].Rows.Count > 0)
                                {
                                    #region JobRefs
                                    List<JobRef> JobRefs = null;
                                    JobRefs = resultDS.Tables[1].AsEnumerable()
                                        .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo)
                                        .Select(row =>
                                    new JobRef
                                    {
                                        DMSJobNo = Util.DataHelper.ConvertObjectToString(row["DMSJobNo"]),
                                        DMSJobStatus = Util.DataHelper.ConvertObjectToString(row["DMSJobStatus"]),
                                    }).ToList();
                                    if (JobRefs != null && JobRefs.Count > 0)
                                        appointment.JobRefs = JobRefs;
                                    #endregion

                                }

                                if (resultDS.Tables.Count > 2 && resultDS.Tables[2].Rows.Count > 0)
                                {
                                    #region RORefs
                                    List<RORef> RORefs = null;
                                    RORefs = resultDS.Tables[2].AsEnumerable()
                                        .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo)
                                        .Select(row =>
                                    new RORef
                                    {
                                        DMSRONo = Util.DataHelper.ConvertObjectToString(row["DMSRONo"]),
                                        DMSROStatus = Util.DataHelper.ConvertObjectToString(row["DMSROStatus"]),
                                    }).ToList();
                                    if (RORefs != null && RORefs.Count > 0)
                                        appointment.RORefs = RORefs;
                                    #endregion
                                }

                                if (resultDS.Tables.Count > 3 && resultDS.Tables[3].Rows.Count > 0)
                                {
                                    #region Customers & SpecialMessage
                                    List<WA.Standard.IF.Data.v2.Common.Customer.Customer> Customers = null;
                                    Customers = resultDS.Tables[3].AsEnumerable()
                                        .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo)
                                        .Select(row =>
                                    new WA.Standard.IF.Data.v2.Common.Customer.Customer
                                    {
                                        CardNo = Util.DataHelper.ConvertObjectToString(row["CardNo"]),
                                        CustomerInfoType = Util.DataHelper.ConvertObjectToString(row["CustomerInfoType"]),
                                        DMSCustomerNo = Util.DataHelper.ConvertObjectToString(row["DMSCustomerNo"]),
                                        Email = Util.DataHelper.ConvertObjectToString(row["Email"]),
                                        FirstName = Util.DataHelper.ConvertObjectToString(row["FirstName"]),
                                        FullName = Util.DataHelper.ConvertObjectToString(row["FullName"]),
                                        Gender = Util.DataHelper.ConvertObjectToString(row["Gender"]),
                                        LastName = Util.DataHelper.ConvertObjectToString(row["LastName"]),
                                        MiddleName = Util.DataHelper.ConvertObjectToString(row["MiddleName"]),
                                        Salutation = Util.DataHelper.ConvertObjectToString(row["Salutation"]),
                                        SpecialMessage = new SpecialMessage() { Message = Util.DataHelper.ConvertObjectToString(row["SpecialMessage"]) },
                                        Addresses = new List<Address>(),
                                        Contacts = new List<Data.v2.Common.Customer.Contact>(),
                                        CorporateInfos = new List<CorporateInfo>(),
                                    }).ToList();
                                    #endregion

                                    if (Customers != null && Customers.Count > 0)
                                    {
                                        foreach (WA.Standard.IF.Data.v2.Common.Customer.Customer customer in Customers)
                                        {
                                            if (resultDS.Tables.Count > 4 && resultDS.Tables[4].Rows.Count > 0)
                                            {
                                                #region Addresses
                                                List<Address> Addresses = null;
                                                Addresses = resultDS.Tables[4].AsEnumerable()
                                                    .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSCustomerNo"], null) == customer.DMSCustomerNo)
                                                    .Select(row =>
                                                new Address
                                                {
                                                    Address1 = Util.DataHelper.ConvertObjectToString(row["Address1"]),
                                                    Address2 = Util.DataHelper.ConvertObjectToString(row["Address2"]),
                                                    AddressType = Util.DataHelper.ConvertObjectToString(row["AddressType"]),
                                                    City = Util.DataHelper.ConvertObjectToString(row["City"]),
                                                    Country = Util.DataHelper.ConvertObjectToString(row["Country"]),
                                                    State = Util.DataHelper.ConvertObjectToString(row["State"]),
                                                    ZipCode = Util.DataHelper.ConvertObjectToString(row["ZipCode"]),
                                                }).ToList();
                                                if (Addresses != null && Addresses.Count > 0)
                                                    customer.Addresses = Addresses;
                                                #endregion
                                            }

                                            if (resultDS.Tables.Count > 5 && resultDS.Tables[5].Rows.Count > 0)
                                            {
                                                #region Contacts
                                                List<WA.Standard.IF.Data.v2.Common.Customer.Contact> Contacts = null;
                                                Contacts = resultDS.Tables[5].AsEnumerable()
                                                    .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSCustomerNo"], null) == customer.DMSCustomerNo)
                                                    .Select(row =>
                                                new WA.Standard.IF.Data.v2.Common.Customer.Contact
                                                {
                                                    ContactMethodYN = Util.DataHelper.ConvertObjectToString(row["ContactMethodYN"]),
                                                    ContactType = Util.DataHelper.ConvertObjectToString(row["ContactType"]),
                                                    ContactValue = Util.DataHelper.ConvertObjectToString(row["ContactValue"]),
                                                }).ToList();
                                                if (Contacts != null && Contacts.Count > 0)
                                                    customer.Contacts = Contacts;
                                                #endregion
                                            }

                                            if (resultDS.Tables.Count > 6 && resultDS.Tables[6].Rows.Count > 0)
                                            {
                                                #region CorporateInfos
                                                List<WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo> CorporateInfos = null;
                                                CorporateInfos = resultDS.Tables[6].AsEnumerable()
                                                    .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSCustomerNo"], null) == customer.DMSCustomerNo)
                                                    .Select(row =>
                                                new WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo
                                                {
                                                    Name = Util.DataHelper.ConvertObjectToString(row["Name"]),
                                                    Value = Util.DataHelper.ConvertObjectToString(row["Value"]),
                                                }).ToList();
                                                if (CorporateInfos != null && CorporateInfos.Count > 0)
                                                    customer.CorporateInfos = CorporateInfos;
                                                #endregion
                                            }
                                        }
                                        appointment.Customers = Customers;
                                    }
                                }

                                if (resultDS.Tables.Count > 7 && resultDS.Tables[7].Rows.Count > 0)
                                {
                                    #region Vehicles
                                    List<WA.Standard.IF.Data.v2.Common.Vehicle.Vehicle> Vehicles = null;
                                    Vehicles = resultDS.Tables[7].AsEnumerable()
                                        .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo)
                                        .Select(row =>
                                    new WA.Standard.IF.Data.v2.Common.Vehicle.Vehicle
                                    {
                                        Color = Util.DataHelper.ConvertObjectToString(row["Color"]),
                                        Cylinders = Util.DataHelper.ConvertObjectToString(row["Cylinders"]),
                                        DateDelivered = Util.DataHelper.ConvertObjectToDateTime(row["DateDelivered"]),
                                        DateInService = Util.DataHelper.ConvertObjectToDateTime(row["DateInService"]),
                                        DeclinedJob = Util.DataHelper.ConvertObjectToString(row["DeclinedJob"]),
                                        DisplayDescription = Util.DataHelper.ConvertObjectToString(row["DisplayDescription"]),
                                        DMSCustomerNo = Util.DataHelper.ConvertObjectToString(row["DMSCustomerNo"]),
                                        DMSVehicleNo = Util.DataHelper.ConvertObjectToString(row["DMSVehicleNo"]),
                                        EngineType = Util.DataHelper.ConvertObjectToString(row["EngineType"]),
                                        ExtendedWarranty = Util.DataHelper.ConvertObjectToDateTime(row["ExtendedWarranty"]),
                                        FuelType = Util.DataHelper.ConvertObjectToString(row["FuelType"]),
                                        FullModelName = Util.DataHelper.ConvertObjectToString(row["FullModelName"]),
                                        InsuranceDate = Util.DataHelper.ConvertObjectToDateTime(row["InsuranceDate"]),
                                        LastMileage = Util.DataHelper.ConvertObjectToString(row["LastMileage"]),
                                        LastServiceDate = Util.DataHelper.ConvertObjectToDateTime(row["LastServiceDate"]),
                                        LastSixVIN = Util.DataHelper.ConvertObjectToString(row["LastSixVIN"]),
                                        LicenseNumber = Util.DataHelper.ConvertObjectToString(row["LicenseNumber"]),
                                        LicensePlateNo = Util.DataHelper.ConvertObjectToString(row["LicensePlateNo"]),
                                        Make = Util.DataHelper.ConvertObjectToString(row["Make"]),
                                        ModelCode = Util.DataHelper.ConvertObjectToString(row["ModelCode"]),
                                        ModelName = Util.DataHelper.ConvertObjectToString(row["ModelName"]),
                                        ModelYear = Util.DataHelper.ConvertObjectToString(row["ModelYear"]),
                                        PendingJob = Util.DataHelper.ConvertObjectToString(row["PendingJob"]),
                                        StockNumber = Util.DataHelper.ConvertObjectToString(row["StockNumber"]),
                                        Trim = Util.DataHelper.ConvertObjectToString(row["Trim"]),
                                        VehicleType = Util.DataHelper.ConvertObjectToString(row["VehicleType"]),
                                        VIN = Util.DataHelper.ConvertObjectToString(row["VIN"]),
                                        WarrantyMiles = Util.DataHelper.ConvertObjectToString(row["WarrantyMiles"]),
                                        WarrantyMonths = Util.DataHelper.ConvertObjectToString(row["WarrantyMonths"]),
                                        WarrantyStartDate = Util.DataHelper.ConvertObjectToDateTime(row["WarrantyStartDate"]),
                                        Campaigns = new List<Campaign>(),
                                    }).ToList();
                                    #endregion

                                    if (Vehicles != null && Vehicles.Count > 0 && resultDS.Tables.Count > 8 && resultDS.Tables[8].Rows.Count > 0)
                                    {
                                        foreach (WA.Standard.IF.Data.v2.Common.Vehicle.Vehicle vehicle in Vehicles)
                                        {
                                            #region Campaigns
                                            List<WA.Standard.IF.Data.v2.Common.Vehicle.Campaign> Campaigns = null;
                                            Campaigns = resultDS.Tables[8].AsEnumerable()
                                                .Where(row => Util.DataHelper.ConvertObjectToString(row["VIN"], null) == vehicle.VIN)
                                                .Select(row =>
                                            new WA.Standard.IF.Data.v2.Common.Vehicle.Campaign
                                            {
                                                CampaignDescription = Util.DataHelper.ConvertObjectToString(row["CampaignDescription"]),
                                                CampaignID = Util.DataHelper.ConvertObjectToString(row["CampaignID"]),
                                                CampaignPerformed = Util.DataHelper.ConvertObjectToString(row["CampaignPerformed"]),
                                            }).ToList();
                                            if (Campaigns != null && Campaigns.Count > 0)
                                                vehicle.Campaigns = Campaigns;
                                            #endregion
                                        }
                                        appointment.Vehicle = Vehicles[0];
                                    }
                                }

                                if (resultDS.Tables.Count > 9 && resultDS.Tables[9].Rows.Count > 0)
                                {
                                    #region AdditionalFields
                                    List<AdditionalField> AdditionalFields = null;
                                    AdditionalFields = resultDS.Tables[9].AsEnumerable()
                                        .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo)
                                        .Select(row =>
                                    new AdditionalField
                                    {
                                        Name = Util.DataHelper.ConvertObjectToString(row["Name"]),
                                        Value = Util.DataHelper.ConvertObjectToString(row["Value"]),
                                    }).ToList();
                                    if (AdditionalFields != null && AdditionalFields.Count > 0)
                                        appointment.AdditionalFields = AdditionalFields;
                                    #endregion
                                }

                                if (resultDS.Tables.Count > 10 && resultDS.Tables[10].Rows.Count > 0)
                                {
                                    #region Options
                                    List<Option> Options = null;
                                    Options = resultDS.Tables[10].AsEnumerable()
                                        .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo)
                                        .Select(row =>
                                    new Option
                                    {
                                        Name = Util.DataHelper.ConvertObjectToString(row["Name"]),
                                        Value = Util.DataHelper.ConvertObjectToString(row["Value"]),
                                    }).ToList();
                                    if (Options != null && Options.Count > 0)
                                        appointment.Options = Options;
                                    #endregion
                                }

                                if (resultDS.Tables.Count > 11 && resultDS.Tables[11].Rows.Count > 0)
                                {
                                    #region RequestItems
                                    List<RequestItem> RequestItems = null;
                                    RequestItems = resultDS.Tables[11].AsEnumerable()
                                        .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo)
                                        .Select(row =>
                                    new RequestItem
                                    {
                                        CPSIND = Util.DataHelper.ConvertObjectToString(row["CPSIND"]),
                                        RequestCode = Util.DataHelper.ConvertObjectToString(row["RequestCode"]),
                                        RequestDescription = Util.DataHelper.ConvertObjectToString(row["RequestDescription"]),
                                        ServiceLineNumber = Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"]),
                                        ServiceLineStatus = Util.DataHelper.ConvertObjectToString(row["ServiceLineStatus"]),
                                        ServiceType = Util.DataHelper.ConvertObjectToString(row["ServiceType"]),
                                        TCEmployeeID = Util.DataHelper.ConvertObjectToString(row["TCEmployeeID"]),
                                        TCEmployeeName = Util.DataHelper.ConvertObjectToString(row["TCEmployeeName"]),
                                        WorkType = Util.DataHelper.ConvertObjectToString(row["WorkType"]),
                                        OPCodes = new List<OPCode>(),
                                        Comments = new List<Comment>(),
                                        Descriptions = new List<Description>(),
                                    }).ToList();
                                    #endregion

                                    if (RequestItems != null && RequestItems.Count > 0 && resultDS.Tables.Count > 12 && resultDS.Tables[12].Rows.Count > 0)
                                    {
                                        //12.RequestItem Comments & Descriptions
                                        //12.OPCodes & Descriptions & Causes & Corrections
                                        //12.Parts & Descriptions
                                        //12.MISCs & Descriptions
                                        //12.Sublets & Descriptions
                                        //13.AppointmentPrice & RequestItemPrice & OPPrice & PartPrice & MISCPrice & SubletPrice
                                        foreach (RequestItem requestitem in RequestItems)
                                        {
                                            #region RequestItemComments
                                            List<Comment> RequestItemComments = null;
                                            RequestItemComments = resultDS.Tables[12].AsEnumerable()
                                                       .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                        && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                        && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._Request
                                                        && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Comment
                                                        )
                                                .Select(row =>
                                            new Comment
                                            {
                                                SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                DescriptionComment = Util.DataHelper.ConvertObjectToString(row["Description"]),
                                            }).ToList();
                                            if (RequestItemComments != null && RequestItemComments.Count > 0)
                                                requestitem.Comments = RequestItemComments;
                                            #endregion

                                            #region RequestItemDescriptions
                                            List<Description> RequestItemDescriptions = null;
                                            RequestItemDescriptions = resultDS.Tables[12].AsEnumerable()
                                                       .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                        && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                        && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._Request
                                                        && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Description
                                                        )
                                                .Select(row =>
                                            new Description
                                            {
                                                SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                DescriptionComment = Util.DataHelper.ConvertObjectToString(row["Description"]),
                                            }).ToList();
                                            if (RequestItemDescriptions != null && RequestItemDescriptions.Count > 0)
                                                requestitem.Descriptions = RequestItemDescriptions;
                                            #endregion

                                            #region OPCodes
                                            List<OPCode> OPCodes = null;
                                            OPCodes = resultDS.Tables[12].AsEnumerable()
                                                       .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                        && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                        && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._OPCode
                                                        && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Request
                                                        )
                                                .Select(row =>
                                            new OPCode
                                            {
                                                ActualHours = Util.DataHelper.ConvertObjectToDouble(row["ActualHours"]),
                                                Code = Util.DataHelper.ConvertObjectToString(row["OPCode"]),
                                                Description = Util.DataHelper.ConvertObjectToString(row["Description"]),
                                                EstimatedHours = Util.DataHelper.ConvertObjectToDouble(row["EstimatedHours"]),
                                                SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                ServiceType = Util.DataHelper.ConvertObjectToString(row["ServiceType"]),
                                                SkillLevel = Util.DataHelper.ConvertObjectToString(row["SkillLevel"]),
                                                Causes = new List<Cause>(),
                                                Corrections = new List<Correction>(),
                                                Descriptions = new List<Description>(),
                                                PriceType = new PriceType(),
                                                Parts = new List<Part>(),
                                                Sublets = new List<Sublet>(),
                                                MISCs = new List<MISC>(),
                                            }).ToList();
                                            #endregion

                                            if (OPCodes != null && OPCodes.Count > 0)
                                            {
                                                foreach (OPCode opcode in OPCodes)
                                                {
                                                    #region OPCodeDescriptions
                                                    List<Description> OPCodeDescriptions = null;
                                                    OPCodeDescriptions = resultDS.Tables[12].AsEnumerable()
                                                       .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                        && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                        && Util.DataHelper.ConvertObjectToString(row["OPCode"], null) == opcode.Code
                                                        && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._OPCode
                                                        && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Description
                                                        )
                                                        .Select(row =>
                                                    new Description
                                                    {
                                                        SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                        DescriptionComment = Util.DataHelper.ConvertObjectToString(row["Description"]),
                                                    }).ToList();
                                                    if (OPCodeDescriptions != null && OPCodeDescriptions.Count > 0)
                                                        opcode.Descriptions = OPCodeDescriptions;
                                                    #endregion

                                                    #region OPCodeCauses
                                                    List<Cause> OPCodeCauses = null;
                                                    OPCodeCauses = resultDS.Tables[12].AsEnumerable()
                                                       .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                        && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                        && Util.DataHelper.ConvertObjectToString(row["OPCode"], null) == opcode.Code
                                                        && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._OPCode
                                                        && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Cause
                                                        )
                                                        .Select(row =>
                                                    new Cause
                                                    {
                                                        CauseLaborOpCode = Util.DataHelper.ConvertObjectToString(row["CauseLaborOpCode"]),
                                                        Comment = Util.DataHelper.ConvertObjectToString(row["Description"]),
                                                        SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                    }).ToList();
                                                    if (OPCodeCauses != null && OPCodeCauses.Count > 0)
                                                        opcode.Causes = OPCodeCauses;
                                                    #endregion

                                                    #region OPCodeCorrections
                                                    List<Correction> OPCodeCorrections = null;
                                                    OPCodeCorrections = resultDS.Tables[12].AsEnumerable()
                                                       .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                        && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                        && Util.DataHelper.ConvertObjectToString(row["OPCode"], null) == opcode.Code
                                                        && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._OPCode
                                                        && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Correction
                                                        )
                                                        .Select(row =>
                                                    new Correction
                                                    {
                                                        CorrectionLaborOpCode = Util.DataHelper.ConvertObjectToString(row["CauseLaborOpCode"]),
                                                        Comment = Util.DataHelper.ConvertObjectToString(row["Description"]),
                                                        SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                    }).ToList();
                                                    if (OPCodeCorrections != null && OPCodeCorrections.Count > 0)
                                                        opcode.Corrections = OPCodeCorrections;
                                                    #endregion

                                                    #region Parts
                                                    List<Part> Parts = null;
                                                    Parts = resultDS.Tables[12].AsEnumerable()
                                                       .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                        && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                        && Util.DataHelper.ConvertObjectToString(row["OPCode"], null) == opcode.Code
                                                        && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._Part
                                                        && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Request
                                                        )
                                                        .Select(row =>
                                                    new Part
                                                    {
                                                        DisplayPartNumber = Util.DataHelper.ConvertObjectToString(row["PartNumber"]),
                                                        PartDescription = Util.DataHelper.ConvertObjectToString(row["Description"]),
                                                        PartNumber = Util.DataHelper.ConvertObjectToString(row["PartNumber"]),
                                                        PartType = Util.DataHelper.ConvertObjectToString(row["PartType"]),
                                                        Quantity = Util.DataHelper.ConvertObjectToDouble(row["Quantity"]),
                                                        SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                        ServiceType = Util.DataHelper.ConvertObjectToString(row["ServiceType"]),
                                                        StockQuantity = Util.DataHelper.ConvertObjectToDouble(row["StockQuantity"]),
                                                        StockStatus = Util.DataHelper.ConvertObjectToString(row["StockStatus"]),
                                                        UnitOfMeasure = Util.DataHelper.ConvertObjectToString(row["UnitOfMeasure"]),
                                                        Descriptions = new List<Description>(),
                                                        PriceType = new PriceType(),
                                                    }).ToList();
                                                    #endregion

                                                    if (Parts != null && Parts.Count > 0)
                                                    {
                                                        foreach (Part part in Parts)
                                                        {
                                                            #region PartDescriptions
                                                            List<Description> PartDescriptions = null;
                                                            PartDescriptions = resultDS.Tables[12].AsEnumerable()
                                                               .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                                && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                                && Util.DataHelper.ConvertObjectToString(row["OPCode"], null) == opcode.Code
                                                                && Util.DataHelper.ConvertObjectToString(row["PartNumber"], null) == part.PartNumber
                                                                && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._Part
                                                                && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Description
                                                                )
                                                                .Select(row =>
                                                            new Description
                                                            {
                                                                SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                                DescriptionComment = Util.DataHelper.ConvertObjectToString(row["Description"]),
                                                            }).ToList();
                                                            if (PartDescriptions != null && PartDescriptions.Count > 0)
                                                                part.Descriptions = PartDescriptions;
                                                            #endregion
                                                        }
                                                        opcode.Parts = Parts;
                                                    }

                                                    #region Sublets
                                                    List<Sublet> Sublets = null;
                                                    Sublets = resultDS.Tables[12].AsEnumerable()
                                                       .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                        && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                        && Util.DataHelper.ConvertObjectToString(row["OPCode"], null) == opcode.Code
                                                        && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._Sublet
                                                        && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Request
                                                        )
                                                        .Select(row =>
                                                    new Sublet
                                                    {
                                                        SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                        ServiceType = Util.DataHelper.ConvertObjectToString(row["ServiceType"]),
                                                        Descriptions = new List<Description>(),
                                                        PriceType = new PriceType(),
                                                    }).ToList();
                                                    #endregion

                                                    if (Sublets != null && Sublets.Count > 0)
                                                    {
                                                        foreach (Sublet sublet in Sublets)
                                                        {
                                                            #region SubletDescriptions
                                                            List<Description> SubletDescriptions = null;
                                                            SubletDescriptions = resultDS.Tables[12].AsEnumerable()
                                                               .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                                && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                                && Util.DataHelper.ConvertObjectToString(row["OPCode"], null) == opcode.Code
                                                                && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._Sublet
                                                                && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Description
                                                                )
                                                                .Select(row =>
                                                            new Description
                                                            {
                                                                SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                                DescriptionComment = Util.DataHelper.ConvertObjectToString(row["Description"]),
                                                            }).ToList();
                                                            if (SubletDescriptions != null && SubletDescriptions.Count > 0)
                                                                sublet.Descriptions = SubletDescriptions;
                                                            #endregion
                                                        }
                                                        opcode.Sublets = Sublets;
                                                    }

                                                    #region MISCs
                                                    List<MISC> MISCs = null;
                                                    MISCs = resultDS.Tables[12].AsEnumerable()
                                                       .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                        && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                        && Util.DataHelper.ConvertObjectToString(row["OPCode"], null) == opcode.Code
                                                        && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._MISC
                                                        && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Request
                                                        )
                                                        .Select(row =>
                                                    new MISC
                                                    {
                                                        SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                        ServiceType = Util.DataHelper.ConvertObjectToString(row["ServiceType"]),
                                                        Descriptions = new List<Description>(),
                                                        PriceType = new PriceType(),
                                                    }).ToList();
                                                    #endregion

                                                    if (MISCs != null && MISCs.Count > 0)
                                                    {
                                                        foreach (MISC misc in MISCs)
                                                        {
                                                            #region MISCDescriptions
                                                            List<Description> MISCDescriptions = null;
                                                            MISCDescriptions = resultDS.Tables[12].AsEnumerable()
                                                               .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSAppointmentNo"], null) == appointment.DMSAppointmentNo
                                                                && Util.DataHelper.ConvertObjectToString(row["ServiceLineNumber"], null) == requestitem.ServiceLineNumber
                                                                && Util.DataHelper.ConvertObjectToString(row["OPCode"], null) == opcode.Code
                                                                && Util.DataHelper.ConvertObjectToString(row["LineType"], null) == WA.Standard.IF.Biz.v2.Base.LineType._MISC
                                                                && Util.DataHelper.ConvertObjectToString(row["TransCode"], null) == WA.Standard.IF.Biz.v2.Base.TransCode._Description
                                                                )
                                                                .Select(row =>
                                                            new Description
                                                            {
                                                                SequenceNumber = Util.DataHelper.ConvertObjectToString(row["SequenceNumber"]),
                                                                DescriptionComment = Util.DataHelper.ConvertObjectToString(row["Description"]),
                                                            }).ToList();
                                                            if (MISCDescriptions != null && MISCDescriptions.Count > 0)
                                                                misc.Descriptions = MISCDescriptions;
                                                            #endregion
                                                        }
                                                        opcode.MISCs = MISCs;
                                                    }
                                                }
                                                requestitem.OPCodes = OPCodes;
                                            }

                                        }
                                        appointment.RequestItems = RequestItems;
                                    }
                                }

                                if (resultDS.Tables.Count > 13 && resultDS.Tables[13].Rows.Count > 0)
                                {
                                    #region PriceTypes - Not Yet

                                    #endregion
                                }

                            }
                            response.ResultMessage = GetResultMessageData(PredefinedCode._SuccessDone, PredefinedMessage._SuccessDone);
                            response.Appointments = Appointments;
                        }
                        #endregion
                    }
                    else
                    {
                        response.ResultMessage = GetResultMessageData(PredefinedCode._SuccessNoResult, PredefinedMessage._SuccessNoResult);
                    }
                 */
                #endregion
            }

            return response;
        }
Exemplo n.º 5
0
        public AppointmentGetResponse AppointmentGet(AppointmentGetRequest request)
        {
            AppointmentGetResponse response = new AppointmentGetResponse();

            //DMS information set by dealer information
            string proxypath = string.Format("{0}.{1}.{2}.{3}",
                request.TransactionHeader.DocumentVersion,
                request.TransactionHeader.DistributorID,
                request.TransactionHeader.DMSCode,
                request.TransactionHeader.DMSVersion);

            switch (proxypath)
            {
                case "v2.Common.WA.v2":
                    {
                        #region v2.Common.WA.v2 - Standard (Proxy Class Dll Name : _WA.Mapper.v2)

                        #region AppointmentGet Request Set

                        //Create proxy credential
                        NetworkCredential proxycredential = new NetworkCredential(request.TransactionHeader.Username, request.TransactionHeader.Password);

                        //Create proxy web service from dms web service with credential
                        _WA.Mapper.v2.Appointment.Appointment proxyws = new _WA.Mapper.v2.Appointment.Appointment(request.TransactionHeader.DMSServerUrl);
                        proxyws.Credentials = proxycredential;

                        //Create proxy request with appointmentget and transaction
                        _WA.Mapper.v2.Appointment.AppointmentGetRequest proxyrequest = new _WA.Mapper.v2.Appointment.AppointmentGetRequest();

                        //Create proxy transaction
                        _WA.Mapper.v2.Appointment.TransactionHeader proxytransactionheader = new _WA.Mapper.v2.Appointment.TransactionHeader();
                        if (request.TransactionHeader != null)
                        {
                            #region//TransactionHeader Set
                            proxytransactionheader.CountryID = request.TransactionHeader.CountryID;
                            proxytransactionheader.DealerID = request.TransactionHeader.DealerID;
                            proxytransactionheader.DistributorID = request.TransactionHeader.DistributorID;
                            proxytransactionheader.DMSCode = request.TransactionHeader.DMSCode;
                            proxytransactionheader.DMSServerUrl = request.TransactionHeader.DMSServerUrl;
                            proxytransactionheader.DMSVersion = request.TransactionHeader.DMSVersion;
                            proxytransactionheader.DocumentVersion = request.TransactionHeader.DocumentVersion;
                            proxytransactionheader.GroupID = request.TransactionHeader.GroupID;
                            proxytransactionheader.IneterfaceID = request.TransactionHeader.IneterfaceID;
                            proxytransactionheader.Password = request.TransactionHeader.Password;
                            proxytransactionheader.PollingToken = request.TransactionHeader.PollingToken;
                            proxytransactionheader.RequestPollingToken = request.TransactionHeader.RequestPollingToken;
                            proxytransactionheader.RequestType = request.TransactionHeader.RequestType;
                            proxytransactionheader.TransactionId = request.TransactionHeader.TransactionId;
                            proxytransactionheader.TransactionDateTimeLocal = request.TransactionHeader.TransactionDateTimeLocal;
                            proxytransactionheader.TransactionDateTimeUTC = request.TransactionHeader.TransactionDateTimeUTC;
                            proxytransactionheader.TransactionType = request.TransactionHeader.TransactionType;
                            proxytransactionheader.Username = request.TransactionHeader.Username;
                            proxytransactionheader.VenderTrackingCode = request.TransactionHeader.VenderTrackingCode;
                            proxyrequest.TransactionHeader = proxytransactionheader;
                            #endregion
                        }

                        //Create proxy appointmentget
                        _WA.Mapper.v2.Appointment.AppointmentGet proxyappointmentget = new _WA.Mapper.v2.Appointment.AppointmentGet();
                        if (request.AppointmentGet != null)
                        {
                            #region//AppointmentGet Set
                            proxyappointmentget.AppointmentDateTimeFromLocal = request.AppointmentGet.AppointmentDateTimeFromLocal;
                            proxyappointmentget.AppointmentDateTimeToLocal = request.AppointmentGet.AppointmentDateTimeFromLocal;
                            proxyappointmentget.DMSAppointmentID = request.AppointmentGet.DMSAppointmentID;
                            proxyappointmentget.DMSAppointmentNo = request.AppointmentGet.DMSAppointmentNo;
                            proxyappointmentget.DMSAppointmentStatus = request.AppointmentGet.DMSAppointmentStatus;
                            proxyappointmentget.LastModifiedDateTimeFromUTC = request.AppointmentGet.LastModifiedDateTimeFromUTC;
                            proxyappointmentget.LastModifiedDateTimeToUTC = request.AppointmentGet.LastModifiedDateTimeToUTC;
                            proxyappointmentget.SAEmployeeID = request.AppointmentGet.SAEmployeeID;
                            proxyappointmentget.SAEmployeeName = request.AppointmentGet.SAEmployeeName;
                            proxyappointmentget.TCEmployeeID = request.AppointmentGet.TCEmployeeID;
                            proxyappointmentget.TCEmployeeName = request.AppointmentGet.TCEmployeeName;
                            if (request.AppointmentGet.Customer != null)
                            {
                                _WA.Mapper.v2.Appointment.Customer proxycustomer = new _WA.Mapper.v2.Appointment.Customer();
                                proxycustomer.DMSCustomerNo = request.AppointmentGet.Customer.DMSCustomerNo;
                                proxycustomer.LastName = request.AppointmentGet.Customer.LastName;

                                if (request.AppointmentGet.Customer.Contacts != null && request.AppointmentGet.Customer.Contacts.Count > 0)
                                {
                                    int cnt = 0;
                                    proxycustomer.Contacts = new _WA.Mapper.v2.Appointment.Contact[request.AppointmentGet.Customer.Contacts.Count];
                                    foreach (WA.Standard.IF.Data.v2.Common.Appointment.Contact contact in request.AppointmentGet.Customer.Contacts)
                                    {
                                        _WA.Mapper.v2.Appointment.Contact proxycontact = new _WA.Mapper.v2.Appointment.Contact();
                                        proxycontact.ContactType = contact.ContactType;
                                        proxycontact.ContactValue = contact.ContactValue;
                                        proxycustomer.Contacts[cnt] = proxycontact;
                                        cnt++;
                                    }
                                }
                                proxyappointmentget.Customer = proxycustomer;
                            }
                            proxyrequest.AppointmentGet = proxyappointmentget;
                            #endregion
                        }

                        #endregion

                        //Run proxy web method with proxy request
                        _WA.Mapper.v2.Appointment.AppointmentGetResponse proxyresponse = proxyws.AppointmentGet(proxyrequest);

                        //Mapping with Standard Interface Specification Object
                        if (proxyresponse != null)
                        {
                            if (proxyresponse.TransactionHeader != null)
                            {
                                #region//TransactionHeader Set
                                TransactionHeader transactionheader = new TransactionHeader();
                                transactionheader.CountryID = proxyresponse.TransactionHeader.CountryID;
                                transactionheader.DealerID = proxyresponse.TransactionHeader.DealerID;
                                transactionheader.DistributorID = proxyresponse.TransactionHeader.DistributorID;
                                transactionheader.DMSCode = proxyresponse.TransactionHeader.DMSCode;
                                transactionheader.DMSServerUrl = proxyresponse.TransactionHeader.DMSServerUrl;
                                transactionheader.DMSVersion = proxyresponse.TransactionHeader.DMSVersion;
                                transactionheader.DocumentVersion = proxyresponse.TransactionHeader.DocumentVersion;
                                transactionheader.GroupID = proxyresponse.TransactionHeader.GroupID;
                                transactionheader.IneterfaceID = proxyresponse.TransactionHeader.IneterfaceID;
                                transactionheader.Password = proxyresponse.TransactionHeader.Password;
                                transactionheader.PollingToken = proxyresponse.TransactionHeader.PollingToken;
                                transactionheader.RequestPollingToken = proxyresponse.TransactionHeader.RequestPollingToken;
                                transactionheader.RequestType = proxyresponse.TransactionHeader.RequestType;
                                transactionheader.TransactionId = proxyresponse.TransactionHeader.TransactionId;
                                transactionheader.TransactionDateTimeLocal = proxyresponse.TransactionHeader.TransactionDateTimeLocal;
                                transactionheader.TransactionDateTimeUTC = proxyresponse.TransactionHeader.TransactionDateTimeUTC;
                                transactionheader.TransactionType = proxyresponse.TransactionHeader.TransactionType;
                                transactionheader.Username = proxyresponse.TransactionHeader.Username;
                                transactionheader.VenderTrackingCode = proxyresponse.TransactionHeader.VenderTrackingCode;
                                response.TransactionHeader = transactionheader;
                                #endregion
                            }

                            //ResultMessage Set
                            if (proxyresponse.ResultMessage != null)
                            {
                                response.ResultMessage = GetResultMessageData(proxyresponse.ResultMessage.Code, proxyresponse.ResultMessage.Message);
                            }

                            if (proxyresponse.Errors != null)
                            {
                                //Error List Set
                                foreach (_WA.Mapper.v2.Appointment.Error proxyerror in proxyresponse.Errors)
                                {
                                    if (response.Errors != null)
                                        response.Errors.Add(GetErrorData(proxyerror.Code, proxyerror.Message));
                                    else
                                        response.Errors = GetErrorDataList(proxyerror.Code, proxyerror.Message);
                                }
                            }
                            else
                            {
                                #region//AppointmentGetResponse Set

                                if (proxyresponse.Appointments != null && proxyresponse.Appointments.Length > 0)
                                {
                                    response.Appointments = new List<Appointment>();
                                    foreach (_WA.Mapper.v2.Appointment.Appointment1 proxyappointment in proxyresponse.Appointments)
                                    {
                                        #region //Appointment Header
                                        Appointment appointment = new Appointment();
                                        appointment.AppointmentDateTimeLocal = proxyappointment.AppointmentDateTimeLocal;
                                        appointment.CloseDateTimeLocal = proxyappointment.CloseDateTimeLocal;
                                        appointment.CustomerComment = proxyappointment.CustomerComment;
                                        appointment.DeliveryDateTimeLocal = proxyappointment.DeliveryDateTimeLocal;
                                        appointment.DMSAppointmentID = proxyappointment.DMSAppointmentID;
                                        appointment.DMSAppointmentNo = proxyappointment.DMSAppointmentNo;
                                        appointment.DMSAppointmentStatus = proxyappointment.DMSAppointmentStatus;
                                        appointment.InMileage = proxyappointment.InMileage;
                                        appointment.OpenDateTimeLocal = proxyappointment.OpenDateTimeLocal;
                                        appointment.PaymentMethod = proxyappointment.PaymentMethod;
                                        appointment.SAEmployeeID = proxyappointment.SAEmployeeID;
                                        appointment.SAEmployeeName = proxyappointment.SAEmployeeName;
                                        appointment.ServiceType = proxyappointment.ServiceType;
                                        appointment.TCEmployeeID = proxyappointment.TCEmployeeID;
                                        appointment.TCEmployeeName = proxyappointment.TCEmployeeName;
                                        appointment.WorkType = proxyappointment.WorkType;
                                        #endregion

                                        #region //Appointment AdditionalFields
                                        if (proxyappointment.AdditionalFields != null && proxyappointment.AdditionalFields.Length > 0)
                                        {
                                            appointment.AdditionalFields = new List<AdditionalField>();
                                            foreach (_WA.Mapper.v2.Appointment.AdditionalField proxyadditionalfield in proxyappointment.AdditionalFields)
                                            {
                                                AdditionalField additionalfield = new AdditionalField();
                                                additionalfield.AdditionalFieldName = proxyadditionalfield.Name;
                                                additionalfield.AdditionalFieldValue = proxyadditionalfield.Value;
                                                appointment.AdditionalFields.Add(additionalfield);
                                            }
                                        }
                                        #endregion

                                        #region//Appointment JobRefs
                                        if (proxyappointment.JobRefs != null && proxyappointment.JobRefs.Length > 0)
                                        {
                                            appointment.JobRefs = new List<JobRef>();
                                            foreach (_WA.Mapper.v2.Appointment.JobRef proxyjobref in proxyappointment.JobRefs)
                                            {
                                                JobRef jobref = new JobRef();
                                                jobref.DMSJobNo = proxyjobref.DMSJobNo;
                                                jobref.DMSJobStatus = proxyjobref.DMSJobStatus;
                                                appointment.JobRefs.Add(jobref);
                                            }
                                        }
                                        #endregion

                                        #region//Appointment ManagementFields
                                        if (proxyappointment.ManagementFields != null)
                                        {
                                            ManagementFields managementfields = new ManagementFields();
                                            managementfields.CreateDateTimeUTC = proxyappointment.ManagementFields.CreateDateTimeUTC;
                                            managementfields.LastModifiedDateTimeUTC = proxyappointment.ManagementFields.LastModifiedDateTimeUTC;
                                            appointment.ManagementFields = managementfields;
                                        }
                                        #endregion

                                        #region//Appointment Options
                                        if (proxyappointment.Options != null && proxyappointment.Options.Length > 0)
                                        {
                                            appointment.Options = new List<Option>();
                                            foreach (_WA.Mapper.v2.Appointment.Option proxyoption in proxyappointment.Options)
                                            {
                                                Option option = new Option();
                                                option.OptionName = proxyoption.Name;
                                                option.OptionValue = proxyoption.Value;
                                                appointment.Options.Add(option);
                                            }
                                        }
                                        #endregion

                                        #region//Appointment PriceType
                                        if (proxyappointment.PriceType != null)
                                        {
                                            PriceType pricetype = new PriceType();
                                            pricetype.DiscountPrice = proxyappointment.PriceType.DiscountPrice;
                                            pricetype.DiscountRate = proxyappointment.PriceType.DiscountRate;
                                            pricetype.TotalPrice = proxyappointment.PriceType.TotalPrice;
                                            pricetype.TotalPriceIncludeTax = proxyappointment.PriceType.TotalPriceIncludeTax;
                                            pricetype.UnitPrice = proxyappointment.PriceType.UnitPrice;
                                            appointment.PriceType = pricetype;
                                        }
                                        #endregion

                                        #region//Appointment RORefs
                                        if (proxyappointment.RORefs != null && proxyappointment.RORefs.Length > 0)
                                        {
                                            appointment.RORefs = new List<RORef>();
                                            foreach (_WA.Mapper.v2.Appointment.RORef proxyroref in proxyappointment.RORefs)
                                            {
                                                RORef roref = new RORef();
                                                roref.DMSRONo = proxyroref.DMSRONo;
                                                roref.DMSROStatus = proxyroref.DMSROStatus;
                                                appointment.RORefs.Add(roref);
                                            }
                                        }
                                        #endregion

                                        #region//Appointment Customers
                                        if (proxyappointment.Customers != null && proxyappointment.Customers.Length > 0)
                                        {
                                            appointment.Customers = new List<Data.v2.Common.Customer.Customer>();
                                            foreach (_WA.Mapper.v2.Appointment.Customer1 proxycustomer in proxyappointment.Customers)
                                            {
                                                #region//Appointment Customer Header
                                                WA.Standard.IF.Data.v2.Common.Customer.Customer customer = new Data.v2.Common.Customer.Customer();
                                                customer.CardNo = proxycustomer.CardNo;
                                                customer.CorporateInfos = customer.CorporateInfos;
                                                customer.CustomerInfoType = customer.CustomerInfoType;
                                                customer.DMSCustomerNo = proxycustomer.DMSCustomerNo;
                                                customer.Email = proxycustomer.Email;
                                                customer.FirstName = proxycustomer.FirstName;
                                                customer.FullName = proxycustomer.FullName;
                                                customer.Gender = proxycustomer.Gender;
                                                customer.LastName = proxycustomer.LastName;
                                                customer.MiddleName = proxycustomer.MiddleName;
                                                customer.Salutation = proxycustomer.Salutation;
                                                #endregion

                                                #region//Appointment Customer Addresses
                                                if (proxycustomer.Addresses != null && proxycustomer.Addresses.Length > 0)
                                                {
                                                    customer.Addresses = new List<Data.v2.Common.Customer.Address>();
                                                    foreach (_WA.Mapper.v2.Appointment.Address proxyaddress in proxycustomer.Addresses)
                                                    {
                                                        Data.v2.Common.Customer.Address address = new Data.v2.Common.Customer.Address();
                                                        address.Address1 = proxyaddress.Address1;
                                                        address.Address2 = proxyaddress.Address2;
                                                        address.AddressType = proxyaddress.AddressType;
                                                        address.City = proxyaddress.City;
                                                        address.Country = proxyaddress.Country;
                                                        address.State = proxyaddress.State;
                                                        address.ZipCode = proxyaddress.ZipCode;
                                                        customer.Addresses.Add(address);
                                                    }
                                                }
                                                #endregion

                                                #region//Appointment Customer Contacts
                                                if (proxycustomer.Contacts != null && proxycustomer.Contacts.Length > 0)
                                                {
                                                    customer.Contacts = new List<Data.v2.Common.Customer.Contact>();
                                                    foreach (_WA.Mapper.v2.Appointment.Contact1 proxycontact in proxycustomer.Contacts)
                                                    {
                                                        Data.v2.Common.Customer.Contact contact = new Data.v2.Common.Customer.Contact();
                                                        contact.ContactMethodYN = proxycontact.ContactMethodYN;
                                                        contact.ContactType = proxycontact.ContactType;
                                                        contact.ContactValue = proxycontact.ContactValue;
                                                        customer.Contacts.Add(contact);
                                                    }
                                                }
                                                #endregion

                                                #region//Appointment Customer SpecialMessage
                                                if (proxycustomer.SpecialMessage != null)
                                                {
                                                    Data.v2.Common.Customer.SpecialMessage specialmessage = new Data.v2.Common.Customer.SpecialMessage();
                                                    specialmessage.Message = proxycustomer.SpecialMessage.Message;
                                                    customer.SpecialMessage = specialmessage;
                                                }
                                                #endregion

                                                #region//Appointment Customer CorporateInfos
                                                if (proxycustomer.CorporateInfos != null && proxycustomer.CorporateInfos.Length > 0)
                                                {
                                                    customer.CorporateInfos = new List<Data.v2.Common.Customer.CorporateInfo>();
                                                    foreach (_WA.Mapper.v2.Appointment.CorporateInfo proxycorporateinfo in proxycustomer.CorporateInfos)
                                                    {
                                                        Data.v2.Common.Customer.CorporateInfo corporateinfo = new Data.v2.Common.Customer.CorporateInfo();
                                                        corporateinfo.CorporateInfoName = proxycorporateinfo.Name;
                                                        corporateinfo.CorporateInfoValue = proxycorporateinfo.Value;
                                                        customer.CorporateInfos.Add(corporateinfo);
                                                    }
                                                }
                                                #endregion

                                                appointment.Customers.Add(customer);
                                            }
                                        }
                                        #endregion

                                        #region//Appointment Vehicle
                                        if (proxyappointment.Vehicle != null)
                                        {
                                            if (proxyappointment.Vehicle != null)
                                            {
                                                #region//Appointment Vehicle Header
                                                Data.v2.Common.Vehicle.Vehicle vehicle = new Data.v2.Common.Vehicle.Vehicle();
                                                vehicle.Color = proxyappointment.Vehicle.Color;
                                                vehicle.Cylinders = proxyappointment.Vehicle.Cylinders;
                                                vehicle.DateDelivered = proxyappointment.Vehicle.DateDelivered;
                                                vehicle.DateInService = proxyappointment.Vehicle.DateInService;
                                                vehicle.DeclinedJob = proxyappointment.Vehicle.DeclinedJob;
                                                vehicle.DisplayDescription = proxyappointment.Vehicle.DisplayDescription;
                                                vehicle.DMSVehicleNo = proxyappointment.Vehicle.DMSVehicleNo;
                                                vehicle.EngineType = proxyappointment.Vehicle.EngineType;
                                                vehicle.ExtendedWarranty = proxyappointment.Vehicle.ExtendedWarranty;
                                                vehicle.FuelType = proxyappointment.Vehicle.FuelType;
                                                vehicle.FullModelName = proxyappointment.Vehicle.FullModelName;
                                                vehicle.InsuranceDate = proxyappointment.Vehicle.InsuranceDate;
                                                vehicle.LastMileage = proxyappointment.Vehicle.LastMileage;
                                                vehicle.LastServiceDate = proxyappointment.Vehicle.LastServiceDate;
                                                vehicle.LastSixVIN = proxyappointment.Vehicle.LastSixVIN;
                                                vehicle.LicenseNumber = proxyappointment.Vehicle.LicenseNumber;
                                                vehicle.LicensePlateNo = proxyappointment.Vehicle.LicensePlateNo;
                                                vehicle.Make = proxyappointment.Vehicle.Make;
                                                vehicle.ModelCode = proxyappointment.Vehicle.ModelCode;
                                                vehicle.ModelName = proxyappointment.Vehicle.ModelName;
                                                vehicle.ModelYear = proxyappointment.Vehicle.ModelYear;
                                                vehicle.PendingJob = proxyappointment.Vehicle.PendingJob;
                                                vehicle.StockNumber = proxyappointment.Vehicle.StockNumber;
                                                vehicle.Trim = proxyappointment.Vehicle.Trim;
                                                vehicle.VehicleType = proxyappointment.Vehicle.VehicleType;
                                                vehicle.VIN = proxyappointment.Vehicle.VIN;
                                                vehicle.WarrantyMiles = proxyappointment.Vehicle.WarrantyMiles;
                                                vehicle.WarrantyMonths = proxyappointment.Vehicle.WarrantyMonths;
                                                vehicle.WarrantyStartDate = proxyappointment.Vehicle.WarrantyStartDate;
                                                #endregion

                                                #region//Appointment Vehicle Campaigns
                                                if (proxyappointment.Vehicle.Campaigns != null && proxyappointment.Vehicle.Campaigns.Length > 0)
                                                {
                                                    vehicle.Campaigns = new List<Data.v2.Common.Vehicle.Campaign>();
                                                    foreach (_WA.Mapper.v2.Appointment.Campaign proxycampaign in proxyappointment.Vehicle.Campaigns)
                                                    {
                                                        Data.v2.Common.Vehicle.Campaign campaign = new Data.v2.Common.Vehicle.Campaign();
                                                        campaign.CampaignDescription = proxycampaign.CampaignDescription;
                                                        campaign.CampaignID = proxycampaign.CampaignID;
                                                        campaign.CampaignPerformed = proxycampaign.CampaignPerformed;
                                                        vehicle.Campaigns.Add(campaign);
                                                    }
                                                }
                                                #endregion

                                                appointment.Vehicle = vehicle;
                                            }
                                        }
                                        #endregion

                                        #region//Appointment RequestItems
                                        if (proxyappointment.RequestItems != null && proxyappointment.RequestItems.Length > 0)
                                        {
                                            appointment.RequestItems = new List<RequestItem>();
                                            foreach (_WA.Mapper.v2.Appointment.RequestItem proxyrequestitem in proxyappointment.RequestItems)
                                            {
                                                #region//Appointment RequestItem Header
                                                RequestItem requestitem = new RequestItem();
                                                requestitem.CPSIND = proxyrequestitem.CPSIND;
                                                requestitem.RequestCode = proxyrequestitem.RequestCode;
                                                requestitem.RequestDescription = proxyrequestitem.RequestDescription;
                                                requestitem.ServiceLineNumber = proxyrequestitem.ServiceLineNumber;
                                                requestitem.ServiceLineStatus = proxyrequestitem.ServiceLineStatus;
                                                requestitem.ServiceType = proxyrequestitem.ServiceType;
                                                requestitem.TCEmployeeID = proxyrequestitem.TCEmployeeID;
                                                requestitem.TCEmployeeName = proxyrequestitem.TCEmployeeName;
                                                requestitem.WorkType = proxyrequestitem.WorkType;
                                                #endregion

                                                #region//Appointment RequestItem Comments
                                                if (proxyrequestitem.Comments != null && proxyrequestitem.Comments.Length > 0)
                                                {
                                                    requestitem.Comments = new List<Comment>();
                                                    foreach (_WA.Mapper.v2.Appointment.Comment proxycomment in proxyrequestitem.Comments)
                                                    {
                                                        Comment comment = new Comment();
                                                        comment.DescriptionComment = proxycomment.DescriptionComment;
                                                        comment.SequenceNumber = proxycomment.SequenceNumber;
                                                        requestitem.Comments.Add(comment);
                                                    }
                                                }
                                                #endregion

                                                #region//Appointment RequestItem Descriptions
                                                if (proxyrequestitem.Descriptions != null && proxyrequestitem.Descriptions.Length > 0)
                                                {
                                                    requestitem.Descriptions = new List<Description>();
                                                    foreach (_WA.Mapper.v2.Appointment.Description proxydescription in proxyrequestitem.Descriptions)
                                                    {
                                                        Description description = new Description();
                                                        description.DescriptionComment = proxydescription.DescriptionComment;
                                                        description.SequenceNumber = proxydescription.SequenceNumber;
                                                        requestitem.Descriptions.Add(description);
                                                    }
                                                }
                                                #endregion

                                                #region//Appointment RequestItem OPCodes
                                                if (proxyrequestitem.OPCodes != null && proxyrequestitem.OPCodes.Length > 0)
                                                {
                                                    requestitem.OPCodes = new List<OPCode>();
                                                    foreach (_WA.Mapper.v2.Appointment.OPCode proxyopcode in proxyrequestitem.OPCodes)
                                                    {
                                                        #region//Appointment RequestItem OPCode Header
                                                        OPCode opcode = new OPCode();
                                                        opcode.ActualHours = proxyopcode.ActualHours;
                                                        opcode.Code = proxyopcode.Code;
                                                        opcode.Description = proxyopcode.Description;
                                                        opcode.EstimatedHours = proxyopcode.EstimatedHours;
                                                        opcode.SequenceNumber = proxyopcode.SequenceNumber;
                                                        opcode.ServiceType = proxyopcode.ServiceType;
                                                        opcode.SkillLevel = proxyopcode.SkillLevel;
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode Descriptions
                                                        if (proxyopcode.Descriptions != null && proxyopcode.Descriptions.Length > 0)
                                                        {
                                                            opcode.Descriptions = new List<Description>();
                                                            foreach (_WA.Mapper.v2.Appointment.Description proxydescription in proxyopcode.Descriptions)
                                                            {
                                                                Description description = new Description();
                                                                description.DescriptionComment = proxydescription.DescriptionComment;
                                                                description.SequenceNumber = proxydescription.SequenceNumber;
                                                                opcode.Descriptions.Add(description);
                                                            }
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode Causes
                                                        if (proxyopcode.Causes != null && proxyopcode.Causes.Length > 0)
                                                        {
                                                            opcode.Causes = new List<Cause>();
                                                            foreach (_WA.Mapper.v2.Appointment.Cause proxycause in proxyopcode.Causes)
                                                            {
                                                                Cause cause = new Cause();
                                                                cause.CauseLaborOpCode = proxycause.CauseLaborOpCode;
                                                                cause.Comment = proxycause.Comment;
                                                                cause.SequenceNumber = proxycause.SequenceNumber;
                                                                opcode.Causes.Add(cause);
                                                            }
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode Corrections
                                                        if (proxyopcode.Corrections != null && proxyopcode.Corrections.Length > 0)
                                                        {
                                                            opcode.Corrections = new List<Correction>();
                                                            foreach (_WA.Mapper.v2.Appointment.Correction proxycorrection in proxyopcode.Corrections)
                                                            {
                                                                Correction correction = new Correction();
                                                                correction.CorrectionLaborOpCode = proxycorrection.CorrectionLaborOpCode;
                                                                correction.Comment = proxycorrection.Comment;
                                                                correction.SequenceNumber = proxycorrection.SequenceNumber;
                                                                opcode.Corrections.Add(correction);
                                                            }
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode PriceType
                                                        if (proxyopcode.PriceType != null)
                                                        {
                                                            PriceType pricetype = new PriceType();
                                                            pricetype.DiscountPrice = proxyopcode.PriceType.DiscountPrice;
                                                            pricetype.DiscountRate = proxyopcode.PriceType.DiscountRate;
                                                            pricetype.TotalPrice = proxyopcode.PriceType.TotalPrice;
                                                            pricetype.TotalPriceIncludeTax = proxyopcode.PriceType.TotalPriceIncludeTax;
                                                            pricetype.UnitPrice = proxyopcode.PriceType.UnitPrice;
                                                            opcode.PriceType = pricetype;
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode Parts
                                                        if (proxyopcode.Parts != null && proxyopcode.Parts.Length > 0)
                                                        {
                                                            opcode.Parts = new List<Part>();
                                                            foreach (_WA.Mapper.v2.Appointment.Part proxypart in proxyopcode.Parts)
                                                            {
                                                                #region//Appointment RequestItem OPCode Parts Header
                                                                Part part = new Part();
                                                                part.DisplayPartNumber = proxypart.DisplayPartNumber;
                                                                part.PartDescription = proxypart.PartDescription;
                                                                part.PartNumber = proxypart.PartNumber;
                                                                part.PartType = proxypart.PartType;
                                                                part.Quantity = proxypart.Quantity;
                                                                part.SequenceNumber = proxypart.SequenceNumber;
                                                                part.ServiceType = proxypart.ServiceType;
                                                                part.StockQuantity = proxypart.StockQuantity;
                                                                part.StockStatus = proxypart.StockStatus;
                                                                part.UnitOfMeasure = proxypart.UnitOfMeasure;
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode Parts Descriptions
                                                                if (proxypart.Descriptions != null && proxypart.Descriptions.Length > 0)
                                                                {
                                                                    part.Descriptions = new List<Description>();
                                                                    foreach (_WA.Mapper.v2.Appointment.Description proxydescription in proxypart.Descriptions)
                                                                    {
                                                                        Description description = new Description();
                                                                        description.DescriptionComment = proxydescription.DescriptionComment;
                                                                        description.SequenceNumber = proxydescription.SequenceNumber;
                                                                        part.Descriptions.Add(description);
                                                                    }
                                                                }
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode Parts PriceType
                                                                if (proxypart.PriceType != null)
                                                                {
                                                                    PriceType pricetype = new PriceType();
                                                                    pricetype.DiscountPrice = proxypart.PriceType.DiscountPrice;
                                                                    pricetype.DiscountRate = proxypart.PriceType.DiscountRate;
                                                                    pricetype.TotalPrice = proxypart.PriceType.TotalPrice;
                                                                    pricetype.TotalPriceIncludeTax = proxypart.PriceType.TotalPriceIncludeTax;
                                                                    pricetype.UnitPrice = proxypart.PriceType.UnitPrice;
                                                                    part.PriceType = pricetype;
                                                                }
                                                                #endregion

                                                                opcode.Parts.Add(part);
                                                            }
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode Sublets
                                                        if (proxyopcode.Sublets != null && proxyopcode.Sublets.Length > 0)
                                                        {
                                                            opcode.Sublets = new List<Sublet>();
                                                            foreach (_WA.Mapper.v2.Appointment.Sublet proxysublet in proxyopcode.Sublets)
                                                            {
                                                                #region//Appointment RequestItem OPCode Sublet Header
                                                                Sublet sublet = new Sublet();
                                                                sublet.SequenceNumber = proxysublet.SequenceNumber;
                                                                sublet.ServiceType = proxysublet.ServiceType;
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode Sublets Descriptions
                                                                if (proxysublet.Descriptions != null && proxysublet.Descriptions.Length > 0)
                                                                {
                                                                    sublet.Descriptions = new List<Description>();
                                                                    foreach (_WA.Mapper.v2.Appointment.Description proxydescription in proxysublet.Descriptions)
                                                                    {
                                                                        Description description = new Description();
                                                                        description.DescriptionComment = proxydescription.DescriptionComment;
                                                                        description.SequenceNumber = proxydescription.SequenceNumber;
                                                                        sublet.Descriptions.Add(description);
                                                                    }
                                                                }
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode Sublets PriceType
                                                                if (proxysublet.PriceType != null)
                                                                {
                                                                    PriceType pricetype = new PriceType();
                                                                    pricetype.DiscountPrice = proxysublet.PriceType.DiscountPrice;
                                                                    pricetype.DiscountRate = proxysublet.PriceType.DiscountRate;
                                                                    pricetype.TotalPrice = proxysublet.PriceType.TotalPrice;
                                                                    pricetype.TotalPriceIncludeTax = proxysublet.PriceType.TotalPriceIncludeTax;
                                                                    pricetype.UnitPrice = proxysublet.PriceType.UnitPrice;
                                                                    sublet.PriceType = pricetype;
                                                                }
                                                                #endregion

                                                                opcode.Sublets.Add(sublet);
                                                            }
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode MISCs
                                                        if (proxyopcode.MISCs != null && proxyopcode.MISCs.Length > 0)
                                                        {
                                                            opcode.MISCs = new List<MISC>();
                                                            foreach (_WA.Mapper.v2.Appointment.MISC proxymisc in proxyopcode.MISCs)
                                                            {
                                                                #region//Appointment RequestItem OPCode MISC Header
                                                                MISC misc = new MISC();
                                                                misc.SequenceNumber = proxymisc.SequenceNumber;
                                                                misc.ServiceType = proxymisc.ServiceType;
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode MISCs Descriptions
                                                                if (proxymisc.Descriptions != null && proxymisc.Descriptions.Length > 0)
                                                                {
                                                                    misc.Descriptions = new List<Description>();
                                                                    foreach (_WA.Mapper.v2.Appointment.Description proxydescription in proxymisc.Descriptions)
                                                                    {
                                                                        Description description = new Description();
                                                                        description.DescriptionComment = proxydescription.DescriptionComment;
                                                                        description.SequenceNumber = proxydescription.SequenceNumber;
                                                                        misc.Descriptions.Add(description);
                                                                    }
                                                                }
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode MISCs PriceType
                                                                if (proxymisc.PriceType != null)
                                                                {
                                                                    PriceType pricetype = new PriceType();
                                                                    pricetype.DiscountPrice = proxymisc.PriceType.DiscountPrice;
                                                                    pricetype.DiscountRate = proxymisc.PriceType.DiscountRate;
                                                                    pricetype.TotalPrice = proxymisc.PriceType.TotalPrice;
                                                                    pricetype.TotalPriceIncludeTax = proxymisc.PriceType.TotalPriceIncludeTax;
                                                                    pricetype.UnitPrice = proxymisc.PriceType.UnitPrice;
                                                                    misc.PriceType = pricetype;
                                                                }
                                                                #endregion

                                                                opcode.MISCs.Add(misc);
                                                            }
                                                        }
                                                        #endregion

                                                        requestitem.OPCodes.Add(opcode);
                                                    }
                                                }
                                                #endregion

                                                appointment.RequestItems.Add(requestitem);
                                            }
                                        }
                                        #endregion

                                        response.Appointments.Add(appointment);
                                    }
                                }
                                else
                                {
                                    response.ResultMessage = GetResultMessageData(ResponseCode.NoResult, ResponseMessage.NoResult);
                                }
                                #endregion
                            }
                        }
                        else
                        {
                            if (response.Errors != null)
                                response.Errors.Add(GetErrorData(ResponseCode.Fail, ResponseMessage.Fail));
                            else
                                response.Errors = GetErrorDataList(ResponseCode.Fail, ResponseMessage.Fail);
                        }
                        #endregion
                    }
                    break;
                case "v2.HMCIS.1C.v4":
                    {
                        #region v2.HMCIS.1C.v4 - RTR (Proxy Class Dll Name : _1C.v4)

                        #region AppointmentGet Request Set

                        //Create proxy credential
                        NetworkCredential proxycredential = new NetworkCredential(request.TransactionHeader.Username, request.TransactionHeader.Password);

                        //Create proxy web service from dms web service with credential
                        _1C.v4.Appointment.Appointment proxyws = new _1C.v4.Appointment.Appointment(request.TransactionHeader.DMSServerUrl);
                        proxyws.Credentials = proxycredential;

                        //Create proxy request with appointmentget and transaction
                        _1C.v4.Appointment.AppointmentGetRequest proxyrequest = new _1C.v4.Appointment.AppointmentGetRequest();

                        //Create proxy transaction
                        _1C.v4.Appointment.TransactionHeader proxytransactionheader = new _1C.v4.Appointment.TransactionHeader();
                        if (request.TransactionHeader != null)
                        {
                            #region//TransactionHeader Set
                            proxytransactionheader.CountryID = request.TransactionHeader.CountryID;
                            proxytransactionheader.DealerID = request.TransactionHeader.DealerID;
                            proxytransactionheader.DistributorID = request.TransactionHeader.DistributorID;
                            proxytransactionheader.DMSCode = request.TransactionHeader.DMSCode;
                            proxytransactionheader.DMSServerUrl = request.TransactionHeader.DMSServerUrl;
                            proxytransactionheader.DMSVersion = request.TransactionHeader.DMSVersion;
                            proxytransactionheader.DocumentVersion = request.TransactionHeader.DocumentVersion;
                            proxytransactionheader.GroupID = request.TransactionHeader.GroupID;
                            proxytransactionheader.IneterfaceID = request.TransactionHeader.IneterfaceID;
                            proxytransactionheader.Password = request.TransactionHeader.Password;
                            proxytransactionheader.PollingToken = request.TransactionHeader.PollingToken;
                            proxytransactionheader.RequestPollingToken = request.TransactionHeader.RequestPollingToken;
                            proxytransactionheader.RequestType = request.TransactionHeader.RequestType;
                            proxytransactionheader.TransactionId = request.TransactionHeader.TransactionId;
                            proxytransactionheader.TransactionDateTimeLocal = request.TransactionHeader.TransactionDateTimeLocal;
                            proxytransactionheader.TransactionDateTimeUTC = request.TransactionHeader.TransactionDateTimeUTC;
                            proxytransactionheader.TransactionType = request.TransactionHeader.TransactionType;
                            proxytransactionheader.Username = request.TransactionHeader.Username;
                            proxytransactionheader.VenderTrackingCode = request.TransactionHeader.VenderTrackingCode;
                            proxyrequest.TransactionHeader = proxytransactionheader;
                            #endregion
                        }

                        //Create proxy appointmentget
                        _1C.v4.Appointment.AppointmentGet proxyappointmentget = new _1C.v4.Appointment.AppointmentGet();
                        if (request.AppointmentGet != null)
                        {
                            #region//AppointmentGet Set
                            proxyappointmentget.AppointmentDateTimeFromLocal = request.AppointmentGet.AppointmentDateTimeFromLocal;
                            proxyappointmentget.AppointmentDateTimeToLocal = request.AppointmentGet.AppointmentDateTimeFromLocal;
                            proxyappointmentget.DMSAppointmentID = request.AppointmentGet.DMSAppointmentID;
                            proxyappointmentget.DMSAppointmentNo = request.AppointmentGet.DMSAppointmentNo;
                            proxyappointmentget.DMSAppointmentStatus = request.AppointmentGet.DMSAppointmentStatus;
                            proxyappointmentget.LastModifiedDateTimeFromUTC = request.AppointmentGet.LastModifiedDateTimeFromUTC;
                            proxyappointmentget.LastModifiedDateTimeToUTC = request.AppointmentGet.LastModifiedDateTimeToUTC;
                            proxyappointmentget.SAEmployeeID = request.AppointmentGet.SAEmployeeID;
                            proxyappointmentget.SAEmployeeName = request.AppointmentGet.SAEmployeeName;
                            proxyappointmentget.TCEmployeeID = request.AppointmentGet.TCEmployeeID;
                            proxyappointmentget.TCEmployeeName = request.AppointmentGet.TCEmployeeName;
                            if (request.AppointmentGet.Customer != null)
                            {
                                _1C.v4.Appointment.Customer proxycustomer = new _1C.v4.Appointment.Customer();
                                proxycustomer.DMSCustomerNo = request.AppointmentGet.Customer.DMSCustomerNo;
                                proxycustomer.LastName = request.AppointmentGet.Customer.LastName;

                                if (request.AppointmentGet.Customer.Contacts != null && request.AppointmentGet.Customer.Contacts.Count > 0)
                                {
                                    int cnt = 0;
                                    proxycustomer.Contacts = new _1C.v4.Appointment.Contact[request.AppointmentGet.Customer.Contacts.Count];
                                    foreach (WA.Standard.IF.Data.v2.Common.Appointment.Contact contact in request.AppointmentGet.Customer.Contacts)
                                    {
                                        _1C.v4.Appointment.Contact proxycontact = new _1C.v4.Appointment.Contact();
                                        proxycontact.ContactType = contact.ContactType;
                                        proxycontact.ContactValue = contact.ContactValue;
                                        proxycustomer.Contacts[cnt] = proxycontact;
                                        cnt++;
                                    }
                                }
                                proxyappointmentget.Customer = proxycustomer;
                            }
                            proxyrequest.AppointmentGet = proxyappointmentget;
                            #endregion
                        }

                        #endregion

                        //Run proxy web method with proxy request
                        _1C.v4.Appointment.AppointmentGetResponse proxyresponse = proxyws.AppointmentGet(proxyrequest);

                        //Mapping with Standard Interface Specification Object
                        if (proxyresponse != null)
                        {
                            if (proxyresponse.TransactionHeader != null)
                            {
                                #region//TransactionHeader Set
                                TransactionHeader transactionheader = new TransactionHeader();
                                transactionheader.CountryID = proxyresponse.TransactionHeader.CountryID;
                                transactionheader.DealerID = proxyresponse.TransactionHeader.DealerID;
                                transactionheader.DistributorID = proxyresponse.TransactionHeader.DistributorID;
                                transactionheader.DMSCode = proxyresponse.TransactionHeader.DMSCode;
                                transactionheader.DMSServerUrl = proxyresponse.TransactionHeader.DMSServerUrl;
                                transactionheader.DMSVersion = proxyresponse.TransactionHeader.DMSVersion;
                                transactionheader.DocumentVersion = proxyresponse.TransactionHeader.DocumentVersion;
                                transactionheader.GroupID = proxyresponse.TransactionHeader.GroupID;
                                transactionheader.IneterfaceID = proxyresponse.TransactionHeader.IneterfaceID;
                                transactionheader.Password = proxyresponse.TransactionHeader.Password;
                                transactionheader.PollingToken = proxyresponse.TransactionHeader.PollingToken;
                                transactionheader.RequestPollingToken = proxyresponse.TransactionHeader.RequestPollingToken;
                                transactionheader.RequestType = proxyresponse.TransactionHeader.RequestType;
                                transactionheader.TransactionId = proxyresponse.TransactionHeader.TransactionId;
                                transactionheader.TransactionDateTimeLocal = proxyresponse.TransactionHeader.TransactionDateTimeLocal;
                                transactionheader.TransactionDateTimeUTC = proxyresponse.TransactionHeader.TransactionDateTimeUTC;
                                transactionheader.TransactionType = proxyresponse.TransactionHeader.TransactionType;
                                transactionheader.Username = proxyresponse.TransactionHeader.Username;
                                transactionheader.VenderTrackingCode = proxyresponse.TransactionHeader.VenderTrackingCode;
                                response.TransactionHeader = transactionheader;
                                #endregion
                            }

                            //ResultMessage Set
                            if (proxyresponse.ResultMessage != null)
                            {
                                response.ResultMessage = GetResultMessageData(proxyresponse.ResultMessage.Code, proxyresponse.ResultMessage.Message);
                            }

                            if (proxyresponse.Errors != null)
                            {
                                //Error List Set
                                foreach (_1C.v4.Appointment.Error proxyerror in proxyresponse.Errors)
                                {
                                    if (response.Errors != null)
                                        response.Errors.Add(GetErrorData(proxyerror.Code, proxyerror.Message));
                                    else
                                        response.Errors = GetErrorDataList(proxyerror.Code, proxyerror.Message);
                                }
                            }
                            else
                            {
                                #region//AppointmentGetResponse Set

                                if (proxyresponse.Appointments != null && proxyresponse.Appointments.Length > 0)
                                {
                                    response.Appointments = new List<Appointment>();
                                    foreach (_1C.v4.Appointment.Appointment1 proxyappointment in proxyresponse.Appointments)
                                    {
                                        #region //Appointment Header
                                        Appointment appointment = new Appointment();
                                        appointment.AppointmentDateTimeLocal = proxyappointment.AppointmentDateTimeLocal;
                                        appointment.CloseDateTimeLocal = proxyappointment.CloseDateTimeLocal;
                                        appointment.CustomerComment = proxyappointment.CustomerComment;
                                        appointment.DeliveryDateTimeLocal = proxyappointment.DeliveryDateTimeLocal;
                                        appointment.DMSAppointmentID = proxyappointment.DMSAppointmentID;
                                        appointment.DMSAppointmentNo = proxyappointment.DMSAppointmentNo;
                                        appointment.DMSAppointmentStatus = proxyappointment.DMSAppointmentStatus;
                                        appointment.InMileage = proxyappointment.InMileage;
                                        appointment.OpenDateTimeLocal = proxyappointment.OpenDateTimeLocal;
                                        appointment.PaymentMethod = proxyappointment.PaymentMethod;
                                        appointment.SAEmployeeID = proxyappointment.SAEmployeeID;
                                        appointment.SAEmployeeName = proxyappointment.SAEmployeeName;
                                        appointment.ServiceType = proxyappointment.ServiceType;
                                        appointment.TCEmployeeID = proxyappointment.TCEmployeeID;
                                        appointment.TCEmployeeName = proxyappointment.TCEmployeeName;
                                        appointment.WorkType = proxyappointment.WorkType;
                                        #endregion

                                        #region //Appointment AdditionalFields
                                        if (proxyappointment.AdditionalFields != null && proxyappointment.AdditionalFields.Length > 0)
                                        {
                                            appointment.AdditionalFields = new List<AdditionalField>();
                                            foreach (_1C.v4.Appointment.AdditionalField proxyadditionalfield in proxyappointment.AdditionalFields)
                                            {
                                                AdditionalField additionalfield = new AdditionalField();
                                                additionalfield.AdditionalFieldName = proxyadditionalfield.Name;
                                                additionalfield.AdditionalFieldValue = proxyadditionalfield.Value;
                                                appointment.AdditionalFields.Add(additionalfield);
                                            }
                                        }
                                        #endregion

                                        #region//Appointment JobRefs
                                        if (proxyappointment.JobRefs != null && proxyappointment.JobRefs.Length > 0)
                                        {
                                            appointment.JobRefs = new List<JobRef>();
                                            foreach (_1C.v4.Appointment.JobRef proxyjobref in proxyappointment.JobRefs)
                                            {
                                                JobRef jobref = new JobRef();
                                                jobref.DMSJobNo = proxyjobref.DMSJobNo;
                                                jobref.DMSJobStatus = proxyjobref.DMSJobStatus;
                                                appointment.JobRefs.Add(jobref);
                                            }
                                        }
                                        #endregion

                                        #region//Appointment ManagementFields
                                        if (proxyappointment.ManagementFields != null)
                                        {
                                            ManagementFields managementfields = new ManagementFields();
                                            managementfields.CreateDateTimeUTC = proxyappointment.ManagementFields.CreateDateTimeUTC;
                                            managementfields.LastModifiedDateTimeUTC = proxyappointment.ManagementFields.LastModifiedDateTimeUTC;
                                            appointment.ManagementFields = managementfields;
                                        }
                                        #endregion

                                        #region//Appointment Options
                                        if (proxyappointment.Options != null && proxyappointment.Options.Length > 0)
                                        {
                                            appointment.Options = new List<Option>();
                                            foreach (_1C.v4.Appointment.Option proxyoption in proxyappointment.Options)
                                            {
                                                Option option = new Option();
                                                option.OptionName = proxyoption.Name;
                                                option.OptionValue = proxyoption.Value;
                                                appointment.Options.Add(option);
                                            }
                                        }
                                        #endregion

                                        #region//Appointment PriceType
                                        if (proxyappointment.PriceType != null)
                                        {
                                            PriceType pricetype = new PriceType();
                                            pricetype.DiscountPrice = proxyappointment.PriceType.DiscountPrice;
                                            pricetype.DiscountRate = proxyappointment.PriceType.DiscountRate;
                                            pricetype.TotalPrice = proxyappointment.PriceType.TotalPrice;
                                            pricetype.TotalPriceIncludeTax = proxyappointment.PriceType.TotalPriceIncludeTax;
                                            pricetype.UnitPrice = proxyappointment.PriceType.UnitPrice;
                                            appointment.PriceType = pricetype;
                                        }
                                        #endregion

                                        #region//Appointment RORefs
                                        if (proxyappointment.RORefs != null && proxyappointment.RORefs.Length > 0)
                                        {
                                            appointment.RORefs = new List<RORef>();
                                            foreach (_1C.v4.Appointment.RORef proxyroref in proxyappointment.RORefs)
                                            {
                                                RORef roref = new RORef();
                                                roref.DMSRONo = proxyroref.DMSRONo;
                                                roref.DMSROStatus = proxyroref.DMSROStatus;
                                                appointment.RORefs.Add(roref);
                                            }
                                        }
                                        #endregion

                                        #region//Appointment Customers
                                        if (proxyappointment.Customers != null && proxyappointment.Customers.Length > 0)
                                        {
                                            appointment.Customers = new List<Data.v2.Common.Customer.Customer>();
                                            foreach (_1C.v4.Appointment.Customer1 proxycustomer in proxyappointment.Customers)
                                            {
                                                #region//Appointment Customer Header
                                                WA.Standard.IF.Data.v2.Common.Customer.Customer customer = new Data.v2.Common.Customer.Customer();
                                                customer.CardNo = proxycustomer.CardNo;
                                                customer.CorporateInfos = customer.CorporateInfos;
                                                customer.CustomerInfoType = customer.CustomerInfoType;
                                                customer.DMSCustomerNo = proxycustomer.DMSCustomerNo;
                                                customer.Email = proxycustomer.Email;
                                                customer.FirstName = proxycustomer.FirstName;
                                                customer.FullName = proxycustomer.FullName;
                                                customer.Gender = proxycustomer.Gender;
                                                customer.LastName = proxycustomer.LastName;
                                                customer.MiddleName = proxycustomer.MiddleName;
                                                customer.Salutation = proxycustomer.Salutation;
                                                #endregion

                                                #region//Appointment Customer Addresses
                                                if (proxycustomer.Addresses != null && proxycustomer.Addresses.Length > 0)
                                                {
                                                    customer.Addresses = new List<Data.v2.Common.Customer.Address>();
                                                    foreach (_1C.v4.Appointment.Address proxyaddress in proxycustomer.Addresses)
                                                    {
                                                        Data.v2.Common.Customer.Address address = new Data.v2.Common.Customer.Address();
                                                        address.Address1 = proxyaddress.Address1;
                                                        address.Address2 = proxyaddress.Address2;
                                                        address.AddressType = proxyaddress.AddressType;
                                                        address.City = proxyaddress.City;
                                                        address.Country = proxyaddress.Country;
                                                        address.State = proxyaddress.State;
                                                        address.ZipCode = proxyaddress.ZipCode;
                                                        customer.Addresses.Add(address);
                                                    }
                                                }
                                                #endregion

                                                #region//Appointment Customer Contacts
                                                if (proxycustomer.Contacts != null && proxycustomer.Contacts.Length > 0)
                                                {
                                                    customer.Contacts = new List<Data.v2.Common.Customer.Contact>();
                                                    foreach (_1C.v4.Appointment.Contact1 proxycontact in proxycustomer.Contacts)
                                                    {
                                                        Data.v2.Common.Customer.Contact contact = new Data.v2.Common.Customer.Contact();
                                                        contact.ContactMethodYN = proxycontact.ContactMethodYN;
                                                        contact.ContactType = proxycontact.ContactType;
                                                        contact.ContactValue = proxycontact.ContactValue;
                                                        customer.Contacts.Add(contact);
                                                    }
                                                }
                                                #endregion

                                                #region//Appointment Customer SpecialMessage
                                                if (proxycustomer.SpecialMessage != null)
                                                {
                                                    Data.v2.Common.Customer.SpecialMessage specialmessage = new Data.v2.Common.Customer.SpecialMessage();
                                                    specialmessage.Message = proxycustomer.SpecialMessage.Message;
                                                    customer.SpecialMessage = specialmessage;
                                                }
                                                #endregion

                                                #region//Appointment Customer CorporateInfos
                                                if (proxycustomer.CorporateInfos != null && proxycustomer.CorporateInfos.Length > 0)
                                                {
                                                    customer.CorporateInfos = new List<Data.v2.Common.Customer.CorporateInfo>();
                                                    foreach (_1C.v4.Appointment.CorporateInfo proxycorporateinfo in proxycustomer.CorporateInfos)
                                                    {
                                                        Data.v2.Common.Customer.CorporateInfo corporateinfo = new Data.v2.Common.Customer.CorporateInfo();
                                                        corporateinfo.CorporateInfoName = proxycorporateinfo.Name;
                                                        corporateinfo.CorporateInfoValue = proxycorporateinfo.Value;
                                                        customer.CorporateInfos.Add(corporateinfo);
                                                    }
                                                }
                                                #endregion

                                                appointment.Customers.Add(customer);
                                            }
                                        }
                                        #endregion

                                        #region//Appointment Vehicle
                                        if (proxyappointment.Vehicle != null)
                                        {
                                            if (proxyappointment.Vehicle != null)
                                            {
                                                #region//Appointment Vehicle Header
                                                Data.v2.Common.Vehicle.Vehicle vehicle = new Data.v2.Common.Vehicle.Vehicle();
                                                vehicle.Color = proxyappointment.Vehicle.Color;
                                                vehicle.Cylinders = proxyappointment.Vehicle.Cylinders;
                                                vehicle.DateDelivered = proxyappointment.Vehicle.DateDelivered;
                                                vehicle.DateInService = proxyappointment.Vehicle.DateInService;
                                                vehicle.DeclinedJob = proxyappointment.Vehicle.DeclinedJob;
                                                vehicle.DisplayDescription = proxyappointment.Vehicle.DisplayDescription;
                                                vehicle.DMSVehicleNo = proxyappointment.Vehicle.DMSVehicleNo;
                                                vehicle.EngineType = proxyappointment.Vehicle.EngineType;
                                                vehicle.ExtendedWarranty = proxyappointment.Vehicle.ExtendedWarranty;
                                                vehicle.FuelType = proxyappointment.Vehicle.FuelType;
                                                vehicle.FullModelName = proxyappointment.Vehicle.FullModelName;
                                                vehicle.InsuranceDate = proxyappointment.Vehicle.InsuranceDate;
                                                vehicle.LastMileage = proxyappointment.Vehicle.LastMileage;
                                                vehicle.LastServiceDate = proxyappointment.Vehicle.LastServiceDate;
                                                vehicle.LastSixVIN = proxyappointment.Vehicle.LastSixVIN;
                                                vehicle.LicenseNumber = proxyappointment.Vehicle.LicenseNumber;
                                                vehicle.LicensePlateNo = proxyappointment.Vehicle.LicensePlateNo;
                                                vehicle.Make = proxyappointment.Vehicle.Make;
                                                vehicle.ModelCode = proxyappointment.Vehicle.ModelCode;
                                                vehicle.ModelName = proxyappointment.Vehicle.ModelName;
                                                vehicle.ModelYear = proxyappointment.Vehicle.ModelYear;
                                                vehicle.PendingJob = proxyappointment.Vehicle.PendingJob;
                                                vehicle.StockNumber = proxyappointment.Vehicle.StockNumber;
                                                vehicle.Trim = proxyappointment.Vehicle.Trim;
                                                vehicle.VehicleType = proxyappointment.Vehicle.VehicleType;
                                                vehicle.VIN = proxyappointment.Vehicle.VIN;
                                                vehicle.WarrantyMiles = proxyappointment.Vehicle.WarrantyMiles;
                                                vehicle.WarrantyMonths = proxyappointment.Vehicle.WarrantyMonths;
                                                vehicle.WarrantyStartDate = proxyappointment.Vehicle.WarrantyStartDate;
                                                #endregion

                                                #region//Appointment Vehicle Campaigns
                                                if (proxyappointment.Vehicle.Campaigns != null && proxyappointment.Vehicle.Campaigns.Length > 0)
                                                {
                                                    vehicle.Campaigns = new List<Data.v2.Common.Vehicle.Campaign>();
                                                    foreach (_1C.v4.Appointment.Campaign proxycampaign in proxyappointment.Vehicle.Campaigns)
                                                    {
                                                        Data.v2.Common.Vehicle.Campaign campaign = new Data.v2.Common.Vehicle.Campaign();
                                                        campaign.CampaignDescription = proxycampaign.CampaignDescription;
                                                        campaign.CampaignID = proxycampaign.CampaignID;
                                                        campaign.CampaignPerformed = proxycampaign.CampaignPerformed;
                                                        vehicle.Campaigns.Add(campaign);
                                                    }
                                                }
                                                #endregion

                                                appointment.Vehicle = vehicle;
                                            }
                                        }
                                        #endregion

                                        #region//Appointment RequestItems
                                        if (proxyappointment.RequestItems != null && proxyappointment.RequestItems.Length > 0)
                                        {
                                            appointment.RequestItems = new List<RequestItem>();
                                            foreach (_1C.v4.Appointment.RequestItem proxyrequestitem in proxyappointment.RequestItems)
                                            {
                                                #region//Appointment RequestItem Header
                                                RequestItem requestitem = new RequestItem();
                                                requestitem.CPSIND = proxyrequestitem.CPSIND;
                                                requestitem.RequestCode = proxyrequestitem.RequestCode;
                                                requestitem.RequestDescription = proxyrequestitem.RequestDescription;
                                                requestitem.ServiceLineNumber = proxyrequestitem.ServiceLineNumber;
                                                requestitem.ServiceLineStatus = proxyrequestitem.ServiceLineStatus;
                                                requestitem.ServiceType = proxyrequestitem.ServiceType;
                                                requestitem.TCEmployeeID = proxyrequestitem.TCEmployeeID;
                                                requestitem.TCEmployeeName = proxyrequestitem.TCEmployeeName;
                                                requestitem.WorkType = proxyrequestitem.WorkType;
                                                #endregion

                                                #region//Appointment RequestItem Comments
                                                if (proxyrequestitem.Comments != null && proxyrequestitem.Comments.Length > 0)
                                                {
                                                    requestitem.Comments = new List<Comment>();
                                                    foreach (_1C.v4.Appointment.Comment proxycomment in proxyrequestitem.Comments)
                                                    {
                                                        Comment comment = new Comment();
                                                        comment.DescriptionComment = proxycomment.DescriptionComment;
                                                        comment.SequenceNumber = proxycomment.SequenceNumber;
                                                        requestitem.Comments.Add(comment);
                                                    }
                                                }
                                                #endregion

                                                #region//Appointment RequestItem Descriptions
                                                if (proxyrequestitem.Descriptions != null && proxyrequestitem.Descriptions.Length > 0)
                                                {
                                                    requestitem.Descriptions = new List<Description>();
                                                    foreach (_1C.v4.Appointment.Description proxydescription in proxyrequestitem.Descriptions)
                                                    {
                                                        Description description = new Description();
                                                        description.DescriptionComment = proxydescription.DescriptionComment;
                                                        description.SequenceNumber = proxydescription.SequenceNumber;
                                                        requestitem.Descriptions.Add(description);
                                                    }
                                                }
                                                #endregion

                                                #region//Appointment RequestItem OPCodes
                                                if (proxyrequestitem.OPCodes != null && proxyrequestitem.OPCodes.Length > 0)
                                                {
                                                    requestitem.OPCodes = new List<OPCode>();
                                                    foreach (_1C.v4.Appointment.OPCode proxyopcode in proxyrequestitem.OPCodes)
                                                    {
                                                        #region//Appointment RequestItem OPCode Header
                                                        OPCode opcode = new OPCode();
                                                        opcode.ActualHours = proxyopcode.ActualHours;
                                                        opcode.Code = proxyopcode.Code;
                                                        opcode.Description = proxyopcode.Description;
                                                        opcode.EstimatedHours = proxyopcode.EstimatedHours;
                                                        opcode.SequenceNumber = proxyopcode.SequenceNumber;
                                                        opcode.ServiceType = proxyopcode.ServiceType;
                                                        opcode.SkillLevel = proxyopcode.SkillLevel;
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode Descriptions
                                                        if (proxyopcode.Descriptions != null && proxyopcode.Descriptions.Length > 0)
                                                        {
                                                            opcode.Descriptions = new List<Description>();
                                                            foreach (_1C.v4.Appointment.Description proxydescription in proxyopcode.Descriptions)
                                                            {
                                                                Description description = new Description();
                                                                description.DescriptionComment = proxydescription.DescriptionComment;
                                                                description.SequenceNumber = proxydescription.SequenceNumber;
                                                                opcode.Descriptions.Add(description);
                                                            }
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode Causes
                                                        if (proxyopcode.Causes != null && proxyopcode.Causes.Length > 0)
                                                        {
                                                            opcode.Causes = new List<Cause>();
                                                            foreach (_1C.v4.Appointment.Cause proxycause in proxyopcode.Causes)
                                                            {
                                                                Cause cause = new Cause();
                                                                cause.CauseLaborOpCode = proxycause.CauseLaborOpCode;
                                                                cause.Comment = proxycause.Comment;
                                                                cause.SequenceNumber = proxycause.SequenceNumber;
                                                                opcode.Causes.Add(cause);
                                                            }
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode Corrections
                                                        if (proxyopcode.Corrections != null && proxyopcode.Corrections.Length > 0)
                                                        {
                                                            opcode.Corrections = new List<Correction>();
                                                            foreach (_1C.v4.Appointment.Correction proxycorrection in proxyopcode.Corrections)
                                                            {
                                                                Correction correction = new Correction();
                                                                correction.CorrectionLaborOpCode = proxycorrection.CorrectionLaborOpCode;
                                                                correction.Comment = proxycorrection.Comment;
                                                                correction.SequenceNumber = proxycorrection.SequenceNumber;
                                                                opcode.Corrections.Add(correction);
                                                            }
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode PriceType
                                                        if (proxyopcode.PriceType != null)
                                                        {
                                                            PriceType pricetype = new PriceType();
                                                            pricetype.DiscountPrice = proxyopcode.PriceType.DiscountPrice;
                                                            pricetype.DiscountRate = proxyopcode.PriceType.DiscountRate;
                                                            pricetype.TotalPrice = proxyopcode.PriceType.TotalPrice;
                                                            pricetype.TotalPriceIncludeTax = proxyopcode.PriceType.TotalPriceIncludeTax;
                                                            pricetype.UnitPrice = proxyopcode.PriceType.UnitPrice;
                                                            opcode.PriceType = pricetype;
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode Parts
                                                        if (proxyopcode.Parts != null && proxyopcode.Parts.Length > 0)
                                                        {
                                                            opcode.Parts = new List<Part>();
                                                            foreach (_1C.v4.Appointment.Part proxypart in proxyopcode.Parts)
                                                            {
                                                                #region//Appointment RequestItem OPCode Parts Header
                                                                Part part = new Part();
                                                                part.DisplayPartNumber = proxypart.DisplayPartNumber;
                                                                part.PartDescription = proxypart.PartDescription;
                                                                part.PartNumber = proxypart.PartNumber;
                                                                part.PartType = proxypart.PartType;
                                                                part.Quantity = proxypart.Quantity;
                                                                part.SequenceNumber = proxypart.SequenceNumber;
                                                                part.ServiceType = proxypart.ServiceType;
                                                                part.StockQuantity = proxypart.StockQuantity;
                                                                part.StockStatus = proxypart.StockStatus;
                                                                part.UnitOfMeasure = proxypart.UnitOfMeasure;
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode Parts Descriptions
                                                                if (proxypart.Descriptions != null && proxypart.Descriptions.Length > 0)
                                                                {
                                                                    part.Descriptions = new List<Description>();
                                                                    foreach (_1C.v4.Appointment.Description proxydescription in proxypart.Descriptions)
                                                                    {
                                                                        Description description = new Description();
                                                                        description.DescriptionComment = proxydescription.DescriptionComment;
                                                                        description.SequenceNumber = proxydescription.SequenceNumber;
                                                                        part.Descriptions.Add(description);
                                                                    }
                                                                }
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode Parts PriceType
                                                                if (proxypart.PriceType != null)
                                                                {
                                                                    PriceType pricetype = new PriceType();
                                                                    pricetype.DiscountPrice = proxypart.PriceType.DiscountPrice;
                                                                    pricetype.DiscountRate = proxypart.PriceType.DiscountRate;
                                                                    pricetype.TotalPrice = proxypart.PriceType.TotalPrice;
                                                                    pricetype.TotalPriceIncludeTax = proxypart.PriceType.TotalPriceIncludeTax;
                                                                    pricetype.UnitPrice = proxypart.PriceType.UnitPrice;
                                                                    part.PriceType = pricetype;
                                                                }
                                                                #endregion

                                                                opcode.Parts.Add(part);
                                                            }
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode Sublets
                                                        if (proxyopcode.Sublets != null && proxyopcode.Sublets.Length > 0)
                                                        {
                                                            opcode.Sublets = new List<Sublet>();
                                                            foreach (_1C.v4.Appointment.Sublet proxysublet in proxyopcode.Sublets)
                                                            {
                                                                #region//Appointment RequestItem OPCode Sublet Header
                                                                Sublet sublet = new Sublet();
                                                                sublet.SequenceNumber = proxysublet.SequenceNumber;
                                                                sublet.ServiceType = proxysublet.ServiceType;
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode Sublets Descriptions
                                                                if (proxysublet.Descriptions != null && proxysublet.Descriptions.Length > 0)
                                                                {
                                                                    sublet.Descriptions = new List<Description>();
                                                                    foreach (_1C.v4.Appointment.Description proxydescription in proxysublet.Descriptions)
                                                                    {
                                                                        Description description = new Description();
                                                                        description.DescriptionComment = proxydescription.DescriptionComment;
                                                                        description.SequenceNumber = proxydescription.SequenceNumber;
                                                                        sublet.Descriptions.Add(description);
                                                                    }
                                                                }
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode Sublets PriceType
                                                                if (proxysublet.PriceType != null)
                                                                {
                                                                    PriceType pricetype = new PriceType();
                                                                    pricetype.DiscountPrice = proxysublet.PriceType.DiscountPrice;
                                                                    pricetype.DiscountRate = proxysublet.PriceType.DiscountRate;
                                                                    pricetype.TotalPrice = proxysublet.PriceType.TotalPrice;
                                                                    pricetype.TotalPriceIncludeTax = proxysublet.PriceType.TotalPriceIncludeTax;
                                                                    pricetype.UnitPrice = proxysublet.PriceType.UnitPrice;
                                                                    sublet.PriceType = pricetype;
                                                                }
                                                                #endregion

                                                                opcode.Sublets.Add(sublet);
                                                            }
                                                        }
                                                        #endregion

                                                        #region//Appointment RequestItem OPCode MISCs
                                                        if (proxyopcode.MISCs != null && proxyopcode.MISCs.Length > 0)
                                                        {
                                                            opcode.MISCs = new List<MISC>();
                                                            foreach (_1C.v4.Appointment.MISC proxymisc in proxyopcode.MISCs)
                                                            {
                                                                #region//Appointment RequestItem OPCode MISC Header
                                                                MISC misc = new MISC();
                                                                misc.SequenceNumber = proxymisc.SequenceNumber;
                                                                misc.ServiceType = proxymisc.ServiceType;
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode MISCs Descriptions
                                                                if (proxymisc.Descriptions != null && proxymisc.Descriptions.Length > 0)
                                                                {
                                                                    misc.Descriptions = new List<Description>();
                                                                    foreach (_1C.v4.Appointment.Description proxydescription in proxymisc.Descriptions)
                                                                    {
                                                                        Description description = new Description();
                                                                        description.DescriptionComment = proxydescription.DescriptionComment;
                                                                        description.SequenceNumber = proxydescription.SequenceNumber;
                                                                        misc.Descriptions.Add(description);
                                                                    }
                                                                }
                                                                #endregion

                                                                #region//Appointment RequestItem OPCode MISCs PriceType
                                                                if (proxymisc.PriceType != null)
                                                                {
                                                                    PriceType pricetype = new PriceType();
                                                                    pricetype.DiscountPrice = proxymisc.PriceType.DiscountPrice;
                                                                    pricetype.DiscountRate = proxymisc.PriceType.DiscountRate;
                                                                    pricetype.TotalPrice = proxymisc.PriceType.TotalPrice;
                                                                    pricetype.TotalPriceIncludeTax = proxymisc.PriceType.TotalPriceIncludeTax;
                                                                    pricetype.UnitPrice = proxymisc.PriceType.UnitPrice;
                                                                    misc.PriceType = pricetype;
                                                                }
                                                                #endregion

                                                                opcode.MISCs.Add(misc);
                                                            }
                                                        }
                                                        #endregion

                                                        requestitem.OPCodes.Add(opcode);
                                                    }
                                                }
                                                #endregion

                                                appointment.RequestItems.Add(requestitem);
                                            }
                                        }
                                        #endregion

                                        response.Appointments.Add(appointment);
                                    }
                                }
                                else
                                {
                                    response.ResultMessage = GetResultMessageData(ResponseCode.NoResult, ResponseMessage.NoResult);
                                }
                                #endregion
                            }
                        }
                        else
                        {
                            if (response.Errors != null)
                                response.Errors.Add(GetErrorData(ResponseCode.Fail, ResponseMessage.Fail));
                            else
                                response.Errors = GetErrorDataList(ResponseCode.Fail, ResponseMessage.Fail);
                        }
                        #endregion
                    }
                    break;
                default: response.Errors = new List<Error>() { new Error() { Code = ResponseCode.NoMatchedProxy, Message = ResponseMessage.NoMatchedProxy } };
                    break;
            }

            return response;
        }