Пример #1
0
        /*************************************************************************************
        *	module: frmAnonCust.cs - TLoadData
        *
        *	author: Tim Ragain
        *	date: Jan 22, 2002
        *
        *	Purpose: Takes two variables the x represents the day as an integer and the sCount is a
        *	short representing the column of the Calendar control.  This initializes the OCAData.dll
        *	control and calls the GetDailyCount and GetDailyAnon procedures.  The anonymous count is
        *	subtracted from the total count to get the customer count.  The appropriate column
        *	and row is updated.
        *************************************************************************************/
        private void TLoadData(int x, short sCount)
        {
            OCAData.CCountDailyClass rpt   = new OCAData.CCountDailyClass();
            System.DateTime          dDate = new System.DateTime(monthCalendar1.SelectionStart.Year, monthCalendar1.SelectionStart.Month,
                                                                 monthCalendar1.SelectionStart.Day);

            long lngCount = 0, l_AnonUploads = 0;

            UpdateStatus();
            //***********Total Record Count***************
            statusBar1.Text = "Getting Daily Count for " + dDate.AddDays(x).Date.ToString();
            lngCount        = rpt.GetDailyCount(dDate.AddDays(x));
            lDate[x]        = dDate.AddDays(x);
            //***********Total Anon Count***************
            UpdateStatus();
            statusBar1.Text = "Getting Anon Users for " + dDate.AddDays(x).Date.ToString();
            l_AnonUploads   = rpt.GetDailyAnon(dDate.AddDays(x));
            lock (this)
            {
                axMSChart1.Row      = sCount;
                axMSChart1.Column   = 1;
                axMSChart1.RowLabel = dDate.AddDays(x).Date.ToShortDateString();                 //+ dDate.Date.ToString();
                axMSChart1.Data     = l_AnonUploads.ToString();
            }

            UpdateStatus();
            //***********Calculate Customer Count***************
            statusBar1.Text = "Calculating Customer Count for " + dDate.AddDays(x).Date.ToString();
            if (l_AnonUploads > lngCount)
            {
                lngCount = l_AnonUploads - lngCount;
            }
            else
            {
                lngCount = lngCount - l_AnonUploads;
            }
            lock (this)
            {
                axMSChart1.Row    = sCount;
                axMSChart1.Column = 2;
                lAnonymous[x]     = l_AnonUploads;
                lCustomer[x]      = lngCount;
                axMSChart1.Data   = lngCount.ToString();
            }
            //**********************************
            UpdateStatus();
            this.Refresh();
        }
        /*************************************************************************************
        *	module: anoncustomer.aspx.cs - Page_Load
        *
        *	author: Tim Ragain
        *	date: Jan 22, 2002
        *
        *	Purpose: to Create both gif charts from the Office Watson Controls and set the images to those
        *	files.  Create OCAData object and return data for anonymous versus customer uploads.  Set the information
        *	in the tables to correspond to the graphs.
        *************************************************************************************/
        private void Page_Load(object sender, System.EventArgs e)
        {
            int    x       = -1;
            int    rowCnt  = 7;
            int    rowCtr  = 0;
            int    cellCtr = 0;
            int    cellCnt = 3;
            string sFName;

            long[] LACustomer = new long[7];
            long[] LAAnon = new long[7];
            long   lTemp = 0, lTotalAnon = 0, lTotalCustomer = 0;

            Object[] yCustomerCol        = new Object[7];
            Object[] xAonCol             = new Object[7];
            Object[] yCustomerValues     = new Object[2];
            Object[] xAnonValues         = new Object[2];
            OCAData.CCountDailyClass rpt = new OCAData.CCountDailyClass();

            System.DateTime dDate = new System.DateTime(System.DateTime.Now.Year, System.DateTime.Now.Month,
                                                        System.DateTime.Now.Day);
            OWC.WCChart                oWeeklyChart, oRatioChart;
            OWC.ChartSpaceClass        oSpace  = new OWC.ChartSpaceClass();
            OWC.ChartSpaceClass        oSpace1 = new OWC.ChartSpaceClass();
            OWC.WCSeries               oSeries1;
            OWC.WCDataLabels           oLabels;
            OWC.WCDataLabelsCollection oLabelCollection;


            oSpace.Clear();
            oSpace.Refresh();
            oWeeklyChart           = oSpace.Charts.Add(0);
            oWeeklyChart.HasLegend = true;
            //Begin Image One
            for (x = 0; x < 2; x++)
            {
                oWeeklyChart.SeriesCollection.Add(x);
            }
            for (x = 0; x < 7; x++)
            {
                LACustomer[x] = rpt.GetDailyCount(dDate.AddDays(-(x + 1)));
                try
                {
                    LAAnon[x] = rpt.GetDailyAnon(dDate.AddDays(-(x + 1)));
                }
                catch
                {
                    LAAnon[x] = 0;
                }
                if (LACustomer[x] > LAAnon[x])
                {
//					xAonCol.SetValue((LACustomer[x] - LAAnon[x]), 0);
                    lTotalCustomer = lTotalCustomer + (LACustomer[x] - LAAnon[x]);
                }
                else
                {
//					xAonCol.SetValue((LAAnon[x] - LACustomer[x]), 0);
                    lTotalCustomer = lTotalCustomer + (LAAnon[x] - LACustomer[x]);
                }
                lTotalAnon = lTotalAnon + LAAnon[x];
            }
//*******************************************************************************************************
            oWeeklyChart.HasTitle      = true;
            oWeeklyChart.Title.Caption = "Database - Anonymouse vs Customer";
            for (x = 0; x < 6; x++)
            {
                xAonCol[x] = LAAnon[x].ToString();
            }
            oWeeklyChart.SeriesCollection[0].Caption = "Anonymous";
            oWeeklyChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimValues, -1, xAonCol);
            for (x = 0; x < 6; x++)
            {
                if (LACustomer[x] > LAAnon[x])
                {
                    lTemp      = LACustomer[x] - LAAnon[x];
                    xAonCol[x] = lTemp.ToString();
                }
                else
                {
                    lTemp      = LAAnon[x] - LACustomer[x];
                    xAonCol[x] = lTemp.ToString();
                }
            }
            oWeeklyChart.SeriesCollection[1].Caption = "Customer";
            oWeeklyChart.SeriesCollection[1].SetData(OWC.ChartDimensionsEnum.chDimValues, -1, xAonCol);
            for (x = 0; x < 6; x++)
            {
                xAonCol.SetValue(dDate.AddDays(x).ToShortDateString(), x);
            }
            oWeeklyChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimCategories, -1, xAonCol);
