예제 #1
0
        public WA.Standard.IF.Data.v2.Common.Appointment.AppointmentGetResponse AppointmentGet(WA.Standard.IF.Data.v2.Common.Appointment.AppointmentGetRequest request)
        {
            WA.Standard.IF.Data.v2.Common.Appointment.AppointmentGetResponse response = new WA.Standard.IF.Data.v2.Common.Appointment.AppointmentGetResponse();

            #region v2.WA.v2 - WA.Standard.IF.WebService

            #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.v2.WS_Appointment.Appointment proxyws = new WA.v2.WS_Appointment.Appointment();
            proxyws.Credentials = proxycredential;

            //Create proxy request with appointmentget and transaction
            WA.v2.WS_Appointment.AppointmentGetRequest proxyrequest = new WA.v2.WS_Appointment.AppointmentGetRequest();

            //Create proxy transaction
            WA.v2.WS_Appointment.TransactionHeader proxytransactionheader = new WA.v2.WS_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;
                proxyws.Url = string.Format("{0}/rtr-atest/ws/Appointment.1cws", proxytransactionheader.DMSServerUrl);
                #endregion
            }

            //Create proxy appointmentget
            WA.v2.WS_Appointment.AppointmentGet proxyappointmentget = new WA.v2.WS_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 = Map.SetDMSCodeFromWACode(CodeType.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.v2.WS_Appointment.Customer proxycustomer = new WA.v2.WS_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.v2.WS_Appointment.Contact[request.AppointmentGet.Customer.Contacts.Count];
                        foreach (WA.Standard.IF.Data.v2.Common.Appointment.Contact contact in request.AppointmentGet.Customer.Contacts)
                        {
                            WA.v2.WS_Appointment.Contact proxycontact = new WA.v2.WS_Appointment.Contact();
                            proxycontact.ContactType = Map.SetDMSCodeFromWACode(CodeType.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.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS AppointmentGetRequest XML", proxyrequest);

            WA.v2.WS_Appointment.AppointmentGetResponse proxyresponse = proxyws.AppointmentGet(proxyrequest);

            WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS AppointmentGetResponse XML", proxyresponse);

            //Mapping with Standard Interface Specification Object
            if (proxyresponse != null)
            {
                if (proxyresponse.TransactionHeader != null)
                {
                    #region//TransactionHeader Set
                    WA.Standard.IF.Data.v2.Common.Common.TransactionHeader transactionheader = new WA.Standard.IF.Data.v2.Common.Common.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.v2.WS_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<WA.Standard.IF.Data.v2.Common.Appointment.Appointment>();
                        foreach (WA.v2.WS_Appointment.Appointment1 proxyappointment in proxyresponse.Appointments)
                        {
                            #region //Appointment Header
                            WA.Standard.IF.Data.v2.Common.Appointment.Appointment appointment = new WA.Standard.IF.Data.v2.Common.Appointment.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 = Map.GetWACodeFromDMSCode(CodeType.DMSAppointmentStatus, proxyappointment.DMSAppointmentStatus);
                            appointment.InMileage = proxyappointment.InMileage;
                            appointment.OpenDateTimeLocal = proxyappointment.OpenDateTimeLocal;
                            appointment.PaymentMethod = Map.GetWACodeFromDMSCode(CodeType.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 = Map.GetWACodeFromDMSCode(CodeType.WorkType, proxyappointment.WorkType);
                            #endregion

                            #region //Appointment AdditionalFields
                            if (proxyappointment.AdditionalFields != null && proxyappointment.AdditionalFields.Length > 0)
                            {
                                appointment.AdditionalFields = new List<WA.Standard.IF.Data.v2.Common.Common.AdditionalField>();
                                foreach (WA.v2.WS_Appointment.AdditionalField proxyadditionalfield in proxyappointment.AdditionalFields)
                                {
                                    WA.Standard.IF.Data.v2.Common.Common.AdditionalField additionalfield = new WA.Standard.IF.Data.v2.Common.Common.AdditionalField();
                                    additionalfield.AdditionalFieldName = proxyadditionalfield.AdditionalFieldName;
                                    additionalfield.AdditionalFieldValue = proxyadditionalfield.AdditionalFieldValue;
                                    appointment.AdditionalFields.Add(additionalfield);
                                }
                            }
                            #endregion

                            #region//Appointment JobRefs
                            if (proxyappointment.JobRefs != null && proxyappointment.JobRefs.Length > 0)
                            {
                                appointment.JobRefs = new List<WA.Standard.IF.Data.v2.Common.Common.JobRef>();
                                foreach (WA.v2.WS_Appointment.JobRef proxyjobref in proxyappointment.JobRefs)
                                {
                                    WA.Standard.IF.Data.v2.Common.Common.JobRef jobref = new WA.Standard.IF.Data.v2.Common.Common.JobRef();
                                    jobref.DMSJobNo = proxyjobref.DMSJobNo;
                                    jobref.DMSJobStatus = Map.GetWACodeFromDMSCode(CodeType.DMSJobStatus, proxyjobref.DMSJobStatus);
                                    appointment.JobRefs.Add(jobref);
                                }
                            }
                            #endregion

                            #region//Appointment ManagementFields
                            if (proxyappointment.ManagementFields != null)
                            {
                                WA.Standard.IF.Data.v2.Common.Common.ManagementFields managementfields = new WA.Standard.IF.Data.v2.Common.Common.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<WA.Standard.IF.Data.v2.Common.Common.Option>();
                                foreach (WA.v2.WS_Appointment.Option proxyoption in proxyappointment.Options)
                                {
                                    WA.Standard.IF.Data.v2.Common.Common.Option option = new WA.Standard.IF.Data.v2.Common.Common.Option();
                                    option.OptionName = proxyoption.OptionName;
                                    option.OptionValue = proxyoption.OptionValue;
                                    appointment.Options.Add(option);
                                }
                            }
                            #endregion

                            #region//Appointment PriceType
                            if (proxyappointment.PriceType != null)
                            {
                                WA.Standard.IF.Data.v2.Common.Common.PriceType pricetype = new WA.Standard.IF.Data.v2.Common.Common.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<WA.Standard.IF.Data.v2.Common.Common.RORef>();
                                foreach (WA.v2.WS_Appointment.RORef proxyroref in proxyappointment.RORefs)
                                {
                                    WA.Standard.IF.Data.v2.Common.Common.RORef roref = new WA.Standard.IF.Data.v2.Common.Common.RORef();
                                    roref.DMSRONo = proxyroref.DMSRONo;
                                    roref.DMSROStatus = Map.GetWACodeFromDMSCode(CodeType.DMSROStatus, proxyroref.DMSROStatus);
                                    appointment.RORefs.Add(roref);
                                }
                            }
                            #endregion

                            #region//Appointment Customers
                            if (proxyappointment.Customers != null && proxyappointment.Customers.Length > 0)
                            {
                                appointment.Customers = new List<WA.Standard.IF.Data.v2.Common.Customer.Customer>();
                                foreach (WA.v2.WS_Appointment.Customer1 proxycustomer in proxyappointment.Customers)
                                {
                                    #region//Appointment Customer Header
                                    WA.Standard.IF.Data.v2.Common.Customer.Customer customer = new WA.Standard.IF.Data.v2.Common.Customer.Customer();
                                    customer.CardNo = proxycustomer.CardNo;
                                    customer.CorporateInfos = customer.CorporateInfos;
                                    customer.CustomerInfoType = Map.GetWACodeFromDMSCode(CodeType.CustomerInfoType, proxycustomer.CustomerInfoType);
                                    customer.DMSCustomerNo = proxycustomer.DMSCustomerNo;
                                    customer.Email = proxycustomer.Email;
                                    customer.FirstName = proxycustomer.FirstName;
                                    customer.FullName = proxycustomer.FullName;
                                    customer.Gender = Map.GetWACodeFromDMSCode(CodeType.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<WA.Standard.IF.Data.v2.Common.Customer.Address>();
                                        foreach (WA.v2.WS_Appointment.Address proxyaddress in proxycustomer.Addresses)
                                        {
                                            WA.Standard.IF.Data.v2.Common.Customer.Address address = new WA.Standard.IF.Data.v2.Common.Customer.Address();
                                            address.AddressType = Map.GetWACodeFromDMSCode(CodeType.AddressType, proxyaddress.AddressType);
                                            address.City = proxyaddress.City;
                                            address.District = proxyaddress.District;
                                            address.Flat = proxyaddress.Flat;
                                            address.FullAddress = proxyaddress.FullAddress;
                                            address.House = proxyaddress.House;
                                            address.Housing = proxyaddress.Housing;
                                            address.Locality = proxyaddress.Locality;
                                            address.Region = proxyaddress.Region;
                                            address.Street = proxyaddress.Street;
                                            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<WA.Standard.IF.Data.v2.Common.Customer.Contact>();
                                        foreach (WA.v2.WS_Appointment.Contact1 proxycontact in proxycustomer.Contacts)
                                        {
                                            WA.Standard.IF.Data.v2.Common.Customer.Contact contact = new WA.Standard.IF.Data.v2.Common.Customer.Contact();
                                            contact.ContactMethodYN = proxycontact.ContactMethodYN;
                                            contact.ContactType = Map.GetWACodeFromDMSCode(CodeType.ContactType, proxycontact.ContactType);
                                            contact.ContactValue = proxycontact.ContactValue;
                                            customer.Contacts.Add(contact);
                                        }
                                    }
                                    #endregion

                                    #region//Appointment Customer SpecialMessage
                                    if (proxycustomer.SpecialMessage != null)
                                    {
                                        WA.Standard.IF.Data.v2.Common.Customer.SpecialMessage specialmessage = new WA.Standard.IF.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<WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo>();
                                        foreach (WA.v2.WS_Appointment.CorporateInfo proxycorporateinfo in proxycustomer.CorporateInfos)
                                        {
                                            WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo corporateinfo = new WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo();
                                            corporateinfo.CorporateInfoName = proxycorporateinfo.CorporateInfoName;
                                            corporateinfo.CorporateInfoValue = proxycorporateinfo.CorporateInfoValue;
                                            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
                                    WA.Standard.IF.Data.v2.Common.Vehicle.Vehicle vehicle = new WA.Standard.IF.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 = Map.GetWACodeFromDMSCode(CodeType.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<WA.Standard.IF.Data.v2.Common.Vehicle.Campaign>();
                                        foreach (WA.v2.WS_Appointment.Campaign proxycampaign in proxyappointment.Vehicle.Campaigns)
                                        {
                                            WA.Standard.IF.Data.v2.Common.Vehicle.Campaign campaign = new WA.Standard.IF.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<WA.Standard.IF.Data.v2.Common.Common.RequestItem>();
                                foreach (WA.v2.WS_Appointment.RequestItem proxyrequestitem in proxyappointment.RequestItems)
                                {
                                    #region//Appointment RequestItem Header
                                    WA.Standard.IF.Data.v2.Common.Common.RequestItem requestitem = new WA.Standard.IF.Data.v2.Common.Common.RequestItem();
                                    requestitem.CPSIND = proxyrequestitem.CPSIND;
                                    requestitem.RequestCode = proxyrequestitem.RequestCode;
                                    requestitem.RequestDescription = proxyrequestitem.RequestDescription;
                                    requestitem.ServiceLineNumber = proxyrequestitem.ServiceLineNumber;
                                    requestitem.ServiceLineStatus = Map.GetWACodeFromDMSCode(CodeType.ServiceLineStatus, proxyrequestitem.ServiceLineStatus);
                                    requestitem.ServiceType = Map.GetWACodeFromDMSCode(CodeType.ServiceType, proxyrequestitem.ServiceType);
                                    requestitem.TCEmployeeID = proxyrequestitem.TCEmployeeID;
                                    requestitem.TCEmployeeName = proxyrequestitem.TCEmployeeName;
                                    requestitem.WorkType = Map.GetWACodeFromDMSCode(CodeType.WorkType, proxyrequestitem.WorkType);
                                    #endregion

                                    #region//Appointment RequestItem Comments
                                    if (proxyrequestitem.Comments != null && proxyrequestitem.Comments.Length > 0)
                                    {
                                        requestitem.Comments = new List<WA.Standard.IF.Data.v2.Common.Common.Comment>();
                                        foreach (WA.v2.WS_Appointment.Comment proxycomment in proxyrequestitem.Comments)
                                        {
                                            WA.Standard.IF.Data.v2.Common.Common.Comment comment = new WA.Standard.IF.Data.v2.Common.Common.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<WA.Standard.IF.Data.v2.Common.Common.Description>();
                                        foreach (WA.v2.WS_Appointment.Description proxydescription in proxyrequestitem.Descriptions)
                                        {
                                            WA.Standard.IF.Data.v2.Common.Common.Description description = new WA.Standard.IF.Data.v2.Common.Common.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<WA.Standard.IF.Data.v2.Common.Common.OPCode>();
                                        foreach (WA.v2.WS_Appointment.OPCode proxyopcode in proxyrequestitem.OPCodes)
                                        {
                                            #region//Appointment RequestItem OPCode Header
                                            WA.Standard.IF.Data.v2.Common.Common.OPCode opcode = new WA.Standard.IF.Data.v2.Common.Common.OPCode();
                                            opcode.ActualHours = proxyopcode.ActualHours;
                                            opcode.Code = proxyopcode.Code;
                                            opcode.Description = proxyopcode.Description;
                                            opcode.EstimatedHours = proxyopcode.EstimatedHours;
                                            opcode.OPCodeType = Map.GetWACodeFromDMSCode(CodeType.OPCodeType, proxyopcode.OPCodeType);
                                            opcode.Quantity = proxyopcode.Quantity;
                                            opcode.SequenceNumber = proxyopcode.SequenceNumber;
                                            opcode.ServiceType = Map.GetWACodeFromDMSCode(CodeType.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<WA.Standard.IF.Data.v2.Common.Common.Description>();
                                                foreach (WA.v2.WS_Appointment.Description proxydescription in proxyopcode.Descriptions)
                                                {
                                                    WA.Standard.IF.Data.v2.Common.Common.Description description = new WA.Standard.IF.Data.v2.Common.Common.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<WA.Standard.IF.Data.v2.Common.Common.Cause>();
                                                foreach (WA.v2.WS_Appointment.Cause proxycause in proxyopcode.Causes)
                                                {
                                                    WA.Standard.IF.Data.v2.Common.Common.Cause cause = new WA.Standard.IF.Data.v2.Common.Common.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<WA.Standard.IF.Data.v2.Common.Common.Correction>();
                                                foreach (WA.v2.WS_Appointment.Correction proxycorrection in proxyopcode.Corrections)
                                                {
                                                    WA.Standard.IF.Data.v2.Common.Common.Correction correction = new WA.Standard.IF.Data.v2.Common.Common.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)
                                            {
                                                WA.Standard.IF.Data.v2.Common.Common.PriceType pricetype = new WA.Standard.IF.Data.v2.Common.Common.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<WA.Standard.IF.Data.v2.Common.Common.Part>();
                                                foreach (WA.v2.WS_Appointment.Part proxypart in proxyopcode.Parts)
                                                {
                                                    #region//Appointment RequestItem OPCode Parts Header
                                                    WA.Standard.IF.Data.v2.Common.Common.Part part = new WA.Standard.IF.Data.v2.Common.Common.Part();
                                                    part.DisplayPartNumber = proxypart.DisplayPartNumber;
                                                    part.PartDescription = proxypart.PartDescription;
                                                    part.PartNumber = proxypart.PartNumber;
                                                    part.PartType = Map.GetWACodeFromDMSCode(CodeType.PartType, proxypart.PartType);
                                                    part.Quantity = proxypart.Quantity;
                                                    part.SequenceNumber = proxypart.SequenceNumber;
                                                    part.ServiceType = Map.GetWACodeFromDMSCode(CodeType.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<WA.Standard.IF.Data.v2.Common.Common.Description>();
                                                        foreach (WA.v2.WS_Appointment.Description proxydescription in proxypart.Descriptions)
                                                        {
                                                            WA.Standard.IF.Data.v2.Common.Common.Description description = new WA.Standard.IF.Data.v2.Common.Common.Description();
                                                            description.DescriptionComment = proxydescription.DescriptionComment;
                                                            description.SequenceNumber = proxydescription.SequenceNumber;
                                                            part.Descriptions.Add(description);
                                                        }
                                                    }
                                                    #endregion

                                                    #region//Appointment RequestItem OPCode Parts PriceType
                                                    if (proxypart.PriceType != null)
                                                    {
                                                        WA.Standard.IF.Data.v2.Common.Common.PriceType pricetype = new WA.Standard.IF.Data.v2.Common.Common.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<WA.Standard.IF.Data.v2.Common.Common.Sublet>();
                                                foreach (WA.v2.WS_Appointment.Sublet proxysublet in proxyopcode.Sublets)
                                                {
                                                    #region//Appointment RequestItem OPCode Sublet Header
                                                    WA.Standard.IF.Data.v2.Common.Common.Sublet sublet = new WA.Standard.IF.Data.v2.Common.Common.Sublet();
                                                    sublet.SequenceNumber = proxysublet.SequenceNumber;
                                                    sublet.ServiceType = Map.GetWACodeFromDMSCode(CodeType.ServiceType, proxysublet.ServiceType);
                                                    #endregion

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

                                                    #region//Appointment RequestItem OPCode Sublets PriceType
                                                    if (proxysublet.PriceType != null)
                                                    {
                                                        WA.Standard.IF.Data.v2.Common.Common.PriceType pricetype = new WA.Standard.IF.Data.v2.Common.Common.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<WA.Standard.IF.Data.v2.Common.Common.MISC>();
                                                foreach (WA.v2.WS_Appointment.MISC proxymisc in proxyopcode.MISCs)
                                                {
                                                    #region//Appointment RequestItem OPCode MISC Header
                                                    WA.Standard.IF.Data.v2.Common.Common.MISC misc = new WA.Standard.IF.Data.v2.Common.Common.MISC();
                                                    misc.SequenceNumber = proxymisc.SequenceNumber;
                                                    misc.ServiceType = Map.GetWACodeFromDMSCode(CodeType.ServiceType, proxymisc.ServiceType);
                                                    #endregion

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

                                                    #region//Appointment RequestItem OPCode MISCs PriceType
                                                    if (proxymisc.PriceType != null)
                                                    {
                                                        WA.Standard.IF.Data.v2.Common.Common.PriceType pricetype = new WA.Standard.IF.Data.v2.Common.Common.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(WA.Standard.IF.Data.v2.Common.Common.ResponseCode.NoResult, WA.Standard.IF.Data.v2.Common.Common.ResponseMessage.NoResult);
                    }
                    #endregion
                }
            }
            #endregion

            return response;
        }
예제 #2
0
        public WA.Standard.IF.Data.v2.Common.Job.JobGetResponse JobGet(WA.Standard.IF.Data.v2.Common.Job.JobGetRequest request)
        {
            WA.Standard.IF.Data.v2.Common.Job.JobGetResponse response = new WA.Standard.IF.Data.v2.Common.Job.JobGetResponse();

            #region v2.WA.v2 - WA.Standard.IF.WebService

            #region JobGet 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.v2.WS_Job.Job proxyws = new WA.v2.WS_Job.Job();
            proxyws.Credentials = proxycredential;

            //Create proxy request with jobget and transaction
            WA.v2.WS_Job.JobGetRequest proxyrequest = new WA.v2.WS_Job.JobGetRequest();

            //Create proxy transaction
            WA.v2.WS_Job.TransactionHeader proxytransactionheader = new WA.v2.WS_Job.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;
                proxyws.Url = string.Format("{0}/rtr-atest/ws/Job.1cws", proxytransactionheader.DMSServerUrl);
                #endregion
            }

            //Create proxy jobget
            WA.v2.WS_Job.JobGet proxyjobget = new WA.v2.WS_Job.JobGet();
            if (request.JobGet != null)
            {
                #region//JobGet Set
                proxyjobget.DMSAppointmentNo = request.JobGet.DMSAppointmentNo;
                proxyjobget.DMSJobNo = request.JobGet.DMSJobNo;
                proxyjobget.DMSJobStatus = Map.SetDMSCodeFromWACode(CodeType.DMSJobStatus, request.JobGet.DMSJobStatus);
                proxyjobget.DMSRONo = request.JobGet.DMSRONo;
                proxyjobget.LastModifiedDateTimeFromUTC = request.JobGet.LastModifiedDateTimeFromUTC;
                proxyjobget.LastModifiedDateTimeToUTC = request.JobGet.LastModifiedDateTimeToUTC;
                proxyjobget.ScheduledDateTimeFromLocal = request.JobGet.ScheduledDateTimeFromLocal;
                proxyjobget.ScheduledDateTimeToLocal = request.JobGet.ScheduledDateTimeToLocal;
                proxyrequest.JobGet = proxyjobget;
                #endregion
            }

            #endregion

            //Run proxy web method with proxy request
            WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS JobGetRequest XML", proxyrequest);

            WA.v2.WS_Job.JobGetResponse proxyresponse = proxyws.JobGet(proxyrequest);

            WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS JobGetResponse XML", proxyresponse);

            //Mapping with Standard Interface Specification Object
            if (proxyresponse != null)
            {
                if (proxyresponse.TransactionHeader != null)
                {
                    #region//TransactionHeader Set
                    WA.Standard.IF.Data.v2.Common.Common.TransactionHeader transactionheader = new WA.Standard.IF.Data.v2.Common.Common.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.v2.WS_Job.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//JobGetResponse Set

                    if (proxyresponse.Jobs != null && proxyresponse.Jobs.Length > 0)
                    {
                        response.Jobs = new List<WA.Standard.IF.Data.v2.Common.Job.Job>();
                        foreach (WA.v2.WS_Job.Job1 proxyjob in proxyresponse.Jobs)
                        {
                            #region//Job Header
                            WA.Standard.IF.Data.v2.Common.Job.Job job = new WA.Standard.IF.Data.v2.Common.Job.Job();
                            job.ActualHours = proxyjob.ActualHours;
                            job.DMSJobNo = proxyjob.DMSJobNo;
                            job.DMSRONo = proxyjob.DMSRONo;
                            job.DMSAppointmentNo = proxyjob.DMSAppointmentNo;
                            job.ServiceLineNumber = proxyjob.ServiceLineNumber;
                            job.SkillLevel = proxyjob.SkillLevel;
                            job.DMSJobStatus = proxyjob.DMSJobStatus;
                            #endregion

                            #region //Job ManagementFields
                            if (proxyjob.ManagementFields != null)
                            {
                                WA.Standard.IF.Data.v2.Common.Common.ManagementFields managementfields = new WA.Standard.IF.Data.v2.Common.Common.ManagementFields();
                                managementfields.CreateDateTimeUTC = proxyjob.ManagementFields.CreateDateTimeUTC;
                                managementfields.LastModifiedDateTimeUTC = proxyjob.ManagementFields.LastModifiedDateTimeUTC;
                                job.ManagementFields = managementfields;
                            }
                            #endregion

                            #region//Job Comments - Not Used
                            if (proxyjob.Comments != null && proxyjob.Comments.Length > 0)
                            {
                                job.Comments = new List<WA.Standard.IF.Data.v2.Common.Common.Comment>();
                                foreach (WA.v2.WS_Job.Comment proxycomment in proxyjob.Comments)
                                {
                                    WA.Standard.IF.Data.v2.Common.Common.Comment comment = new WA.Standard.IF.Data.v2.Common.Common.Comment();
                                    comment.DescriptionComment = proxycomment.DescriptionComment;
                                    comment.SequenceNumber = proxycomment.SequenceNumber;
                                    job.Comments.Add(comment);
                                }
                            }
                            #endregion

                            #region//Job Descriptions - Not Used
                            if (proxyjob.Descriptions != null && proxyjob.Descriptions.Length > 0)
                            {
                                job.Descriptions = new List<WA.Standard.IF.Data.v2.Common.Common.Description>();
                                foreach (WA.v2.WS_Job.Description proxydescription in proxyjob.Descriptions)
                                {
                                    WA.Standard.IF.Data.v2.Common.Common.Description description = new WA.Standard.IF.Data.v2.Common.Common.Description();
                                    description.DescriptionComment = proxydescription.DescriptionComment;
                                    description.SequenceNumber = proxydescription.SequenceNumber;
                                    job.Descriptions.Add(description);
                                }
                            }
                            #endregion

                            #region//Job Causes - Not Used
                            if (proxyjob.Causes != null && proxyjob.Causes.Length > 0)
                            {
                                job.Causes = new List<WA.Standard.IF.Data.v2.Common.Common.Cause>();
                                foreach (WA.v2.WS_Job.Cause proxycause in proxyjob.Causes)
                                {
                                    WA.Standard.IF.Data.v2.Common.Common.Cause cause = new WA.Standard.IF.Data.v2.Common.Common.Cause();
                                    cause.CauseLaborOpCode = proxycause.CauseLaborOpCode;
                                    cause.Comment = proxycause.Comment;
                                    cause.SequenceNumber = proxycause.SequenceNumber;
                                    job.Causes.Add(cause);
                                }
                            }
                            #endregion

                            #region//Job Corrections - Not Used
                            if (proxyjob.Corrections != null && proxyjob.Corrections.Length > 0)
                            {
                                job.Corrections = new List<WA.Standard.IF.Data.v2.Common.Common.Correction>();
                                foreach (WA.v2.WS_Job.Correction proxycorrection in proxyjob.Corrections)
                                {
                                    WA.Standard.IF.Data.v2.Common.Common.Correction cause = new WA.Standard.IF.Data.v2.Common.Common.Correction();
                                    cause.CorrectionLaborOpCode = proxycorrection.CorrectionLaborOpCode;
                                    cause.Comment = proxycorrection.Comment;
                                    cause.SequenceNumber = proxycorrection.SequenceNumber;
                                    job.Corrections.Add(cause);
                                }
                            }
                            #endregion

                            #region//Job OPCodes
                            if (proxyjob.OPCodes != null && proxyjob.OPCodes.Length > 0)
                            {
                                job.OPCodes = new List<WA.Standard.IF.Data.v2.Common.Job.OPCode>();
                                foreach (WA.v2.WS_Job.OPCode proxyopcode in proxyjob.OPCodes)
                                {
                                    #region//Job OPCode Header
                                    WA.Standard.IF.Data.v2.Common.Job.OPCode opcode = new WA.Standard.IF.Data.v2.Common.Job.OPCode();
                                    opcode.ActualHours = proxyopcode.ActualHours;
                                    opcode.Code = proxyopcode.Code;
                                    opcode.Description = proxyopcode.Description;
                                    opcode.EstimatedHours = proxyopcode.EstimatedHours;
                                    opcode.SkillLevel = proxyopcode.SkillLevel;
                                    #endregion

                                    #region//Job OPCode Comments - Not Used
                                    //if (proxyopcode.Comments != null && proxyopcode.Comments.Length > 0)
                                    //{
                                    //    opcode.Comments = new List<WA.Standard.IF.Data.v2.Common.Common.Comment>();
                                    //    foreach (WA.v2.WS_Job.Comment proxycomment in proxyopcode.Comments)
                                    //    {
                                    //        WA.Standard.IF.Data.v2.Common.Common.Comment comment = new WA.Standard.IF.Data.v2.Common.Common.Comment();
                                    //        comment.DescriptionComment = proxycomment.DescriptionComment;
                                    //        comment.SequenceNumber = proxycomment.SequenceNumber;
                                    //        opcode.Comments.Add(comment);
                                    //    }
                                    //}
                                    #endregion

                                    #region//Job OPCode Descriptions - Not Used
                                    //if (proxyopcode.Descriptions != null && proxyopcode.Descriptions.Length > 0)
                                    //{
                                    //    opcode.Descriptions = new List<WA.Standard.IF.Data.v2.Common.Common.Description>();
                                    //    foreach (WA.v2.WS_Job.Description proxydescription in proxyopcode.Descriptions)
                                    //    {
                                    //        WA.Standard.IF.Data.v2.Common.Common.Description description = new WA.Standard.IF.Data.v2.Common.Common.Description();
                                    //        description.DescriptionComment = proxydescription.DescriptionComment;
                                    //        description.SequenceNumber = proxydescription.SequenceNumber;
                                    //        opcode.Descriptions.Add(description);
                                    //    }
                                    //}
                                    #endregion

                                    #region//Job OPCode Causes - Not Used
                                    //if (proxyopcode.Causes != null && proxyopcode.Causes.Length > 0)
                                    //{
                                    //    opcode.Causes = new List<WA.Standard.IF.Data.v2.Common.Common.Cause>();
                                    //    foreach (WA.v2.WS_Job.Cause proxycause in proxyopcode.Causes)
                                    //    {
                                    //        WA.Standard.IF.Data.v2.Common.Common.Cause cause = new WA.Standard.IF.Data.v2.Common.Common.Cause();
                                    //        cause.CauseLaborOpCode = proxycause.CauseLaborOpCode;
                                    //        cause.Comment = proxycause.Comment;
                                    //        cause.SequenceNumber = proxycause.SequenceNumber;
                                    //        opcode.Causes.Add(cause);
                                    //    }
                                    //}
                                    #endregion

                                    #region//Job OPCode Corrections - Not Used
                                    //if (proxyopcode.Corrections != null && proxyopcode.Corrections.Length > 0)
                                    //{
                                    //    opcode.Corrections = new List<WA.Standard.IF.Data.v2.Common.Common.Correction>();
                                    //    foreach (WA.v2.WS_Job.Correction proxycorrection in proxyopcode.Corrections)
                                    //    {
                                    //        WA.Standard.IF.Data.v2.Common.Common.Correction correction = new WA.Standard.IF.Data.v2.Common.Common.Correction();
                                    //        correction.CorrectionLaborOpCode = proxycorrection.CorrectionLaborOpCode;
                                    //        correction.Comment = proxycorrection.Comment;
                                    //        correction.SequenceNumber = proxycorrection.SequenceNumber;
                                    //        opcode.Corrections.Add(correction);
                                    //    }
                                    //}
                                    #endregion

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

                            #region//Job Plan
                            if (proxyjob.Plan != null)
                            {
                                #region//Job Plan Header
                                WA.Standard.IF.Data.v2.Common.Job.Plan plan = new WA.Standard.IF.Data.v2.Common.Job.Plan();
                                plan.ScheduledDateTimeFromLocal = proxyjob.Plan.ScheduledDateTimeFromLocal;
                                plan.ScheduledDateTimeToLocal = proxyjob.Plan.ScheduledDateTimeToLocal;
                                plan.StallID = proxyjob.Plan.StallID;
                                plan.StallName = proxyjob.Plan.StallName;
                                #endregion

                                #region//Job Technicians
                                if (proxyjob.Plan.Technicians != null && proxyjob.Plan.Technicians.Length > 0)
                                {
                                    plan.Technicians = new List<WA.Standard.IF.Data.v2.Common.Job.Technician>();
                                    foreach (WA.v2.WS_Job.Technician proxytechnician in proxyjob.Plan.Technicians)
                                    {
                                        WA.Standard.IF.Data.v2.Common.Job.Technician technician = new WA.Standard.IF.Data.v2.Common.Job.Technician();
                                        technician.TCEmployeeID = proxytechnician.TCEmployeeID;
                                        technician.TCEmployeeName = proxytechnician.TCEmployeeName;
                                        plan.Technicians.Add(technician);
                                    }
                                }
                                #endregion

                                job.Plan = plan;
                            }
                            #endregion

                            #region//Job Dispatch
                            if (proxyjob.Dispatch != null)
                            {
                                #region//Job Dispatch Header
                                WA.Standard.IF.Data.v2.Common.Job.Dispatch dispatch = new WA.Standard.IF.Data.v2.Common.Job.Dispatch();
                                dispatch.ScheduledDateTimeFromLocal = proxyjob.Dispatch.ScheduledDateTimeFromLocal;
                                dispatch.ScheduledDateTimeToLocal = proxyjob.Dispatch.ScheduledDateTimeToLocal;
                                dispatch.StallID = proxyjob.Dispatch.StallID;
                                dispatch.StallName = proxyjob.Dispatch.StallName;
                                #endregion

                                #region//Job Technicians
                                if (proxyjob.Dispatch.Technicians != null && proxyjob.Dispatch.Technicians.Length > 0)
                                {
                                    dispatch.Technicians = new List<WA.Standard.IF.Data.v2.Common.Job.Technician>();
                                    foreach (WA.v2.WS_Job.Technician proxytechnician in proxyjob.Dispatch.Technicians)
                                    {
                                        WA.Standard.IF.Data.v2.Common.Job.Technician technician = new WA.Standard.IF.Data.v2.Common.Job.Technician();
                                        technician.TCEmployeeID = proxytechnician.TCEmployeeID;
                                        technician.TCEmployeeName = proxytechnician.TCEmployeeName;
                                        dispatch.Technicians.Add(technician);
                                    }
                                }
                                #endregion

                                job.Dispatch = dispatch;
                            }
                            #endregion

                            #region//Job Actual
                            if (proxyjob.Actual != null)
                            {
                                #region//Job Actual Header
                                WA.Standard.IF.Data.v2.Common.Job.Actual actual = new WA.Standard.IF.Data.v2.Common.Job.Actual();
                                actual.StallID = proxyjob.Actual.StallID;
                                actual.StallName = proxyjob.Actual.StallName;
                                #endregion

                                #region//Job ActualTimeLogs
                                if (proxyjob.Actual.ActualTimeLogs != null && proxyjob.Actual.ActualTimeLogs.Length > 0)
                                {
                                    actual.ActualTimeLogs = new List<WA.Standard.IF.Data.v2.Common.Job.ActualTimeLog>();
                                    foreach (WA.v2.WS_Job.ActualTimeLog proxyactualtimelog in proxyjob.Actual.ActualTimeLogs)
                                    {
                                        WA.Standard.IF.Data.v2.Common.Job.ActualTimeLog actualtimelog = new WA.Standard.IF.Data.v2.Common.Job.ActualTimeLog();
                                        actualtimelog.EndDateTimeLocal = proxyactualtimelog.EndDateTimeLocal;
                                        actualtimelog.PauseReasonCode = Map.GetWACodeFromDMSCode(CodeType.PauseReasonCode, proxyactualtimelog.PauseReasonCode);
                                        actualtimelog.PauseReasonComment = proxyactualtimelog.PauseReasonComment;
                                        actualtimelog.StartDateTimeLocal = proxyactualtimelog.StartDateTimeLocal;
                                        actualtimelog.Status = Map.GetWACodeFromDMSCode(CodeType.ActualJobStatus, proxyactualtimelog.Status);
                                        actualtimelog.TCEmployeeID = proxyactualtimelog.TCEmployeeID;
                                        actualtimelog.TCEmployeeName = proxyactualtimelog.TCEmployeeName;
                                        actual.ActualTimeLogs.Add(actualtimelog);
                                    }
                                }
                                #endregion

                                #region//Job JobComments
                                if (proxyjob.Actual.JobComments != null && proxyjob.Actual.JobComments.Length > 0)
                                {
                                    actual.JobComments = new List<WA.Standard.IF.Data.v2.Common.Job.JobComment>();
                                    foreach (WA.v2.WS_Job.JobComment proxyjobcomment in proxyjob.Actual.JobComments)
                                    {
                                        WA.Standard.IF.Data.v2.Common.Job.JobComment jobcomment = new WA.Standard.IF.Data.v2.Common.Job.JobComment();
                                        jobcomment.ActualWorkHour = proxyjobcomment.ActualWorkHour;
                                        jobcomment.SubStatus = Map.GetWACodeFromDMSCode(CodeType.JobSubStatus, proxyjobcomment.SubStatus);
                                        actual.JobComments.Add(jobcomment);
                                    }
                                }
                                #endregion

                                job.Actual = actual;
                            }
                            #endregion

                            response.Jobs.Add(job);
                        }
                    }
                    else
                    {
                        response.ResultMessage = GetResultMessageData(WA.Standard.IF.Data.v2.Common.Common.ResponseCode.NoResult, WA.Standard.IF.Data.v2.Common.Common.ResponseMessage.NoResult);
                    }
                    #endregion
                }
            }
            #endregion

            return response;
        }
예제 #3
0
        public WA.Standard.IF.Data.v2.Common.PackageCode.PackageCodeGetResponse PackageCodeGet(WA.Standard.IF.Data.v2.Common.PackageCode.PackageCodeGetRequest request)
        {
            WA.Standard.IF.Data.v2.Common.PackageCode.PackageCodeGetResponse response = new WA.Standard.IF.Data.v2.Common.PackageCode.PackageCodeGetResponse();

            #region v2.WA.v2 - WA.Standard.IF.WebService

            #region PackageCodeGet 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.v2.WS_PackageCode.PackageCode proxyws = new WA.v2.WS_PackageCode.PackageCode();
            proxyws.Credentials = proxycredential;

            //Create proxy request with packagecodeget and transaction
            WA.v2.WS_PackageCode.PackageCodeGetRequest proxyrequest = new WA.v2.WS_PackageCode.PackageCodeGetRequest();

            //Create proxy transaction
            WA.v2.WS_PackageCode.TransactionHeader proxytransactionheader = new WA.v2.WS_PackageCode.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;
                proxyws.Url = string.Format("{0}/rtr-atest/ws/PackageCode.1cws", proxytransactionheader.DMSServerUrl);
                #endregion
            }

            //Create proxy packagecodeget
            WA.v2.WS_PackageCode.PackageCodeGet proxypackagecodeget = new WA.v2.WS_PackageCode.PackageCodeGet();
            if (request.PackageCodeGet != null)
            {
                #region//PackageCodeGet Set
                proxypackagecodeget.Category = request.PackageCodeGet.Category;
                proxypackagecodeget.Code = request.PackageCodeGet.Code;
                proxypackagecodeget.Description = request.PackageCodeGet.Description;
                proxypackagecodeget.EngineCode = request.PackageCodeGet.EngineCode;
                proxypackagecodeget.Engine = request.PackageCodeGet.Engine;
                proxypackagecodeget.LastModifiedDateTimeFromUTC = request.PackageCodeGet.LastModifiedDateTimeFromUTC;
                proxypackagecodeget.LastModifiedDateTimeToUTC = request.PackageCodeGet.LastModifiedDateTimeToUTC;
                proxypackagecodeget.Make = request.PackageCodeGet.Make;
                proxypackagecodeget.Mileage = request.PackageCodeGet.Mileage;
                proxypackagecodeget.ModelCode = request.PackageCodeGet.ModelCode;
                proxypackagecodeget.Model = request.PackageCodeGet.Model;
                proxypackagecodeget.Year = request.PackageCodeGet.Year;
                proxyrequest.PackageCodeGet = proxypackagecodeget;
                #endregion
            }
            #endregion

            //Run proxy web method with proxy request
            WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS PackageCodeGetRequest XML", proxyrequest);

            WA.v2.WS_PackageCode.PackageCodeGetResponse proxyresponse = proxyws.PackageCodeGet(proxyrequest);

            WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS PackageCodeGetResponse XML", proxyresponse);

            //Mapping with Standard Interface Specification Object
            if (proxyresponse != null)
            {
                if (proxyresponse.TransactionHeader != null)
                {
                    #region//TransactionHeader Set
                    WA.Standard.IF.Data.v2.Common.Common.TransactionHeader transactionheader = new WA.Standard.IF.Data.v2.Common.Common.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.v2.WS_PackageCode.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 //PackageCodeGetResponse Set

                    if (proxyresponse.PackageCodes != null && proxyresponse.PackageCodes.Length > 0)
                    {
                        #region//PackageCodesGetResponse Set
                        response.PackageCodes = new List<WA.Standard.IF.Data.v2.Common.PackageCode.PackageCode>();
                        foreach (WA.v2.WS_PackageCode.PackageCode1 proxypackagecode in proxyresponse.PackageCodes)
                        {
                            #region //PackageCodes Header
                            WA.Standard.IF.Data.v2.Common.PackageCode.PackageCode packagecode = new WA.Standard.IF.Data.v2.Common.PackageCode.PackageCode();
                            packagecode.Code = proxypackagecode.Code;
                            packagecode.DefLinePaymentMethod = proxypackagecode.DefLinePaymentMethod;
                            packagecode.Description = proxypackagecode.Description;
                            packagecode.PackageCodeType = Map.GetWACodeFromDMSCode(CodeType.PackageCodeType, proxypackagecode.PackageCodeType);
                            packagecode.DisplayPackageCode = proxypackagecode.DisplayPackageCode;
                            packagecode.DisplayPackageDescription = proxypackagecode.DisplayPackageDescription;
                            packagecode.EngineCode = proxypackagecode.EngineCode;
                            packagecode.Engine = proxypackagecode.Engine;
                            packagecode.EstimatedHours = proxypackagecode.EstimatedHours;
                            packagecode.Make = proxypackagecode.Make;
                            packagecode.Mileage = proxypackagecode.Mileage;
                            packagecode.ModelCode = proxypackagecode.ModelCode;
                            packagecode.Model = proxypackagecode.Model;
                            packagecode.Period = proxypackagecode.Period;
                            packagecode.Year = proxypackagecode.Year;
                            #endregion

                            #region //PackageCodes ManagementFields
                            if (proxypackagecode.ManagementFields != null)
                            {
                                WA.Standard.IF.Data.v2.Common.Common.ManagementFields managementfields = new WA.Standard.IF.Data.v2.Common.Common.ManagementFields();
                                managementfields.CreateDateTimeUTC = proxypackagecode.ManagementFields.CreateDateTimeUTC;
                                managementfields.LastModifiedDateTimeUTC = proxypackagecode.ManagementFields.LastModifiedDateTimeUTC;
                                packagecode.ManagementFields = managementfields;
                            }
                            #endregion

                            #region //PackageCodes PriceType
                            if (proxypackagecode.PriceType != null)
                            {
                                WA.Standard.IF.Data.v2.Common.Common.PriceType pricetype = new WA.Standard.IF.Data.v2.Common.Common.PriceType();
                                pricetype.DiscountPrice = proxypackagecode.PriceType.DiscountPrice;
                                pricetype.DiscountRate = proxypackagecode.PriceType.DiscountRate;
                                pricetype.TotalPrice = proxypackagecode.PriceType.TotalPrice;
                                pricetype.TotalPriceIncludeTax = proxypackagecode.PriceType.TotalPriceIncludeTax;
                                pricetype.UnitPrice = proxypackagecode.PriceType.UnitPrice;
                                packagecode.PriceType = pricetype;
                            }
                            #endregion

                            if (proxypackagecode.OPCodes != null && proxypackagecode.OPCodes.Length > 0)
                            {
                                #region//PackageCodes OPCode
                                packagecode.OPCodes = new List<WA.Standard.IF.Data.v2.Common.PackageCode.OPCode>();
                                foreach (WA.v2.WS_PackageCode.OPCode proxyopcode in proxypackagecode.OPCodes)
                                {
                                    #region //PackageCodes OPCode Header
                                    WA.Standard.IF.Data.v2.Common.PackageCode.OPCode opcode = new WA.Standard.IF.Data.v2.Common.PackageCode.OPCode();
                                    opcode.Code = proxyopcode.Code;
                                    opcode.CorrectionLOP = proxyopcode.CorrectionLOP;
                                    opcode.CPSIND = proxyopcode.CPSIND;
                                    opcode.DefLinePaymentMethod = proxyopcode.DefLinePaymentMethod;
                                    opcode.Description = proxyopcode.Description;
                                    opcode.DisplayOPCode = proxyopcode.DisplayOPCode;
                                    opcode.DisplayOPDescription = proxyopcode.DisplayOPDescription;
                                    opcode.Engine = proxyopcode.Engine;
                                    opcode.EstimatedHours = proxyopcode.EstimatedHours;
                                    opcode.HazardMaterialCharge = proxyopcode.HazardMaterialCharge;
                                    opcode.MandatoryYN = proxyopcode.MandatoryYN;
                                    opcode.Make = proxyopcode.Make;
                                    opcode.Mileage = proxyopcode.Mileage;
                                    opcode.Model = proxyopcode.Model;
                                    opcode.OPCodeType = Map.GetWACodeFromDMSCode(CodeType.OPCodeType, proxyopcode.OPCodeType);
                                    opcode.Quantity = proxyopcode.Quantity;
                                    opcode.Period = proxyopcode.Period;
                                    opcode.PredefinedCauseDescription = proxyopcode.PredefinedCauseDescription;
                                    opcode.SkillLevel = proxyopcode.SkillLevel;
                                    opcode.Year = proxyopcode.Year;
                                    #endregion

                                    #region //PackageCodes OPCode PriceType
                                    if (proxyopcode.PriceType != null)
                                    {
                                        WA.Standard.IF.Data.v2.Common.Common.PriceType pricetype = new WA.Standard.IF.Data.v2.Common.Common.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 //PackageCodes OPCode Parts
                                    if (proxyopcode.Parts != null && proxyopcode.Parts.Length > 0)
                                    {
                                        opcode.Parts = new List<WA.Standard.IF.Data.v2.Common.PackageCode.Part>();
                                        foreach (WA.v2.WS_PackageCode.Part proxypart in proxyopcode.Parts)
                                        {
                                            #region //PackageCodes OPCode Part Header
                                            WA.Standard.IF.Data.v2.Common.PackageCode.Part part = new WA.Standard.IF.Data.v2.Common.PackageCode.Part();
                                            part.DisplayPartNumber = proxypart.DisplayPartNumber;
                                            part.MandatoryYN = proxypart.MandatoryYN;
                                            part.PartDescription = proxypart.PartDescription;
                                            part.PartNumber = proxypart.PartNumber;
                                            part.PartType = Map.GetWACodeFromDMSCode(CodeType.PartType, proxypart.PartType);
                                            part.Quantity = proxypart.Quantity;
                                            //part.ServiceType = Map.GetWACodeFromDMSCode(CodeType.ServiceType, proxypart.ServiceType);
                                            part.StockQuantity = proxypart.StockQuantity;
                                            part.StockStatus = proxypart.StockStatus;
                                            part.UnitOfMeasure = proxypart.UnitOfMeasure;
                                            part.QuantityOnHand = proxypart.QuantityOnHand;
                                            #endregion

                                            #region //PackageCodes OPCode Part PriceType
                                            if (proxypart.PriceType != null)
                                            {
                                                WA.Standard.IF.Data.v2.Common.Common.PriceType pricetype = new WA.Standard.IF.Data.v2.Common.Common.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

                                    packagecode.OPCodes.Add(opcode);
                                }
                                #endregion
                            }
                            response.PackageCodes.Add(packagecode);
                        }
                        #endregion
                    }
                    else
                    {
                        response.ResultMessage = GetResultMessageData(WA.Standard.IF.Data.v2.Common.Common.ResponseCode.NoResult, WA.Standard.IF.Data.v2.Common.Common.ResponseMessage.NoResult);
                    }
                    #endregion
                }
            }
            #endregion

            return response;
        }
예제 #4
0
        public WA.Standard.IF.Data.v2.Common.Employee.EmployeeGetResponse EmployeeGet(WA.Standard.IF.Data.v2.Common.Employee.EmployeeGetRequest request)
        {
            WA.Standard.IF.Data.v2.Common.Employee.EmployeeGetResponse response = new WA.Standard.IF.Data.v2.Common.Employee.EmployeeGetResponse();

            #region v2.WA.v2 - WA.Standard.IF.WebService

            #region EmployeeGet 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.v2.WS_Employee.Employee proxyws = new WA.v2.WS_Employee.Employee();
            proxyws.Credentials = proxycredential;

            //Create proxy request with employeeget and transaction
            WA.v2.WS_Employee.EmployeeGetRequest proxyrequest = new WA.v2.WS_Employee.EmployeeGetRequest();

            //Create proxy transaction
            WA.v2.WS_Employee.TransactionHeader proxytransactionheader = new WA.v2.WS_Employee.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;
                proxyws.Url = string.Format("{0}/rtr-atest/ws/Employee.1cws", proxytransactionheader.DMSServerUrl);
                #endregion
            }

            //Create proxy employeeget
            WA.v2.WS_Employee.EmployeeGet proxyemployeeget = new WA.v2.WS_Employee.EmployeeGet();
            if (request.EmployeeGet != null)
            {
                #region//EmployeeGet Set
                proxyemployeeget.DMSEmployeeNo = request.EmployeeGet.DMSEmployeeNo;
                proxyemployeeget.LastModifiedDateTimeFromUTC = request.EmployeeGet.LastModifiedDateTimeFromUTC;
                proxyemployeeget.LastModifiedDateTimeToUTC = request.EmployeeGet.LastModifiedDateTimeToUTC;
                proxyemployeeget.LoginID = request.EmployeeGet.LoginID;
                proxyrequest.EmployeeGet = proxyemployeeget;
                #endregion
            }
            #endregion

            //Run proxy web method with proxy request
            WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS EmployeeGetRequest XML", proxyrequest);

            WA.v2.WS_Employee.EmployeeGetResponse proxyresponse = proxyws.EmployeeGet(proxyrequest);

            WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS EmployeeGetResponse XML", proxyresponse);

            //Mapping with Standard Interface Specification Object
            if (proxyresponse != null)
            {
                if (proxyresponse.TransactionHeader != null)
                {
                    #region//TransactionHeader Set
                    WA.Standard.IF.Data.v2.Common.Common.TransactionHeader transactionheader = new WA.Standard.IF.Data.v2.Common.Common.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.v2.WS_Employee.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 //EmployeeGetResponse Set

                    if (proxyresponse.Employees != null && proxyresponse.Employees.Length > 0)
                    {
                        response.Employees = new List<WA.Standard.IF.Data.v2.Common.Employee.Employee>();
                        foreach (WA.v2.WS_Employee.Employee1 proxyemployee in proxyresponse.Employees)
                        {
                            #region //Employee Header
                            WA.Standard.IF.Data.v2.Common.Employee.Employee employee = new WA.Standard.IF.Data.v2.Common.Employee.Employee();
                            employee.DMSEmployeeNo = proxyemployee.DMSEmployeeNo;
                            employee.Email = proxyemployee.Email;
                            employee.EmployeeStatus = Map.GetWACodeFromDMSCode(CodeType.EmployeeStatus, proxyemployee.EmployeeStatus);
                            employee.FirstName = proxyemployee.FirstName;
                            employee.FullName = proxyemployee.FullName;
                            employee.Gender = Map.GetWACodeFromDMSCode(CodeType.Gender, proxyemployee.Gender);
                            employee.Group = proxyemployee.Group;
                            employee.Language = proxyemployee.Language;
                            employee.LastName = proxyemployee.LastName;
                            employee.LoginID = proxyemployee.LoginID;
                            employee.LoginPassword = proxyemployee.LoginPassword;
                            employee.MiddleName = proxyemployee.MiddleName;
                            employee.MobileNumber = proxyemployee.MobileNumber;
                            employee.PhoneNumber = proxyemployee.PhoneNumber;
                            employee.Salution = proxyemployee.Salution;
                            employee.SkillsetString = proxyemployee.SkillsetString;
                            employee.Title = proxyemployee.Title;
                            #endregion

                            #region //Employee Roles
                            if (proxyemployee.Roles != null && proxyemployee.Roles.Length > 0)
                            {
                                employee.Roles = new List<WA.Standard.IF.Data.v2.Common.Employee.Role>();
                                foreach (WA.v2.WS_Employee.Role proxyrole in proxyemployee.Roles)
                                {
                                    WA.Standard.IF.Data.v2.Common.Employee.Role role = new WA.Standard.IF.Data.v2.Common.Employee.Role();
                                    role.RoleName = Map.GetWACodeFromDMSCode(CodeType.RoleName, proxyrole.RoleName);
                                    role.RoleUserID = proxyrole.RoleUserID;
                                    employee.Roles.Add(role);
                                }
                            }
                            #endregion

                            #region //Employee ManagementFields
                            if (proxyemployee.ManagementFields != null)
                            {
                                WA.Standard.IF.Data.v2.Common.Common.ManagementFields managementfields = new WA.Standard.IF.Data.v2.Common.Common.ManagementFields();
                                managementfields.LastModifiedDateTimeUTC = proxyemployee.ManagementFields.CreateDateTimeUTC;
                                managementfields.LastModifiedDateTimeUTC = proxyemployee.ManagementFields.LastModifiedDateTimeUTC;
                                employee.ManagementFields = managementfields;
                            }

                            response.Employees.Add(employee);
                            #endregion
                        }
                    }
                    else
                    {
                        response.ResultMessage = GetResultMessageData(WA.Standard.IF.Data.v2.Common.Common.ResponseCode.NoResult, WA.Standard.IF.Data.v2.Common.Common.ResponseMessage.NoResult);
                    }
                    #endregion
                }
            }
            #endregion

            return response;
        }