public void InstanceOK()

        {
            clsAccountCollection allAccount = new clsAccountCollection();

            Assert.IsNotNull(allAccount);
        }
        public void DeleteMethodOK()

        {
            clsAccountCollection allAccount = new clsAccountCollection();

            clsAccount TestItem = new clsAccount();

            Int32 PrimaryKey = 0;

            TestItem.NewsLetterSub = true;
            TestItem.JoinDate      = Convert.ToDateTime("2011-01-01");
            TestItem.CustFName     = "Jim";
            TestItem.CustSName     = "Johnson";
            TestItem.CustAddress   = "NN39GA";
            TestItem.CustPhone     = 0791231231;
            TestItem.CustID        = 2;

            allAccount.ThisAccount = TestItem;

            PrimaryKey = allAccount.Add();

            TestItem.CustID = PrimaryKey;

            allAccount.ThisAccount.Find(PrimaryKey);

            allAccount.Delete();

            Boolean Found = allAccount.ThisAccount.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
Example #3
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        clsAccountCollection TheAccounts = new clsAccountCollection();

        TheAccounts.ThisAccount.Find(CustID);
        TheAccounts.Delete();
        Response.Redirect("AccountList.aspx");
    }
Example #4
0
    void DisplayAccount()
    {
        clsAccountCollection Account = new clsAccountCollection();

        lstResult.DataSource     = Account.AccountList;
        lstResult.DataValueField = "CustID";
        lstResult.DataTextField  = "CustAddress";
        lstResult.DataBind();
    }
        public void ReportByCustAddressNoneFound()

        {
            clsAccountCollection filteredAccount = new clsAccountCollection();

            filteredAccount.ReportByCustAddress("yyy yyy");

            Assert.AreEqual(0, filteredAccount.count);
        }
Example #6
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        clsAccountCollection Account = new clsAccountCollection();

        Account.ReportByCustAddress(txtSearch.Text);
        lstResult.DataSource     = Account.AccountList;
        lstResult.DataValueField = "CustID";
        lstResult.DataValueField = "CustAddress";
        lstResult.DataBind();
    }
        public void ReportByCustAddressMethodOK()

        {
            clsAccountCollection allAccount = new clsAccountCollection();

            clsAccountCollection filteredAccount = new clsAccountCollection();

            filteredAccount.ReportByCustAddress("");

            Assert.AreEqual(allAccount.count, filteredAccount.count);
        }
Example #8
0
    private void DisplayAccount()
    {
        clsAccountCollection TheAccount = new clsAccountCollection();

        TheAccount.ThisAccount.Find(CustID_);
        txtCustID.Text           = TheAccount.ThisAccount.CustID.ToString();
        txtCustFName.Text        = TheAccount.ThisAccount.CustFName.ToString();
        txtCustSName.Text        = TheAccount.ThisAccount.CustSName;
        txtCustPhone.Text        = TheAccount.ThisAccount.CustPhone.ToString();
        txtCustAddress.Text      = TheAccount.ThisAccount.CustAddress.ToString();
        txtJoinDate.Text         = TheAccount.ThisAccount.JoinDate.ToString();
        chkNewsletterSub.Checked = TheAccount.ThisAccount.NewsLetterSub;
    }
        public void ThisAccountPropertyOK()

        {
            clsAccountCollection allAccount = new clsAccountCollection();

            clsAccount TestAccount = new clsAccount();

            TestAccount.NewsLetterSub = true;
            TestAccount.JoinDate      = Convert.ToDateTime("2011-01-01");
            TestAccount.CustFName     = "Jim";
            TestAccount.CustSName     = "Johnson";
            TestAccount.CustAddress   = "NN3 9GA";
            TestAccount.CustPhone     = 0791231231;
            TestAccount.CustID        = 2;

            allAccount.ThisAccount = TestAccount;

            Assert.AreEqual(allAccount.ThisAccount, TestAccount);
        }
