コード例 #1
0
        //
        // Days Report
        private void navBarItem1_LinkClicked_1(object sender, NavBarLinkEventArgs e)
        {
            frmPickDateTime frm = new frmPickDateTime();

            frm.myState = EnumPickDateTime.PickDays;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                waitForm.ShowWaitForm();
                clearText();
                ChartTitle title = new ChartTitle();
                title.Text = "Days Report From : " + frm.startDate.ToShortDateString() + " To " + frm.endDate.ToShortDateString();
                chartControl.Titles.Add(title);
                System.Threading.Thread.Sleep(1000);

                table = MyConnect.getTable("execute DaysReport @start ='" + frm.startDate.ToString("yyyy-MM-dd") + "',@end = '" + frm.endDate.ToString("yyyy-MM-dd") + "'");

                Series s1 = new Series("Total", ViewType.Line);
                s1.View.Color = Color.Orange;
                chartControl.Series.Add(s1);
                int i = 0, j = 0;
                foreach (DateTime date in MyAction.GetAllDates(frm.startDate, frm.endDate))
                {
                    if (j < table.Rows.Count)
                    {
                        DateTime temp = DateTime.Parse(table.Rows[j][0].ToString());
                        if (temp.Equals(date))
                        {
                            s1.Points.Add(new SeriesPoint(temp.ToString("dd-MM-yyyy"), long.Parse(table.Rows[j][1].ToString())));
                            j++;
                        }
                        else
                        {
                            s1.Points.Add(new SeriesPoint(date.ToString("dd-MM-yyyy"), 0));
                        }
                    }
                    else
                    {
                        s1.Points.Add(new SeriesPoint(date.ToString("dd-MM-yyyy"), 0));
                    }
                    i++;
                }
                chartControl.Series.Add(s1);
                //MessageBox.Show(table.Rows[0][1].ToString());
                waitForm.CloseWaitForm();
                this.State = EnumReportState.RevenueOfDays;
            }
        }