protected void gvTRNChkList_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); string cmdName = e.CommandName; if (cmdName.Equals("cmdDelete")) { // Perform Delete Operation TRNCheckList chkList = new TRNCheckList(); chkList.ChkListID = id; chkList.ModifiedBy = 1; chkList.Status = 0; int result = new TRNCheckListBO().DeleteCheckList(chkList); LoadCheckList(); } if (cmdName.Equals("cmdEdit")) { // Show data to TextBoses and controls DataView dvRecord = new TRNCheckListBO().GetCheckListByID(id); if (dvRecord.Count > 0) { lblID.Text = dvRecord.Table.Rows[0]["ID"].ToString(); txtCheckList.Text = dvRecord.Table.Rows[0]["Checklist"].ToString(); collapse = 0; btnSave.Text = "Update"; } } }
public int InsertCheckList(TRNCheckList objList) { objList.ChkListID = 1; BeginTransaction(); try { objList.ChkListID = Insert(objList); CommitTransaction(); } catch (Exception ex) { RollBackTransaction(); objList.ChkListID = -1; } return objList.ChkListID; }
public int UpdateCheckList(TRNCheckList objList) { int rowsaffected = -1; BeginTransaction(); try { String[] UpdateProperties = new String[] { "CheckList", "ModifiedBy", "ModifiedDate", "Status" }; rowsaffected = Update(objList, UpdateProperties); CommitTransaction(); } catch (Exception e) { RollBackTransaction(); rowsaffected = -1; } return rowsaffected; }
protected void btnSave_Click(object sender, EventArgs e) { if (lblID.Text != string.Empty) { TRNCheckList chkList = new TRNCheckList(); chkList.ChkListID = Convert.ToInt32(lblID.Text); chkList.CheckList = txtCheckList.Text; chkList.ModifiedBy = 1; chkList.Status = 1; int result = new TRNCheckListBO().UpdateCheckList(chkList); if (result > 0) { Clear(); LoadCheckList(); collapse = 1; btnSave.Text = "Save"; } } else { TRNCheckList chkListInsert = new TRNCheckList(); chkListInsert.CheckList = txtCheckList.Text; chkListInsert.CreatedBy = 1; chkListInsert.Status = 1; int result = new TRNCheckListBO().InsertCheckList(chkListInsert); if (result > 0) { Clear(); collapse = 1; LoadCheckList(); } } }
public int DeleteCheckList(TRNCheckList objCheckList) { objCheckList.ModifiedDate = DateTime.Now; return new TRNCheckListDAO().DeleteCheckList(objCheckList); }
public int InsertCheckList(TRNCheckList objCheckList) { objCheckList.CreatedDate = DateTime.Now; return new TRNCheckListDAO().InsertCheckList(objCheckList); }