示例#1
0
 private void BtnPay_Click(object sender, EventArgs e)
 {
     try
     {
         int    change = int.Parse(TxtChange.Text);
         string date   = DateTime.Now.ToString("yyyyMMdd");
         string time   = DateTime.Now.ToString("HH:mm:ss");
         if (change <= 0)
         {
             if (MessageBox.Show("거스름돈은 " + change * -1 + "원 입니다. \r\n결제 하시겠습니까?", "결제 확인", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 //DB에 접속해서 매출 기록 남기기 (결제 금액 기반)
                 MySqlConnection connection = new MySqlConnection(SQLLOGIN);
                 connection.Open();
                 string       query   = "INSERT INTO `" + date + "` (times, sales) VALUES('" + time + "', " + TxtCost.Text + ");";
                 MySqlCommand command = new MySqlCommand(query, connection);
                 command.ExecuteNonQuery();
                 connection.Close();
                 //메인 화면의 테이블 정보 및 표기를 삭제
                 father.TableListViewInitialize();
                 father.TableInitialize(TableNumber - 1);
                 father.TableCostEdit(0, TableNumber - 1);
                 this.Close();
             }
             else
             {
                 return;
             }
         }
         else if (change > 0)
         {
             //강제 결제 여부 확인
             if (MessageBox.Show("충분한 금액이 지불되지 않았습니다.\r\n강제 결제 하시겠습니까?", "결제 경고", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
             {
                 MySqlConnection connection = new MySqlConnection(SQLLOGIN);
                 connection.Open();
                 string       query   = "INSERT INTO `" + date + "` (times, sales) VALUES('" + time + "', " + TxtPay.Text + ");";
                 MySqlCommand command = new MySqlCommand(query, connection);
                 command.ExecuteNonQuery();
                 connection.Close();
                 //메인 화면의 테이블 정보 및 표기를 삭제
                 father.TableListViewInitialize();
                 father.TableInitialize(TableNumber - 1);
                 father.TableCostEdit(0, TableNumber - 1);
                 this.Close();
             }
             else
             {
                 return;
             }
         }
     }
     catch
     {
         MessageBox.Show("결제 오류: 결제 요청 값이 없습니다");
     }
 }
示例#2
0
 private void BtnConfirm_Click(object sender, EventArgs e)
 {
     String[] send = new String[3];
     father.TableInitialize(tablenumber - 1);         //부모 데이터셋을 초기화
     foreach (ListViewItem item in MenuList.Items)    //리스트뷰 아이템을 string으로 패킹해서 메소드 통한 전송
     {
         send[0] = item.Text;
         send[1] = item.SubItems[1].Text;
         send[2] = item.SubItems[2].Text;
         father.MenuSelectAccess(tablenumber - 1, send);
     }
     father.TableListViewShow(tablenumber - 1);      //좌측 테이블에 리스트 보여주도록 요청
     this.Close();
 }