public void ListAndCountOK()
        {
            clsReportsCollection AllReports = new clsReportsCollection();

            //create some data to assign to the property , in this case the data needs to be a list of objects
            List <clsReports> TestList = new List <clsReports>();

            //add an item to the list and create the item of test data
            clsReports TestItem = new clsReports();

            //set the properties of the test object
            TestItem.ProfitOrLoss = true;
            TestItem.EmployeeId   = 2;
            TestItem.DateAdded    = DateTime.Now.Date;
            TestItem.EmployeeName = "Akshay";
            TestItem.Expenses     = 200;
            TestItem.Total        = 1000;

            //add the item to the test list
            TestList.Add(TestItem);

            //assign the data to the property
            AllReports.ReportList = TestList;

            //test to see that two values are the same
            Assert.AreEqual(AllReports.Count, TestList.Count);
        }
        public void AddMethodOK()
        {
            clsReportsCollection AllReports = new clsReportsCollection();

            //create the item of test data
            clsReports TestItem = new clsReports();

            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.ProfitOrLoss = true;
            TestItem.EmployeeId   = 2;
            TestItem.DateAdded    = DateTime.Now.Date;
            TestItem.EmployeeName = "Akshay";
            TestItem.Expenses     = 200;
            TestItem.Total        = 1000;

            //set ThisReports to the test data
            AllReports.ThisReport = TestItem;

            //add the record
            PrimaryKey = AllReports.Add();

            //set the primary key of the test data
            TestItem.EmployeeId = PrimaryKey;

            //find the record
            AllReports.ThisReport.Find(PrimaryKey);

            //test to see that the two values are the same
            Assert.AreEqual(AllReports.ThisReport, TestItem);
        }
コード例 #3
0
        public void DateAddedExtremeMax()
        {
            clsReports AReport = new clsReports();

            //string variable to store the error message
            String Error = "";

            //create a variable to store the test date data
            DateTime TestDate;

            //set the date to todays date
            TestDate = DateTime.Now.Date;

            //change the date to whatever the date is plus 100 years
            TestDate = TestDate.AddYears(100);

            //convert the date variable to string variable
            String DateAdded = TestDate.ToString();

            //Invoke the method
            Error = AReport.Valid(EmployeeName, Total, Expenses, DateAdded);

            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
        public void ReportListOK()
        {
            clsReportsCollection AllReports = new clsReportsCollection();

            //create some test data to assign to the property
            //in this case data neeeds list of objects
            List <clsReports> TestList = new List <clsReports>();
            clsReports        TestItem = new clsReports();

            //set its properties
            TestItem.ProfitOrLoss = true;
            TestItem.EmployeeId   = 2;
            TestItem.EmployeeName = "Akshay";
            TestItem.Expenses     = 200;
            TestItem.Total        = 1000;

            //add item to test list
            TestList.Add(TestItem);

            //assign the data to the property
            AllReports.ReportList = TestList;

            //test to see the two values are the same
            Assert.AreEqual(AllReports.ReportList, TestList);
        }
コード例 #5
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        clsReports AReport = new clsReports();

        //variable to store the primary key
        Int32 EmployeeId;

        //variable to store result of the find operation
        Boolean Found = false;

        //get primary key enterd by the user
        EmployeeId = Convert.ToInt32(txtEmployeeId.Text);

        //find the record
        Found = AReport.Find(EmployeeId);

        //if found
        if (Found == true)
        {
            //Display the values of the properties in form
            txtEmployeeId.Text   = AReport.EmployeeId.ToString();
            txtEmployeeName.Text = AReport.EmployeeName;
            txtExpenses.Text     = AReport.Expenses.ToString();
            txtTotal.Text        = AReport.Total.ToString();
        }
    }
コード例 #6
0
        public void EmployeeNameOK()
        {
            clsReports AReport  = new clsReports();
            String     TestData = "Akshay";

            AReport.EmployeeName = TestData;
            Assert.AreEqual(AReport.Total, TestData);
        }
