private object ResolveObject(APICallSignature callSig)
        {
            object obj = null;

            Task.Run(async() => {
                switch (callSig.CallObjCode)
                {
                case "30":
                    var journalRepo = new sbo.fx.Factories.RepositoryFactory().JournalRepository();
                    obj             = await journalRepo.GetByTransId(int.Parse(callSig.CallKey));
                    break;

                case "60":
                    var inventoryOutRepo = new sbo.fx.Factories.RepositoryFactory().InventoryTransactionRepository();
                    obj = await inventoryOutRepo.GetTransactionByDocNo(int.Parse(callSig.CallKey), InventoryType.Out);
                    break;

                case "59":
                    var inventoryInRepo = new sbo.fx.Factories.RepositoryFactory().InventoryTransactionRepository();
                    obj = await inventoryInRepo.GetTransactionByDocNo(int.Parse(callSig.CallKey), InventoryType.In);
                    break;

                case "4":
                    var itemRepo = new sbo.fx.Factories.RepositoryFactory().ItemRepository();
                    obj          = await itemRepo.GetItemByItemCode(callSig.CallKey);
                    break;

                case "2":
                    var bpRepo = new sbo.fx.Factories.RepositoryFactory().BusinessPartnerRepository();
                    obj        = await bpRepo.GetByCardCode(callSig.CallKey);
                    break;

                case "1":
                    var glRepo = new sbo.fx.Factories.RepositoryFactory().GlAccountRepository();
                    obj        = await glRepo.GetByAccountCode(callSig.CallKey);
                    break;
                }
            });

            return(obj);
        }
        private object ResolveObject(APICallSignature callSig)
        {
            try
            {
                object obj = null;
                Task.Run(async() => {
                    switch (callSig.CallObjCode)
                    {
                    case "JE":
                        var journalRepo = new sbo.fx.Factories.RepositoryFactory().JournalRepository();
                        journalRepo.InitRepository(GlobalInstance.Instance.SboComObject, GlobalInstance.Instance.SqlObject);
                        if (GlobalInstance.Instance.SqlObject.State == System.Data.ConnectionState.Closed)
                        {
                            GlobalInstance.Instance.SqlObject.Open();
                        }
                        if (GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Broken || GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Closed)
                        {
                            obj = await journalRepo.GetByTransIdForRDPosting(int.Parse(callSig.CallKey));
                        }
                        break;

                    case "GI":
                        var inventoryOutRepo = new sbo.fx.Factories.RepositoryFactory().InventoryTransactionRepository();
                        inventoryOutRepo.InitRepository(GlobalInstance.Instance.SboComObject, GlobalInstance.Instance.SqlObject);
                        if (GlobalInstance.Instance.SqlObject.State == System.Data.ConnectionState.Closed)
                        {
                            GlobalInstance.Instance.SqlObject.Open();
                        }
                        if (GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Broken || GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Closed)
                        {
                            obj = await inventoryOutRepo.GetTransactionByDocNo(int.Parse(callSig.CallKey), InventoryType.Out);
                        }
                        break;

                    case "GR":
                        var inventoryInRepo = new sbo.fx.Factories.RepositoryFactory().InventoryTransactionRepository();
                        inventoryInRepo.InitRepository(GlobalInstance.Instance.SboComObject, GlobalInstance.Instance.SqlObject);
                        if (GlobalInstance.Instance.SqlObject.State == System.Data.ConnectionState.Closed)
                        {
                            GlobalInstance.Instance.SqlObject.Open();
                        }
                        if (GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Broken || GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Closed)
                        {
                            obj = await inventoryInRepo.GetTransactionByDocNo(int.Parse(callSig.CallKey), InventoryType.In);
                        }
                        break;

                    case "ITM":
                        var itemRepo = new sbo.fx.Factories.RepositoryFactory().ItemRepository();
                        itemRepo.InitRepository(GlobalInstance.Instance.SboComObject, GlobalInstance.Instance.SqlObject);
                        if (GlobalInstance.Instance.SqlObject.State == System.Data.ConnectionState.Closed)
                        {
                            GlobalInstance.Instance.SqlObject.Open();
                        }
                        if (GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Broken || GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Closed)
                        {
                            obj = await itemRepo.GetItemByItemCode(callSig.CallKey);
                        }
                        break;

                    case "BP":
                        var bpRepo = new sbo.fx.Factories.RepositoryFactory().BusinessPartnerRepository();
                        bpRepo.InitRepository(GlobalInstance.Instance.SboComObject, GlobalInstance.Instance.SqlObject);
                        if (GlobalInstance.Instance.SqlObject.State == System.Data.ConnectionState.Closed)
                        {
                            GlobalInstance.Instance.SqlObject.Open();
                        }
                        if (GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Broken || GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Closed)
                        {
                            obj = await bpRepo.GetByCardCode(callSig.CallKey);
                        }
                        break;

                    case "GL":
                        var glRepo = new sbo.fx.Factories.RepositoryFactory().GlAccountRepository();
                        glRepo.InitRepository(GlobalInstance.Instance.SboComObject, GlobalInstance.Instance.SqlObject);
                        if (GlobalInstance.Instance.SqlObject.State == System.Data.ConnectionState.Closed)
                        {
                            GlobalInstance.Instance.SqlObject.Open();
                        }
                        if (GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Broken || GlobalInstance.Instance.SqlObject.State != System.Data.ConnectionState.Closed)
                        {
                            obj = await glRepo.GetByAccountCode(callSig.CallKey);
                        }
                        break;
                    }
                }).Wait();

                return(obj);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }