Пример #1
0
        }                                                        //cell 더블클릭 이벤트 추가예정

        private void button2_Click_1(object sender, EventArgs e) //예약(O)
        {
            MySqlConnection myConnection = new MySqlConnection(connectionString);

            myConnection.Open();

            int ID = 0;

            try
            {
                PlanInfoDAC dac = new PlanInfoDAC(myConnection);

                DataTable dt = new DataTable();
                dt = dac.SelectMaxId().Tables[0];

                if (dt.Rows[0][0].ToString() == "")
                {
                    ID = 1;
                }
                else
                {
                    ID = Convert.ToInt16(dt.Rows[0][0].ToString()) + 1;
                }

                PlanInfo item = new PlanInfo();
                item.입력날짜 = DateTime.Now;
                item.라인   = SelectProductionLine.Text;
                item.목표수  = Convert.ToInt16(Line_num.Text);
                item.상황   = "예약";
                item.제품명  = Line_Product.Text;
                item.ID   = ID;
                dac.Insert(item);
                LinePlanGrid.DataSource          = dac.SelectSituation("예약").Tables[0];
                LinePlanGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

                MessageBox.Show("입력이 완료되었습니다.");

                myConnection.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("제품명 , 제품 수량 , 생산 라인을 입력해주세요.");
            }
            finally
            {
                if (myConnection != null && myConnection.State == System.Data.ConnectionState.Open)
                {
                    myConnection.Close();
                }
            }
            Line_num.Clear();
        }
Пример #2
0
        private void Page_planTab_SelectedIndexChanged_1(object sender, EventArgs e)    // O
        {
            MySqlConnection myConnection = new MySqlConnection(connectionString);

            myConnection.Open();
            if (Page_planTab.SelectedIndex == 0)
            {
                PlanInfoDAC dac = new PlanInfoDAC(myConnection);
                LinePlanGrid.DataSource          = dac.SelectSituation("예약").Tables[0];
                LinePlanGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            }
            if (Page_planTab.SelectedIndex == 1)
            {
                RESET_Click(sender, e);
            }
        }
Пример #3
0
        private void Delete_Plan_Click_1(object sender, EventArgs e)    //예약 취소
        {
            MySqlConnection myConnection = null;

            try
            {
                myConnection = new MySqlConnection(connectionString);
                myConnection.Open();

                PlanInfoDAC dac = new PlanInfoDAC(myConnection);

                string ID = LinePlanGrid[5, LinePlanGrid.SelectedRows[0].Index].Value.ToString();

                PlanInfo item = new PlanInfo();
                item.제품명 = Line_Product.Text;

                item.ID = Convert.ToInt32(ID);

                dac.DeleteDB(item);

                LinePlanGrid.DataSource          = dac.SelectSituation("예약").Tables[0];
                LinePlanGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

                myConnection.Close();
            }
            catch (MySqlException)
            {
                MessageBox.Show("셀을 선택해주세요.");
            }
            finally
            {
                if (myConnection != null && myConnection.State == System.Data.ConnectionState.Open)
                {
                    myConnection.Close();
                }
            }
        }
Пример #4
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            MySqlConnection myConnection = new MySqlConnection(connectionString);

            myConnection.Open();

            PlanInfoDAC dac = new PlanInfoDAC(myConnection);

            DataTable dt = dac.SelectSituation("중지").Tables[0]; // 1개만 서치

            if (dt.Rows.Count != 0)
            {
                timer1.Enabled = false;
                if (MessageBox.Show("재가동 하시겠습니까 ?", dt.Rows[0][3].ToString() + dt.Rows[0][4].ToString(), MessageBoxButtons.OK) == DialogResult.OK)
                {
                    PlanInfo item = new PlanInfo();
                    item.ID = Convert.ToInt32(dt.Rows[0][5].ToString());

                    dac.UpdateID(item);
                    myConnection.Close();
                    timer1.Enabled = true;
                }
            }
        }