コード例 #7
0
        public void CreateReport()
        {
            try
            {
                ReportViewer rvReport = new ReportViewer();
                #region Assign DataSet and Report Data Sourse Details
                DataSet    DS;
                clsReports oReport = new clsReports();
                DS = oReport.Get_ProgrameValidity_Report(hidUniID.Value, ddlExamEvent.SelectedValue);
                if (DS.Tables.Count != 0)
                {
                    DataTable dtExport = new DataTable();
                    dtExport = DS.Tables[0];
                    //  dtExport = ((System.Data.DataTable)Session["ViewElg_dtData"]).Copy();
                    ReportDataSource  ReportDetailsDS1 = new ReportDataSource("DataSet1", dtExport);
                    ReportParameter[] p = new ReportParameter[4];

                    p.SetValue(new ReportParameter("UniName", clsGetSettings.Name), 0);
                    p.SetValue(new ReportParameter("UniAdd", clsGetSettings.Address), 1);
                    p.SetValue(new ReportParameter("UserName", ((clsUser)Session["User"]).Name), 2);
                    p.SetValue(new ReportParameter("Logo", Classes.clsGetSettings.SitePath + @"Images/" + Classes.clsGetSettings.UniversityLogo), 3);
                    // ReportDataSource MultNomDS = new ReportDataSource("dsDisc_dtMultiNom", MultinomenClature());


                    #endregion

                    ReportViewer1.LocalReport.DataSources.Clear();
                    ReportViewer1.LocalReport.ReportPath = clsGetSettings.PhysicalSitePath + "Eligibility\\Rdlc\\rptStudentProgrameValidity.rdlc";

                    #region Adding DataSet and Report Data Sourse to ReportViewer DataSources

                    ReportViewer1.LocalReport.DataSources.Add(ReportDetailsDS1);
                    // ReportViewer1.LocalReport.DataSources.Add(MultNomDS);
                    ReportViewer1.LocalReport.SetParameters(p);

                    #endregion

                    ReportViewer1.LocalReport.EnableExternalImages = true;
                    ReportViewer1.LocalReport.Refresh();
                }

                string    sDateTime = DateTime.Now.ToString("ddMMyyyyhhmmsstt");
                Warning[] warnings;
                string[]  streamids;
                string    mimeType, encoding, filenameExtension;
                byte[]    bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
                Response.Buffer = true;
                Response.Clear();
                Response.ContentType = mimeType;
                Response.AddHeader("content-disposition", "attachment; filename=ProgrameValidityReport_" + sDateTime + ".pdf");
                Response.BinaryWrite(bytes);
            }
            catch (Exception Ex)
            {
                Exception e = new Exception(Ex.Message, Ex);
            }
        }
コード例 #8
0
        public void FindMethodOK()
        {
            clsReports AReport    = new clsReports();
            Boolean    Found      = false;
            Int32      EmployeeId = 2;

            Found = AReport.Find(EmployeeId);
            Assert.IsTrue(Found);
        }
コード例 #9
0
        private bool BindReport()
        {
            CreateHashTable();
            oReport = new clsReports();
            DataSet oDs = null;

            using (oDs = oReport.GetFormBReportData(oHt))
            {
                if (oDs != null && oDs.Tables.Count > 0 && oDs.Tables[0] != null && oDs.Tables[0].Rows.Count > 0)
                {
                    oDt = oDs.Tables[0];
                    rptViewer.LocalReport.DataSources.Clear();
                    rptViewer.LocalReport.ReportPath = clsGetSettings.PhysicalSitePath + "Eligibility\\Rdlc\\rptFormB.rdlc";
                    ReportDataSource  oRds  = new ReportDataSource("dsFormB", oDt);
                    ReportParameter[] param = new ReportParameter[5];
                    param[0] = new ReportParameter("College", oDt.Rows[0]["Inst_Name"].ToString(), true);
                    param[1] = new ReportParameter("Term", hidCrName.Value, true);
                    param[2] = new ReportParameter("IntakeCapcity", oDt.Rows[0]["IntakeCapacity"].ToString(), true);
                    param[3] = new ReportParameter("University", clsGetSettings.UniversityName, true);
                    param[4] = new ReportParameter("AcademicYear", ((DropDownList)YCMOU.FindControl("ddlAcadYear")).SelectedItem.Text, true);
                    //param[2] = new ReportParameter("UniSitePath", clsGetSettings.SitePath.ToString(), true);
                    //param[3] = new ReportParameter("UniversityCity", clsGetSettings.UniversityCity, true);
                    //param[4] = new ReportParameter("userName", user.Name, true);
                    //param[5] = new ReportParameter("Address", clsGetSettings.Address, true);
                    //string sCriteria = "Branch Change details for " + user.Name; ;
                    //param[6] = new ReportParameter("ReportCriteria", sCriteria, true);
                    ReportDataSource MultNomDS         = new ReportDataSource("dsMultiNom", MultinomenClature());
                    ReportDataSource DSFormBSummaryMed = null;
                    ReportDataSource DSFormBSummaryCat = null;
                    if (oDs.Tables[2] != null && oDs.Tables[2].Rows.Count > 0)
                    {
                        DSFormBSummaryMed = new ReportDataSource("DSFormBSummaryMed", oDs.Tables[2]);
                    }
                    if (oDs.Tables[1] != null && oDs.Tables[1].Rows.Count > 0)
                    {
                        DSFormBSummaryCat = new ReportDataSource("DSFormBSummaryCat", oDs.Tables[1]);
                    }
                    rptViewer.LocalReport.EnableExternalImages = true;
                    rptViewer.LocalReport.SetParameters(param);
                    rptViewer.LocalReport.DataSources.Add(oRds);
                    rptViewer.LocalReport.DataSources.Add(DSFormBSummaryMed);
                    rptViewer.LocalReport.DataSources.Add(DSFormBSummaryCat);
                    rptViewer.LocalReport.DataSources.Add(MultNomDS);
                    rptViewer.LocalReport.Refresh();
                    return(true);
                }
                else
                {
                    lblErrorMsg.Visible = true;
                    return(false);
                }
            }
        }