Example #10
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        //Create a new instance of clsAccounts
        clsAccount Account     = new clsAccount();
        string     CustID      = txtCustID.Text;
        string     CustFName   = txtCustFName.Text;
        string     CustSName   = txtCustSName.Text;
        string     CustAddress = txtCustAddress.Text;
        string     JoinDate    = txtJoinDate.Text;
        string     CustPhone   = txtCustPhone.Text;
        string     Error       = "";

        ///////////////
        Error = Account.Valid(CustFName, CustSName, CustAddress, JoinDate, CustPhone);
        if (Error == "")
        {
            Account.CustID        = Int32.Parse(CustID);
            Account.CustFName     = CustFName;
            Account.CustSName     = CustSName;
            Account.CustAddress   = CustAddress;
            Account.JoinDate      = Convert.ToDateTime(JoinDate);
            Account.NewsLetterSub = chkNewsletterSub.Checked;
            Account.CustPhone     = long.Parse(CustPhone);
            clsAccountCollection AccountList = new clsAccountCollection();
            if (CustID_ == -1)
            {
                AccountList.ThisAccount = Account;
                AccountList.Add();
            }
            else
            {
                AccountList.ThisAccount.Find(CustID_);
                AccountList.ThisAccount = Account;
                AccountList.Update();
            }
            Response.Redirect("accountList.aspx");
        }
        else
        {
            lblError.Text = Error;
        }
    }
        public void UpdateMethodOK()

        {
            clsAccountCollection allAccount = new clsAccountCollection();

            clsAccount TestItem = new clsAccount();

            int PrimaryKey = 80;

            TestItem.NewsLetterSub = true;
            TestItem.JoinDate      = Convert.ToDateTime("2011-01-01");
            TestItem.CustFName     = "Jim";
            TestItem.CustSName     = "Johnson";
            TestItem.CustAddress   = "NN3 9GA";
            TestItem.CustPhone     = 0791231231;
            TestItem.CustID        = 2;

            allAccount.ThisAccount = TestItem;

            PrimaryKey = allAccount.Add();

            TestItem.CustID = PrimaryKey;

            TestItem.NewsLetterSub = true;
            TestItem.JoinDate      = Convert.ToDateTime("2011-01-01");
            TestItem.CustFName     = "Jennifer";
            TestItem.CustSName     = "Carnel";
            TestItem.CustAddress   = "LE30DS";
            TestItem.CustPhone     = 0793213212;
            TestItem.CustID        = 3;

            allAccount.ThisAccount = TestItem;

            allAccount.Update();

            allAccount.ThisAccount.Find(PrimaryKey);

            Assert.AreEqual(allAccount.ThisAccount, TestItem);
        }
        public void ListAndCountOK()

        {
            clsAccountCollection allAccount = new clsAccountCollection();

            List <clsAccount> TestList = new List <clsAccount>();

            clsAccount TestItem = new clsAccount();

            TestItem.NewsLetterSub = true;
            TestItem.JoinDate      = Convert.ToDateTime("2011-01-01");
            TestItem.CustFName     = "Jim";
            TestItem.CustSName     = "Johnson";
            TestItem.CustAddress   = "NN3 9GA";
            TestItem.CustPhone     = 0791231231;
            TestItem.CustID        = 2;

            TestList.Add(TestItem);

            allAccount.AccountList = TestList;

            Assert.AreEqual(allAccount.count, TestList.Count);
        }
        public void ReportByCustAddressTestDataFound()

        {
            clsAccountCollection FilteredAccount = new clsAccountCollection();
            Boolean OK = true;

            FilteredAccount.ReportByCustAddress("LE30DS");
            if (FilteredAccount.count == 2)
            {
                if (FilteredAccount.AccountList[0].CustID != 3)
                {
                    OK = false;
                }
                if (FilteredAccount.AccountList[1].CustID != 4)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }