Exemplo n.º 1
0
        internal static Account AccountCreate(ServiceContext context, AccountTypeEnum accountType, AccountClassificationEnum classification, AccountSubTypeEnum subType)
        {
            Account account = new Account
            {
                Name                    = "Account_" + Helper.GetGuid(),
                AccountType             = accountType,
                AccountTypeSpecified    = true,
                Classification          = classification,
                ClassificationSpecified = true,
                AccountSubType          = subType.ToString(),
                SubAccountSpecified     = true
            };
            Account apiResponse = Helper.AddToQBO(context, account);

            return(apiResponse);
        }
        internal static Account AccountCreate(DataService dataService, AccountTypeEnum accountType, AccountClassificationEnum classification, AccountSubTypeEnum subType)
        {
            Account account = new Account
            {
                Name                    = "Account_" + GetGuid(),
                AccountType             = accountType,
                AccountTypeSpecified    = true,
                Classification          = classification,
                ClassificationSpecified = true,
                AccountSubType          = subType.ToString(),
                SubAccountSpecified     = true
            };
            Account apiResponse = dataService.Add(account);

            return(apiResponse);
        }
Exemplo n.º 3
0
        internal static Account AccountCreate(DataService dataService, AccountTypeEnum accountType,
                                              AccountClassificationEnum classification, AccountSubTypeEnum subType)
        {
            var random  = new Random();
            var account = new Account
            {
                Name                    = "Account_" + random.NextDouble(),
                AccountType             = accountType,
                AccountTypeSpecified    = true,
                Classification          = classification,
                ClassificationSpecified = true,
                AccountSubType          = subType.ToString(),
                SubAccountSpecified     = true
            };
            var apiResponse = dataService.Add(account);

            return(apiResponse);
        }
        private Account CreateAccount(DataService dataService, AccountTypeEnum type, AccountSubTypeEnum subType)
        {
            // We are creating new Account by type and subtype which we will use for new inventory
            // The Account name should be unique
            // Following lines are just object creation, to create this account in QBO it should follow by the service call
            Random  random     = new Random();
            Account newAccount = new Account
            {
                Name                 = "My " + type.ToString() + random.Next(), // Dont forget to change the name before running the code
                AccountType          = type,
                AccountSubType       = subType.ToString(),
                AccountTypeSpecified = true,
                SubAccountSpecified  = true
            };

            // Following line will create incomeAccount in quickbooks with Name= My Income Account
            return(dataService.Add <Account>(newAccount));
        }