public int GetId()
        {
            var lastrow = service.LastRow().OrderByDescending(a => a.PartyBalanceId).FirstOrDefault();

            if (lastrow == null)
            {
                return(1);
            }
            else
            {
                return(lastrow.PartyBalanceId + 1);
            }
        }
        public LedgerPosting Save(LedgerPosting ledger)
        {
            var ledgerDetails = ledgerService.GetById(ledger.LedgerId);
            // var isExists = service.GetAll().Where(a => a.InvoiceNo == ledger.InvoiceNo && a.LedgerId == ledger.LedgerId).FirstOrDefault();
            var max = service.LastRow().OrderByDescending(a => a.Id).FirstOrDefault();

            if (max == null)
            {
                ledger.Id = 1;
            }
            else
            {
                ledger.Id = max.Id + 1;
            }

            if (ledger.VoucherNo == null)
            {
                ledger.VoucherNo = max.VoucherNo + 1;
            }
            ledger.YearId   = CurrentSession.GetCurrentSession().FinancialYear;
            ledger.IsActive = true;
            var result = service.Save(ledger);

            return(result);
        }
Esempio n. 3
0
        public AccountGroup Save(AccountGroup cus)
        {
            var isExists = service.GetAll().Where(a => a.AccountGroupName == cus.AccountGroupName).FirstOrDefault();
            var max      = service.LastRow().OrderByDescending(a => a.Id).FirstOrDefault().Id;

            cus.Id = max + 1;
            if (isExists != null)
            {
                return(null);
            }
            service.Save(cus);
            return(cus);
        }
Esempio n. 4
0
        public LedgerPosting Save(LedgerPosting cus)
        {
            var isExists = service.GetAll().Where(a => a.LedgerId == cus.LedgerId && a.YearId == cus.YearId).FirstOrDefault();
            var max      = service.LastRow().OrderByDescending(a => a.Id).FirstOrDefault().Id;

            cus.Id = max + 1;
            if (isExists != null)
            {
                return(null);
            }
            cus.YearId = CurrentSession.GetCurrentSession().FinancialYear;
            service.Save(cus);
            return(cus);
        }
Esempio n. 5
0
        public Supplier Save(Supplier cus)
        {
            var max = service.LastRow().OrderByDescending(a => a.Id).FirstOrDefault();

            if (max == null)
            {
                cus.Id = 1;
            }
            else
            {
                cus.Id = max.Id + 1;
            }
            return(service.Save(cus));
        }
        public JournalMaster Save(JournalMaster JMaster)
        {
            //    var ledgerDetails = ledgerService.GetById(ledger.LedgerId);
            //    var isExists = service.GetAll().Where(a => a.InvoiceNo == ledger.InvoiceNo && a.LedgerId == ledger.LedgerId).FirstOrDefault();
            var max = journalMaster.LastRow().OrderByDescending(a => a.Id).FirstOrDefault();

            if (max == null)
            {
                JMaster.Id = 1;
            }
            else
            {
                JMaster.Id = max.Id + 1;
            }
            var financialYear = CurrentSession.GetCurrentSession().FinancialYear;

            JMaster.YearId        = CurrentSession.GetCurrentSession().FinancialYear;
            JMaster.VoucherTypeId = 6;
            JMaster.UserId        = CurrentSession.GetCurrentSession().UserId;

            var result = journalMaster.Save(JMaster);

            return(result);
        }
        public AdditionalCost AddCostSave(AdditionalCost addCost)
        {
            var isExists = addCostService.GetAll().Where(a => a.VoucherNo == addCost.VoucherNo && a.LedgerId == addCost.LedgerId).FirstOrDefault();
            var max      = addCostService.LastRow().OrderByDescending(a => a.Id).FirstOrDefault();

            if (max == null)
            {
                addCost.Id = 1;
            }
            else
            {
                addCost.Id = max.Id + 1;
            }
            var result = addCostService.Save(addCost);

            return(result);
        }
Esempio n. 8
0
        public SalaryPayment Save(SalaryPayment SP)
        {
            var max = service.LastRow().OrderByDescending(a => a.Id).FirstOrDefault();

            SP.VoucherNo = max.VoucherNo;
            SP.LedgerId  = max.LedgerId;

            var Max = salaryPayment.LastRow().OrderByDescending(a => a.Id).FirstOrDefault();

            if (Max == null)
            {
                SP.Id = 1;
            }
            else
            {
                SP.Id = max.Id + 1;
            }
            var result = salaryPayment.Save(SP);

            return(result);
        }
        public JournalDetail Save(JournalDetail JDetails)
        {
            var max = journalDetails.LastRow().OrderByDescending(a => a.Id).FirstOrDefault();

            if (max == null)
            {
                JDetails.Id = 1;
            }
            else
            {
                JDetails.Id = max.Id + 1;
            }
            int value = int.Parse(journalMaster.LastRow().OrderByDescending(p => p.Id).Select(r => r.Id).First().ToString());

            JDetails.JournalMasterId = value;


            var result = journalDetails.Save(JDetails);

            return(result);
        }