Exemplo n.º 1
0
        //Get Item
        public async Task <dynamic> GetItemDetails(ItemDetailModel model)
        {
            SecurityToken token = await GetSecurityToken();

            var client = new PaymentGateway.IeBizServiceClient();
            var data   = await client.SearchItemsAsync(token, model.itemInternalId, model.itemId, model.searchFilters, model.start, model.limit, model.sort);

            return(data);
        }
Exemplo n.º 2
0
        //Search Items with Pagination
        public async Task <dynamic> SearchItemsWithPagination(ItemDetailModel model)
        {
            SecurityToken token = await GetSecurityToken();

            var client = new PaymentGateway.IeBizServiceClient();

            model.start = (model.pageno - 1) * model.pagesize;
            model.limit = model.pagesize;
            var data = await client.SearchItemsAsync(token, model.itemInternalId, model.itemId, model.searchFilters, model.start, model.limit, model.sort);

            return(data);
        }
Exemplo n.º 3
0
        public async Task <dynamic> SyncItems(SyncDetailModel model)
        {
            SecurityToken token = await GetSecurityToken();

            var client = new PaymentGateway.IeBizServiceClient();
            List <SyncItemReponse> itemReponses = new List <SyncItemReponse>();
            SyncResponseModel      response     = new SyncResponseModel();

            foreach (var item in model.items)
            {
                SyncItemReponse itemreponse = new SyncItemReponse();
                try
                {
                    var items = await client.SearchItemsAsync(token, "", item.ItemId, null, 0, 20, "");

                    if (items.Length == 0)
                    {
                        var newitem = await new ItemManager().AddItem(token, item);
                        itemreponse.Status         = newitem.Status;
                        itemreponse.Message        = "Succesfuly Created";
                        itemreponse.ItemId         = item.ItemId;
                        itemreponse.ItemInternalId = newitem.ItemInternalId;
                        itemReponses.Add(itemreponse);
                    }
                    else
                    {
                        item.ItemInternalId = items[0]?.ItemInternalId;
                        item.ItemId         = items[0]?.ItemId;
                        var updateitem = await new ItemManager().UpdateItemDetails(token, item);
                        itemreponse.Status         = updateitem.Status;
                        itemreponse.Message        = "Succesfuly Updated";
                        itemreponse.ItemId         = item.ItemId;
                        itemreponse.ItemInternalId = updateitem.ItemInternalId;
                        itemReponses.Add(itemreponse);
                    }
                }
                catch (Exception ex)
                {
                    //if (ex.Message.ToString() == "Not Found" && item != null)
                    //{
                    //    var newitem = await new ItemManager().AddItem(token,item);
                    //    itemreponse.Status = newitem.Status;
                    //    itemreponse.Message = "Succesfuly Created";
                    //    itemreponse.ItemId = item.ItemId;
                    //    itemreponse.ItemInternalId = newitem.InvoiceInternalId;
                    //    itemReponses.Add(itemreponse);
                    //}
                }
            }
            response.syncItemReponses = itemReponses;
            return(response.syncItemReponses);
        }
Exemplo n.º 4
0
        //Search Items
        public async Task <dynamic> SearchAllItems(ItemDetailModel model)
        {
            SecurityToken token = await GetSecurityToken();

            var client = new PaymentGateway.IeBizServiceClient();
            List <ItemReturnModel> itemReturnModels = new List <ItemReturnModel>();
            int length     = 0;
            int lengthnode = 0;

            do
            {
                lengthnode++;
                var data = await client.SearchItemsAsync(token, model.itemInternalId, model.itemId, model.searchFilters, model.start, model.limit, model.sort);

                length = data.Length;
                ItemReturnModel itemReturn = new ItemReturnModel();
                itemReturn.items = data.ToList();
                itemReturnModels.Add(itemReturn);
                model.start = Int32.Parse(lengthnode + "000");
                model.limit = Int32.Parse(lengthnode + "999");
            } while (length >= 1000);
            return(itemReturnModels);
        }