public int Update(int itemId, int GoodsReceiptId, int newQuantity, bool persist = true)
        {
            GoodsReceiptDetail GoodsReceiptDetail = Find(c => c.GoodsReceiptId == GoodsReceiptId && c.ItemId == itemId);

            Table.Attach(GoodsReceiptDetail).State = EntityState.Deleted;
            return(persist ? SaveChanges() : 0);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Get(uint DocEntry)
        {
            SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext;

            SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            oRecSet.DoQuery($@"
                SELECT
                    document.""DocEntry"",
                    document.""DocNum"",
                    to_char(to_date(SUBSTRING(document.""DocDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""DocDate"",

                    (case when document.""CANCELED"" = 'Y' then 'Cancelado'
                    when document.""DocStatus"" = 'O' then 'Abierto'
                    when document.""DocStatus"" = 'C' then 'Cerrado'
                    else document.""DocStatus"" end)  AS  ""DocStatus"",

                    warehouse.""WhsName""
                FROM OIGN document
                LEFT JOIN NNM1 series ON series.""Series"" = document.""Series""
                LEFT JOIN OWHS warehouse ON warehouse.""WhsCode"" = series.""SeriesName""
                WHERE document.""DocEntry"" = '{DocEntry}';");

            int rc = oRecSet.RecordCount;

            if (rc == 0)
            {
                return(NoContent());
            }

            JToken temp = context.XMLTOJSON(oRecSet.GetAsXML())["OIGN"][0];

            oRecSet.DoQuery($@"
                Select
                    ""ItemCode"",
                    ""Dscription"",
                    ""Quantity"",
                    ""UomCode"",
                    ""InvQty"",
                    ""UomCode2""
                From IGN1 Where ""DocEntry"" = '{DocEntry}';");
            oRecSet.MoveFirst();
            temp["Lines"] = context.XMLTOJSON(oRecSet.GetAsXML())["IGN1"];

            GoodsReceiptDetail output = temp.ToObject <GoodsReceiptDetail>();

            //Force Garbage Collector. Recommendation by InterLatin Dude. SDK Problem with memory.
            GC.Collect();
            GC.WaitForPendingFinalizers();

            //var s1 = Stopwatch.StartNew();
            //s1.Stop();
            //const int _max = 1000000;
            //Console.WriteLine(((double)(s1.Elapsed.TotalMilliseconds * 1000 * 1000) / _max).ToString("0.00 ns"));

            return(Ok(output));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            GoodsReceiptDetail = await _context.GoodsReceiptDetail.FindAsync(id);

            if (GoodsReceiptDetail != null)
            {
                _context.GoodsReceiptDetail.Remove(GoodsReceiptDetail);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            GoodsReceiptDetail = await _context.GoodsReceiptDetail
                                 .Include(g => g.GoodsReceipt)
                                 .Include(g => g.Item).FirstOrDefaultAsync(m => m.ItemId == id);

            if (GoodsReceiptDetail == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            GoodsReceiptDetail = await _context.GoodsReceiptDetail
                                 .Include(g => g.GoodsReceipt)
                                 .Include(g => g.Item).FirstOrDefaultAsync(m => m.ItemId == id);

            if (GoodsReceiptDetail == null)
            {
                return(NotFound());
            }
            ViewData["GoodsReceiptId"] = new SelectList(_context.GoodsReceipt, "Id", "Id");
            ViewData["ItemId"]         = new SelectList(_context.Item, "Id", "Name");
            return(Page());
        }
 public virtual int Delete(GoodsReceiptDetail entity, bool persist = true)
 {
     entity.IsDeleted = true;
     Table.Update(entity);
     return(persist ? SaveChanges() : 0);
 }
 public int Add(GoodsReceiptDetail entity, bool persist = true)
 {
     Table.Add(entity);
     return(persist ? SaveChanges() : 0);
 }