private void btnSave_Click(object sender, EventArgs e) { oStudent = new DataAccess.Student(); oMStudent = new Model.Student(); foreach (var oText in pnlMain.Controls.OfType <TextBox>().ToList()) { if (oText.Text.Trim() == String.Empty) { oFrmMsgBox = new Forms.frmMessageBox(eVariable.MESSAGE.ALL_FIELDS_ARE_ALL_REQUIRED.ToString().Replace("_", " ")); oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } } oMStudent.UNIQUE_ID = txtStudentID.Text; oMStudent.FIRST_NAME = txtFname.Text; oMStudent.MIDDLE_NAME = txtMname.Text; oMStudent.LAST_NAME = txtLname.Text; oMStudent.DOB = dtDOB.Value.ToString("yyyy-MM-dd"); oMStudent.AGE = txtAge.Text; oMStudent.COURSE = txtCourse.Text; oMStudent.SECTION = txtSection.Text; oMStudent.CONTACT_NO = txtContactNo.Text; oMStudent.ADDRESS = txtAddress.Text; if (TransactionType == eVariable.TransactionType.EDIT) { oStudent.UpdateStudent(oMStudent); } else { if (!oStudent.IsRecordExists(oMStudent)) { oStudent.InsertStudent(oMStudent); } else { oFrmMsgBox = new frmMessageBox(eVariable.MESSAGE.RECORD_ALREADY_EXISTS.ToString().Replace("_", " ")); oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } } oFrmStudents.LoadStudents(); oFrmMsgBox = new frmMessageBox(eVariable.MESSAGE.RECORD_HAS_BEEN_SUCCESSFULLY_SAVE.ToString().Replace("_", " ")); oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); TransactionType = eVariable.TransactionType.ADD; Close(); }
private void btnOk_Click(object sender, EventArgs e) { if (txtPassword.Text.Trim() == sKey.Trim()) { Close(); } else { oFrmMsgBox = new frmMessageBox("THE PASSWORD YOU ENTERED IS INCORRECT!"); oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); txtPassword.Focus(); } }
void IsDBExists() { oDatabase = new DataAccess.SystemFunction(); if (!oDatabase.IsDatabaseExits()) { oFrmMsgBox = new Forms.frmMessageBox("DATABASE DOES NOT EXISTS. PLEASE RESTORE FIRST THE DATABASE. THANK YOU"); oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); Maintenance.frmBackupRestoreDB oFrmDB = new Maintenance.frmBackupRestoreDB(); oFrmDB.ShowDialog(); return; } }
private void btnCandidate_Click(object sender, EventArgs e) { IsDBExists(); ClearControls(); oElection = new DataAccess.SystemFunction(); if (!oElection.IsElectionCodeActive()) { oFrmMsgBox = new Forms.frmMessageBox("THERE IS NO ACTIVE ELECTION TICKET NUMBER. PLEASE OPEN FIRST TO START. THANK YOU. CLICK : UTILITY ELECTION TICKET NO"); oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } xFrm = new Forms.frmCandidateList(); Form_Load(xFrm); }
private void btnSave_Click(object sender, EventArgs e) { oParty = new DataAccess.Party(); if (txtParty.Text.Trim() != String.Empty) { oMParty = new Model.Party(); oMParty.ID = eVariable.sID; oMParty.PARTY = txtParty.Text; oMParty.STATUS = chkStatus.Checked == true ? "ACTIVE" : "INACTIVE"; if (TransactionType == eVariable.TransactionType.EDIT) { if (!oParty.UpdateParty(oMParty)) { oFrmMsgBox = new frmMessageBox("THIS RECORD CANNOT BE UPDATED"); oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); TransactionType = eVariable.TransactionType.ADD; LoadParty(); eVariable.ClearText(panel3); return; } } else { if (oParty.IsPartyExists(txtParty.Text)) { oFrmMsgBox = new frmMessageBox("RECORD ALREADY EXISTS"); oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } oParty = new DataAccess.Party(); oParty.InsertParty(oMParty); } oFrmMsgBox = new frmMessageBox("RECORD SUCCESSFULLY SAVED"); oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); TransactionType = eVariable.TransactionType.ADD; LoadParty(); eVariable.ClearText(panel3); } }
private void btnLock_Click(object sender, EventArgs e) { oDatabase = new DataAccess.SystemFunction(); if (!oDatabase.IsDatabaseExits()) { oFrmMsgBox = new Forms.frmMessageBox("DATABASE DOES NOT EXISTS. PLEASE RESTORE FIRST THE DATABASE. THANK YOU"); oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); Maintenance.frmBackupRestoreDB oFrmDB = new Maintenance.frmBackupRestoreDB(); oFrmDB.ShowDialog(); return; } ClearControls(); Forms.frmLock oFrm = new Forms.frmLock(eVariable.sPassword); oFrm.ShowDialog(); }