public CustomerVehicleGetResponse CustomerVehicleGet(CustomerVehicleGetRequest request) { CustomerVehicleGetResponse response = new CustomerVehicleGetResponse(); //DMS information set by dealer information string proxypath = string.Format("{0}.{1}.{2}", request.TransactionHeader.DocumentVersion, request.TransactionHeader.DMSCode, request.TransactionHeader.DMSVersion); switch (proxypath) { case "v2.WA.v2": { WA.v2.ProxyService proxyservice = new WA.v2.ProxyService(); response = proxyservice.CustomerVehicleGet(request); } break; case "v2.1C.v8241": { _1C.v8241.ProxyService proxyservice = new _1C.v8241.ProxyService(); response = proxyservice.CustomerVehicleGet(request); } break; default: response.TransactionHeader = request.TransactionHeader; response.Errors = new List<Error>() { new Error() { Code = ResponseCode.WA_NoMatchedProxy, Message = ResponseMessage.NoMatchedProxy } }; break; } return response; }
public CustomerVehicleGetResponse CustomerVehicleGet(CustomerVehicleGetRequest request) { CustomerVehicleGetResponse response = new CustomerVehicleGetResponse(); try { //Request body-header object validation response.Errors = GetErrorDataListFromRequestTransactionHeader(request.TransactionHeader); if (response.Errors != null) { response.TransactionHeader = new Data.v2.Common.Common.TransactionHeader(); return response; } response.Errors = GetErrorDataListFromRequest(request.CustomerVehicleGet); if (response.Errors != null) { response.TransactionHeader = request.TransactionHeader; return response; } using (CustomerVehicle_Biz biz = new CustomerVehicle_Biz()) { response = biz.CustomerVehicleGet(request); } } catch (Exception ex) { response.Errors = GetErrorDataListFromException(ex); WA.Standard.IF.Logger.Log.Log.RootLogger.ErrorFormat("CustomerVehicleGetResponse Error {0}: ", ex); } return response; }
public CustomerVehicleGetResponse CustomerVehicleGet(CustomerVehicleGetRequest request) { CustomerVehicleGetResponse response = new CustomerVehicleGetResponse(); try { WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "WA CustomerVehicleGetRequest XML", request); //Request body-header object validation response.Errors = GetErrorDataListFromRequestTransactionHeader(request.TransactionHeader); if (response.Errors != null) { response.TransactionHeader = new Data.v2.Common.Common.TransactionHeader(); } response.Errors = GetErrorDataListFromRequest(request.CustomerVehicleGet); if (response.Errors != null) { response.TransactionHeader = request.TransactionHeader; } if (response.Errors == null) { using (CustomerVehicle_Biz biz = new CustomerVehicle_Biz()) { response = biz.CustomerVehicleGet(request); } WA.Standard.IF.Logger.Log.Log.SaveXMLLog(0, request.TransactionHeader.DealerID, "WA CustomerVehicleGetRequest XML", response); } } catch (Exception ex) { response.Errors = GetErrorDataListFromException(ex); WA.Standard.IF.Logger.Log.Log.SaveErrorLog(null, "CustomerVehicleGet", request, ex.Message, ex); } return response; }
public CustomerVehicleGetResponse CustomerVehicleGet(CustomerVehicleGetRequest request) { CustomerVehicleGetResponse response = new CustomerVehicleGetResponse(); if (WA.Standard.IF.Logger.Log.Log.RunningMode.Equals(WA.Standard.IF.Data.v2.Common.Common.RunningMode.Mapper)) { #region For Mapper Process WA.Standard.IF.Proxy.v2.Common.CustomerVehicle_Proxy proxy = new Proxy.v2.Common.CustomerVehicle_Proxy(); response = proxy.CustomerVehicleGet(request); #endregion } else if (WA.Standard.IF.Logger.Log.Log.RunningMode.Equals(WA.Standard.IF.Data.v2.Common.Common.RunningMode.XMLDMS)) { response.TransactionHeader = request.TransactionHeader; #region For XML Process List<CustomerVehicle> CustomerVehicles = Util.DataHelper.GetListByElementName<CustomerVehicle>(System.Web.HttpContext.Current.Server.MapPath("/v2/Repository/CustomerVehicles.xml"), "CustomerVehicle"); if (CustomerVehicles != null && CustomerVehicles.Count > 0) { List<CustomerVehicle> resultlist = CustomerVehicles .Where(item => (request.CustomerVehicleGet.Customer == null || (request.CustomerVehicleGet.Customer != null && (string.IsNullOrEmpty(request.CustomerVehicleGet.Customer.CardNo) || request.CustomerVehicleGet.Customer.CardNo == item.Customer.CardNo) && (string.IsNullOrEmpty(request.CustomerVehicleGet.Customer.DMSCustomerNo) || request.CustomerVehicleGet.Customer.DMSCustomerNo == item.Customer.DMSCustomerNo) && (string.IsNullOrEmpty(request.CustomerVehicleGet.Customer.Email) || request.CustomerVehicleGet.Customer.Email == item.Customer.Email) && (string.IsNullOrEmpty(request.CustomerVehicleGet.Customer.LastName) || request.CustomerVehicleGet.Customer.LastName == item.Customer.LastName) //Need to add condition, Contacts ) ) && (request.CustomerVehicleGet.Vehicle == null || (request.CustomerVehicleGet.Vehicle != null && (string.IsNullOrEmpty(request.CustomerVehicleGet.Vehicle.DMSVehicleNo) || request.CustomerVehicleGet.Vehicle.DMSVehicleNo == item.Vehicle.DMSVehicleNo) && (string.IsNullOrEmpty(request.CustomerVehicleGet.Vehicle.LastSixVIN) || request.CustomerVehicleGet.Vehicle.LastSixVIN == item.Vehicle.LastSixVIN) && (string.IsNullOrEmpty(request.CustomerVehicleGet.Vehicle.LicensePlateNo) || request.CustomerVehicleGet.Vehicle.LicensePlateNo == item.Vehicle.LicensePlateNo) && (string.IsNullOrEmpty(request.CustomerVehicleGet.Vehicle.VIN) || request.CustomerVehicleGet.Vehicle.VIN == item.Vehicle.VIN) ) )).ToList<CustomerVehicle>(); response.CustomerVehicles = resultlist; if (resultlist.Count > 0) response.ResultMessage = GetResultMessageData(ResponseCode.Success, ResponseMessage.Success); else response.ResultMessage = GetResultMessageData(ResponseCode.NoResult, ResponseMessage.NoResult); } else { response.ResultMessage = GetResultMessageData(ResponseCode.NoResult, ResponseMessage.NoResult); } #endregion } else if (WA.Standard.IF.Logger.Log.Log.RunningMode.Equals(WA.Standard.IF.Data.v2.Common.Common.RunningMode.DBDMS)) { #region For DB Process /* DataSet resultDS = new DataSet(); using (CustomerVehicle_Dac dac = new CustomerVehicle_Dac()) { if (request.CustomerVehicleGet.Customer != null && request.CustomerVehicleGet.Customer.Contacts != null) { foreach (WA.Standard.IF.Data.v2.Common.CustomerVehicle.Contact contact in request.CustomerVehicleGet.Customer.Contacts) { DataSet ds = dac.SelectCustomerVehicle(request.TransactionHeader.CountryID , request.TransactionHeader.DistributorID , request.TransactionHeader.GroupID , request.TransactionHeader.DealerID , request.TransactionHeader.Language // Need to check , contact.ContactType , contact.ContactValue , request.CustomerVehicleGet ); //Merging all data. Because same appointment could be return from sql server. resultDS.Merge(ds); } //Remove duplicate rows by key field if (resultDS.Tables != null) { for (int i = 0; i < resultDS.Tables.Count; i++) { if (i == 0) Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSCustomerNo"); else if (i == 1) Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSAddressNo"); else if (i == 2) Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSContactNo"); else if (i == 3) Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSCorporateInfoNo"); else if (i == 4) Util.DataHelper.RemoveDuplicateRows(resultDS.Tables[i], "DMSCampaignNo"); } } } else { resultDS = dac.SelectCustomerVehicle(request.TransactionHeader.CountryID , request.TransactionHeader.DistributorID , request.TransactionHeader.GroupID , request.TransactionHeader.DealerID , request.TransactionHeader.Language //language , null //contact.ContactType , null //contact.ContactValue , request.CustomerVehicleGet ); } } //0. Customer //1. Address //2. Contact //3. CorporateInfo //4. Customer //5. Vehicle //6. Campaigns if (resultDS.Tables != null && resultDS.Tables.Count > 0) { List<CustomerVehicle> CustomerVehicles = null; if (resultDS.Tables[0].Rows.Count > 0) { #region CustomerVehicles CustomerVehicles = resultDS.Tables[0].AsEnumerable() .Select(row => new CustomerVehicle { Customer = new Data.v2.Common.Customer.Customer() { CardNo = Util.DataHelper.ConvertObjectToString(row["CardNo"]), CustomerInfoType = Util.DataHelper.ConvertObjectToString(row["CustomerInfoType"]), DMSCustomerNo = Util.DataHelper.ConvertObjectToString(row["DMSCustomerNo"]), Email = Util.DataHelper.ConvertObjectToString(row["Email"]), FirstName = Util.DataHelper.ConvertObjectToString(row["FirstName"]), FullName = Util.DataHelper.ConvertObjectToString(row["FullName"]), Gender = Util.DataHelper.ConvertObjectToString(row["Gender"]), LastName = Util.DataHelper.ConvertObjectToString(row["LastName"]), MiddleName = Util.DataHelper.ConvertObjectToString(row["MiddleName"]), Salutation = Util.DataHelper.ConvertObjectToString(row["Salutation"]), SpecialMessage = new SpecialMessage() { Message = Util.DataHelper.ConvertObjectToString(row["SpecialMessage"], null) }, Addresses = new List<Address>(), Contacts = new List<Data.v2.Common.Customer.Contact>(), CorporateInfos = new List<CorporateInfo>(), }, Vehicle = new Data.v2.Common.Vehicle.Vehicle() { Color = Util.DataHelper.ConvertObjectToString(row["Color"]), Cylinders = Util.DataHelper.ConvertObjectToString(row["Cylinders"]), DateDelivered = Util.DataHelper.ConvertObjectToDateTime(row["DateDelivered"]), DateInService = Util.DataHelper.ConvertObjectToDateTime(row["DateInService"]), DeclinedJob = Util.DataHelper.ConvertObjectToString(row["DeclinedJob"]), DisplayDescription = Util.DataHelper.ConvertObjectToString(row["DisplayDescription"]), DMSCustomerNo = Util.DataHelper.ConvertObjectToString(row["DMSCustomerNo"]), DMSVehicleNo = Util.DataHelper.ConvertObjectToString(row["DMSVehicleNo"]), EngineType = Util.DataHelper.ConvertObjectToString(row["EngineType"]), ExtendedWarranty = Util.DataHelper.ConvertObjectToDateTime(row["ExtendedWarranty"]), FuelType = Util.DataHelper.ConvertObjectToString(row["FuelType"]), FullModelName = Util.DataHelper.ConvertObjectToString(row["FullModelName"]), InsuranceDate = Util.DataHelper.ConvertObjectToDateTime(row["InsuranceDate"]), LastMileage = Util.DataHelper.ConvertObjectToString(row["LastMileage"]), LastServiceDate = Util.DataHelper.ConvertObjectToDateTime(row["LastServiceDate"]), LastSixVIN = Util.DataHelper.ConvertObjectToString(row["LastSixVIN"]), LicenseNumber = Util.DataHelper.ConvertObjectToString(row["LicenseNumber"]), LicensePlateNo = Util.DataHelper.ConvertObjectToString(row["LicensePlateNo"]), Make = Util.DataHelper.ConvertObjectToString(row["Make"]), ModelCode = Util.DataHelper.ConvertObjectToString(row["ModelCode"]), ModelName = Util.DataHelper.ConvertObjectToString(row["ModelName"]), ModelYear = Util.DataHelper.ConvertObjectToString(row["ModelYear"]), PendingJob = Util.DataHelper.ConvertObjectToString(row["PendingJob"]), StockNumber = Util.DataHelper.ConvertObjectToString(row["StockNumber"]), Trim = Util.DataHelper.ConvertObjectToString(row["Trim"]), VehicleType = Util.DataHelper.ConvertObjectToString(row["VehicleType"]), VIN = Util.DataHelper.ConvertObjectToString(row["VIN"]), WarrantyMiles = Util.DataHelper.ConvertObjectToString(row["WarrantyMiles"]), WarrantyMonths = Util.DataHelper.ConvertObjectToString(row["WarrantyMonths"]), WarrantyStartDate = Util.DataHelper.ConvertObjectToDateTime(row["WarrantyStartDate"]), Campaigns = new List<Campaign>(), } }).ToList(); #endregion if (CustomerVehicles != null && CustomerVehicles.Count > 0) { foreach (CustomerVehicle customervehicle in CustomerVehicles) { if (resultDS.Tables.Count > 1 && resultDS.Tables[1].Rows.Count > 0) { #region Addresses List<Address> Addresses = null; Addresses = resultDS.Tables[1].AsEnumerable() .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSCustomerNo"], null) == customervehicle.Customer.DMSCustomerNo) .Select(row => new Address { Address1 = Util.DataHelper.ConvertObjectToString(row["Address1"]), Address2 = Util.DataHelper.ConvertObjectToString(row["Address2"]), AddressType = Util.DataHelper.ConvertObjectToString(row["AddressType"]), City = Util.DataHelper.ConvertObjectToString(row["City"]), Country = Util.DataHelper.ConvertObjectToString(row["Country"]), State = Util.DataHelper.ConvertObjectToString(row["State"]), ZipCode = Util.DataHelper.ConvertObjectToString(row["ZipCode"]), }).ToList(); if (Addresses != null && Addresses.Count > 0) customervehicle.Customer.Addresses = Addresses; #endregion } if (resultDS.Tables.Count > 2 && resultDS.Tables[2].Rows.Count > 0) { #region Contacts List<WA.Standard.IF.Data.v2.Common.Customer.Contact> Contacts = null; Contacts = resultDS.Tables[2].AsEnumerable() .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSCustomerNo"], null) == customervehicle.Customer.DMSCustomerNo) .Select(row => new WA.Standard.IF.Data.v2.Common.Customer.Contact { ContactMethodYN = Util.DataHelper.ConvertObjectToString(row["ContactMethodYN"]), ContactType = Util.DataHelper.ConvertObjectToString(row["ContactType"]), ContactValue = Util.DataHelper.ConvertObjectToString(row["ContactValue"]), }).ToList(); if (Contacts != null && Contacts.Count > 0) customervehicle.Customer.Contacts = Contacts; #endregion } if (resultDS.Tables.Count > 3 && resultDS.Tables[3].Rows.Count > 0) { #region CorporateInfos List<WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo> CorporateInfos = null; CorporateInfos = resultDS.Tables[3].AsEnumerable() .Where(row => Util.DataHelper.ConvertObjectToString(row["DMSCustomerNo"], null) == customervehicle.Customer.DMSCustomerNo) .Select(row => new WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo { Name = Util.DataHelper.ConvertObjectToString(row["Name"]), Value = Util.DataHelper.ConvertObjectToString(row["Value"]), }).ToList(); if (CorporateInfos != null && CorporateInfos.Count > 0) customervehicle.Customer.CorporateInfos = CorporateInfos; #endregion } if (resultDS.Tables.Count > 4 && resultDS.Tables[4].Rows.Count > 0) { #region Campaigns List<WA.Standard.IF.Data.v2.Common.Vehicle.Campaign> Campaigns = null; Campaigns = resultDS.Tables[4].AsEnumerable() .Where(row => Util.DataHelper.ConvertObjectToString(row["VIN"], null) == customervehicle.Vehicle.VIN) .Select(row => new WA.Standard.IF.Data.v2.Common.Vehicle.Campaign { CampaignDescription = Util.DataHelper.ConvertObjectToString(row["CampaignDescription"]), CampaignID = Util.DataHelper.ConvertObjectToString(row["CampaignID"]), CampaignPerformed = Util.DataHelper.ConvertObjectToString(row["CampaignPerformed"]), }).ToList(); if (Campaigns != null && Campaigns.Count > 0) customervehicle.Vehicle.Campaigns = Campaigns; #endregion } } response.CustomerVehicles = CustomerVehicles; response.ResultMessage = GetResultMessageData(PredefinedCode._SuccessDone, PredefinedMessage._SuccessDone); } } else { response.ResultMessage = GetResultMessageData(PredefinedCode._SuccessNoResult, PredefinedMessage._SuccessNoResult); } } else { response.ResultMessage = GetResultMessageData(PredefinedCode._SuccessNoResult, PredefinedMessage._SuccessNoResult); } */ #endregion } return response; }
public CustomerVehicleGetResponse CustomerVehicleGet(CustomerVehicleGetRequest request) { CustomerVehicleGetResponse response = new CustomerVehicleGetResponse(); //DMS information set by dealer information string proxypath = string.Format("{0}.{1}.{2}.{3}", request.TransactionHeader.DocumentVersion, request.TransactionHeader.DistributorID, request.TransactionHeader.DMSCode, request.TransactionHeader.DMSVersion); switch (proxypath) { case "v2.Common.WA.v2": { #region v2.Common.WA.v2 - RTR (Proxy Class Dll Name : _WA.Mapper.v2) #region CustomerVehicleGet Request Set //Create proxy credential NetworkCredential proxycredential = new NetworkCredential(request.TransactionHeader.Username, request.TransactionHeader.Password); //Create proxy web service from dms web service with credential _WA.Mapper.v2.CustomerVehicle.CustomerVehicle proxyws = new _WA.Mapper.v2.CustomerVehicle.CustomerVehicle(request.TransactionHeader.DMSServerUrl); proxyws.Credentials = proxycredential; //Create proxy request with customervehicleget and transaction _WA.Mapper.v2.CustomerVehicle.CustomerVehicleGetRequest proxyrequest = new _WA.Mapper.v2.CustomerVehicle.CustomerVehicleGetRequest(); //Create proxy transaction _WA.Mapper.v2.CustomerVehicle.TransactionHeader proxytransactionheader = new _WA.Mapper.v2.CustomerVehicle.TransactionHeader(); if (request.TransactionHeader != null) { #region//TransactionHeader Set proxytransactionheader.CountryID = request.TransactionHeader.CountryID; proxytransactionheader.DealerID = request.TransactionHeader.DealerID; proxytransactionheader.DistributorID = request.TransactionHeader.DistributorID; proxytransactionheader.DMSCode = request.TransactionHeader.DMSCode; proxytransactionheader.DMSServerUrl = request.TransactionHeader.DMSServerUrl; proxytransactionheader.DMSVersion = request.TransactionHeader.DMSVersion; proxytransactionheader.DocumentVersion = request.TransactionHeader.DocumentVersion; proxytransactionheader.GroupID = request.TransactionHeader.GroupID; proxytransactionheader.IneterfaceID = request.TransactionHeader.IneterfaceID; proxytransactionheader.Password = request.TransactionHeader.Password; proxytransactionheader.PollingToken = request.TransactionHeader.PollingToken; proxytransactionheader.RequestPollingToken = request.TransactionHeader.RequestPollingToken; proxytransactionheader.RequestType = request.TransactionHeader.RequestType; proxytransactionheader.TransactionId = request.TransactionHeader.TransactionId; proxytransactionheader.TransactionDateTimeLocal = request.TransactionHeader.TransactionDateTimeLocal; proxytransactionheader.TransactionDateTimeUTC = request.TransactionHeader.TransactionDateTimeUTC; proxytransactionheader.TransactionType = request.TransactionHeader.TransactionType; proxytransactionheader.Username = request.TransactionHeader.Username; proxytransactionheader.VenderTrackingCode = request.TransactionHeader.VenderTrackingCode; proxyrequest.TransactionHeader = proxytransactionheader; #endregion } //Create proxy customervehicleget _WA.Mapper.v2.CustomerVehicle.CustomerVehicleGet proxycustomervehicleget = new _WA.Mapper.v2.CustomerVehicle.CustomerVehicleGet(); if (request.CustomerVehicleGet != null) { #region//CustomerVehicleGet Customer if (request.CustomerVehicleGet.Customer != null) { _WA.Mapper.v2.CustomerVehicle.Customer customerget = new _WA.Mapper.v2.CustomerVehicle.Customer(); customerget.CardNo = request.CustomerVehicleGet.Customer.CardNo; customerget.DMSCustomerNo = request.CustomerVehicleGet.Customer.DMSCustomerNo; customerget.Email = request.CustomerVehicleGet.Customer.Email; customerget.LastName = request.CustomerVehicleGet.Customer.LastName; if (request.CustomerVehicleGet.Customer.Contacts != null && request.CustomerVehicleGet.Customer.Contacts.Count > 0) { int contactcnt = 0; _WA.Mapper.v2.CustomerVehicle.Contact[] proxycontacts = new _WA.Mapper.v2.CustomerVehicle.Contact[request.CustomerVehicleGet.Customer.Contacts.Count]; foreach (WA.Standard.IF.Data.v2.Common.CustomerVehicle.Contact contact in request.CustomerVehicleGet.Customer.Contacts) { _WA.Mapper.v2.CustomerVehicle.Contact proxycontact = new _WA.Mapper.v2.CustomerVehicle.Contact(); proxycontact.ContactType = contact.ContactType; proxycontact.ContactValue = contact.ContactValue; proxycontacts[contactcnt] = proxycontact; contactcnt++; } customerget.Contacts = proxycontacts; } proxycustomervehicleget.Customer = customerget; } #endregion #region//CustomerVehicleGet Vehicle if (request.CustomerVehicleGet.Vehicle != null) { _WA.Mapper.v2.CustomerVehicle.Vehicle proxyvehicle = new _WA.Mapper.v2.CustomerVehicle.Vehicle(); proxyvehicle.DMSVehicleNo = request.CustomerVehicleGet.Vehicle.DMSVehicleNo; proxyvehicle.LastSixVIN = request.CustomerVehicleGet.Vehicle.LastSixVIN; proxyvehicle.LicensePlateNo = request.CustomerVehicleGet.Vehicle.LicensePlateNo; proxyvehicle.VIN = request.CustomerVehicleGet.Vehicle.VIN; proxycustomervehicleget.Vehicle = proxyvehicle; } #endregion proxyrequest.CustomerVehicleGet = proxycustomervehicleget; } #endregion //Run proxy web method with proxy request _WA.Mapper.v2.CustomerVehicle.CustomerVehicleGetResponse proxyresponse = proxyws.CustomerVehicleGet(proxyrequest); //Mapping with Standard Interface Specification Object if (proxyresponse != null) { if (proxyresponse.TransactionHeader != null) { #region//TransactionHeader Set TransactionHeader transactionheader = new TransactionHeader(); transactionheader.CountryID = proxyresponse.TransactionHeader.CountryID; transactionheader.DealerID = proxyresponse.TransactionHeader.DealerID; transactionheader.DistributorID = proxyresponse.TransactionHeader.DistributorID; transactionheader.DMSCode = proxyresponse.TransactionHeader.DMSCode; transactionheader.DMSServerUrl = proxyresponse.TransactionHeader.DMSServerUrl; transactionheader.DMSVersion = proxyresponse.TransactionHeader.DMSVersion; transactionheader.DocumentVersion = proxyresponse.TransactionHeader.DocumentVersion; transactionheader.GroupID = proxyresponse.TransactionHeader.GroupID; transactionheader.IneterfaceID = proxyresponse.TransactionHeader.IneterfaceID; transactionheader.Password = proxyresponse.TransactionHeader.Password; transactionheader.PollingToken = proxyresponse.TransactionHeader.PollingToken; transactionheader.RequestPollingToken = proxyresponse.TransactionHeader.RequestPollingToken; transactionheader.RequestType = proxyresponse.TransactionHeader.RequestType; transactionheader.TransactionId = proxyresponse.TransactionHeader.TransactionId; transactionheader.TransactionDateTimeLocal = proxyresponse.TransactionHeader.TransactionDateTimeLocal; transactionheader.TransactionDateTimeUTC = proxyresponse.TransactionHeader.TransactionDateTimeUTC; transactionheader.TransactionType = proxyresponse.TransactionHeader.TransactionType; transactionheader.Username = proxyresponse.TransactionHeader.Username; transactionheader.VenderTrackingCode = proxyresponse.TransactionHeader.VenderTrackingCode; response.TransactionHeader = transactionheader; #endregion } //ResultMessage Set if (proxyresponse.ResultMessage != null) { response.ResultMessage = GetResultMessageData(proxyresponse.ResultMessage.Code, proxyresponse.ResultMessage.Message); } if (proxyresponse.Errors != null) { //Error List Set foreach (_WA.Mapper.v2.CustomerVehicle.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 //CustomerVehicleGetResponse Set if (proxyresponse.CustomerVehicles != null && proxyresponse.CustomerVehicles.Length > 0) { response.CustomerVehicles = new List<CustomerVehicle>(); foreach (_WA.Mapper.v2.CustomerVehicle.CustomerVehicle1 proxycustomervehicle in proxyresponse.CustomerVehicles) { #region //CustomerVehicle Header CustomerVehicle customervehicle = new CustomerVehicle(); #endregion #region //CustomerVehicle Customer & Vehicle if (proxycustomervehicle.Customer != null && proxycustomervehicle.Vehicle != null) { #region //CustomerVehicle Customer Header Data.v2.Common.Customer.Customer customer = new Data.v2.Common.Customer.Customer(); customer.CardNo = proxycustomervehicle.Customer.CardNo; customer.CustomerInfoType = proxycustomervehicle.Customer.CustomerInfoType; customer.DMSCustomerNo = proxycustomervehicle.Customer.DMSCustomerNo; customer.Email = proxycustomervehicle.Customer.Email; customer.FirstName = proxycustomervehicle.Customer.FirstName; customer.FullName = proxycustomervehicle.Customer.FullName; customer.Gender = proxycustomervehicle.Customer.Gender; customer.LastName = proxycustomervehicle.Customer.LastName; customer.MiddleName = proxycustomervehicle.Customer.MiddleName; customer.Salutation = proxycustomervehicle.Customer.Salutation; #endregion #region //CustomerVehicle Customer SpecialMessage if (proxycustomervehicle.Customer.SpecialMessage != null) { SpecialMessage specialmessage = new SpecialMessage(); specialmessage.Message = proxycustomervehicle.Customer.SpecialMessage.Message; customer.SpecialMessage = specialmessage; } #endregion #region //CustomerVehicle Customer Addresses if (proxycustomervehicle.Customer.Addresses != null && proxycustomervehicle.Customer.Addresses.Length > 0) { customer.Addresses = new List<Address>(); foreach (_WA.Mapper.v2.CustomerVehicle.Address proxyaddress in proxycustomervehicle.Customer.Addresses) { Address address = new Address(); address.Address1 = proxyaddress.Address1; address.Address2 = proxyaddress.Address2; address.AddressType = proxyaddress.AddressType; address.City = proxyaddress.City; address.Country = proxyaddress.Country; address.State = proxyaddress.State; address.ZipCode = proxyaddress.ZipCode; customer.Addresses.Add(address); } } #endregion #region //CustomerVehicle Customer Contacts if (proxycustomervehicle.Customer.Contacts != null && proxycustomervehicle.Customer.Contacts.Length > 0) { customer.Contacts = new List<WA.Standard.IF.Data.v2.Common.Customer.Contact>(); foreach (_WA.Mapper.v2.CustomerVehicle.Contact1 proxycontact in proxycustomervehicle.Customer.Contacts) { WA.Standard.IF.Data.v2.Common.Customer.Contact contact = new WA.Standard.IF.Data.v2.Common.Customer.Contact(); contact.ContactMethodYN = string.IsNullOrEmpty(proxycontact.ContactMethodYN) ? "" : proxycontact.ContactMethodYN; contact.ContactType = string.IsNullOrEmpty(proxycontact.ContactType) ? "" : proxycontact.ContactType; contact.ContactValue = string.IsNullOrEmpty(proxycontact.ContactValue) ? "" : proxycontact.ContactValue; customer.Contacts.Add(contact); } } #endregion #region //CustomerVehicle Customer CorporateInfos if (proxycustomervehicle.Customer.CorporateInfos != null && proxycustomervehicle.Customer.CorporateInfos.Length > 0) { customer.CorporateInfos = new List<WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo>(); foreach (_WA.Mapper.v2.CustomerVehicle.CorporateInfo proxycorporateinfo in proxycustomervehicle.Customer.CorporateInfos) { WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo corporateinfo = new WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo(); corporateinfo.CorporateInfoName = proxycorporateinfo.Name; corporateinfo.CorporateInfoValue = proxycorporateinfo.Value; customer.CorporateInfos.Add(corporateinfo); } } #endregion customervehicle.Customer = customer; #region//CustomerVehicle Vehicle Header Data.v2.Common.Vehicle.Vehicle vehicle = new Data.v2.Common.Vehicle.Vehicle(); vehicle.Color = proxycustomervehicle.Vehicle.Color; vehicle.Cylinders = proxycustomervehicle.Vehicle.Cylinders; vehicle.DateDelivered = proxycustomervehicle.Vehicle.DateDelivered; vehicle.DateInService = proxycustomervehicle.Vehicle.DateInService; vehicle.DeclinedJob = proxycustomervehicle.Vehicle.DeclinedJob; vehicle.DisplayDescription = proxycustomervehicle.Vehicle.DisplayDescription; vehicle.DMSVehicleNo = proxycustomervehicle.Vehicle.DMSVehicleNo; vehicle.EngineType = proxycustomervehicle.Vehicle.EngineType; vehicle.ExtendedWarranty = proxycustomervehicle.Vehicle.ExtendedWarranty; vehicle.FuelType = proxycustomervehicle.Vehicle.FuelType; vehicle.FullModelName = proxycustomervehicle.Vehicle.FullModelName; vehicle.InsuranceDate = proxycustomervehicle.Vehicle.InsuranceDate; vehicle.LastMileage = proxycustomervehicle.Vehicle.LastMileage; vehicle.LastServiceDate = proxycustomervehicle.Vehicle.LastServiceDate; //vehicle.LastSixVIN = proxycustomervehicle.Vehicle.VIN; // not exists ?????? vehicle.LicenseNumber = proxycustomervehicle.Vehicle.LicenseNumber; vehicle.LicensePlateNo = proxycustomervehicle.Vehicle.LicensePlateNo; vehicle.Make = proxycustomervehicle.Vehicle.Make; vehicle.ModelCode = proxycustomervehicle.Vehicle.ModelCode; vehicle.ModelName = proxycustomervehicle.Vehicle.ModelName; vehicle.ModelYear = proxycustomervehicle.Vehicle.ModelYear; vehicle.PendingJob = proxycustomervehicle.Vehicle.PendingJob; vehicle.StockNumber = proxycustomervehicle.Vehicle.StockNumber; vehicle.Trim = proxycustomervehicle.Vehicle.Trim; vehicle.VehicleType = proxycustomervehicle.Vehicle.VehicleType; vehicle.VIN = proxycustomervehicle.Vehicle.VIN; vehicle.WarrantyMiles = proxycustomervehicle.Vehicle.WarrantyMiles; vehicle.WarrantyMonths = proxycustomervehicle.Vehicle.WarrantyMonths; vehicle.WarrantyStartDate = proxycustomervehicle.Vehicle.WarrantyStartDate; #endregion #region//CustomerVehicle Vehicle Campaigns if (proxycustomervehicle.Vehicle.Campaigns != null && proxycustomervehicle.Vehicle.Campaigns.Length > 0) { vehicle.Campaigns = new List<Data.v2.Common.Vehicle.Campaign>(); foreach (_WA.Mapper.v2.CustomerVehicle.Campaign proxycampaign in proxycustomervehicle.Vehicle.Campaigns) { Data.v2.Common.Vehicle.Campaign campaign = new Data.v2.Common.Vehicle.Campaign(); campaign.CampaignDescription = proxycampaign.CampaignDescription; campaign.CampaignID = proxycampaign.CampaignID; campaign.CampaignPerformed = proxycampaign.CampaignPerformed; vehicle.Campaigns.Add(campaign); } } #endregion customervehicle.Vehicle = vehicle; response.CustomerVehicles.Add(customervehicle); } #endregion } } else { response.ResultMessage = GetResultMessageData(ResponseCode.NoResult, ResponseMessage.NoResult); } #endregion } } else { if (response.Errors != null) response.Errors.Add(GetErrorData(ResponseCode.Fail, ResponseMessage.Fail)); else response.Errors = GetErrorDataList(ResponseCode.Fail, ResponseMessage.Fail); } #endregion } break; case "v2.HMCIS.1C.v4": { #region v2.HMCIS.1C.v4 - RTR (Proxy Class Dll Name : _1C.v4) #region CustomerVehicleGet Request Set //Create proxy credential NetworkCredential proxycredential = new NetworkCredential(request.TransactionHeader.Username, request.TransactionHeader.Password); //Create proxy web service from dms web service with credential _1C.v4.CustomerVehicle.CustomerVehicle proxyws = new _1C.v4.CustomerVehicle.CustomerVehicle(request.TransactionHeader.DMSServerUrl); proxyws.Credentials = proxycredential; //Create proxy request with customervehicleget and transaction _1C.v4.CustomerVehicle.CustomerVehicleGetRequest proxyrequest = new _1C.v4.CustomerVehicle.CustomerVehicleGetRequest(); //Create proxy transaction _1C.v4.CustomerVehicle.TransactionHeader proxytransactionheader = new _1C.v4.CustomerVehicle.TransactionHeader(); if (request.TransactionHeader != null) { #region//TransactionHeader Set proxytransactionheader.CountryID = request.TransactionHeader.CountryID; proxytransactionheader.DealerID = request.TransactionHeader.DealerID; proxytransactionheader.DistributorID = request.TransactionHeader.DistributorID; proxytransactionheader.DMSCode = request.TransactionHeader.DMSCode; proxytransactionheader.DMSServerUrl = request.TransactionHeader.DMSServerUrl; proxytransactionheader.DMSVersion = request.TransactionHeader.DMSVersion; proxytransactionheader.DocumentVersion = request.TransactionHeader.DocumentVersion; proxytransactionheader.GroupID = request.TransactionHeader.GroupID; proxytransactionheader.IneterfaceID = request.TransactionHeader.IneterfaceID; proxytransactionheader.Password = request.TransactionHeader.Password; proxytransactionheader.PollingToken = request.TransactionHeader.PollingToken; proxytransactionheader.RequestPollingToken = request.TransactionHeader.RequestPollingToken; proxytransactionheader.RequestType = request.TransactionHeader.RequestType; proxytransactionheader.TransactionId = request.TransactionHeader.TransactionId; proxytransactionheader.TransactionDateTimeLocal = request.TransactionHeader.TransactionDateTimeLocal; proxytransactionheader.TransactionDateTimeUTC = request.TransactionHeader.TransactionDateTimeUTC; proxytransactionheader.TransactionType = request.TransactionHeader.TransactionType; proxytransactionheader.Username = request.TransactionHeader.Username; proxytransactionheader.VenderTrackingCode = request.TransactionHeader.VenderTrackingCode; proxyrequest.TransactionHeader = proxytransactionheader; #endregion } //Create proxy customervehicleget _1C.v4.CustomerVehicle.CustomerVehicleGet proxycustomervehicleget = new _1C.v4.CustomerVehicle.CustomerVehicleGet(); if (request.CustomerVehicleGet != null) { #region//CustomerVehicleGet Customer if (request.CustomerVehicleGet.Customer != null) { _1C.v4.CustomerVehicle.CustomerGet customerget = new _1C.v4.CustomerVehicle.CustomerGet(); customerget.CardNo = request.CustomerVehicleGet.Customer.CardNo; customerget.DMSCustomerNo = request.CustomerVehicleGet.Customer.DMSCustomerNo; customerget.Email = request.CustomerVehicleGet.Customer.Email; customerget.LastName = request.CustomerVehicleGet.Customer.LastName; if (request.CustomerVehicleGet.Customer.Contacts != null && request.CustomerVehicleGet.Customer.Contacts.Count > 0) { int contactcnt = 0; _1C.v4.CustomerVehicle.Contact[] proxycontacts = new _1C.v4.CustomerVehicle.Contact[request.CustomerVehicleGet.Customer.Contacts.Count]; foreach (WA.Standard.IF.Data.v2.Common.CustomerVehicle.Contact contact in request.CustomerVehicleGet.Customer.Contacts) { _1C.v4.CustomerVehicle.Contact proxycontact = new _1C.v4.CustomerVehicle.Contact(); proxycontact.ContactType = contact.ContactType; proxycontact.ContactValue = contact.ContactValue; proxycontacts[contactcnt] = proxycontact; contactcnt++; } customerget.Contacts = proxycontacts; } proxycustomervehicleget.CustomerGet = customerget; } #endregion #region//CustomerVehicleGet Vehicle if (request.CustomerVehicleGet.Vehicle != null) { _1C.v4.CustomerVehicle.VehicleGet proxyvehicle = new _1C.v4.CustomerVehicle.VehicleGet(); proxyvehicle.DMSVehicleNo = request.CustomerVehicleGet.Vehicle.DMSVehicleNo; proxyvehicle.LastSixVIN = request.CustomerVehicleGet.Vehicle.LastSixVIN; proxyvehicle.LicensePlateNo = request.CustomerVehicleGet.Vehicle.LicensePlateNo; proxyvehicle.VIN = request.CustomerVehicleGet.Vehicle.VIN; proxycustomervehicleget.VehicleGet = proxyvehicle; } #endregion proxyrequest.CustomerVehicleGet = proxycustomervehicleget; } #endregion //Run proxy web method with proxy request _1C.v4.CustomerVehicle.CustomerVehicleGetResponse proxyresponse = proxyws.CustomerVehicleGet(proxyrequest); //Mapping with Standard Interface Specification Object if (proxyresponse != null) { if (proxyresponse.TransactionHeader != null) { #region//TransactionHeader Set TransactionHeader transactionheader = new TransactionHeader(); transactionheader.CountryID = proxyresponse.TransactionHeader.CountryID; transactionheader.DealerID = proxyresponse.TransactionHeader.DealerID; transactionheader.DistributorID = proxyresponse.TransactionHeader.DistributorID; transactionheader.DMSCode = proxyresponse.TransactionHeader.DMSCode; transactionheader.DMSServerUrl = proxyresponse.TransactionHeader.DMSServerUrl; transactionheader.DMSVersion = proxyresponse.TransactionHeader.DMSVersion; transactionheader.DocumentVersion = proxyresponse.TransactionHeader.DocumentVersion; transactionheader.GroupID = proxyresponse.TransactionHeader.GroupID; transactionheader.IneterfaceID = proxyresponse.TransactionHeader.IneterfaceID; transactionheader.Password = proxyresponse.TransactionHeader.Password; transactionheader.PollingToken = proxyresponse.TransactionHeader.PollingToken; transactionheader.RequestPollingToken = proxyresponse.TransactionHeader.RequestPollingToken; transactionheader.RequestType = proxyresponse.TransactionHeader.RequestType; transactionheader.TransactionId = proxyresponse.TransactionHeader.TransactionId; transactionheader.TransactionDateTimeLocal = proxyresponse.TransactionHeader.TransactionDateTimeLocal; transactionheader.TransactionDateTimeUTC = proxyresponse.TransactionHeader.TransactionDateTimeUTC; transactionheader.TransactionType = proxyresponse.TransactionHeader.TransactionType; transactionheader.Username = proxyresponse.TransactionHeader.Username; transactionheader.VenderTrackingCode = proxyresponse.TransactionHeader.VenderTrackingCode; response.TransactionHeader = transactionheader; #endregion } //ResultMessage Set if (proxyresponse.ResultMessage != null) { response.ResultMessage = GetResultMessageData(proxyresponse.ResultMessage.Code, proxyresponse.ResultMessage.Message); } if (proxyresponse.Errors != null) { //Error List Set foreach (_1C.v4.CustomerVehicle.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 //CustomerVehicleGetResponse Set if (proxyresponse.CustomerVehicles != null && proxyresponse.CustomerVehicles.Length > 0) { response.CustomerVehicles = new List<CustomerVehicle>(); foreach (_1C.v4.CustomerVehicle.CustomerVehicle1 proxycustomervehicle in proxyresponse.CustomerVehicles) { #region //CustomerVehicle Header CustomerVehicle customervehicle = new CustomerVehicle(); #endregion #region //CustomerVehicle Customer & Vehicle if (proxycustomervehicle.Customer != null && proxycustomervehicle.Vehicle != null) { #region //CustomerVehicle Customer Header Data.v2.Common.Customer.Customer customer = new Data.v2.Common.Customer.Customer(); customer.CardNo = proxycustomervehicle.Customer.CustomerCardNo; customer.CustomerInfoType = proxycustomervehicle.Customer.CustomerInfoType; customer.DMSCustomerNo = proxycustomervehicle.Customer.DMSCustomerNo; customer.Email = proxycustomervehicle.Customer.CustomerEmail; customer.FirstName = proxycustomervehicle.Customer.CustomerFirstName; customer.FullName = proxycustomervehicle.Customer.CustomerFullName; customer.Gender = proxycustomervehicle.Customer.Gender; customer.LastName = proxycustomervehicle.Customer.CustomerLastName; customer.MiddleName = proxycustomervehicle.Customer.CustomerMiddleName; customer.Salutation = proxycustomervehicle.Customer.Salutation; #endregion #region //CustomerVehicle Customer SpecialMessage if (proxycustomervehicle.Customer.CustomerSpecialMessage != null) { SpecialMessage specialmessage = new SpecialMessage(); specialmessage.Message = proxycustomervehicle.Customer.CustomerSpecialMessage.Message; customer.SpecialMessage = specialmessage; } #endregion #region //CustomerVehicle Customer Addresses if (proxycustomervehicle.Customer.Addresses != null && proxycustomervehicle.Customer.Addresses.Length > 0) { customer.Addresses = new List<Address>(); foreach (_1C.v4.CustomerVehicle.Address proxyaddress in proxycustomervehicle.Customer.Addresses) { Address address = new Address(); address.Address1 = proxyaddress.Address1; address.Address2 = proxyaddress.Address2; address.AddressType = proxyaddress.AddressType; address.City = proxyaddress.City; address.Country = proxyaddress.Country; address.State = proxyaddress.State; address.ZipCode = proxyaddress.ZipCode; customer.Addresses.Add(address); } } #endregion #region //CustomerVehicle Customer Contacts if (proxycustomervehicle.Customer.Contacts != null && proxycustomervehicle.Customer.Contacts.Length > 0) { customer.Contacts = new List<WA.Standard.IF.Data.v2.Common.Customer.Contact>(); foreach (_1C.v4.CustomerVehicle.Contact proxycontact in proxycustomervehicle.Customer.Contacts) { WA.Standard.IF.Data.v2.Common.Customer.Contact contact = new WA.Standard.IF.Data.v2.Common.Customer.Contact(); contact.ContactMethodYN = string.IsNullOrEmpty(proxycontact.ContactMethodYN) ? "" : proxycontact.ContactMethodYN; contact.ContactType = string.IsNullOrEmpty(proxycontact.ContactType) ? "" : proxycontact.ContactType; contact.ContactValue = string.IsNullOrEmpty(proxycontact.ContactValue) ? "" : proxycontact.ContactValue; customer.Contacts.Add(contact); } } #endregion #region //CustomerVehicle Customer CorporateInfos if (proxycustomervehicle.Customer.CorporateInfos != null && proxycustomervehicle.Customer.CorporateInfos.Length > 0) { customer.CorporateInfos = new List<WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo>(); foreach (_1C.v4.CustomerVehicle.CorporateInfo proxycorporateinfo in proxycustomervehicle.Customer.CorporateInfos) { WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo corporateinfo = new WA.Standard.IF.Data.v2.Common.Customer.CorporateInfo(); corporateinfo.CorporateInfoName = proxycorporateinfo.Name; corporateinfo.CorporateInfoValue = proxycorporateinfo.Value; customer.CorporateInfos.Add(corporateinfo); } } #endregion customervehicle.Customer = customer; #region//CustomerVehicle Vehicle Header Data.v2.Common.Vehicle.Vehicle vehicle = new Data.v2.Common.Vehicle.Vehicle(); vehicle.Color = proxycustomervehicle.Vehicle.Color; vehicle.Cylinders = proxycustomervehicle.Vehicle.Cylinders; vehicle.DateDelivered = proxycustomervehicle.Vehicle.DateDelivered; vehicle.DateInService = proxycustomervehicle.Vehicle.DateInService; vehicle.DeclinedJob = proxycustomervehicle.Vehicle.DeclinedJob; vehicle.DisplayDescription = proxycustomervehicle.Vehicle.DisplayDescription; vehicle.DMSVehicleNo = proxycustomervehicle.Vehicle.DMSVehicleNo; vehicle.EngineType = proxycustomervehicle.Vehicle.EngineType; vehicle.ExtendedWarranty = proxycustomervehicle.Vehicle.ExtendedWarranty; vehicle.FuelType = proxycustomervehicle.Vehicle.FuelType; vehicle.FullModelName = proxycustomervehicle.Vehicle.FullModelName; vehicle.InsuranceDate = proxycustomervehicle.Vehicle.InsuranceDate; vehicle.LastMileage = proxycustomervehicle.Vehicle.LastMileage; vehicle.LastServiceDate = proxycustomervehicle.Vehicle.LastServiceDate; //vehicle.LastSixVIN = proxycustomervehicle.Vehicle.VIN; // not exists ?????? vehicle.LicenseNumber = proxycustomervehicle.Vehicle.LicenseNumber; vehicle.LicensePlateNo = proxycustomervehicle.Vehicle.LicensePlateNo; vehicle.Make = proxycustomervehicle.Vehicle.Make; vehicle.ModelCode = proxycustomervehicle.Vehicle.ModelCode; vehicle.ModelName = proxycustomervehicle.Vehicle.ModelName; vehicle.ModelYear = proxycustomervehicle.Vehicle.ModelYear; vehicle.PendingJob = proxycustomervehicle.Vehicle.PendingJob; vehicle.StockNumber = proxycustomervehicle.Vehicle.StockNumber; vehicle.Trim = proxycustomervehicle.Vehicle.Trim; vehicle.VehicleType = proxycustomervehicle.Vehicle.VehicleType; vehicle.VIN = proxycustomervehicle.Vehicle.VIN; vehicle.WarrantyMiles = proxycustomervehicle.Vehicle.WarrantyMiles; vehicle.WarrantyMonths = proxycustomervehicle.Vehicle.WarrantyMonths; vehicle.WarrantyStartDate = proxycustomervehicle.Vehicle.WarrantyStartDate; #endregion #region//CustomerVehicle Vehicle Campaigns if (proxycustomervehicle.Vehicle.Campaigns != null && proxycustomervehicle.Vehicle.Campaigns.Length > 0) { vehicle.Campaigns = new List<Data.v2.Common.Vehicle.Campaign>(); foreach (_1C.v4.CustomerVehicle.Campaign proxycampaign in proxycustomervehicle.Vehicle.Campaigns) { Data.v2.Common.Vehicle.Campaign campaign = new Data.v2.Common.Vehicle.Campaign(); campaign.CampaignDescription = proxycampaign.CampaignDescription; campaign.CampaignID = proxycampaign.CampaignID; campaign.CampaignPerformed = proxycampaign.CampaignPerformed; vehicle.Campaigns.Add(campaign); } } #endregion customervehicle.Vehicle = vehicle; response.CustomerVehicles.Add(customervehicle); } #endregion } } else { response.ResultMessage = GetResultMessageData(ResponseCode.NoResult, ResponseMessage.NoResult); } #endregion } } else { if (response.Errors != null) response.Errors.Add(GetErrorData(ResponseCode.Fail, ResponseMessage.Fail)); else response.Errors = GetErrorDataList(ResponseCode.Fail, ResponseMessage.Fail); } #endregion } break; case "v2.HMES.SERAUTO.v1": break; default: response.Errors = new List<Error>() { new Error() { Code = ResponseCode.NoMatchedProxy, Message = ResponseMessage.NoMatchedProxy } }; break; } return response; }