コード例 #1
0
        /*  -----------------------------------------------------
         *  FUNCTION - DeleteUser
         *  -----------------------------------------------------
         *
         * ------------------------------------------------------
         */
        public void DeleteUser(Cp_user user)
        {
            cpdb.Cp_Users.Remove((
                                     from u in cpdb.Cp_Users
                                     where u.Cp_user_id == user.Cp_user_id
                                     select u
                                     ).FirstOrDefault());

            cpdb.SaveChanges();
        }
コード例 #2
0
        /*  -----------------------------------------------------
         *  FUNCTION - DeleteBank
         *  -----------------------------------------------------
         *
         * ------------------------------------------------------
         */
        public void DeleteBank(Bank prmBank)
        {
            cpdb.Banks.Remove((
                                  from b in cpdb.Banks
                                  where b.Bank_id == prmBank.Bank_id
                                  select b
                                  ).FirstOrDefault());

            cpdb.SaveChanges();
        }
コード例 #3
0
        /*  -----------------------------------------------------
         *  FUNCTION - UpdateAcct_check
         *  -----------------------------------------------------
         *
         * ------------------------------------------------------
         */
        public Acct_check UpdateAcct_check(Acct_check origCheck, Acct_check newInfoCheck)
        {
            origCheck.Account_id    = newInfoCheck.Account_id;
            origCheck.Amount        = newInfoCheck.Amount;
            origCheck.Check_number  = newInfoCheck.Check_number;
            origCheck.Date_written  = newInfoCheck.Date_written;
            origCheck.Date_received = newInfoCheck.Date_received;
            origCheck.Date_paid     = newInfoCheck.Date_paid;
            origCheck.Amount_paid   = newInfoCheck.Amount_paid;

            cpdb.SaveChanges();

            return(SelectAcct_check(origCheck.Acct_check_id));
        }
コード例 #4
0
        /*  -----------------------------------------------------
         *  FUNCTION -- UpdateAccount
         *  -----------------------------------------------------
         *  pass in an Account object <prmAcctToUpdate> to update
         *      and an Account object <prmNewAcctInfo> with the new updated info
         *  set all <prmAcctToUpdate>'s info to the <prmNewAcctInfo>'s info
         *  -----------------------------------------------------
         */
        public Account UpdateAccount(Account acctToUpdate, Account newAcctInfo)
        {
            acctToUpdate.First_name     = newAcctInfo.First_name;
            acctToUpdate.Last_name      = newAcctInfo.Last_name;
            acctToUpdate.First_name_2   = newAcctInfo.First_name_2;
            acctToUpdate.Last_name_2    = newAcctInfo.Last_name_2;
            acctToUpdate.Bank_id        = newAcctInfo.Bank_id;
            acctToUpdate.Address        = newAcctInfo.Address;
            acctToUpdate.City           = newAcctInfo.City;
            acctToUpdate.State          = newAcctInfo.State;
            acctToUpdate.Country        = newAcctInfo.Country;
            acctToUpdate.Zip_code       = newAcctInfo.Zip_code;
            acctToUpdate.Account_number = newAcctInfo.Account_number;
            acctToUpdate.Phone_number   = newAcctInfo.Phone_number;

            cpdb.SaveChanges();

            return(SelectAccount(acctToUpdate.Account_id));
        }
コード例 #5
0
        public Client InsertClient(Client client)
        {
            Client tstClient = (
                from c in cpdb.Clients
                where c.Client_id == client.Client_id
                select c
                ).FirstOrDefault();

            Client newClient;

            if (tstClient == null)
            {
                newClient = cpdb.Clients.Add(tstClient);
                cpdb.SaveChanges();
            }
            else
            {
                newClient = tstClient;
            }

            return(newClient);
        }