Advertisement
Guest User

Untitled

a guest
Apr 25th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.34 KB | None | 0 0
  1. @RestResource(urlMapping='/ProfileService/')
  2. global without sharing class BusinessProfile1{
  3. global static final String GENERIC_ERROR = 'GEN0001';
  4. global static final String GENERIC_ERROR_TYPE = 'Generic';
  5. global static final String USER_ERROR = 'PC0028';
  6. global static final String FIRST_NAME = 'PC0010';
  7. global static final String LAST_NAME = 'PC0002';
  8. global static final String MAIL = 'PC0003';
  9. global static final String ERROR_TYPE ='UpdateProfile' ;
  10. global static final String INVALID_EMAIL = 'PC0018';
  11. global static final String PASSWORD_ERROR = 'PC0014';
  12. global static final String USERPASSWORD = 'PC0008';
  13. @HttpGet global static String doGet(){
  14. RestRequest req = RestContext.request;
  15. RestResponse res = RestContext.response;
  16. try{StringUserId=req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
  17. System.debug('UserId:'+UserId);
  18. if(UserId =='' || UserId ==null) UserId = userinfo.getUserId();
  19. return getProfileDetails(UserId);
  20. }catch(Exception e){
  21. System.debug('Message1:'+e.getMessage());
  22. throw new CustomException(PG_Utils.getException(GENERIC_ERROR,GENERIC_ERROR_TYPE, CustomException__c.getValues('GEN0001').Error_Description__c));
  23. }
  24. }
  25.  
  26. @HttpPost
  27. global static String doPost(){
  28. RestRequest req = RestContext.request;
  29. RestResponse res = Restcontext.response;
  30. Blob body = req.requestBody;
  31. System.debug('Test:'+body.toString());
  32. UpdateProfile profiles = (UpdateProfile) System.JSON.deserialize(body.toString(), UpdateProfile.class);
  33. System.debug('Parsed Input:'+profiles);if(profiles.UserId == '' || profiles.UserId == Null) profiles.UserId = UserInfo.getUserId();
  34. return updateProfileDetails(profiles);}
  35. @HttpPut
  36. global static String doPut(){
  37. RestRequest req = RestContext.request;
  38. RestResponse res = Restcontext.response;
  39. Blob body = req.requestBody;
  40. //Map<String, Object> m=(Map<String,Object>)System.JSON.deserialize(body.toString());
  41. //System.debug('m:'+m.get('action'));
  42. manageUser mu = (manageUser) System.JSON.deserialize(body.toString(), manageUser.class);
  43. System.debug('mu:'+mu);
  44. try{
  45. if(mu.action == 'setPassword')
  46. {
  47. String userid = mu.userId;
  48. String Password = mu.newPassword;
  49. if(userid =='' || userid == null) userid = UserInfo.getUserId();
  50.  
  51. if (Password == '' || Password == null) throw new customexception(PG_Utils.getException(USERPASSWORD,ERROR_TYPE,CustomException__c.getValues(USERPASSWORD).Error_Description__c));
  52. if(PG_Utils.IsValidPassword(Password)) throw new customexception(PG_Utils.getException(PASSWORD_ERROR,ERROR_TYPE,CustomException__c.getValues(PASSWORD_ERROR).Error_Description__c));
  53.  
  54. User user = [Select Id from user where Id =:userid ];
  55. try {
  56. System.setPassword(user.id, Password);
  57. }
  58. catch(Exception e){
  59. if(e.getMessage().contains('invalid repeated password')){
  60. throw new CustomException(PG_Utils.getException(USER_ERROR,GENERIC_ERROR_TYPE, 'Invalid repeated password'));
  61. }
  62. }
  63. JSONGenerator gen = JSON.createGenerator(true);
  64. gen.writeStartObject();
  65. gen.writeObjectField('Status','Success');
  66. gen.writeEndObject();
  67. String pretty = gen.getAsString();
  68. return pretty;
  69. }else if(mu.action == 'resetPassword'){
  70. String userid = mu.userId;
  71. String Password = mu.newPassword;
  72. if(userid =='' || userid == null) userid = UserInfo.getUserId();
  73.  
  74. if (Password == '' || Password == null) throw new customexception(PG_Utils.getException(USERPASSWORD,ERROR_TYPE,CustomException__c.getValues(USERPASSWORD).Error_Description__c));
  75. if(PG_Utils.IsValidPassword(Password)) throw new customexception(PG_Utils.getException(PASSWORD_ERROR,ERROR_TYPE,CustomException__c.getValues(PASSWORD_ERROR).Error_Description__c));
  76.  
  77. User user = [Select Id from user where Id =:userid ];
  78. try {
  79. System.setPassword(user.id, Password);
  80. }
  81. catch(Exception e){
  82. if(e.getMessage().contains('invalid repeated password')){
  83. throw new CustomException(PG_Utils.getException(USER_ERROR,GENERIC_ERROR_TYPE, 'Invalid repeated password'));
  84. }
  85. }
  86.  
  87. JSONGenerator gen = JSON.createGenerator(true);
  88. gen.writeStartObject();
  89. gen.writeObjectField('Status','Success');
  90. gen.writeEndObject();
  91. String pretty = gen.getAsString();
  92. return pretty;
  93. }
  94. }catch(Exception e){
  95. system.debug('errorrs'+e);
  96. return e.getMessage();
  97. }
  98. return null;
  99. }
  100.  
  101. global class manageUser{
  102. public String userId {get;set;}
  103. public String action {get;set;}
  104. public String newPassword {get;set;}
  105. }
  106.  
  107. global static String getProfileDetails(String UserId){
  108. try{
  109. List<Addresses> addresses = New List<Addresses>();
  110. List<Roles> roles = new List<Roles>();
  111. List<Pharmacy> pharmacy = new List<Pharmacy>();
  112. Set<ID> subRoleID = new Set<ID>();
  113.  
  114. List<User> users = [Select id, Title, FirstName, LastName, Email, Username, Country, MobilePhone, Fax, Phone, ContactID, AccountID, PG_SecretAnswer__c, PG_SecretQuestion__c, JE_Password__c, PG_TCAgreed__c, LanguageLocaleKey, LocaleSidKey, PG_SecretAnswerSalt__c, IsActive
  115. from User
  116. where Id =: UserID];
  117.  
  118. if(!users.isEmpty()){
  119. User user= users[0];
  120. Contact contact = [Select Id, Salutation, FirstName, LastName, Email, MobilePhone, Fax, OtherPhone, Preferred_Contact__c, MailingCity, MailingPostalCode, MailingStreet, OtherCity, otherPostalCode, OtherStreet, Account.PG_SoldTo__c, owner.Name, Owner.Email, ownerId,
  121. AccountId, Account.Name,Account.PG_PharmacyRegistrationNumber__c, Account.PG_JnJCustomerCode__c, Account.VAT_Number__c, Account.PG_Account__c, PG_ContactApprovalState__r.PG_ApprovalStatus__c , Account.BillingStreet,
  122. Account.BillingCity, Account.BillingPostalCode, Account.ShippingStreet, Account.ShippingCity, Account.ShippingPostalCode,
  123. (Select Account_ID__c, Account_ID__r.VAT_Number__c,Account_ID__r.Ownerid,Account_ID__r.Owner.Name,Account_ID__r.Owner.Email,Account_ID__r.PG_AccountType__c,Account_ID__r.Fax,Account_ID__r.Phone, Account_ID__r.PG_JnJCustomerCode__c, Account_ID__r.PG_PharmacyRegistrationNumber__c, Account_ID__r.BillingPostalCode, Account_ID__r.PG_SoldTo__c, Account_ID__r.PG_Account__c, Account_ID__r.Name, Account_ID__r.BillingStreet, Account_ID__r.BillingCity, Account_ID__r.ShippingStreet, Account_ID__r.ShippingCity, Account_ID__r.ShippingPostalCode, Contact_ID__c, isPrimary__c, ApprovalState__c From Account_Affiliations__r) from Contact where Id =: user.ContactId];
  124.  
  125.  
  126. Map<ID,String> mapApproval = new Map<ID,String>();
  127. List<ID> ConID = new List<ID>();
  128. if(contact.Account_Affiliations__r.size()>0){
  129. for(Account_Affiliation__c af : contact.Account_Affiliations__r){
  130. Pharmacy pharma = new Pharmacy();
  131. List<Addresses> PhAddresses = New List<Addresses>();
  132.  
  133. pharma.ID = af.Account_ID__c;
  134. pharma.Name = af.Account_ID__r.Name;
  135. pharma.Status = af.ApprovalState__c;
  136. pharma.CustomerGroup = af.Account_ID__r.PG_SoldTo__c;
  137. pharma.IsPGAccount = af.Account_ID__r.PG_Account__c;
  138. pharma.Phone = af.Account_ID__r.Phone;
  139. pharma.PGAccountStatus=af.Account_ID__r.PG_AccountType__c;
  140. pharma.Fax = af.Account_ID__r.Fax;
  141. pharma.ABP_CIP = af.Account_ID__r.PG_PharmacyRegistrationNumber__c;
  142. // pharma.EComm_Eligible = af.Account_ID__r.E_Commerce_Eligibility__c;
  143. pharma.Salesrep_ID=af.Account_ID__r.Ownerid;
  144. pharma.Salesrep_Name=af.Account_ID__r.Owner.Name;
  145. pharma.Salesrep_Email=af.Account_ID__r.Owner.Email;
  146.  
  147. /**** get Pharmacy Address ***/
  148. Addresses PhBillingAddress = new Addresses();
  149. PhBillingAddress.City = af.Account_ID__r.BillingCity;
  150. PhBillingAddress.PostalCode = af.Account_ID__r.BillingPostalCode;
  151. PhBillingAddress.StreetAddress = af.Account_ID__r.BillingStreet;
  152. PhBillingAddress.Type = 'billing';
  153. PhAddresses.add(PhBillingAddress);
  154.  
  155. Addresses PhShippingAddress = new Addresses();
  156. PhShippingAddress.City = af.Account_ID__r.ShippingCity;
  157. PhShippingAddress.PostalCode = af.Account_ID__r.ShippingPostalCode;
  158. PhShippingAddress.StreetAddress = af.Account_ID__r.ShippingStreet;
  159. PhShippingAddress.Type = 'shipping';
  160. PhAddresses.add(PhShippingAddress);
  161.  
  162. pharma.Address = PhAddresses;
  163. pharma.VATNumber = af.Account_ID__r.VAT_Number__c;
  164. if(af.isPrimary__c) { pharma.PrimaryPharmacyId = af.Account_ID__r.PG_PharmacyRegistrationNumber__c; }
  165. pharmacy.add(pharma);
  166. }
  167. }
  168.  
  169. /*** get Address Information ***/
  170. Addresses billingAddress = new Addresses();
  171. billingAddress.City = contact.MailingCity;
  172. billingAddress.PostalCode = contact.MailingPostalCode;
  173. billingAddress.StreetAddress = contact.MailingStreet;
  174. billingAddress.Type = 'billing';
  175. addresses.add(billingAddress);
  176.  
  177. Addresses shippingAddress = new Addresses();
  178. shippingAddress.City = contact.OtherCity;
  179. shippingAddress.PostalCode = contact.otherPostalCode;
  180. shippingAddress.StreetAddress = contact.OtherStreet;
  181. shippingAddress.Type = 'shipping';
  182. addresses.add(shippingAddress);
  183.  
  184. /*** get Role Information ***/
  185. List<PG_ContactUser__c> ContactUser = [Select PG_SubRole__c, Contact__c, PG_SubRole__r.Name,PG_SubRole__r.TranslationKey__c, PG_SubRole__r.ERP_Role__c
  186. From PG_ContactUser__c
  187. where Contact__c =: User.ContactId];
  188.  
  189. for(PG_ContactUser__c conUser :ContactUser)
  190. subRoleID.add(conUser.PG_SubRole__c);
  191.  
  192. List<PG_FunctionalityAccessPerSubRole__c> Function = [Select hasAccess__c, PG_SubRole__c,PG_Functionality__c, PG_Functionality__r.Name, PG_CountryLanguage__r.Name, Name From PG_FunctionalityAccessPerSubRole__c where PG_SubRole__c IN: subRoleID and hasAccess__c = true and PG_CountryLanguage__r.Name =: Userinfo.getLocale()];
  193. Map<ID, list<String>> mapFunctions = new Map<Id,List<String>>();
  194. for(ID ids : subRoleID){
  195. List<String> functionName = new List<String>();
  196. for(PG_FunctionalityAccessPerSubRole__c fun : Function){
  197. if(fun.PG_SubRole__c == ids) functionName.add(fun.PG_Functionality__r.Name);
  198. }
  199. mapFunctions.put(ids,functionName);
  200. }
  201.  
  202.  
  203. for(PG_ContactUser__c conUser :ContactUser){
  204. Roles role = new Roles();
  205. role.Name = conUser.PG_SubRole__r.Name;
  206. role.TranslationKey = conUser.PG_SubRole__r.TranslationKey__c;
  207. role.ERPRole = conUser.PG_SubRole__r.ERP_Role__c;
  208. role.Functions = mapFunctions.get(conUser.PG_SubRole__c);
  209. roles.add(role);
  210. }
  211.  
  212. profileDetails profDetails = new profileDetails();
  213. profDetails.Salutation = user.Title;
  214. profDetails.FirstName = user.FirstName;
  215. profDetails.LastName = user.LastName;
  216. profDetails.EmailAddress = user.Email;
  217. profDetails.Username = user.Username;
  218. profDetails.IsTermsAgreed = user.PG_TCAgreed__c;
  219. profDetails.Country = user.Country;
  220. profDetails.VATNumber = contact.Account.VAT_Number__c;
  221. profDetails.Phone = User.Phone;
  222. profDetails.Fax = User.Fax;
  223. profDetails.Mobile = User.MobilePhone;
  224. profDetails.PreferredContact = contact.Preferred_Contact__c;
  225. profDetails.PrimaryPharmacyId = contact.Account.PG_PharmacyRegistrationNumber__c;
  226. profDetails.UserLanguage = User.LanguageLocaleKey;
  227. profDetails.UserLocale = User.LocaleSidKey;
  228. profDetails.SaltValue = User.PG_SecretAnswerSalt__c;
  229. profDetails.SecretQuestion = User.PG_SecretQuestion__c;
  230. profDetails.SecretAnswer = User.PG_SecretAnswer__c;
  231. profDetails.Addresses = addresses;
  232. profDetails.Roles = roles;
  233. profDetails.Pharmacy = pharmacy;
  234. profDetails.IsActive = User.IsActive;
  235.  
  236. return json.serialize(profDetails);
  237. }else{
  238. throw new CustomException(PG_Utils.getException(USER_ERROR,GENERIC_ERROR_TYPE, CustomException__c.getValues('PC0001').Error_Description__c));
  239. }
  240. }catch(Exception e){
  241. System.debug('Message:'+e.getMessage());
  242. return e.getMessage();
  243. }
  244. return null;
  245. }
  246.  
  247. global static String updateProfileDetails(UpdateProfile profiles){
  248. try{
  249. System.debug('UserID:'+profiles.UserId);
  250. /** Adding a single user into list to support error handiling.
  251. If list not used system will stop the execution **/
  252.  
  253. List<User> users = [Select id, Title, FirstName, LastName, Email, Username, Country, MobilePhone, Fax, Phone, ContactID, AccountID, PG_SecretAnswer__c, PG_SecretQuestion__c,PG_SecretAnswerSalt__c, JE_Password__c, PG_TCAgreed__c, IsActive
  254. from User
  255. where Id =: profiles.UserID];
  256. if(!users.isEmpty()){
  257. User user= users[0];
  258.  
  259. Contact contact = [Select Id, Salutation, FirstName, LastName, Email, MobilePhone, Fax, OtherPhone, Preferred_Contact__c, MailingCity, MailingPostalCode, MailingStreet, OtherCity, otherPostalCode, OtherStreet, PG_ContactApprovalState__c, PG_ContactApprovalState__r.PG_ApprovalStatus__c,
  260. AccountId, Account.Name,Account.PG_PharmacyRegistrationNumber__c, Account.PG_JnJCustomerCode__c
  261. from Contact where Id =: user.ContactId];
  262. Account account = [Select Id, PG_JnJCustomerCode__c, VAT_Number__c, ownerID from Account where PG_JnJCustomerCode__c =:profiles.PrimaryPharmacyId];
  263.  
  264. /*** Update User & contact details ***/
  265. if(profiles.FirstName == null || profiles.FirstName == '')
  266. {
  267. throw new customexception(PG_Utils.getException(FIRST_NAME,ERROR_TYPE,CustomException__c.getValues(FIRST_NAME).Error_Description__c));
  268. }
  269. if(profiles.LastName == null || profiles.LastName == '')
  270. {
  271. throw new customexception(PG_Utils.getException(LAST_NAME,ERROR_TYPE,CustomException__c.getValues(LAST_NAME).Error_Description__c));
  272. }
  273. if(profiles.EmailAddress == null || profiles.EmailAddress == '')
  274. {
  275. throw new customexception(PG_Utils.getException(MAIL,ERROR_TYPE,CustomException__c.getValues(MAIL).Error_Description__c));
  276. }
  277. if(PG_Utils.IsValidEmailFormat(profiles.EmailAddress))
  278. {
  279. throw new customexception(PG_Utils.getException(INVALID_EMAIL,ERROR_TYPE,CustomException__c.getValues(INVALID_EMAIL).Error_Description__c));
  280. }
  281. if(profiles.FirstName != '' && profiles.FirstName != null) user.FirstName = profiles.FirstName;
  282. if(profiles.LastName != '' && profiles.LastName != null) user.LastName = profiles.LastName;
  283. if(profiles.Salutation != '' && profiles.Salutation != null) user.Title = profiles.Salutation;
  284. if(profiles.EmailAddress != '' && profiles.EmailAddress != null) user.Email = profiles.EmailAddress;
  285. if(profiles.Username != '' && profiles.Username != null) user.Username = profiles.Username;
  286. if(profiles.Country != '' && profiles.Country != null) user.Country = profiles.Country;
  287. if(profiles.Phone != '' && profiles.Phone != null) user.Phone = profiles.Phone;
  288. if(profiles.Fax != '' && profiles.Fax != null) user.Fax = profiles.Fax;
  289. if(profiles.Mobile != '' && profiles.Mobile != null) user.MobilePhone = profiles.Mobile;
  290. if(profiles.SecretQuestion != '' && profiles.SecretQuestion != null) user.PG_SecretQuestion__c = profiles.SecretQuestion;
  291. if(profiles.SecretAnswer != '' && profiles.SecretAnswer != null)
  292. {
  293. user.PG_SecretAnswerSalt__c = PG_GuidGenerator.generateSalt();
  294. Blob hash = Crypto.generateDigest('SHA-512', Blob.valueOf(profiles.SecretAnswer + user.PG_SecretAnswerSalt__c));
  295. user.PG_SecretAnswer__c = EncodingUtil.base64Encode(hash);
  296.  
  297. }
  298. if(profiles.UserLanguage != '' && profiles.UserLanguage != null) user.LanguageLocaleKey = profiles.UserLanguage;
  299. if(profiles.UserLanguage != '' && profiles.UserLocale != null) user.LocaleSidKey = profiles.UserLocale;
  300.  
  301. if(profiles.FirstName != '' && profiles.FirstName != null) contact.FirstName = profiles.FirstName;
  302. if(profiles.LastName != '' && profiles.LastName != null) contact.LastName = profiles.LastName;
  303. if(profiles.Salutation != '' && profiles.Salutation != null) contact.Salutation = profiles.Salutation;
  304. if(profiles.EmailAddress != '' && profiles.EmailAddress != null) contact.Email = profiles.EmailAddress;
  305. if(profiles.Phone != '' && profiles.Phone != null) contact.Phone = profiles.Phone;
  306. if(profiles.Fax != '' && profiles.Fax != null) contact.Fax = profiles.Fax;
  307. if(profiles.Mobile != '' && profiles.Mobile != null) contact.MobilePhone = profiles.Mobile;
  308. if(profiles.PreferredContact != '' && profiles.PreferredContact != null) contact.Preferred_Contact__c = profiles.PreferredContact;
  309. else if(profiles.PreferredContact == '' && profiles.PreferredContact == null) contact.Preferred_Contact__c = '';
  310.  
  311. if(profiles.PrimaryPharmacyId != '' && profiles.PrimaryPharmacyId != null)
  312. {
  313. contact.AccountId = account.Id;
  314. contact.OwnerId = account.OwnerId;
  315. }
  316. /*** Commented on 20th October because no user inactive facillity is available ***/
  317. //if(profiles.IsActive == false) user.IsActive = false;
  318. /*** update Address information ***/
  319.  
  320. for(Addresses add : profiles.Addresses){
  321. System.debug('address:'+add);
  322. if(add.Type == 'billing'){
  323. if(add.City != null && add.City != '') contact.MailingCity = add.City;
  324. if(add.PostalCode != null && add.PostalCode != '') contact.MailingPostalCode = add.PostalCode;
  325. if(add.StreetAddress != null && add.StreetAddress != '') contact.MailingStreet = add.StreetAddress;
  326. }else if(add.Type == 'shipping'){
  327. if(add.City != null && add.City != '') contact.OtherCity = add.City;
  328. if(add.PostalCode != null && add.PostalCode != '') contact.OtherPostalCode = add.PostalCode;
  329. if(add.StreetAddress != null && add.StreetAddress != '') contact.OtherStreet = add.StreetAddress;
  330. }}if(profiles.IsActive != false){update user;
  331. update contact;
  332. }else{
  333. update user;}ProfileDetails pro = (ProfileDetails) Json.deserialize(getProfileDetails(profiles.UserID), ProfileDetails.class);
  334. System.debug('ProfileDeails:'+ pro);updatedProfile up = new updatedProfile(pro.Salutation, pro.FirstName, pro.LastName, pro.EmailAddress, pro.Username, pro.IsTermsAgreed, pro.Country, pro.VATNumber, pro.Phone, pro.Fax, pro.Mobile, pro.PreferredContact, pro.PrimaryPharmacyId, pro.UserLanguage, pro.UserLocale, pro.IsActive, pro.Addresses, pro.Pharmacy, pro.Roles, 'Success');return json.serialize(up);}else{throw new CustomException(PG_Utils.getException(USER_ERROR,GENERIC_ERROR_TYPE, CustomException__c.getValues('PC0001').Error_Description__c));
  335. }}catch(Exception e){return e.getMessage();}return null;}global class ProfileDetails{
  336. public String Salutation {get;set;}
  337. public String FirstName {get;set;}
  338. public String LastName {get;set;}
  339. public String EmailAddress {get;set;}
  340. public String Username {get;set;}
  341. public Boolean IsTermsAgreed {get;set;}
  342. public String Country {get;set;}
  343. public String VATNumber {get;set;}
  344. public String Phone {get;set;}
  345. public String Fax {get;set;}
  346. public String Mobile {get;set;}
  347. public String PreferredContact {get;set;}
  348. public String PrimaryPharmacyId {get;set;}
  349. public String UserLanguage {get;set;}
  350. public String UserLocale {get;set;}
  351. public String SaltValue {get;set;}
  352. public String SecretQuestion {get;set;}
  353. public String SecretAnswer {get;set;}
  354. public Boolean IsActive {get;set;}
  355. public List<Addresses> Addresses {get;set;}
  356. public List<Pharmacy> Pharmacy {get;set;}
  357. public List<Roles> Roles {get;set;}
  358. public profileDetails(){ }
  359. public profileDetails(String Salutation, String FirstName, String LastName, String EmailAddress, String Username, Boolean IsTermsAgreed, String Country, String VATNumber, String Phone, String Fax, String Mobile, String PreferredContact, String PrimaryPharmacyId, String UserLanguage, String UserLocale, String SaltValue, String SecretQuestion, String SecretAnswer, Boolean IsActive, List<Addresses> Addresses, List<Pharmacy> Pharmacy, List<Roles> Roles){
  360. this.Salutation = Salutation;
  361. this.FirstName = FirstName;
  362. this.LastName = LastName;
  363. this.EmailAddress = EmailAddress;
  364. this.Username = Username;
  365. this.IsTermsAgreed = IsTermsAgreed;
  366. this.Country = Country;
  367. this.VATNumber = VATNumber;
  368. this.Phone = Phone;
  369. this.Fax = Fax;
  370. this.Mobile = Mobile;
  371. this.PreferredContact = PreferredContact;
  372. this.PrimaryPharmacyId = PrimaryPharmacyId;
  373. this.UserLanguage = UserLanguage;
  374. this.UserLocale = UserLocale;
  375. this.SaltValue = SaltValue;
  376. this.SecretQuestion = SecretQuestion;
  377. this.SecretAnswer = SecretAnswer;
  378. this.IsActive = IsActive;
  379. this.Addresses = Addresses;
  380. this.Pharmacy = Pharmacy;
  381. this.Roles = Roles;} }
  382. public updatedProfile(){ }
  383. public updatedProfile(String Salutation, String FirstName, String LastName, String EmailAddress, String Username, Boolean IsTermsAgreed, String Country, String VATNumber, String Phone, String Fax, String Mobile, String PreferredContact, String PrimaryPharmacyId, String UserLanguage, String UserLocale, Boolean IsActive, List<Addresses> Addresses, List<Pharmacy> Pharmacy, List<Roles> Roles, String Status){
  384. this.Salutation = Salutation;
  385. this.FirstName = FirstName;
  386. this.LastName = LastName;
  387. this.EmailAddress = EmailAddress;
  388. this.Username = Username;
  389. this.IsTermsAgreed = IsTermsAgreed;
  390. this.Country = Country;
  391. this.VATNumber = VATNumber;
  392. this.Phone = Phone;
  393. this.Fax = Fax;
  394. this.Mobile = Mobile;
  395. this.PreferredContact = PreferredContact;
  396. this.PrimaryPharmacyId = PrimaryPharmacyId;
  397. this.UserLanguage = UserLanguage;
  398. this.UserLocale = UserLocale;
  399. this.IsActive = IsActive;
  400. this.Addresses = Addresses;
  401. this.Pharmacy = Pharmacy;
  402. this.Roles = Roles;
  403. this.Status = Status;} }
  404. global class Addresses{
  405. public String StreetAddress {get;set;}
  406. public String City {get;set;}
  407. public String PostalCode {get;set;}
  408. public String Type {get;set;}
  409. public Addresses(){ }
  410. public Addresses(String Addresses, String City, String PostalCode, String Type){this.StreetAddress = StreetAddress;
  411. this.City = City;
  412. this.PostalCode = PostalCode;
  413. this.Type = Type;}}
  414. global class Roles{
  415. public String Name {get;set;}
  416. public String TranslationKey {get;set;}
  417. public String ERPRole {get;set;}
  418. public List<String> Functions {get;set;}
  419. public Roles(){ }
  420. public Roles(String Name, String TranslationKey, String ERPRole, List<String> Functions){
  421. this.Name = Name;
  422. this.TranslationKey = TranslationKey;
  423. this.ERPRole = ERPRole;
  424. this.Functions = Functions;} }
  425. global class Pharmacy{
  426. public String Name {get;set;}
  427. public String ID {get;set;}
  428. public String Status {get;set;}
  429. public String CustomerGroup {get;set;}
  430. public Boolean IsPGAccount {get;set;}
  431. public String VATNumber {get;set;}
  432. public String PrimaryPharmacyId{get;set;}
  433. public string Phone{get;set;}
  434. public string Fax{get;set;}
  435. public List<Addresses> Address{get;set;}
  436. public String ABP_CIP {get;set;}
  437. public String PGAccountStatus{get;set;}
  438. public String EComm_Eligible {get;set;}
  439. public string Salesrep_Name {get;set;}
  440. public string Salesrep_ID {get;set;}
  441. public string Salesrep_Email{get;set;}
  442. public Pharmacy(){ }
  443. public Pharmacy(String Name, String ID, String Status, String CustomerGroup,Boolean IsPGAccount, List<Addresses> Address,String PrimaryPharmacyId,String VATNumber, String ABP_CIP,String Phone,String Fax,String PGAccountStatus, String EComm_Eligible,string Salesrep_Name,string Salesrep_ID,string Salesrep_Email){
  444. this.Name = Name;
  445. this.ID = ID;
  446. this.Status = Status;
  447. this.CustomerGroup = CustomerGroup;
  448. this.IsPGAccount = IsPGAccount;
  449. this.Address = Address;
  450. this.VATNumber = VATNumber;
  451. this.PrimaryPharmacyId = PrimaryPharmacyId;
  452. this.ABP_CIP = ABP_CIP;
  453. this.Phone = phone;
  454. this.fax = Fax;
  455. this.PGAccountStatus = PGAccountStatus;
  456. this.EComm_Eligible = EComm_Eligible;
  457. this.Salesrep_Name=Salesrep_Name;
  458. this.Salesrep_ID=Salesrep_ID;
  459. this.Salesrep_Email=Salesrep_Email;}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement