Example #1
0
        private void LoadMembers()
        {
            ContactReward clsContactReward = new ContactReward();
            DataTable dtActiveStatisticsReport = clsContactReward.ActiveStatisticsReport(DateTime.Now.AddMonths(-1), DateTime.Now);
            clsContactReward.CommitAndDispose();

            if (dtActiveStatisticsReport.Rows.Count == 0)
            {
                Chart1.Visible = false;
            }
            else
            {
                Chart1.Visible = true; 
                Chart1.DataSource = dtActiveStatisticsReport.DefaultView;

                Chart1.Series["Series1"].XValueMember = "RewardAwardDate";
                Chart1.Series["Series1"].YValueMembers = "TotalNoOfActiveRewards";

                Chart1.Series["Series2"].XValueMember = "RewardAwardDate";
                Chart1.Series["Series2"].YValueMembers = "NoOfActiveRewards";

                Chart1.Series["Series3"].XValueMember = "RewardAwardDate";
                Chart1.Series["Series3"].YValueMembers = "TotalNoOfInActiveRewards";

                Chart1.Series["Series4"].XValueMember = "RewardAwardDate";
                Chart1.Series["Series4"].YValueMembers = "NoOfInActiveRewards";

                Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.LineWidth = 0;
                Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.LineWidth = 0;
                
                Chart1.Series["Series1"].LegendText = "Total No. Of ActiveRewards";
                Chart1.Series["Series2"].LegendText = "No. Of New ActiveRewards";
                Chart1.Series["Series3"].LegendText = "Total No. Of InActiveRewards";
                Chart1.Series["Series4"].LegendText = "No. Of InActiveRewards";

                Chart1.DataBind();
            }
        }
Example #2
0
		private void SetDataSource(ReportDocument Report)
		{
			ReportDataset rptds = new ReportDataset();
            System.Data.DataTable dt;

            DateTime StartTransactionDate = DateTime.MinValue;
            try
            { StartTransactionDate = Convert.ToDateTime(txtStartTransactionDate.Text); }
            catch { }
            DateTime EndTransactionDate = DateTime.MinValue;
            try
            { EndTransactionDate = Convert.ToDateTime(txtEndTransactionDate.Text); }
            catch { }

            ContactReward clsContactReward;
            switch (cboReportType.SelectedValue)
            {
                case ReportTypes.RewardsHistory:
                    #region RewardsHistory
                    clsContactReward = new ContactReward();
                    dt = clsContactReward.RewardsMovement(StartTransactionDate, EndTransactionDate, long.Parse(cboContactName.SelectedItem.Value));
                    clsContactReward.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.RewardsMovement.NewRow();

                        foreach (DataColumn dc in rptds.RewardsMovement.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.RewardsMovement.Rows.Add(drNew);
                    }

                    break;
                    #endregion

                case ReportTypes.RewardsSummary:
                    #region RewardsSummary
                    clsContactReward = new ContactReward();
                    dt = clsContactReward.RewardsSummary(StartTransactionDate, EndTransactionDate, long.Parse(cboContactName.SelectedItem.Value));
                    clsContactReward.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Rewards.NewRow();

                        foreach (DataColumn dc in rptds.Rewards.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Rewards.Rows.Add(drNew);
                    }

                    break;
                    #endregion

                case ReportTypes.RewardsSummaryStatistics:
                    #region RewardsSummaryStatistics
                    clsContactReward = new ContactReward();
                    dt = clsContactReward.SummarizedStatistics();
                    clsContactReward.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.RewardsSummary.NewRow();

                        foreach (DataColumn dc in rptds.RewardsSummary.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.RewardsSummary.Rows.Add(drNew);
                    }

                    break;
                    #endregion
                
            }
			Report.SetDataSource(rptds); 
			SetParameters(Report);
		}