コード例 #10
0
        public void ValidMethodOK()
        {
            clsReports AReport = new clsReports();

            //String variable to store any error message
            String Error = "";

            //invoke the method
            Error = AReport.Valid(EmployeeName, Total, Expenses, DateAdded);

            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
コード例 #11
0
        public void TotalPropertyOK()
        {
            //create an instance of the class we want to create
            clsReports AReport = new clsReports();

            //create some test data to assign to the property
            decimal TestData = 1;

            //assign the data to the property
            AReport.Total = TestData;

            //test to see that two values are the same
            Assert.AreEqual(AReport.Total, TestData);
        }
コード例 #12
0
        public void ExpensesPropertyOK()
        {
            //create an instance of the class we want to create
            clsReports AReport = new clsReports();

            //create some test data to assign to the property
            Int32 TestData = 1;

            //assign the data to the property
            AReport.Expenses = TestData;

            //test to see that two values are the same
            Assert.AreEqual(AReport.Expenses, TestData);
        }
コード例 #13
0
        public void ProfitOrLossPropertyOK()
        {
            //create an instance of the class we want to create
            clsReports AReport = new clsReports();

            //create some test data to assign to the property
            Boolean TestData = true;

            //assign the data to the property
            AReport.ProfitOrLoss = TestData;

            //test to see that two values are the same
            Assert.AreEqual(AReport.ProfitOrLoss, TestData);
        }
コード例 #14
0
        public void ExpensesPlusOne()
        {
            clsReports AReport = new clsReports();

            //string to store the error message
            String Error = "";

            //set the Expenses to plus 1
            string Total = "1"; //This should pass

            //Invoke the method
            Error = AReport.Valid(EmployeeName, Total, Expenses, DateAdded);

            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
コード例 #15
0
        public void DateAddedInvalidData()
        {
            clsReports AReport = new clsReports();

            //string variable to store the error message
            String Error = "";

            //set the DateAdded to non date value
            string DateAdded = "This is not a date!";

            //Invoke the method
            Error = AReport.Valid(EmployeeName, Total, Expenses, DateAdded);

            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
コード例 #16
0
        public void EmployeeNameMaxPlusOne()
        {
            clsReports AReport = new clsReports();

            //string variable to store the error message
            String Error = "";

            //create some test data to pass the method
            string EmployeeName = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; //this should fail

            //invoking the method
            Error = AReport.Valid(EmployeeName, Total, Expenses, DateAdded);

            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
コード例 #17
0
        public void DateAddedPropertyOK()
        {
            //create an instance of the class we want to create
            clsReports AReport = new clsReports();

            //create some data to assign to the property

            DateTime TestData = DateTime.Now.Date;

            //assign data to property

            AReport.DateAdded = TestData;

            //testto see that two values are the same
            Assert.AreEqual(AReport.DateAdded, TestData);
        }
コード例 #18
0
        public void TestTotalFound()
        {
            clsReports AReport    = new clsReports();
            Boolean    Found      = false;
            Boolean    OK         = true;
            Int32      EmployeeId = 2;

            Found = AReport.Find(EmployeeId);
            //check the employee id
            if (AReport.Total != 1000)
            {
                OK = false;
            }
            //test to see if that result is correct
            Assert.IsTrue(OK);
        }
コード例 #19
0
        public void TestDateAddedFound()
        {
            clsReports AReport    = new clsReports();
            Boolean    Found      = false;
            Boolean    OK         = true;
            Int32      EmployeeId = 2;

            Found = AReport.Find(EmployeeId);
            //check the employee id
            if (AReport.DateAdded != Convert.ToDateTime("16/04/2021"))
            {
                OK = false;
            }
            //test to see if that result is correct
            Assert.IsTrue(OK);
        }
コード例 #20
0
        public void UpdateMethodOK()
        {
            clsReportsCollection AllReports = new clsReportsCollection();

            //create the item of test data
            clsReports TestItem = new clsReports();

            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.ProfitOrLoss = true;
            TestItem.EmployeeId   = 2;
            TestItem.DateAdded    = DateTime.Now.Date;
            TestItem.EmployeeName = "Akshay";
            TestItem.Expenses     = 200;
            TestItem.Total        = 1000;

            //set ThisReport to the test data
            AllReports.ThisReport = TestItem;

            //add the record
            PrimaryKey = AllReports.Add();

            //set the primary key of the test data
            TestItem.EmployeeId = PrimaryKey;

            //modify the test data
            TestItem.ProfitOrLoss = false;
            TestItem.EmployeeId   = 3;
            TestItem.DateAdded    = DateTime.Now.Date;
            TestItem.EmployeeName = "Lax";
            TestItem.Expenses     = 500;
            TestItem.Total        = 5000;

            //set the record based on the new test data
            AllReports.ThisReport = TestItem;

            //update the record
            AllReports.Update();

            //find the record
            AllReports.ThisReport.Find(PrimaryKey);

            //test to see ThisReport matched the test data
            Assert.AreEqual(AllReports.ThisReport, TestItem);
        }
コード例 #21
0
        /// <summary>
        /// Fill the Exam Event drop down
        /// </summary>
        public void FillExamEvent()
        {
            clsReports oReport = new clsReports();

            ddlExamEvent.DataSource     = oReport.ListEventResultReports();
            ddlExamEvent.DataTextField  = "Text";
            ddlExamEvent.DataValueField = "Value";
            ddlExamEvent.DataBind();
            ListItem li = new ListItem("--- Select ---", "-1");

            ddlExamEvent.Items.Insert(0, li);
            //ddlExamEvent.DataSource = oReport.ListEventResultReports();
            //ddlExamEvent.DataTextField = "ExamEvent";
            //ddlExamEvent.DataValueField = "ExamEventID";
            //ddlExamEvent.DataBind();
            //ddlExamEvent.Items.Insert(0, li);
        }
コード例 #22
0
        public void ThisReportPropertyOK()
        {
            clsReportsCollection AllReports = new clsReportsCollection();

            //create some test data to assign to the property
            clsReports TestReports = new clsReports();

            //set the properties of the test object
            TestReports.ProfitOrLoss = true;
            TestReports.EmployeeId   = 2;
            TestReports.DateAdded    = DateTime.Now.Date;
            TestReports.EmployeeName = "Akshay";
            TestReports.Expenses     = 200;
            TestReports.Total        = 1000;

            //assign the data to the property
            AllReports.ThisReport = TestReports;

            //test to see the two values are the same
            Assert.AreEqual(AllReports.ThisReport, TestReports);
        }
コード例 #23
0
        public void DeleteMethodOK()
        {
            clsReportsCollection AllReports = new clsReportsCollection();

            //create the item of test data
            clsReports TestItem = new clsReports();

            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.ProfitOrLoss = true;
            TestItem.EmployeeId   = 2;
            TestItem.DateAdded    = DateTime.Now.Date;
            TestItem.EmployeeName = "Akshay";
            TestItem.Expenses     = 200;
            TestItem.Total        = 1000;

            //set ThisReport to the test data
            AllReports.ThisReport = TestItem;

            //add the record
            PrimaryKey = AllReports.Add();

            //set the primary key of the test data
            TestItem.EmployeeId = PrimaryKey;

            //find the record
            AllReports.ThisReport.Find(PrimaryKey);

            //delete the record
            AllReports.Delete();

            //now find the record
            Boolean Found = AllReports.ThisReport.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
コード例 #24
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        clsReports AReport = new clsReports();



        //capture employeeName
        string EmployeeName = txtEmployeeName.Text;
        //capture DateAdded
        string DateAdded = txtDateAdded.Text;
        //capture Total
        string Total = txtTotal.Text;
        //capture Expenses
        string Expenses = txtExpenses.Text;
        //variable to store any error messages
        string Error = "";

        //validate the data
        Error = AReport.Valid(EmployeeName, Total, Expenses, DateAdded);
        if (Error == "")
        {
            //Capture the employee id
            AReport.EmployeeId = EmployeeId;

            //Capture EmployeeName
            AReport.EmployeeName = EmployeeName;
            //capture DateAdded
            AReport.DateAdded = Convert.ToDateTime(DateAdded);
            //capture Total
            AReport.Total = Convert.ToInt32(Total);
            //capture Expenses
            AReport.Expenses = Convert.ToInt32(Expenses);
            //capture Profit
            AReport.ProfitOrLoss = chkProfit.Checked;
            //capture Loss
            AReport.ProfitOrLoss = chkLoss.Checked;

            //create a new instance of the reports collection
            clsReportsCollection ReportList = new clsReportsCollection();

            //if this is a new record i.e. EmployeeId = -1 then add the data
            if (EmployeeId == -1)
            {
                //set the ThisReport property
                ReportList.ThisReport = AReport;

                //add the new record
                ReportList.Add();
            }
            else
            {
                //find the record to update
                ReportList.ThisReport.Find(EmployeeId);

                //set the ThisReport property
                ReportList.ThisReport = AReport;

                //update the record
                ReportList.Update();
            }


            //redirect back to the listpage
            Response.Redirect("5ReportsList.aspx");
        }

        else
        {
            //display the error message
            lblError.Text = Error;
        }
    }
コード例 #25
0
        private async void btnSaveToDB_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtTotal.Text))
                {
                    MetroFramework.MetroMessageBox.Show(this, "Transaction Details is Empty...Pls Perform a Transaction....", "Transaction Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    panel6.Visible = true;
                    foreach (ListViewItem i in metroListView1.Items)
                    {
                        if (i.SubItems[0].Text != null)
                        {
                            List <string> list = new List <string>();
                            clsReports    x    = new clsReports();
                            x.Product = Convert.ToString(i.SubItems[0].Text);
                            x.Price   = Convert.ToDouble(i.SubItems[2].Text);
                            x.Qty     = Convert.ToInt32(i.SubItems[3].Text);
                            clsReports.insert(x);
                            lblProgessing.Text = "Working....";
                            var ProgressReport = new Progress <clsProgressReport>();
                            ProgressReport.ProgressChanged += (o, report) => {
                                lblProgessing.Text      = string.Format("Processing.....{0}%", report.percentComplete);
                                metroProgressBar1.Value = report.percentComplete;
                                metroProgressBar1.Update();
                            };
                            await ProcessImport(list, ProgressReport);

                            lblProgessing.Text = "Done!!!!";
                        }
                        else
                        {
                            MetroFramework.MetroMessageBox.Show(this, "Transaction Details is Empty...Pls Perform a Transaction....", "Transaction Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    MetroFramework.MetroMessageBox.Show(this, "Hurray Transaction Saved Successfully", "Transaction Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    btnPrintReciept.Visible = true;
                    //loadReciept();
                }
                //panel6.Visible = true;
                //if (backgroundWorker1.IsBusy)
                //    return;
                //foreach(ListViewItem i in metroListView1.Items)
                //{
                //    clsReports x = new clsReports();
                //    x.Product = Convert.ToString(i.SubItems[0].Text);
                //    x.Price = Convert.ToDouble(i.SubItems[2].Text);
                //    x.Qty = Convert.ToInt32(i.SubItems[3].Text);
                //    metroProgressBar1.Minimum = 0;
                //    metroProgressBar1.Value = 0;
                //    backgroundWorker1.RunWorkerAsync(clsReports.insert(x));
                //    //clsReports.insert(x);
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #26
0
        public void InstanceOK()
        {
            clsReports AReport = new clsReports();

            Assert.IsNotNull(AReport);
        }