private void gunaButton1_Click(object sender, EventArgs e) { DataTable dt = Account.GetData("select * from tblaccounts where username = '******' "); string dept = dt.Rows[0].Field <string>("department"); form_add_borrow form_add_borrow = new form_add_borrow(username, dept, "add", "", "", "", "", "", "", ""); form_add_borrow.Show(); }
private void gunaButton2_Click(object sender, EventArgs e) { if (selected_user == null) { MessageBox.Show("please select an Activity"); } else { //form_borrow form_borrow = new form_borrow(selected_user, "", username, "", "", "", "", "edit"); //form_borrow.Show(); //bform_id, bform_date, bform_user, bform_dept, bfrorm_actv_name, bform_avtv_date, bform_actv_purpose; DataTable s = Account.GetData("select returned_by, released_by FROM tblactivity WHERE id = '" + selected_user + "'"); string s1 = s.Rows[0].Field <string>("returned_by"); string s2 = s.Rows[0].Field <string>("released_by"); if (string.IsNullOrWhiteSpace(s1.ToString()) && string.IsNullOrWhiteSpace(s2.ToString())) { DataTable dt = Account.GetData("select * from tblactivity where id = '" + selected_user + "' "); string bform_id = dt.Rows[0].Field <string>("id"); string bform_date = dt.Rows[0].Field <string>("date"); string bform_user = dt.Rows[0].Field <string>("requestor"); string bform_dept = dt.Rows[0].Field <string>("dept"); string bfrorm_actv_name = dt.Rows[0].Field <string>("activity_name"); string bform_avtv_date = dt.Rows[0].Field <string>("activity_date"); string bform_actv_purpose = dt.Rows[0].Field <string>("activity_purpose"); form_add_borrow form_add_borrow = new form_add_borrow(username, "", "edit", bform_id, bform_date, bform_user, bform_dept, bfrorm_actv_name, bform_avtv_date, bform_actv_purpose); form_add_borrow.Show(); } else { MessageBox.Show("This activity is not able to edit because it has been released or returned"); } } }