Exemple #1
0
 private void dgv_paid_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == dgv_paid.Columns[6].Index)
     {
         string       id     = dgv_paid.Rows[e.RowIndex].Cells[0].Value.ToString();
         Detail_Order dorder = new Detail_Order(id, "paid");
         dorder.Show();
     }
 }
Exemple #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            conn.Open();

            idbaru = getlastid();
            int total = 0;

            for (int i = 0; i < dataGridView2.RowCount; i++)
            {
                string idhorder = dataGridView2.Rows[i].Cells[0].Value.ToString();
                string query    = "UPDATE dorder set id_horder = " + idbaru + " WHERE id_horder = " + idhorder + "";

                total += int.Parse(dataGridView2.Rows[i].Cells[2].Value.ToString());

                SqlCommand comm = new SqlCommand(query, conn);
                comm.ExecuteNonQuery();


                SqlCommand insertjoin = new SqlCommand("Insert into joinBill(id_join,id_horder) values(" + idbaru + "," + idhorder + ")", conn);
                insertjoin.ExecuteNonQuery();


                SqlCommand updateHorder = new SqlCommand("UPDATE horder set status = 4  WHERE id_horder = " + idhorder + "", conn);
                updateHorder.ExecuteNonQuery();
            }

            SqlCommand insertHeaderOrder = new SqlCommand("Insert into horder(jumlah_harga,tanggal,status,catatan) values(" + total + ",PARSE('" + DateTime.Now.ToShortDateString() + "' as date USING 'AR-LB'),2,'')", conn);

            insertHeaderOrder.ExecuteNonQuery();



            conn.Close();

            MessageBox.Show("Berhasil join");

            Detail_Order d = new Detail_Order(idbaru, "finish");

            this.Hide();
            d.Show();
            this.Close();
        }