예제 #1
0
        void btnStart_Click(object sender, EventArgs e)
        {
            Resolutions rRes = Resolutions.Daily;

            switch (cResolution.SelectedIndex)
            {
            case 0:
                rRes = Resolutions.Daily;
                break;

            case 1:
                rRes = Resolutions.Weekly;
                break;

            case 2:
                rRes = Resolutions.Monthly;
                break;

            case 3:
                rRes = Resolutions.Yearly;
                break;
            }
            GraphEngine gEngine = new GraphEngine("Archive\\" + cResolution.Items[cResolution.SelectedIndex].ToString(), rRes);

            for (int i = 0; i < cItemType.Length; i++)
            {
                GraphItem.Type tType = GraphItem.Type.Barcode;
                switch (cItemType[i].SelectedIndex)
                {
                case 0:
                    tType = GraphItem.Type.Barcode;
                    break;

                case 1:
                    tType = GraphItem.Type.Category;
                    break;

                case 2:
                    tType = GraphItem.Type.Staff;
                    break;
                }
                GraphItem.Parameter gParam = GraphItem.Parameter.Gross;
                switch (cItemProperty[i].SelectedIndex)
                {
                case 0:
                    gParam = GraphItem.Parameter.Gross;
                    break;

                case 1:
                    gParam = GraphItem.Parameter.Net;
                    break;

                case 2:
                    gParam = GraphItem.Parameter.QuantitySold;
                    break;

                case 3:
                    gParam = GraphItem.Parameter.Profit;
                    break;
                }
                string sFieldDesc = "";

                if (tbItemParam[i].Text == "")
                {
                    MessageBox.Show("No item entered in box " + (i + 1).ToString());
                    return;
                }

                if (tType == GraphItem.Type.Barcode)
                {
                    sFieldDesc = sEngine.GetMainStockInfo(tbItemParam[i].Text)[1];
                }
                else if (tType == GraphItem.Type.Category)
                {
                    sFieldDesc = sEngine.GetCategoryDesc(tbItemParam[i].Text);
                }
                gEngine.AddGraphItem(tType, btnItemClr[i].BackColor, tbItemParam[i].Text, gParam, sFieldDesc);
            }
            gEngine.Start(GenerateListOfFolders());

            SaveFileDialog sFile = new SaveFileDialog();

            sFile.Filter = "Bitmap File|*.bmp";
            if (sFile.ShowDialog() == DialogResult.OK)
            {
                System.IO.File.Copy("graph.bmp", sFile.FileName, true);
            }

            this.Close();
        }
예제 #2
0
 public void AddGraphItem(GraphItem.Type tType, Color cGraphingColour, string sFieldParam, GraphItem.Parameter pParam, string sFieldDesc)
 {
     Array.Resize <GraphItem>(ref gItem, gItem.Length + 1);
     gItem[gItem.Length - 1] = new GraphItem(tType, ref iGraph, rResolution, cGraphingColour, pParam, sFieldParam, sFieldDesc);
 }