コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oUser  = new DataAccess.User();
            oMUser = new Model.User();

            foreach (var o in pnlUser.Controls.OfType <TextBox>().ToList())
            {
                if (o.Text.Trim() == String.Empty)
                {
                    oFrmMsgBox             = new frmMessageBox("ALL FIELDS ARE REQUIRED!");
                    oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    o.Focus();
                    return;
                }
            }

            if (txtPassword.Text.Trim() != txtRePassword.Text.Trim())
            {
                oFrmMsgBox             = new frmMessageBox("PASSWORD YOU ENTER DID NOT MATCH.");
                oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                txtPassword.Focus();
                return;
            }

            oMUser.FULLNAME   = txtFullname.Text;
            oMUser.USERNAME   = txtUsername.Text;
            oMUser.PASSWORD   = txtPassword.Text;
            oMUser.ROLE       = cboRole.Text;
            oMUser.CONTACT_NO = txtContactNo.Text;
            oMUser.ADDRESS    = txtAddress.Text;

            if (bEdit)
            {
                oUser.UpdateUser(oMUser);
                ClearFields();
                LoadRecords();
                oFrmMsgBox             = new frmMessageBox("RECORD SUCCESSFULL SAVED.");
                oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                bEdit = false;
            }
            else
            {
                if (oUser.IsRecordExists(txtUsername.Text.Trim()))
                {
                    oFrmMsgBox             = new frmMessageBox("USERNAME YOU CREATED ALREADY EXISTS.");
                    oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }
                oUser.InsertUser(oMUser);
                ClearFields();
                LoadRecords();
                oFrmMsgBox             = new frmMessageBox("RECORD SUCCESSFULL SAVED.");
                oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
            }
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oPosition = new DataAccess.Position();
            if (tbxPosition.Text.Trim() != String.Empty)
            {
                oMPosition          = new Model.Position();
                oMPosition.ID       = eVariable.sID;
                oMPosition.POSITION = tbxPosition.Text;
                oMPosition.STATUS   = chkStatus.Checked == true ? "ACTIVE" : "INACTIVE";

                if (TransactionType == eVariable.TransactionType.EDIT)
                {
                    oPosition.UpdatePosition(oMPosition);
                }
                else
                {
                    if (oPosition.IsPositionExists(tbxPosition.Text))
                    {
                        oFrmMsgBox             = new frmMessageBox("RECORD ALREADY EXISTS");
                        oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                        oFrmMsgBox.ShowDialog();
                        return;
                    }
                    oPosition = new DataAccess.Position();
                    oPosition.InsertPosition(oMPosition);
                }
                oFrmMsgBox             = new frmMessageBox("RECORD SUCCESSFULLY SAVED");
                oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                LoadPosition();
                eVariable.ClearText(panel3);
                TransactionType = eVariable.TransactionType.ADD;
            }
        }
コード例 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oCandidate    = new DataAccess.Candidate();
            oImageConvert = new CommonFunction.CommonFunction();

            foreach (var oText in pnlMain.Controls.OfType <TextBox>().ToList())
            {
                if (oText.Text.Trim() == String.Empty)
                {
                    oFrmMsgBox             = new frmMessageBox("All fields are required.");
                    oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }
            }

            oMCandidate               = new Model.Candidate();
            oMCandidate.UNIQUE_ID     = eVariable.sID;
            oMCandidate._Position.ID  = eVariable.sPositionID;
            oMCandidate._Party.ID     = eVariable.sPartyID;
            oMCandidate.ELECTION_CODE = lblElectionNo.Text;
            oMCandidate.DATE_ADDED    = DateTime.Now.ToString("yyyy-MM-dd");
            oMCandidate.ADDED_BY      = eVariable.sUsername;

            if (txtParty.Text != "INDEPENDENT")
            {
                if (oCandidate.IsSamePositionAndParty(oMCandidate))
                {
                    oFrmMsgBox             = new frmMessageBox("THERE SHOULD BE ONLY ONE POSITION PER PARTY");
                    oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }
            }

            oStringUtility = new CommonFunction.CommonFunction();
            if (pImage.Image != null)
            {
                oMCandidate.PROFILE_PIC = oStringUtility.CompressString(oImageConvert.ImageToBaseString(pImage.Image, ImageFormat.Png));
            }


            if (TransactionType == eVariable.TransactionType.EDIT)
            {
                oMCandidate.MODIFIED_DATE = DateTime.Now.ToString("yyyy-MM-dd");
                oMCandidate.MODIFIED_BY   = eVariable.sUsername;
                oCandidate.UpdateCandidate(oMCandidate);
            }
            else
            {
                oCandidate.InsertCandidate(oMCandidate);
            }

            oFrmCandidateList.LoadCandidates();
            oFrmMsgBox             = new frmMessageBox("Record has been successfully saved.");
            oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
            oFrmMsgBox.ShowDialog();
            Close();
        }
コード例 #4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            oUser    = new DataAccess.User();
            oUtility = new CommonFunction.CommonFunction();

            if (oUtility.Decrypt(oDefUser.USERNAME.Trim()) == txtUsername.Text && oUtility.Decrypt(oDefUser.PASSWORD.Trim()) == txtPassword.Text) //Default Login
            {
                this.Hide();
                this.ShowInTaskbar = false;
                ePublicVariable.eVariable.sUsername = txtUsername.Text;
                ePublicVariable.eVariable.sPassword = txtPassword.Text;
                ePublicVariable.eVariable.sFullname = oUtility.Decrypt(oDefUser.FULLNAME);
                ePublicVariable.eVariable.sRole     = oUtility.Decrypt(oDefUser.ROLE);
                oMainForm = new MAIN();
                oMainForm.ShowDialog();
            }

            else
            {
                #region CheckDatabase

                oDatabase = new DataAccess.SystemFunction();

                if (!oDatabase.IsDatabaseExits())
                {
                    oFrmMsgBox             = new frmMessageBox("DATABASE DOES NOT EXISTS. PLEASE RESTORE FIRST THE DATABASE. THANK YOU");
                    oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();

                    Maintenance.frmBackupRestoreDB oFrm = new Maintenance.frmBackupRestoreDB();
                    oFrm.ShowDialog();
                }

                #endregion


                #region DBLogin
                if (oUser.IsLogin(txtUsername.Text.Trim(), txtPassword.Text.Trim()))
                {
                    this.ShowInTaskbar = false;
                    this.Hide();
                    ePublicVariable.eVariable.sUsername = txtUsername.Text;
                    ePublicVariable.eVariable.sPassword = txtPassword.Text;
                    oMainForm = new MAIN();
                    oMainForm.ShowDialog();
                }
                else
                {
                    oFrmMsgBox             = new Forms.frmMessageBox("PLEASE ENTER CORRECT USERNAME AND PASSWORD.");
                    oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    txtUsername.Focus();
                }
                #endregion
            }
        }
コード例 #5
0
        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();
        }
コード例 #6
0
 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();
     }
 }
コード例 #7
0
        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;
            }
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
            }
        }
コード例 #10
0
        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();
        }