private static DTO_MemberInfo[] getAllUsersFromCloud() { DTO_LoyaltyMemberListResponse response = CloudOps.GetMemberList(siteId, syndicateCode); if (response.Succesful) { return(response.MemberList.ToArray()); } else { return new DTO_MemberInfo[] { } }; }
static void createUser() { DTO_MemberInfo info = new DTO_MemberInfo(); getMemberInformation(ref info); DTO_LoyaltyMemberResponse response = CloudOps.CreateMember(siteId, syndicateCode, info); if (response.Succesful) { Console.WriteLine("User creation success"); } else { Console.WriteLine("User creation failed : {0}", response.Message); } }
static void removeUser() { DTO_MemberInfo member = getMemberFromList(); if (member != null) { DTO_LoyaltyResponse response = CloudOps.DeleteMember(siteId, syndicateCode, member.UUID); if (response.Succesful) { Console.WriteLine("Member removed successfully"); } else { Console.WriteLine("Member removal failed : {0}", response.Message); } } else { Console.WriteLine("No member to remove"); } }
private static void updateSingleUser(DTO_MemberInfo info) { int choice = -1; do { displayUser(info); Console.WriteLine("Select a field to update : Type field number (Eg: 2) and then followed by the new value. Type -1 to complete update."); string response = Console.ReadLine(); string[] arr = response.Split(' '); if (int.TryParse(arr[0], out choice) && arr.Length > 1) { try { string input = string.Join(" ", arr, 1, arr.Length - 1); switch (choice) { case 1: case 4: Console.WriteLine("Cannot update this field"); break; case 2: info.Name = input; break; case 3: info.CellPhone = input; break; case 5: info.DateOfBirth = DateTime.Parse(input); break; case 6: info.LoadedPoints = double.Parse(input); break; case 7: info.EarnedPoints = double.Parse(input); break; default: throw new Exception("Invalid input"); } } catch { Console.WriteLine("Invalid input"); } } }while (choice != -1); DTO_LoyaltyMemberResponse resp = CloudOps.UpdateMember(siteId, syndicateCode, info, false); if (resp.Succesful) { Console.WriteLine("Update successfull"); } else { Console.WriteLine("Update failed : {0}", resp.Message); } }