Ejemplo n.º 1
0
        private void Combo_SelectedIndexChanged(object sender, EventArgs e) // 콤보박스 이벤트
        {
            ComboBox combo = (ComboBox)sender;

            WebComm api   = new WebComm();
            string  index = (string)combo.SelectedItem;

            if (index == "1분기")
            {
                if (tb.Text != "")
                {
                    //api.Post2("http://192.168.3.15:5000/insert_CM"); // 결제버튼 클릭 시 매출관리 테이블에 추가
                    start = tb.Text + "-1-1";
                    end   = tb.Text + "-3-31";
                }
            }
            else if (index == "2분기")
            {
                if (tb.Text != "")
                {
                    start = tb.Text + "-4-1";
                    end   = tb.Text + "-6-30";
                }
            }
            else if (index == "3분기")
            {
                if (tb.Text != "")
                {
                    start = tb.Text + "-7-1";
                    end   = tb.Text + "-9-30";
                }
            }
            else if (index == "4분기")
            {
                if (tb.Text != "")
                {
                    start = tb.Text + "-10-1";
                    end   = tb.Text + "-12-31";
                }
            }


            Hashtable pcd = new Hashtable();

            pcd.Add("spName", "sel_Rank");
            pcd.Add("start", start);
            pcd.Add("end", end);
            list = api.Select("http://192.168.3.15:5000/sel_date", pcd);

            if (list.Count == 0)
            {
                MessageBox.Show("데이터값이 없습니다.");
            }


            else
            {
                panel_clear();
                get_chart();
                array = api.Cut(list);
                for (int i = 0; i < 6; i++)
                {
                    switch (i)
                    {
                    case 0:
                        chart1.Series["Series1"].Points.Clear();
                        chart1.Titles.Add("파스타");

                        for (int j = 0; j < list.Count; j++)
                        {
                            if (array[j * 3].ToString() == "1")
                            {
                                chart1.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString());
                            }
                        }
                        break;

                    case 1:
                        chart2.Series["Series1"].Points.Clear();
                        chart2.Titles.Add("스테이크");
                        for (int j = 0; j < list.Count; j++)
                        {
                            if (array[j * 3].ToString() == "2")
                            {
                                chart2.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString());
                            }
                        }
                        break;

                    case 2:
                        chart3.Series["Series1"].Points.Clear();
                        chart3.Titles.Add("샐러드");
                        for (int j = 0; j < list.Count; j++)
                        {
                            if (array[j * 3].ToString() == "3")
                            {
                                chart3.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString());
                            }
                        }
                        break;

                    case 3:
                        chart4.Series["Series1"].Points.Clear();
                        chart4.Titles.Add("디저트");
                        for (int j = 0; j < list.Count; j++)
                        {
                            if (array[j * 3].ToString() == "4")
                            {
                                chart4.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString());
                            }
                        }
                        break;

                    case 4:
                        chart5.Series["Series1"].Points.Clear();
                        chart5.Titles.Add("음료");
                        for (int j = 0; j < list.Count; j++)
                        {
                            if (array[j * 3].ToString() == "5")
                            {
                                chart5.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString());
                            }
                        }
                        break;

                    case 5:
                        chart6.Series["Series1"].Points.Clear();
                        chart6.Titles.Add("사이드");
                        for (int j = 0; j < list.Count; j++)
                        {
                            if (array[j * 3].ToString() == "6")
                            {
                                chart6.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString());
                            }
                        }
                        break;
                    }
                }
            }
        }