public static argtype TranslateToSfgRequest(CustomerUpdateServiceRequest ahRequest) { EventLogger.LogEvent("ENTERING -> SFGWrapper.CustomerUpdateTranslators.TranslateToSfgRequest()"); argtype sfgRequest = new argtype(); #region readonly properties sfgRequest.org = ahRequest.Org; sfgRequest.test_mode = ahRequest.TestMode ? "Y" : "N"; sfgRequest.app_version = ahRequest.AppVersion; sfgRequest.program_type_id = ahRequest.ProgramTypeId; #endregion sfgRequest.customer_number = ahRequest.MemberToUpdate.MemberId; sfgRequest.title = ahRequest.MemberToUpdate.Salutation; sfgRequest.first = ahRequest.MemberToUpdate.FirstName; sfgRequest.mi = ahRequest.MemberToUpdate.MiddleInitial; sfgRequest.last = ahRequest.MemberToUpdate.LastName; sfgRequest.suffix = ahRequest.MemberToUpdate.Suffix; sfgRequest.professional_title = ahRequest.MemberToUpdate.ProfessionalTitle; sfgRequest.email = ahRequest.MemberToUpdate.Email; sfgRequest.optin = ahRequest.MemberToUpdate.OptIn ? "Y" : "N"; sfgRequest.business_name = ahRequest.MemberToUpdate.Address.BusinessName; sfgRequest.add1 = ahRequest.MemberToUpdate.Address.Address1; sfgRequest.add2 = ahRequest.MemberToUpdate.Address.Address2; sfgRequest.add3 = ahRequest.MemberToUpdate.Address.Address3; sfgRequest.city = ahRequest.MemberToUpdate.Address.City; sfgRequest.st = ahRequest.MemberToUpdate.Address.State; sfgRequest.zip = ahRequest.MemberToUpdate.Address.PostalCode; sfgRequest.country = ahRequest.MemberToUpdate.Address.Country; sfgRequest.phone = ahRequest.MemberToUpdate.Address.Phone; sfgRequest.fax = ahRequest.MemberToUpdate.Address.Fax; sfgRequest.altcity = ahRequest.MemberToUpdate.Address.AltCity; EventLogger.LogEvent("LEAVING -> SFGWrapper.CustomerUpdateTranslators.TranslateToSfgRequest()"); return(sfgRequest); }
public static BaseResponse UpdateMember(CustomerUpdateServiceRequest ahRequest) { string className = "SFGWrapper.CustomerUpdate"; BaseResponse baseResponse = new BaseResponse(); try { using (CustomerUpdateService svc = new CustomerUpdateService()) { svc.Timeout = 20000; svc.Credentials = new System.Net.NetworkCredential(ahRequest.ServiceUsername, ahRequest.ServicePassword); argtype sfgRequest = CustomerUpdateTranslators.TranslateToSfgRequest(ahRequest); baseResponse = CustomerUpdateTranslators.UpdateCustomer(svc.process_wsdl(sfgRequest)); } if (baseResponse == null) { baseResponse = new BaseResponse(); FatalErrorResponse fatalError = new FatalErrorResponse(); baseResponse.TypedResponse = fatalError; baseResponse.Messages.Add(new Message("SFGFatalError")); } } catch (Exception ex) { baseResponse = new BaseResponse(); FatalErrorResponse fatalError = new FatalErrorResponse(); baseResponse.TypedResponse = fatalError; Message error = new Message("UnknownException"); baseResponse.DebugStringLog.Add(ex.TargetSite.Name); baseResponse.DebugStringLog.Add(ex.Message); baseResponse.DebugStringLog.Add(ex.StackTrace); baseResponse.Messages.Add(error); EventLogger.LogError(string.Format("{0}.UpdateMember()", className), string.Format("Message: {0} \r\nStackTrace: {1}", ex.Message, ex.StackTrace)); } return(baseResponse); }