public WA.Standard.IF.Data.v2.HMCIS.Price.PriceCheckResponse PriceCheck(WA.Standard.IF.Data.v2.HMCIS.Price.PriceCheckRequest request) { WA.Standard.IF.Data.v2.HMCIS.Price.PriceCheckResponse response = new WA.Standard.IF.Data.v2.HMCIS.Price.PriceCheckResponse(); #region v2.WA.v2 - WA.Standard.IF.WebService #region PriceCheck 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_Price.Price proxyws = new WA.v2.WS_Price.Price(); proxyws.Credentials = proxycredential; //Create proxy request with pricecheck and transaction WA.v2.WS_Price.PriceCheckRequest proxyrequest = new WA.v2.WS_Price.PriceCheckRequest(); //Create proxy transaction WA.v2.WS_Price.TransactionHeader proxytransactionheader = new WA.v2.WS_Price.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/Price.1cws", proxytransactionheader.DMSServerUrl); #endregion } //Create proxy pricecheck WA.v2.WS_Price.PriceCheck proxypricecheck = new WA.v2.WS_Price.PriceCheck(); if (request.PriceCheck != null) { #region//PriceCheck Header proxypricecheck.DMSRONo = request.PriceCheck.DMSRONo; #endregion #region//PriceCheck OPCodes if (request.PriceCheck.OPCodes != null && request.PriceCheck.OPCodes.Count > 0) { int opcodescnt = 0; WA.v2.WS_Price.OPCode[] proxyopcodes = new WA.v2.WS_Price.OPCode[request.PriceCheck.OPCodes.Count]; foreach (WA.Standard.IF.Data.v2.HMCIS.Price.OPCode opcode in request.PriceCheck.OPCodes) { #region//PriceCheck OPCode Header WA.v2.WS_Price.OPCode proxyopcode = new WA.v2.WS_Price.OPCode(); proxyopcode.Code = opcode.Code; proxyopcode.Engine = opcode.Engine; proxyopcode.Make = opcode.Make; proxyopcode.Mileage = opcode.Mileage; proxyopcode.Model = opcode.Model; proxyopcode.Period = opcode.Period; proxyopcode.Year = opcode.Year; proxyopcode.Quantity = opcode.Quantity; #endregion #region//PriceCheck OPCode PriceType if (opcode.PriceType != null) { WA.v2.WS_Price.PriceType proxypricetype = new WA.v2.WS_Price.PriceType(); proxypricetype.DiscountPrice = opcode.PriceType.DiscountPrice; proxypricetype.DiscountRate = opcode.PriceType.DiscountRate; proxypricetype.TotalPrice = opcode.PriceType.TotalPrice; proxypricetype.TotalPriceIncludeTax = opcode.PriceType.TotalPriceIncludeTax; proxypricetype.UnitPrice = opcode.PriceType.UnitPrice; proxyopcode.PriceType = proxypricetype; } #endregion #region//PriceCheck OPCode Parts if (opcode.Parts != null && opcode.Parts.Count > 0) { int partscnt = 0; WA.v2.WS_Price.Part[] proxyparts = new WA.v2.WS_Price.Part[opcode.Parts.Count]; foreach (WA.Standard.IF.Data.v2.HMCIS.Price.Part part in opcode.Parts) { #region//PriceCheck OPCode Parts Header WA.v2.WS_Price.Part proxypart = new WA.v2.WS_Price.Part(); proxypart.Manufacturer = part.Manufacturer; proxypart.PartNumber = part.PartNumber; proxypart.Quantity = part.Quantity; //proxypart.ServiceType = part.ServiceType; #endregion #region//PriceCheck OPCode Parts PriceType if (part.PriceType != null) { WA.v2.WS_Price.PriceType proxypricetype = new WA.v2.WS_Price.PriceType(); proxypricetype.DiscountPrice = part.PriceType.DiscountPrice; proxypricetype.DiscountRate = part.PriceType.DiscountRate; proxypricetype.TotalPrice = part.PriceType.TotalPrice; proxypricetype.TotalPriceIncludeTax = part.PriceType.TotalPriceIncludeTax; proxypricetype.UnitPrice = part.PriceType.UnitPrice; proxypart.PriceType = proxypricetype; } #endregion proxyparts[partscnt] = proxypart; partscnt++; } proxyopcode.Parts = proxyparts; } #endregion proxyopcodes[opcodescnt] = proxyopcode; opcodescnt++; } proxypricecheck.OPCodes = proxyopcodes; } #endregion proxyrequest.PriceCheck = proxypricecheck; } #endregion //Run proxy web method with proxy request WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS PriceCheckRequest XML", proxyrequest); WA.v2.WS_Price.PriceCheckResponse proxyresponse = proxyws.PriceCheck(proxyrequest); WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS PriceCheckResponse 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_Price.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 //OPCodeGetResponse Set if (proxyresponse.Price != null) { #region//PricesGetResponse Set WA.v2.WS_Price.Price1 proxyprice = proxyresponse.Price; #region //Prices Header WA.Standard.IF.Data.v2.HMCIS.Price.Price price = new WA.Standard.IF.Data.v2.HMCIS.Price.Price(); price.LaborCampaignDiscountAmount = proxyprice.LaborCampaignDiscountAmount; price.PartsCampaignDiscountAmount = proxyprice.PartsCampaignDiscountAmount; price.TotalAmount = proxyprice.TotalAmount; price.TotalCampaignDiscountAmount = proxyprice.TotalCampaignDiscountAmount; price.VATAmount = proxyprice.VATAmount; price.AdditionalRepairOrderSummary = proxyprice.AdditionalRepairOrderSummary; #endregion if (proxyprice.OPCodes != null && proxyprice.OPCodes.Length > 0) { #region//Prices OPCode price.OPCodes = new List<Standard.IF.Data.v2.Common.OPCode.OPCode>(); foreach (WA.v2.WS_Price.OPCode1 proxyopcode in proxyprice.OPCodes) { #region //Prices OPCode Header WA.Standard.IF.Data.v2.Common.OPCode.OPCode opcode = new WA.Standard.IF.Data.v2.Common.OPCode.OPCode(); opcode.Code = proxyopcode.Code; opcode.Engine = proxyopcode.Engine; opcode.Make = proxyopcode.Make; opcode.Mileage = proxyopcode.Mileage; opcode.Model = proxyopcode.Model; opcode.Period = proxyopcode.Period; opcode.Year = proxyopcode.Year; opcode.Quantity = proxyopcode.Quantity; #endregion #region //Prices 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 //Prices OPCode Parts if (proxyopcode.Parts != null && proxyopcode.Parts.Length > 0) { opcode.Parts = new List<Standard.IF.Data.v2.Common.Part.Part>(); foreach (WA.v2.WS_Price.Part1 proxypart in proxyopcode.Parts) { #region //Prices OPCode Part Header WA.Standard.IF.Data.v2.Common.Part.Part part = new WA.Standard.IF.Data.v2.Common.Part.Part(); //part.Manufacturer = proxypart.Manufacturer; part.PartNumber = proxypart.PartNumber; part.Quantity = proxypart.Quantity; //part.ServiceType = proxypart.ServiceType; #endregion #region //Prices 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 price.OPCodes.Add(opcode); } #endregion } response.Price = price; #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; }
public WA.Standard.IF.Data.v2.Common.OPCode.OPCodeGetResponse OPCodeGet(WA.Standard.IF.Data.v2.Common.OPCode.OPCodeGetRequest request) { WA.Standard.IF.Data.v2.Common.OPCode.OPCodeGetResponse response = new WA.Standard.IF.Data.v2.Common.OPCode.OPCodeGetResponse(); #region v2.WA.v2 - WA.Standard.IF.WebService #region OPCodeGet 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_OPCode.OPCode proxyws = new WA.v2.WS_OPCode.OPCode(); proxyws.Credentials = proxycredential; //Create proxy request with opcodeget and transaction WA.v2.WS_OPCode.OPCodeGetRequest proxyrequest = new WA.v2.WS_OPCode.OPCodeGetRequest(); //Create proxy transaction WA.v2.WS_OPCode.TransactionHeader proxytransactionheader = new WA.v2.WS_OPCode.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/OPCode.1cws", proxytransactionheader.DMSServerUrl); #endregion } //Create proxy opcodeget WA.v2.WS_OPCode.OPCodeGet proxyopcodeget = new WA.v2.WS_OPCode.OPCodeGet(); if (request.OPCodeGet != null) { #region//OPCodeGet Set proxyopcodeget.Category = request.OPCodeGet.Category; proxyopcodeget.Code = request.OPCodeGet.Code; proxyopcodeget.Description = request.OPCodeGet.Description; proxyopcodeget.Engine = request.OPCodeGet.Engine; proxyopcodeget.Make = request.OPCodeGet.Make; proxyopcodeget.Mileage = request.OPCodeGet.Mileage; proxyopcodeget.Model = request.OPCodeGet.Model; proxyopcodeget.Year = request.OPCodeGet.Year; proxyrequest.OPCodeGet = proxyopcodeget; #endregion } #endregion //Run proxy web method with proxy request WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS OPCodeGetRequest XML", proxyrequest); WA.v2.WS_OPCode.OPCodeGetResponse proxyresponse = proxyws.OPCodeGet(proxyrequest); WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "DMS OPCodeGetResponse 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_OPCode.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 //OPCodeGetResponse Set if (proxyresponse.OPCodes != null && proxyresponse.OPCodes.Length > 0) { response.OPCodes = new List<WA.Standard.IF.Data.v2.Common.OPCode.OPCode>(); foreach (WA.v2.WS_OPCode.OPCode1 proxyopcode in proxyresponse.OPCodes) { #region //OPCode Header WA.Standard.IF.Data.v2.Common.OPCode.OPCode opcode = new WA.Standard.IF.Data.v2.Common.OPCode.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.Make = proxyopcode.Make; opcode.Mileage = proxyopcode.Mileage; opcode.Model = proxyopcode.Model; opcode.OPCodeType = Map.GetWACodeFromDMSCode(CodeType.OPCodeType, proxyopcode.OPCodeType); opcode.Period = proxyopcode.Period; opcode.PredefinedCauseDescription = proxyopcode.PredefinedCauseDescription; opcode.Quantity = proxyopcode.Quantity; opcode.SkillLevel = proxyopcode.SkillLevel; opcode.Year = proxyopcode.Year; #endregion #region //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 //OPCode Parts if (proxyopcode.Parts != null && proxyopcode.Parts.Length > 0) { opcode.Parts = new List<WA.Standard.IF.Data.v2.Common.Part.Part>(); foreach (WA.v2.WS_OPCode.Part proxypart in proxyopcode.Parts) { #region //OPCode Part Header WA.Standard.IF.Data.v2.Common.Part.Part part = new WA.Standard.IF.Data.v2.Common.Part.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.ServiceType = proxypart.ServiceType; part.StockQuantity = proxypart.StockQuantity; part.StockStatus = proxypart.StockStatus; part.UnitOfMeasure = proxypart.UnitOfMeasure; part.QuantityOnHand = proxypart.QuantityOnHand; #endregion #region //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 response.OPCodes.Add(opcode); } } 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; }