private void button1_Click(object sender, EventArgs e) { if (action == "add") { try { Account.executeSQL("INSERT INTO tblactivity VALUES ('" + activity_id + "' , '" + date + "' , '" + username + "' , '" + dept + "' , '" + actv_name + "' , '" + actv_date + "' , '" + actv_purpose + "' , ' ' , ' ' , ' ' , '')"); if (Account.rowAffected > 0) { MessageBox.Show("Activity Saved", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); Account.executeSQL("INSERT INTO tbllogs VALUES ('" + DateTime.Now.ToString() + "' , 'Added an Activity with an id of : " + activity_id + "' , 'Borrowing Management' , '" + username + "')"); this.Hide(); //refresh datagrid form_activity add = (form_activity)Application.OpenForms["form_activity"]; add.Validate(); add.Refresh(); add.refresh(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void borrow_Click(object sender, EventArgs e) { this.IsMdiContainer = true; form_activity form_activity = new form_activity(username); form_activity.MdiParent = this; form_activity.Show(); }
private void button5_Click(object sender, EventArgs e) { MessageBox.Show("activity Updated", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); Account.executeSQL("INSERT INTO tbllogs VALUES ('" + DateTime.Now.ToString() + "' , 'updated an activity with an id of " + selected_user + "' , 'Borrowing Management' , '" + username + "')"); //refresh datagrid form_activity add = (form_activity)Application.OpenForms["form_activity"]; add.Validate(); add.Refresh(); add.refresh(); this.Close(); }