public object Delete()
        {
            ForteException errTran = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source = "DeleteTransaction"
            };
            var response = Requestor.Delete(_url, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errTran.ForteError.ErrorType = "#ERROR#";
                errTran.ForteError.Message = response;
                throw errTran;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errTran.ForteError.ErrorType = "NotFound";
                errTran.ForteError.Message = response;
                throw errTran;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errTran.ForteError.ErrorType = "BadRequest";
                errTran.ForteError.Message = response;
                throw errTran;
            }
            else
            {
                return response;
            }
        }
Exemple #2
0
        public virtual string Update <T>(T paymethod)
        {
            ForteException errPay = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "UpdatePaymethod"
            };
            var response = Requestor.PutString(_url, paymethod, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errPay.ForteError.ErrorType = "#ERROR#";
                errPay.ForteError.Message   = response;
                throw errPay;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errPay.ForteError.ErrorType = "NotFound";
                errPay.ForteError.Message   = response;
                throw errPay;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errPay.ForteError.ErrorType = "BadRequest";
                errPay.ForteError.Message   = response;
                throw errPay;
            }
            else
            {
                return(response);
            }
        }
Exemple #3
0
        public object Create(ForteAddress forteAddressFull)
        {
            ForteException errGetAddr = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "CreateAddress"
            };
            var response = Requestor.PostString(_url, forteAddressFull, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errGetAddr.ForteError.ErrorType = "#ERROR#";
                errGetAddr.ForteError.Message   = response;
                throw errGetAddr;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errGetAddr.ForteError.ErrorType = "NotFound";
                errGetAddr.ForteError.Message   = response;
                throw errGetAddr;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errGetAddr.ForteError.ErrorType = "BadRequest";
                errGetAddr.ForteError.Message   = response;
                throw errGetAddr;
            }
            else
            {
                return(response);
            }
        }
Exemple #4
0
        public virtual FortePaymethod GetPaymethod()
        {
            FortePaymethod payResult = new FortePaymethod();
            ForteException errPay    = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "GetPaymethod"
            };
            string strpayResult = Requestor.Get(_url, _strUser, _strPassword, _strAuthAccountID);

            if (!(strpayResult.IndexOf("#ERROR#") == -1))
            {
                errPay.ForteError.ErrorType = "#ERROR#";
                errPay.ForteError.Message   = strpayResult;
                throw errPay;
            }
            else if (!(strpayResult.IndexOf("NotFound") == -1))
            {
                errPay.ForteError.ErrorType = "NotFound";
                errPay.ForteError.Message   = strpayResult;
                throw errPay;
            }
            else if (!(strpayResult.IndexOf("BadRequest") == -1))
            {
                errPay.ForteError.ErrorType = "BadRequest";
                errPay.ForteError.Message   = strpayResult;
                throw errPay;
            }
            else
            {
                payResult = Mapper <FortePaymethod> .MapFromJson(strpayResult);

                return(payResult);
            }
        }
        public virtual string Create(ForteCustomer customer)
        {
            ForteException errCust = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source = "CreateCustomer"
            };
            var response = Requestor.PostString(_url, customer, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errCust.ForteError.ErrorType = "#ERROR#";
                errCust.ForteError.Message = response;
                throw errCust;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errCust.ForteError.ErrorType = "NotFound";
                errCust.ForteError.Message = response;
                throw errCust;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errCust.ForteError.ErrorType = "BadRequest";
                errCust.ForteError.Message = response;
                throw errCust;
            }
            else
            {
                return response;
            }
        }
        public virtual string Delete()
        {
            ForteException errDelete = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "Delete"
            };

            var response = Requestor.Delete(_url, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errDelete.ForteError.ErrorType = "#ERROR#";
                errDelete.ForteError.Message   = response;
                throw errDelete;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errDelete.ForteError.ErrorType = "NotFound";
                errDelete.ForteError.Message   = response;
                throw errDelete;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errDelete.ForteError.ErrorType = "BadRequest";
                errDelete.ForteError.Message   = response;
                throw errDelete;
            }
            else
            {
                return(response);
            }
        }
        public string Update(ForteScheduleItem forteScheduleItem)
        {
            ForteException errUpdate = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "Update"
            };

            var response = Requestor.PutString(_url, forteScheduleItem, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errUpdate.ForteError.ErrorType = "#ERROR#";
                errUpdate.ForteError.Message   = response;
                throw errUpdate;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errUpdate.ForteError.ErrorType = "NotFound";
                errUpdate.ForteError.Message   = response;
                throw errUpdate;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errUpdate.ForteError.ErrorType = "BadRequest";
                errUpdate.ForteError.Message   = response;
                throw errUpdate;
            }
            else
            {
                return(response);
            }
        }
        public ForteTransaction GetTransaction()
        {
            ForteTransaction forteTransaction = new ForteTransaction();
            ForteException   errTran          = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "GetTransaction"
            };
            string strtranResult = Requestor.Get(_url, _strUser, _strPassword, _strAuthAccountID);

            if (!(strtranResult.IndexOf("#ERROR#") == -1))
            {
                errTran.ForteError.ErrorType = "#ERROR#";
                errTran.ForteError.Message   = strtranResult;
                throw errTran;
            }
            else if (!(strtranResult.IndexOf("NotFound") == -1))
            {
                errTran.ForteError.ErrorType = "NotFound";
                errTran.ForteError.Message   = strtranResult;
                throw errTran;
            }
            else if (!(strtranResult.IndexOf("BadRequest") == -1))
            {
                errTran.ForteError.ErrorType = "BadRequest";
                errTran.ForteError.Message   = strtranResult;
                throw errTran;
            }
            else
            {
                forteTransaction = Mapper <ForteTransaction> .MapFromJson(strtranResult);

                return(forteTransaction);
            }
        }
        public virtual string Create(ForteCustomer customer)
        {
            ForteException errCust = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "CreateCustomer"
            };
            var response = Requestor.PostString(_url, customer, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errCust.ForteError.ErrorType = "#ERROR#";
                errCust.ForteError.Message   = response;
                throw errCust;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errCust.ForteError.ErrorType = "NotFound";
                errCust.ForteError.Message   = response;
                throw errCust;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errCust.ForteError.ErrorType = "BadRequest";
                errCust.ForteError.Message   = response;
                throw errCust;
            }
            else
            {
                return(response);
            }
        }
        public object Create(ForteAddress forteAddressFull)
        {
            ForteException errGetAddr = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source = "CreateAddress"
            };
            var response = Requestor.PostString(_url, forteAddressFull, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errGetAddr.ForteError.ErrorType = "#ERROR#";
                errGetAddr.ForteError.Message = response;
                throw errGetAddr;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errGetAddr.ForteError.ErrorType = "NotFound";
                errGetAddr.ForteError.Message = response;
                throw errGetAddr;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errGetAddr.ForteError.ErrorType = "BadRequest";
                errGetAddr.ForteError.Message = response;
                throw errGetAddr;
            }
            else
            {
                return response;
            }
        }
        public virtual IEnumerable <ForteCustomer> ListCustomer()
        {
            ForteException errCust = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "ListCustomer"
            };

            string response = Requestor.Get(_url, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errCust.ForteError.ErrorType = "#ERROR#";
                errCust.ForteError.Message   = response;
                throw errCust;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errCust.ForteError.ErrorType = "NotFound";
                errCust.ForteError.Message   = response;
                throw errCust;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errCust.ForteError.ErrorType = "BadRequest";
                errCust.ForteError.Message   = response;
                throw errCust;
            }
            else
            {
                ForteListResult <ForteCustomer> forteResults = JsonConvert.DeserializeObject <ForteListResult <ForteCustomer> >(response);
                return(forteResults.results);
            }
        }
