Example #1
0
        public CostCenter ReadCostCenter(string costCenterType, string costCenterCode)
        {
            var command = new ReadCostCenterCommand
            {
                Office         = session.Office,
                CostCenterType = costCenterType,
                CostCenterCode = costCenterCode
            };
            var response = processXml.Process(command.ToXml());

            return(CostCenter.FromXml(response));
        }
Example #2
0
        public TResult ReadDimension <TResult>(string code) where TResult : class
        {
            var resultType = typeof(TResult);

            var dimensionCommand = new ReadDimension
            {
                Office   = _session.Office,
                ReadType = "dimensions",
                Code     = code
            };

            if (resultType == typeof(Customer))
            {
                dimensionCommand.Type = "DEB";
                var dimensionResponse = _processXml.Process(dimensionCommand.ToXml());
                return(Customer.FromXml(dimensionResponse) as TResult);
            }

            if (resultType == typeof(Supplier))
            {
                dimensionCommand.Type = "CRD";
                var dimensionResponse = _processXml.Process(dimensionCommand.ToXml());
                return(Supplier.FromXml(dimensionResponse) as TResult);
            }

            if (resultType == typeof(BalanceSheet))
            {
                dimensionCommand.Type = "BAS";
                var dimensionResponse = _processXml.Process(dimensionCommand.ToXml());
                return(BalanceSheet.FromXml(dimensionResponse) as TResult);
            }

            if (resultType == typeof(ProfitLoss))
            {
                dimensionCommand.Type = "PNL";
                var dimensionResponse = _processXml.Process(dimensionCommand.ToXml());
                return(ProfitLoss.FromXml(dimensionResponse) as TResult);
            }

            if (resultType == typeof(CostCenter))
            {
                dimensionCommand.Type = "KPL";
                var dimensionResponse = _processXml.Process(dimensionCommand.ToXml());
                return(CostCenter.FromXml(dimensionResponse) as TResult);
            }

            return(default(TResult));
        }