public bool InsertArrear(ArrearVO ar) { try { DataTable dt = new DataTable(); dt.Columns.Add(); dt.Columns.Add(); dt.Columns.Add(); dt.Columns.Add(); dt.Columns.Add(); dt.Rows.Add(new Object[] { ar.OwnerID, ar.PeriodYear, ar.PeriodMonth, ar.Amount }); return(pd.InsertArrear(dt)); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(false); } }
public void Insert() { if (Period.Value.Year > DateTime.Now.Year || (Period.Value.Month > DateTime.Now.Month && Period.Value.Year == DateTime.Now.Year)) { MessageBox.Show("Do not Enter Future Periods"); return; } if (String.IsNullOrEmpty(Value.Text) || (Convert.ToInt32(Value.Text)) == 0) { MessageBox.Show("Enter Arrear Value"); return; } ArrearVO ar = new ArrearVO(ID.SelectedValue.ToString(), Convert.ToInt32(Period.Value.Year.ToString()), Convert.ToInt32(Period.Value.Month.ToString()), Convert.ToDouble(Value.Text)); if (pb.InsertArrear(ar)) { MessageBox.Show("Insert Successful"); dataGridView1.Refresh(); } else { MessageBox.Show("Update Failed"); } }