Example #1
0
        public object Delete(Xero_Bill_Delete request)
        {
            ApiUser         hdUser         = request.ApiUser;
            Instance_Config instanceConfig = new Instance_Config(hdUser);

            CheckXeroIntegration(instanceConfig);
            if (request.is_unlink)
            {
                try
                {
                    Xero.UnlinkXeroBill(hdUser.OrganizationId, hdUser.DepartmentId, request.key);
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    throw new HttpError(Utils.ClearString(ex.Message));
                }
            }
            else
            {
                try
                {
                    Xero.DeleteAndUnlinkBill(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.XeroAuthConsumerKey, request.key, instanceConfig.XeroRSAPrivateKey);
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    throw new HttpError(Utils.ClearString(ex.Message));
                }
            }
        }
Example #2
0
        //GM gmcp;

        public MainGame()
        {
            //Weapons.Axe Weapon = new Weapons.Axe();
            //string asdf = Weapon.Name;
            //Console.WriteLine("Welcome to the arena!");
            hero = new Xero();
            Xero.Init(hero);
            //Heroes = new List<Hero>();
            Monster = new List <BaseCharacter>();
            Party   = new List <BaseCharacter>();
            Party.Add(hero);
            BasicGameLoop();
        }
Example #3
0
        public object Post(Xero_Data request)
        {
            ApiUser hdUser = request.ApiUser;

            try
            {
                Xero.UpdateXeroData(hdUser.OrganizationId, hdUser.DepartmentId, request.user_id, request.account_id, request.xero_contact_id);
            }
            catch (Exception ex)
            {
                throw new HttpError(Utils.ClearString(ex.Message));
            }
            return(new HttpResult("", HttpStatusCode.OK));
        }
Example #4
0
        public object Delete(Xero_Contact_Unlink request)
        {
            ApiUser         hdUser         = request.ApiUser;
            Instance_Config instanceConfig = new Instance_Config(hdUser);

            CheckXeroIntegration(instanceConfig);
            try
            {
                Xero.UnlinkXeroContact(hdUser.OrganizationId, hdUser.DepartmentId, request.key);
                return(new HttpResult("", HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                throw new HttpError(Utils.ClearString(ex.Message));
            }
        }
Example #5
0
        public object Post(Xero_Invoice_Create request)
        {
            ApiUser         hdUser         = request.ApiUser;
            Instance_Config instanceConfig = new Instance_Config(hdUser);

            CheckXeroIntegration(instanceConfig);
            try
            {
                XeroInvoice xeroInvoice;
                string      result = Xero.CreateInvoice(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.XeroAuthConsumerKey, request.invoice_id, out xeroInvoice,
                                                        instanceConfig.XeroRSAPrivateKey);
                if (result != "ok")
                {
                    throw new HttpError(HttpStatusCode.NotFound, Utils.ClearString(result));
                }
                return(xeroInvoice);
            }
            catch (Exception ex)
            {
                throw new HttpError(Utils.ClearString(ex.Message));
            }
        }
Example #6
0
        public object Post(Xero_Bill_Create request)
        {
            ApiUser         hdUser         = request.ApiUser;
            Instance_Config instanceConfig = new Instance_Config(hdUser);

            CheckXeroIntegration(instanceConfig);
            try
            {
                string result = Xero.CreateBill(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.XeroAuthConsumerKey, request.bill_id, instanceConfig.XeroRSAPrivateKey);
                if (result == "ok")
                {
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                else
                {
                    throw new HttpError(Utils.ClearString(result));
                }
            }
            catch (Exception ex)
            {
                throw new HttpError(Utils.ClearString(ex.Message));
            }
        }
Example #7
0
        public object Post(Xero_Contact_Create request)
        {
            ApiUser         hdUser         = request.ApiUser;
            Instance_Config instanceConfig = new Instance_Config(hdUser);

            CheckXeroIntegration(instanceConfig);
            int user_id    = 0;
            int account_id = 0;

            if (request.user_id.HasValue)
            {
                user_id = request.user_id.Value;
            }
            if (request.account_id.HasValue)
            {
                account_id = request.account_id.Value;
            }
            try
            {
                XeroContact xeroContact;
                string      result = Xero.CreateContact(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.XeroAuthConsumerKey, user_id, account_id, out xeroContact,
                                                        instanceConfig.XeroRSAPrivateKey);
                if (result == "ok")
                {
                    return(xeroContact);
                }
                else
                {
                    throw new HttpError(HttpStatusCode.NotFound, Utils.ClearString(result));
                }
            }
            catch (Exception ex)
            {
                throw new HttpError(Utils.ClearString(ex.Message));
            }
        }
Example #8
0
        protected Guid Given_a_file_in(Guid folderId,Xero.Api.Core.Model.File file )
        {
            var result = Api.Files.Add(folderId, file, exampleFile);

            return result.Id ;
        }
Example #9
0
        protected async Task<Guid> Given_a_file_in(Guid folderId,Xero.Api.Core.Model.File file )
        {
            var result = await Api.Files.AddAsync(folderId, file, exampleFile);

            return result.Id ;
        }