예제 #1
0
        public LoanLedger InsertLedgerTransact(string IDS, LoanLedger LoanLedger, LedgerTransact Lt, float Ampd, int instFk)
        {
            try
            {
                int ID = Convert.ToInt32(IDS);
                LoanLedger.ID = ID;
                var resp = uvDb.LoanLedgers.Find(LoanLedger.ID);
                if (resp != null)
                {
                    Lt.colss = resp.ID;
                    Lt.cols  = instFk;
                    if (Ampd == 0)
                    {
                        Lt.Credit = resp.Debit;
                    }
                    else
                    {
                        Lt.Credit = Ampd;
                    }
                    Lt.Debit        = 0;
                    Lt.DueDate      = resp.TranxDate;
                    Lt.DatePaid     = MyUtility.getCurrentLocalDateTime();
                    Lt.ReferenceNum = resp.RefNumber;
                    Lt.ValueDate    = MyUtility.getCurrentLocalDateTime().Date.ToString();
                    Lt.ValueTime    = MyUtility.getCurrentLocalDateTime().TimeOfDay.ToString();
                    uvDb.LedgerTransacts.Add(Lt);
                    uvDb.SaveChanges();
                }

                /* int ID = Convert.ToInt32(IDS);
                 * LoanLedger.ID = ID;
                 * var resp = uvDb.LoanLedgers.Find(LoanLedger.ID);
                 *
                 * if (resp != null)
                 * {
                 *   resp.Credit = resp.Debit;
                 *   resp.PaymentFlag_FK = 1;
                 *   uvDb.SaveChanges();
                 * }
                 * return resp.ID;
                 */
                // return (double)resp.Debit;
                return(resp);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
예제 #2
0
        public int InsertLoanLedger(LoanLedger Ledger)
        {
            try
            {
                uvDb.LoanLedgers.Add(Ledger);
                uvDb.SaveChanges();

                return(Ledger.ID);
            }

            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(0);
            }
        }
예제 #3
0
        public int UpdateLedgers(string IDS, LoanLedger LoanLedger)
        {
            try
            {
                int ID = Convert.ToInt32(IDS);
                LoanLedger.ID = ID;
                var resp = uvDb.LoanLedgers.Find(LoanLedger.ID);

                if (resp != null)
                {
                    resp.Credit         = LoanLedger.Debit;
                    resp.PaymentFlag_FK = LoanLedger.PaymentFlag_FK;
                    uvDb.SaveChanges();
                }
                return(resp.ID);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(0);
            }
        }