Exemple #12
0
        public ForteAddress GetAddress()
        {
            ForteAddress forteaddr = new ForteAddress();

            ForteException errGetAddr = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "GetAddress"
            };

            string strAddrResult = Requestor.Get(_url, _strUser, _strPassword, _strAuthAccountID);


            if (!(strAddrResult.IndexOf("#ERROR#") == -1))
            {
                errGetAddr.ForteError.ErrorType = "#ERROR#";
                errGetAddr.ForteError.Message   = strAddrResult;
                throw errGetAddr;
            }
            else if (!(strAddrResult.IndexOf("NotFound") == -1))
            {
                errGetAddr.ForteError.ErrorType = "NotFound";
                errGetAddr.ForteError.Message   = strAddrResult;
                throw errGetAddr;
            }
            else if (!(strAddrResult.IndexOf("BadRequest") == -1))
            {
                errGetAddr.ForteError.ErrorType = "BadRequest";
                errGetAddr.ForteError.Message   = strAddrResult;
                throw errGetAddr;
            }
            else
            {
                forteaddr = Mapper <ForteAddress> .MapFromJson(strAddrResult);

                return(forteaddr);
            }
        }
        public ForteScheduleItem Get()
        {
            ForteScheduleItem forteScheduleItem = new ForteScheduleItem();

            ForteException errGetAddr = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "Get"
            };

            string response = Requestor.Get(_url, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errGetAddr.ForteError.ErrorType = "#ERROR#";
                errGetAddr.ForteError.Message   = response;
                throw errGetAddr;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errGetAddr.ForteError.ErrorType = "NotFound";
                errGetAddr.ForteError.Message   = response;
                throw errGetAddr;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errGetAddr.ForteError.ErrorType = "BadRequest";
                errGetAddr.ForteError.Message   = response;
                throw errGetAddr;
            }
            else
            {
                forteScheduleItem = JsonConvert.DeserializeObject <ForteScheduleItem>(response);
                return(forteScheduleItem);
            }
        }
        public virtual ForteCustomer GetCustomer()
        {
            ForteCustomer  custResult = new ForteCustomer();
            ForteException errCust    = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source         = "GetCustomer"
            };
            string strcustResult = Requestor.Get(_url, _strUser, _strPassword, _strAuthAccountID);


            if (!(strcustResult.IndexOf("#ERROR#") == -1))
            {
                errCust.ForteError.ErrorType = "#ERROR#";
                errCust.ForteError.Message   = strcustResult;
                throw errCust;
            }
            else if (!(strcustResult.IndexOf("NotFound") == -1))
            {
                errCust.ForteError.ErrorType = "NotFound";
                errCust.ForteError.Message   = strcustResult;
                throw errCust;
            }
            else if (!(strcustResult.IndexOf("BadRequest") == -1))
            {
                errCust.ForteError.ErrorType = "BadRequest";
                errCust.ForteError.Message   = strcustResult;
                throw errCust;
            }
            else
            {
                custResult = Mapper <ForteCustomer> .MapFromJson(strcustResult);

                return(custResult);
            }
        }
        public virtual ForteCustomer GetCustomer()
        {
            ForteCustomer custResult = new ForteCustomer();
            ForteException errCust = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source = "GetCustomer"
            };
            string strcustResult = Requestor.Get(_url, _strUser, _strPassword, _strAuthAccountID);

            if (!(strcustResult.IndexOf("#ERROR#") == -1))
            {
                errCust.ForteError.ErrorType = "#ERROR#";
                errCust.ForteError.Message = strcustResult;
                throw errCust;
            }
            else if (!(strcustResult.IndexOf("NotFound") == -1))
            {
                errCust.ForteError.ErrorType = "NotFound";
                errCust.ForteError.Message = strcustResult;
                throw errCust;
            }
            else if (!(strcustResult.IndexOf("BadRequest") == -1))
            {
                errCust.ForteError.ErrorType = "BadRequest";
                errCust.ForteError.Message = strcustResult;
                throw errCust;
            }
            else
            {
                custResult = Mapper<ForteCustomer>.MapFromJson(strcustResult);
                return custResult;
            }
        }
        public virtual IEnumerable<ForteTransaction> ListTransaction()
        {
            ForteException errTran = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source = "ListTransaction"
            };

            string response = Requestor.Get(_url, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errTran.ForteError.ErrorType = "#ERROR#";
                errTran.ForteError.Message = response;
                throw errTran;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errTran.ForteError.ErrorType = "NotFound";
                errTran.ForteError.Message = response;
                throw errTran;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errTran.ForteError.ErrorType = "BadRequest";
                errTran.ForteError.Message = response;
                throw errTran;
            }
            else
            {
                ForteListResult<ForteTransaction> forteResults = JsonConvert.DeserializeObject<ForteListResult<ForteTransaction>>(response);
                return forteResults.results;
            }
        }
        public ForteTransaction GetTransaction()
        {
            ForteTransaction forteTransaction = new ForteTransaction();
            ForteException errTran = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source = "GetTransaction"
            };
            string strtranResult = Requestor.Get(_url, _strUser, _strPassword, _strAuthAccountID);

            if (!(strtranResult.IndexOf("#ERROR#") == -1))
            {
                errTran.ForteError.ErrorType = "#ERROR#";
                errTran.ForteError.Message = strtranResult;
                throw errTran;
            }
            else if (!(strtranResult.IndexOf("NotFound") == -1))
            {
                errTran.ForteError.ErrorType = "NotFound";
                errTran.ForteError.Message = strtranResult;
                throw errTran;
            }
            else if (!(strtranResult.IndexOf("BadRequest") == -1))
            {
                errTran.ForteError.ErrorType = "BadRequest";
                errTran.ForteError.Message = strtranResult;
                throw errTran;
            }
            else
            {
                forteTransaction = Mapper<ForteTransaction>.MapFromJson(strtranResult);
                return forteTransaction;
            }
        }
        public ForteSchedule Get()
        {
            ForteSchedule forteSchedule = new ForteSchedule();

            ForteException errGet = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source = "Get"
            };

            string response = Requestor.Get(_url, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errGet.ForteError.ErrorType = "#ERROR#";
                errGet.ForteError.Message = response;
                throw errGet;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errGet.ForteError.ErrorType = "NotFound";
                errGet.ForteError.Message = response;
                throw errGet;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errGet.ForteError.ErrorType = "BadRequest";
                errGet.ForteError.Message = response;
                throw errGet;
            }
            else
            {
                forteSchedule = JsonConvert.DeserializeObject<ForteSchedule>(response);
                return forteSchedule;
            }
        }
        public string Update(ForteSchedule forteSchedule)
        {
            ForteException errUpdate = new ForteException()
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                Source = "Update"
            };

            var response = Requestor.PutString(_url, forteSchedule, _strUser, _strPassword, _strAuthAccountID);

            if (!(response.IndexOf("#ERROR#") == -1))
            {
                errUpdate.ForteError.ErrorType = "#ERROR#";
                errUpdate.ForteError.Message = response;
                throw errUpdate;
            }
            else if (!(response.IndexOf("NotFound") == -1))
            {
                errUpdate.ForteError.ErrorType = "NotFound";
                errUpdate.ForteError.Message = response;
                throw errUpdate;
            }
            else if (!(response.IndexOf("BadRequest") == -1))
            {
                errUpdate.ForteError.ErrorType = "BadRequest";
                errUpdate.ForteError.Message = response;
                throw errUpdate;
            }
            else
            {
                return response;
            }
        }