private void button3_Click(object sender, EventArgs e) { if (Pay.Exists(startLbl.Text, endLbl.Text, UserID)) { MessageBox.Show("A pay slip has already been saved !", "Exists", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(paidCbx.Text)) { MessageBox.Show("Has the payment been made !", "Paid", MessageBoxButtons.OK, MessageBoxIcon.Question); paidCbx.BackColor = Color.Red; return; } if (MessageBox.Show("YES or No?", "Confirm submission ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Pay i = new Pay(Guid.NewGuid().ToString(), Convert.ToDateTime(DateTime.Now.Date).ToString("yyyy-MM-dd"), noLbl.Text, UserID, methodCbx.Text, startLbl.Text, endLbl.Text, Convert.ToInt32(weekLbl.Text), Convert.ToDouble(rateLbl.Text), Convert.ToDouble(hourTxt.Text), Convert.ToDouble(totalPayTxt.Text), Convert.ToDouble(overtimeTxt.Text), Convert.ToDouble(rateHalfTxt.Text), Convert.ToDouble(overPayTxt.Text), Convert.ToDouble(totalDeductionTxt.Text), Convert.ToDouble(totalPayTxt.Text), paidCbx.Text, DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID); MySQL.Insert(i); string Query = ""; if (paidCbx.Text == "Yes") { Query = "Update schedule SET status = 'Paid' WHERE (`date` >= '" + fromDate + "' AND `date` <= '" + toDate + "') AND UserID ='" + UserID + "'"; } else { Query = "Update schedule SET status = 'Pending' WHERE (`date` >= '" + fromDate + "' AND `date` <= '" + toDate + "') AND UserID ='" + UserID + "'"; } MySQL.Query(Query); MessageBox.Show("Information Saved"); Helper.Log(Helper.UserName, "Created pay Slip " + userCbx.Text + " " + DateTime.Now); this.Close(); } }