Exemplo n.º 1
0
        private void PrintLeave(int studentID)
        {
            try
            {
                clsManager manager = new clsManager();
                ReportViewer1.Visible = true;

                ReportDataSource rds = new ReportDataSource();
                ReportViewer1.Reset();
                ReportViewer1.ProcessingMode = ProcessingMode.Local;
                LocalReport rep = ReportViewer1.LocalReport;


                rep.Refresh();

                rds.Name = "Student";

                rep.ReportPath = "Reports/rptStudentInfo.rdlc";


                rds.Value = manager.RetrunDataset("select *from tblStudent where StudentId =" + studentID + " ").Tables[0];


                ReportParameter[] p = { new ReportParameter("Company", "Square") };
                rep.SetParameters(p);

                //This name must be in "<datasetname>_<datatablename>" format. This name can also be seen in dataset's datasource view.
                rep.DataSources.Add(rds);
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        public void InstanceOk()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();

            //test to see that it exists
            Assert.IsNotNull(AManager);
        }
Exemplo n.º 3
0
        public void TelephoneNumberOk()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //create some test data to assign to the property
            String TelephoneNumber = "01112234567";

            //assign the data to the property
            AManager.TelephoneNumber = TelephoneNumber;
            //test to see that the two values are the same
            Assert.AreEqual(AManager.TelephoneNumber, TelephoneNumber);
        }
Exemplo n.º 4
0
        public void SurnameOk()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //create some test data to assign to the property
            String Surname = "Kardashian";

            //assign the data to the property
            AManager.Surname = Surname;
            //test to see that the two values are the same
            Assert.AreEqual(AManager.Surname, Surname);
        }
Exemplo n.º 5
0
        public void FirstnameOk()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //create some test data to assign to the property
            String Firstname = "Kourtney";

            //assign the data to the property
            AManager.Firstname = Firstname;
            //test to see that the two values are the same
            Assert.AreEqual(AManager.Firstname, Firstname);
        }
Exemplo n.º 6
0
        public void EmailAddressOk()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //create some test data to assign to the property
            String EmailAddress = "*****@*****.**";

            //assign the data to the property
            AManager.EmailAddress = EmailAddress;
            //test to see that the two values are the same
            Assert.AreEqual(AManager.EmailAddress, EmailAddress);
        }
Exemplo n.º 7
0
        public void ManagerIDOk()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //create some test data to assign to the property
            Int32 ManagerID = 1;

            //assign the data to the property
            AManager.ManagerID = ManagerID;
            //test to see that the two values are the same
            Assert.AreEqual(AManager.ManagerID, ManagerID);
        }
Exemplo n.º 8
0
        public void AddressOk()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //create some test data to assign to the property
            String Address = "11";

            //assign the data to the property
            AManager.Address = Address;
            //test to see that the two values are the same
            Assert.AreEqual(AManager.Address, Address);
        }
Exemplo n.º 9
0
        public void FindMethodOk()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //boolen variable to store the result of the validation
            Boolean Found = false;
            //create some test data to use with the method
            Int32 ManagerID = 22;

            //invoke the method
            Found = AManager.Find(ManagerID);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
Exemplo n.º 10
0
        public void TelephoneNumberMid()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //create a string variable to store the result of the validation
            string Error = "";
            //create some test data to test the method
            string Address         = "14 Mayfair Street";
            string EmailAddress    = "*****@*****.**";
            string Firstname       = "Kam";
            string Surname         = "Kaur";
            string Password        = "******";
            string TelephoneNumber = "01234"; //this should be ok

            //invoke the method
            Error = AManager.Valid(Address, EmailAddress, Firstname, Surname, Password, TelephoneNumber);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 11
0
        public void AddressMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //create a string variable to store the result of the validation
            string Error = "";
            //create some test data to test the method
            string Address         = "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"; //this should trigger an error
            string EmailAddress    = "*****@*****.**";
            string Firstname       = "Kam";
            string Surname         = "Kaur";
            string Password        = "******";
            string TelephoneNumber = "01169877896";

            //invoke the method
            Error = AManager.Valid(Address, EmailAddress, Firstname, Surname, Password, TelephoneNumber);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Exemplo n.º 12
0
        public void TestManagerIDFound()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable to record if data is OK (assume it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 ManagerID = 22;

            //invoke the method
            Found = AManager.Find(ManagerID);
            //check the manager id
            if (AManager.ManagerID != 22)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
Exemplo n.º 13
0
        public void EmailAddressExtremeMax()
        {
            //create an instance of the class we want to create
            clsManager AManager = new clsManager();
            //create a string variable to store the result of the validation
            string Error = "";
            //create some test data to test the method
            string Address      = "14 Mayfair Street";
            string EmailAddress = "";

            EmailAddress = EmailAddress.PadRight(500, 'k'); //this should fail
            string Firstname       = "Kam";
            string Surname         = "Kaur";
            string Password        = "******";
            string TelephoneNumber = "01169877896";

            //invoke the method
            Error = AManager.Valid(Address, EmailAddress, Firstname, Surname, Password, TelephoneNumber);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }