예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int count1 = dataGridView1.Rows.Count;
            int count2 = dataGridView2.Rows.Count;
            int count3 = dataGridView3.Rows.Count;

            if (count1 == count2 && count2 == count3)
            {
                for (int i = 0; i < count1; i++)
                {
                    if ((Convert.ToString(dataGridView1.Rows[i].Cells[0].Value) == (Convert.ToString(dataGridView2.Rows[i].Cells[0].Value))) && ((Convert.ToString(dataGridView2.Rows[i].Cells[0].Value)) == (Convert.ToString(dataGridView3.Rows[i].Cells[0].Value))))
                    {
                        if ((Convert.ToString(dataGridView1.Rows[i].Cells[2].Value) == (Convert.ToString(dataGridView2.Rows[i].Cells[2].Value))) && ((Convert.ToString(dataGridView2.Rows[i].Cells[2].Value)) == (Convert.ToString(dataGridView3.Rows[i].Cells[2].Value))))
                        {
                            con.Open();
                            string     query = "UPDATE TBL_INVOICE SET Istatus = 1 WHERE invoiceID= " + invoicelink.Text.Trim() + ";";
                            SqlCommand cmd   = new SqlCommand(query, con);
                            cmd.ExecuteNonQuery();
                            query = "UPDATE TBL_PURCHASE_ORDER SET POstatus = 1 WHERE POID= " + poidlink.Text.Trim() + ";";
                            cmd   = new SqlCommand(query, con);
                            cmd.ExecuteNonQuery();
                            con.Close();

                            radioButton2.Checked   = true;
                            radioButton2.Enabled   = true;
                            radioButton2.ForeColor = Color.Green;
                            radioButton1.Enabled   = false;
                        }
                        else
                        {
                            MessageBox.Show("The invoice was NOT approved. ");
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show("The invoice was NOT approved. ");
                        break;
                    }
                }
            }
            else
            {
                MessageBox.Show("The invoice was NOT approved.");
            }

            if (radioButton2.Checked)
            {
                if (mp == null)
                {
                    mp             = new MakePayment();
                    mp.MdiParent   = this.MdiParent;
                    mp.FormClosed += new FormClosedEventHandler(mp_FormClosed);
                    mp.Show();
                    //this.Close();
                }
                else
                {
                    mp.Activate();
                    mp.FormClosed += new FormClosedEventHandler(mp_FormClosed);
                    mp.Show();
                }
            }
        }
예제 #2
0
 void mp_FormClosed(object sender, FormClosedEventArgs e)
 {
     mp = null;
 }