SHARE
TWEET

Untitled

a guest Jun 15th, 2017 475 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace createAccount
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             adminReference.AdminSoapClient adminClient = new adminReference.AdminSoapClient();
  13.             adminReference.CreateAccountRequest createAccountRequestObject = new adminReference.CreateAccountRequest();
  14.             adminReference.CreateAccountResponse createAccountResponseObject = new adminReference.CreateAccountResponse();
  15.             adminReference.SHCredentials soapHeader = new adminReference.SHCredentials();
  16.  
  17.             soapHeader.Username = "ptadmin";
  18.             soapHeader.Password = "73lec0";
  19.             soapHeader.SessionId = "";
  20.  
  21.             adminReference.UserInfo userObj = new adminReference.UserInfo();
  22.  
  23.             userObj.FirstName = "Zé";
  24.             userObj.LastName = "Povinho";
  25.             userObj.Username = "PT-user1";
  26.             userObj.Email = "Zé.Povinho@gmail.com";
  27.             userObj.Password = "anibal";
  28.  
  29.             decimal sizeInMB = 1000;
  30.             createAccountRequestObject.AccountSpace = sizeInMB;
  31.  
  32.             int year, month, day;
  33.             year = 2010;
  34.             month = 10;
  35.             day = 14;
  36.             createAccountRequestObject.AccountExpiration = new DateTime(year, month, day);
  37.  
  38.             createAccountResponseObject = adminClient.CreateAccount(soapHeader, createAccountRequestObject);
  39.  
  40.             if (createAccountResponseObject.OperationResult.OperationStatus == adminReference.OperationStatus.Failure)
  41.             {
  42.                 Console.WriteLine("CreateAccount Operation failed");
  43.                 Console.WriteLine(createAccountResponseObject.OperationResult.Message);
  44.             }
  45.             else
  46.             {
  47.                 adminReference.GetAccountDetailsRequest getAccountDetailsRequestObject = new adminReference.GetAccountDetailsRequest();
  48.                 adminReference.GetAccountDetailsResponse getAccountDetailsResponseObject = new adminReference.GetAccountDetailsResponse();
  49.  
  50.                 soapHeader.SessionId = createAccountResponseObject.OperationResult.SessionId;
  51.  
  52.                 getAccountDetailsRequestObject.Username = "PT-user1";
  53.  
  54.                 getAccountDetailsResponseObject = adminClient.GetAccountDetails(soapHeader, getAccountDetailsRequestObject);
  55.  
  56.                 if (getAccountDetailsResponseObject.OperationResult.OperationStatus == adminReference.OperationStatus.Failure)
  57.                 {
  58.                     Console.WriteLine("GetAccountDetails failed");
  59.                     Console.WriteLine(getAccountDetailsResponseObject.OperationResult.Message);
  60.                 }
  61.                 else
  62.                 {
  63.                     Console.WriteLine("Account created:");
  64.                     Console.WriteLine("Usuário = " + getAccountDetailsResponseObject.UserInfo.Username);
  65.                     Console.WriteLine("Nome = " + getAccountDetailsResponseObject.UserInfo.FirstName
  66.                         + " "
  67.                         + getAccountDetailsResponseObject.UserInfo.LastName);
  68.                     decimal totalAccountSize = getAccountDetailsResponseObject.AccountInfo.TotalSize;
  69.                     decimal usedAccountSize = getAccountDetailsResponseObject.AccountInfo.UsedSpace;
  70.                     Console.WriteLine("Account size = " + totalAccountSize.ToString() + " MB");
  71.                     Console.WriteLine("Used space = " + usedAccountSize.ToString() + " MB");
  72.  
  73.                     Console.WriteLine("Account expires on " + getAccountDetailsResponseObject.AccountInfo.Expiration.ToString());
  74.                 }
  75.             }
  76.         }
  77.     }
  78. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top