public static void addIou(OfficeIou i) { //try //{ int iou = i.IouNo; int staffId = i.ToStaff.StaffId; String comment = i.Comment; double am = i.Amount; DBConnection.updateDB("Insert into iou_office(staff_id,date,Comment,Amount)values(" + staffId + " , '" + DateTime.Now.ToString("yyyy/MM/d") + "', '" + comment + "' , " + am + ");"); MessageBox.Show("Successfully added"); }
private void metroButton3_Click(object sender, EventArgs e) { OfficeIou i = new OfficeIou(); //i.IouNo = int.Parse(iou.Text.ToString()); i.ToStaff = new Staff(Int32.Parse(staffNameBox.SelectedValue.ToString())); if (Validation.isNumber(amt.Text)) { i.Amount = int.Parse(amt.Text.ToString()); i.Comment = comment.Text.ToString(); Database.addIou(i); } else { MessageBox.Show("Invalid Number"); } }