//*******************************************************************************************************
            sFName = "Anon";
            try
            {
                oSpace.ExportPicture(Server.MapPath(sFName), "gif", 707, 476);
                imgAnonDaily1.ImageUrl = sFName;
            }
            catch
            {
            }

            //End Image one


            //Begin Image Two
            oSpace1.Clear();
            oSpace1.Refresh();
            oRatioChart           = oSpace1.Charts.Add(0);
            oRatioChart.Type      = OWC.ChartChartTypeEnum.chChartTypeBarClustered;
            oRatioChart.HasLegend = true;

            lTemp            = lTotalCustomer + lTotalAnon;
            oSeries1         = oRatioChart.SeriesCollection.Add(0);
            oLabelCollection = oSeries1.DataLabelsCollection;

            oLabels = oLabelCollection.Add();
            oLabels.HasPercentage = true;
            oLabels.HasValue      = false;


            xAnonValues.SetValue(lTotalAnon.ToString(), 0);
            xAnonValues.SetValue(lTotalCustomer.ToString(), 1);
            yCustomerValues.SetValue("Anonymous", 0);
            yCustomerValues.SetValue("Customer", 1);
            oRatioChart.HasTitle      = true;
            oRatioChart.Title.Caption = "Database - Average Weekly Uploads";
            oSeries1.Caption          = "Average Weekly";       //chDimCategories
            oSeries1.SetData(OWC.ChartDimensionsEnum.chDimCategories, -1, yCustomerValues);
            oSeries1.SetData(OWC.ChartDimensionsEnum.chDimValues, -1, xAnonValues);
            oSeries1.Type = OWC.ChartChartTypeEnum.chChartTypePie;

            sFName = "AnonPer";
            try
            {
                oSpace1.ExportPicture(Server.MapPath(sFName), "gif", 707, 476);
                imgAnonTotal.ImageUrl = sFName;
            }
            catch
            {
            }

            //End Image Two

            //Begin Table
            for (rowCtr = 0; rowCtr <= rowCnt; rowCtr++)
            {
                TableRow tRow = new TableRow();
                tblAnonCustomer.Rows.Add(tRow);
                //tRow.CssClass = "clsTRMenu";
                for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
                {
                    TableCell tCell = new TableCell();

                    if (rowCtr == 0)
                    {
                        switch (cellCtr)
                        {
                        case 1:
                            tCell.Text = "Date";
                            break;

                        case 2:
                            tCell.Text = "Anonymous";
                            break;

                        case 3:
                            tCell.Text = "Customer";
                            break;

                        default:
                            tCell.Text = "0";
                            break;
                        }
                        tCell.Style["font-size"] = "small";
                    }
                    else
                    {
                        switch (cellCtr)
                        {
                        case 1:
                            tCell.Text = dDate.AddDays(-rowCtr).ToShortDateString();
                            break;

                        case 2:
                            tCell.Text = LAAnon[rowCtr - 1].ToString();
                            break;

                        case 3:
                            if (LAAnon[rowCtr - 1] > LACustomer[rowCtr - 1])
                            {
                                lTemp = LAAnon[rowCtr - 1] - LACustomer[rowCtr - 1];
                            }
                            else
                            {
                                lTemp = LACustomer[rowCtr - 1] - LAAnon[rowCtr - 1];
                            }
                            tCell.Text = lTemp.ToString();
                            break;

                        default:
                            tCell.Text = "0";
                            break;
                        }
                        tCell.Style["background-color"] = "white";
                        tCell.Style["font-size"]        = "small-x";
                        tCell.Style["color"]            = "#6487dc";
                        tCell.Style["font-weight"]      = "Bold";
                    }
                    tCell.Style["font-family"] = "Tahoma";
                    tRow.Cells.Add(tCell);
                }
            }

            //End Table
        }