コード例 #1
0
        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);
        }
コード例 #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));
        }
コード例 #3
0
ファイル: Delete.cshtml.cs プロジェクト: war-man/OnlineStore
        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"));
        }
コード例 #4
0
ファイル: Delete.cshtml.cs プロジェクト: war-man/OnlineStore
        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());
        }
コード例 #5
0
ファイル: Edit.cshtml.cs プロジェクト: war-man/OnlineStore
        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());
        }
コード例 #6
0
 public virtual int Delete(GoodsReceiptDetail entity, bool persist = true)
 {
     entity.IsDeleted = true;
     Table.Update(entity);
     return(persist ? SaveChanges() : 0);
 }
コード例 #7
0
 public int Add(GoodsReceiptDetail entity, bool persist = true)
 {
     Table.Add(entity);
     return(persist ? SaveChanges() : 0);
 }