Exemplo n.º 1
0
        public ActionResult OnPostAllocateTransaction([FromBody] Allocate allocate)
        {
            DataSet dstresult = new DataSet();


            DataTable dtsdebit  = allocate.dtDebit;
            DataTable dtscredit = allocate.dtCredit;

            dtsdebit.Columns.Add("IsCredit");
            dtsdebit.Columns.Add("AllocateBy");
            dtsdebit.Columns.Add("AllocateDate");

            dtscredit.Columns.Add("IsCredit");
            dtscredit.Columns.Add("AllocateBy");
            dtscredit.Columns.Add("AllocateDate");

            foreach (DataRow d in dtsdebit.Rows)
            {
                d["IsCredit"]     = false;
                d["AllocateBy"]   = HttpContext.Session.GetString("Usernames").ToString();
                d["AllocateDate"] = DateTime.Now;
            }

            foreach (DataRow d in dtscredit.Rows)
            {
                d["IsCredit"]     = true;
                d["AllocateBy"]   = HttpContext.Session.GetString("Usernames").ToString();
                d["AllocateDate"] = DateTime.Now;
            }

            dtsdebit.AcceptChanges();

            dtscredit.AcceptChanges();


            int val = _transactionRepository.SaveAllocatetrans(dtscredit);

            int vals = _transactionRepository.SaveAllocatetrans(dtsdebit);

            DataTable dtsval = allocate.dtDebit;

            dstresult = _transactionRepository.AllocateTransaction(allocate.reconileID, HttpContext.Session.GetString("UserEmail"));

            return(new JsonResult(dstresult));
        }