private void LoadRecords() { dgDetails.Rows.Clear(); eVariable.DisableGridColumnSort(dgDetails); if (oFindOption == FIND_OPTION.AUTHOR) { AuthorStructure(); oAuthor = new DataAccess.Author(); foreach (DataRow row in oAuthor.GetAuthor(cboSearch.Text, txtSearch.Text).Rows) { dgDetails.Rows.Add(row[0].ToString(), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString()); } } else if (oFindOption == FIND_OPTION.CATEGORY) { CategoryStructure(); oCategory = new DataAccess.Category(); foreach (DataRow row in oCategory.GetCategory(cboSearch.Text, txtSearch.Text).Rows) { dgDetails.Rows.Add(row[0].ToString(), row[1].ToString(), row[2].ToString()); } } else if (oFindOption == FIND_OPTION.LOCATION) { LocationStructure(); oLocation = new DataAccess.Location(); foreach (DataRow row in oLocation.GetLocationRecord(cboSearch.Text, txtSearch.Text).Rows) { dgDetails.Rows.Add(row[0].ToString(), row[1].ToString(), row[2].ToString()); } } }
public static List <Dbo.Author> ListAuthors() { using (DataAccess.Author e = new DataAccess.Author()) { e.Initializer(); return(e.ListAuthors()); } }
public static bool AddAuthors(Dbo.Author e) { using (DataAccess.Author a = new DataAccess.Author()) { a.Initializer(); return(a.Add(e)); } }
public void LoadAuthor() { try { oAuthor = new DataAccess.Author(); dgDetails.Rows.Clear(); eVariable.DisableGridColumnSort(dgDetails); foreach (DataRow row in oAuthor.GetAuthor("", "").Rows) { dgDetails.Rows.Add(row[0].ToString(), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString().Trim()); } } catch (Exception ex) { } }
private void btnSave_Click(object sender, EventArgs e) { oMAuthor = new Model.Author(); oAuthor = new DataAccess.Author(); if (eVariable.IsFieldEmpty(pnlBody)) { oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.ALL_FIELDS_ARE_REQUIRED.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } if (eVariable.m_ActionType == eVariable.ACTION_TYPE.EDIT) { oMAuthor.PERSON_ID = eVariable.sUniqueID; oMAuthor.FIRST_NAME = txtFname.Text; oMAuthor.MIDDLE_NAME = txtMname.Text; oMAuthor.LAST_NAME = txtLname.Text; oMAuthor.STATUS = chkActive.Checked == true ? "ACTIVE" : "INACTIVE"; oAuthor.UpdateAuthor(oMAuthor); } else { oMAuthor.FIRST_NAME = txtFname.Text; oMAuthor.MIDDLE_NAME = txtMname.Text; oMAuthor.LAST_NAME = txtLname.Text; if (oAuthor.isRecordExists(oMAuthor)) { oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_IS_ALREADY_EXISTS.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } oMAuthor.STATUS = chkActive.Checked == true ? "ACTIVE" : "INACTIVE"; oAuthor.InsertAuthor(oMAuthor); } oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); eVariable.ClearText(pnlBody); eVariable.m_ActionType = eVariable.ACTION_TYPE.ADD; LoadAuthor(); }