예제 #1
0
        public IActionResult InventoryReceivingNotes()
        {
            CredentialManage credential = JsonConvert
                                          .DeserializeObject <CredentialManage>(HttpContext.Session.GetString(Constants.VM_MANAGE));
            List <InventoryReceivingNote> notes = GetApiInventoryReceiveNotes
                                                  .GetInventoryReceivingNotes(credential.JwToken).ToList();

            return(View(notes));
        }
예제 #2
0
        public IActionResult InventoryReceivingNoteDetail(int id)
        {
            CredentialManage            credential = JsonConvert.DeserializeObject <CredentialManage>(HttpContext.Session.GetString(Constants.VM_MANAGE));
            List <InventoryRecieveItem> details    = new List <InventoryRecieveItem>();

            // get foods
            List <InventoryRecieveItem> detailForFoods = GetApiInventoryReceivingNoteDetailForFoods
                                                         .GetInventoryReceivingNoteDetailForFoods(credential.JwToken)
                                                         .Where(p => p.InventoryReceivingId == id)
                                                         .Select(p => new InventoryRecieveItem()
            {
                ProductId = GetApiFoodProducts.GetFoodProducts()
                            .SingleOrDefault(k => k.FoodId == p.FoodProductId).ProductId,
                ProductName = GetApiProducts.GetProducts().SingleOrDefault(h => h.ProductId == (GetApiFoodProducts.GetFoodProducts()
                                                                                                .SingleOrDefault(k => k.FoodId == p.FoodProductId).ProductId)).ProductName,
                SubProductId = p.FoodProductId,
                ProductImg   = GetApiProducts.GetProducts().SingleOrDefault(h => h.ProductId == (GetApiFoodProducts.GetFoodProducts()
                                                                                                 .SingleOrDefault(k => k.FoodId == p.FoodProductId).ProductId)).ProductImage,
                Amount = p.FoodProductAmount,
                Size   = "",
                Price  = p.FoodProductPrice
            }).ToList();

            List <InventoryRecieveItem> detailForToys = GetApiInventoryReceiveNoteDetailForToys
                                                        .GetInventoryReceivingNoteDetailForToys(credential.JwToken)
                                                        .Where(p => p.InventoryReceivingId == id)
                                                        .Select(p => new InventoryRecieveItem()
            {
                ProductId = GetApiToyProducts.GetToyProducts()
                            .SingleOrDefault(k => k.ToyId == p.ToyProductId).ProductId,
                ProductName = GetApiProducts.GetProducts().SingleOrDefault(h => h.ProductId == (GetApiToyProducts.GetToyProducts()
                                                                                                .SingleOrDefault(k => k.ToyId == p.ToyProductId).ProductId)).ProductName,
                SubProductId = p.ToyProductId,
                ProductImg   = GetApiProducts.GetProducts().SingleOrDefault(h => h.ProductId == (GetApiToyProducts.GetToyProducts()
                                                                                                 .SingleOrDefault(k => k.ToyId == p.ToyProductId).ProductId)).ProductImage,
                Amount = p.ToyProductAmount,
                Size   = "",
                Price  = p.ToyProductPrice
            }).ToList();

            List <InventoryRecieveItem> detailForCostumes = GetApiInventoryReceiveNoteDetailForCostumes
                                                            .GetInventoryReceivingNoteDetailForCostumes(credential.JwToken)
                                                            .Where(p => p.InventoryReceivingId == id)
                                                            .Select(p => new InventoryRecieveItem()
            {
                ProductId = GetApiCostumeProducts.GetCostumeProducts()
                            .SingleOrDefault(k => k.CostumeId == p.CostumeProductId && k.CostumeSize == p.CostumeProductSize).ProductId,
                ProductName = GetApiProducts.GetProducts().SingleOrDefault(h => h.ProductId == (GetApiCostumeProducts.GetCostumeProducts()
                                                                                                .SingleOrDefault(k => k.CostumeId == p.CostumeProductId && k.CostumeSize == p.CostumeProductSize).ProductId)).ProductName,
                SubProductId = p.CostumeProductId,
                ProductImg   = GetApiProducts.GetProducts().SingleOrDefault(h => h.ProductId == (GetApiCostumeProducts.GetCostumeProducts()
                                                                                                 .SingleOrDefault(k => k.CostumeId == p.CostumeProductId && k.CostumeSize == p.CostumeProductSize).ProductId)).ProductImage,
                Amount = p.CostumeProductAmount,
                Size   = p.CostumeProductSize,
                Price  = p.CostumeProductPrice
            }).ToList();

            details.AddRange(detailForFoods);
            details.AddRange(detailForToys);
            details.AddRange(detailForCostumes);

            InventoryReceivingNote note = GetApiInventoryReceiveNotes.GetInventoryReceivingNotes(credential.JwToken).SingleOrDefault(p => p.InventoryReceivingId == id);

            InventoryReceivingNoteDetailModelView inventoryReceivingNote = new InventoryReceivingNoteDetailModelView()
            {
                InventoryReceivingNote_ID  = note.InventoryReceivingId,
                InventoryReceivingNoteDate = note.InventoryReceivingDateReceiving,
                TotalPrice = note.InventoryReceivingTotalPrice,
                Details    = details
            };

            return(Json(inventoryReceivingNote));
        }
예제 #3
0
 private InventoryReceivingNote CreateInventoryReceiveNote(InventoryReceiveNoteModel inventoryReceivingNote, string token)
 {
     return(GetApiInventoryReceiveNotes.Post(inventoryReceivingNote, token));
 }