Ejemplo n.º 1
0
        public void DeleteGeneralLedgerUsingRepo()
        {
            AccountingSystemV2Entities1 db = new AccountingSystemV2Entities1();

            GeneralLedgerTbl deleteGL = (from d in db.GeneralLedgerTbls where d.generalLedger == "4802" select d).Single();

            db.GeneralLedgerTbls.Remove(deleteGL);
            db.SaveChanges();
        }
Ejemplo n.º 2
0
        public void DeleteTransactionUsingRepo()
        {
            AccountingSystemV2Entities1 db = new AccountingSystemV2Entities1();

            TransactionTbl deleteTbl = (from d in db.TransactionTbls where d.gl1 == "4801" select d).Single();

            db.TransactionTbls.Remove(deleteTbl);

            db.SaveChanges();
        }
Ejemplo n.º 3
0
        public void DeleteProjectUsingRepo()
        {
            AccountingSystemV2Entities1 db = new AccountingSystemV2Entities1();

            ProjectsTbl deleteProject = (from d in db.ProjectsTbls where d.Project == "1442" select d).Single();

            db.ProjectsTbls.Remove(deleteProject);

            db.SaveChanges();
        }
Ejemplo n.º 4
0
        public void DeleteFundUsingRepo()
        {
            AccountingSystemV2Entities1 db = new AccountingSystemV2Entities1();

            FundTbl deleteFund = (from d in db.FundTbls where d.Fund == "A1R" select d).Single();

            db.FundTbls.Remove(deleteFund);

            db.SaveChanges();
        }
Ejemplo n.º 5
0
        public void DeleteCustomerUsingRepo()
        {
            AccountingSystemV2Entities1 db = new AccountingSystemV2Entities1();

            CustomerTbl deleteCustomer = (from d in db.CustomerTbls where d.firstName == "Patrick" select d).Single();
            if (deleteCustomer != null)
               db.CustomerTbls.Remove(deleteCustomer);

            db.SaveChanges();
        }
Ejemplo n.º 6
0
        //Test transaction for valid GLs and customer
        public bool validateTransaction(TransactionTbl transaction)
        {
            bool valid = true;

            AccountingSystemV2Entities1 db = new AccountingSystemV2Entities1();

            //test GL1 for existence
            GeneralLedgerTbl foundGL = (from d in db.GeneralLedgerTbls where d.generalLedger == transaction.gl1 select d).Single();

            if (foundGL == null)
            {
                valid = false;
                throw new System.ArgumentException("GL " + transaction.gl1 + " not found in GL table.");
            }

            //test gl2
            foundGL = (from d in db.GeneralLedgerTbls where d.generalLedger == transaction.gl2 select d).Single();

            if (foundGL == null)
            {
                valid = false;
                throw new System.ArgumentException("GL " + transaction.gl2 + " not found in GL table.");
            }

            //test gl3
            foundGL = (from d in db.GeneralLedgerTbls where d.generalLedger == transaction.gl3 select d).Single();

            if (foundGL == null)
            {
                valid = false;
                throw new System.ArgumentException("GL " + transaction.gl3 + " not found in GL table.");
            }

            //test gl4
            foundGL = (from d in db.GeneralLedgerTbls where d.generalLedger == transaction.gl4 select d).Single();

            if (foundGL == null)
            {
                valid = false;
                throw new System.ArgumentException("GL " + transaction.gl4 + " not found in GL table.");
            }

            //test customer
            CustomerTbl foundCustomer = (from d in db.CustomerTbls where d.CustomerID == transaction.customer select d).Single();

            if (foundCustomer == null)
            {
                valid = false;
                throw new System.ArgumentException("Customer not found in Customer table.");
            }

            return valid;
        }