Пример #1
0
        private void ExtractData()
        {
            try
            {
                int    iColumnCount = dgExport.Columns.Count;
                string sColumnNames = "";

                oOutputCSV = new string[dgExport.Rows.Count + 1];
                for (int i = 0; i < iColumnCount; i++)
                {
                    sColumnNames += dgExport.Columns[i].HeaderText.ToString() + ",";
                }
                oOutputCSV[0] += sColumnNames;
                for (int i = 1; (i - 1) < dgExport.Rows.Count; i++)
                {
                    for (int j = 0; j < iColumnCount; j++)
                    {
                        oOutputCSV[i] += dgExport.Rows[i - 1].Cells[j].Value.ToString() + ",";
                    }
                }

                File.WriteAllLines(oSaveFileDialog.FileName, oOutputCSV, Encoding.UTF8);
                oFrmMsgBox = new Forms.frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_EXTRACTED_AND_SAVE_TO_PATH.ToString().Replace("_", " ") + " :" + oSaveFileDialog.FileName);
                oFrmMsgBox.m_MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
            }
            catch (Exception ex)
            { }
        }
Пример #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                oMVotingSchedule = new Model.VotingSchedule();

                if (DateTimeValidation())
                {
                    oFrmMsgBox             = new Forms.frmMessageBox("THE DATE RANGE YOU HAVE SELECTED ARE INVALID OR END DATE ARE LESS THAN THE CURRENT DATE.");
                    oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    LoadRecordDetails();
                    return;
                }

                oVotingSchedule = new DataAccess.SystemFunction();
                if (oVotingSchedule.IsScheduleExists())
                {
                    oMVotingSchedule.DATE_START = dtDateFrom.Value.ToString("yyyy-MM-dd");
                    oMVotingSchedule.TIME_START = dtTimeFrom.Value.ToString("h:mm:ss tt");
                    oMVotingSchedule.DATE_END   = dtDateTo.Value.ToString("yyyy-MM-dd");
                    oMVotingSchedule.TIME_END   = dtTimeTo.Value.ToString("h:mm:ss tt");
                    oMVotingSchedule.STATUS     = cboStatus.Text;

                    oVotingSchedule.UpdateSchedule(oMVotingSchedule);
                }

                LoadRecordDetails();
                MessageBox.Show("Record has been succesfully saved", sTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
            }
        }
Пример #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                oCandidate     = new DataAccess.Candidate();
                oGeneratedKey  = new DataAccess.SystemFunction();
                oStringUtility = new CommonFunction.CommonFunction();

                sElectionCode = DateTime.Now.ToString("yyyy") + "-" + oStringUtility.GetRandomString(5);

                if (oCandidate.IsCandidateNotEmpty())
                {
                    oFrmMsgBox             = new Forms.frmMessageBox("WARNING! YOU HAVE EXISTING ACTIVE CANDIDATE WITH CURRENT ELECTION TICKET NUMBER [ " + sCurrentCode + " ] USED. PROCEDING THIS ACTIVITY WILL MAKE THEM ALL INACTIVE. WOULD YOU LIKE TO PROCEED?");
                    oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.QUERY;
                    oFrmMsgBox.ShowDialog();
                    if (oFrmMsgBox.sAnswer.ToUpper() != "YES")
                    {
                        return;
                    }
                }

                oElection  = new DataAccess.SystemFunction();
                oMElection = new Model.ElectionCode();

                oMElection.CODE       = sElectionCode;
                oMElection.ADDED_DATE = DateTime.Now;
                oMElection.ADDED_BY   = "Rolly";


                if (rdCloseElection.Checked)
                {
                    oElection.UpdateElectionCode();

                    oCandidate = new DataAccess.Candidate();
                    oCandidate.UpdateCandidateStatus(sCurrentCode);

                    oGeneratedKey = new DataAccess.SystemFunction();
                    oGeneratedKey.UpdateGeneratedKey(sCurrentCode);
                }
                else
                {
                    oElection.UpdateElectionCode();
                    oElection.InsertElectionCode(oMElection);

                    oCandidate = new DataAccess.Candidate();
                    oCandidate.UpdateCandidateStatus(sCurrentCode);

                    oGeneratedKey = new DataAccess.SystemFunction();
                    oGeneratedKey.UpdateGeneratedKey(sCurrentCode);
                }

                LoadKeys();
                oFrmMsgBox             = new Forms.frmMessageBox("RECORD SUCESSFULLY SAVED.");
                oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
            }
            catch (Exception ex)
            {
            }
        }
Пример #4
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (txtElectionCode.Text.Trim() == string.Empty && cboSearch.Text != "STUDENT LIST")
            {
                Forms.frmMessageBox oFrm = new Forms.frmMessageBox("ELECTION CODE NUMBER IS REQUIRED IN THIS REPORT");
                oFrm.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                oFrm.ShowDialog();
                txtElectionCode.Focus();
                return;
            }

            switch (cboSearch.Text)
            {
            case "STUDENT LIST":
                sReportName = "rptRecordList.rdlc";
                LoadStudents();
                break;

            case "CANDIDATE LIST":
                sReportName = "rptCandidateList.rdlc";
                LoadCandidates();
                break;

            case "VOTE RESULT":
                sReportName = "rptResult.rdlc";
                VoteResult();
                break;

            case "ELECTION WINNER":
                sReportName = "rptResult.rdlc";
                ElectionWinner();
                break;
            }
        }
Пример #5
0
        private void btnButton_Click(object sender, EventArgs e)
        {
            if (btnButton.Text.Trim() == "BACKUP")
            {
                #region Backup
                oBackup = new DataAccess.SystemFunction();

                if (txtDBBackup.Text.Trim() != string.Empty)
                {
                    if (oBackup.IsDatabaseExits())
                    {
                        oBackup.BackupDatabase(txtDBBackup.Text);

                        oFrmMsgBox             = new Forms.frmMessageBox("DATABASE SUCCESSFULL BACKUP IN PATH :" + " " + txtDBBackup.Text);
                        oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                        oFrmMsgBox.ShowDialog();
                    }
                    else
                    {
                        oFrmMsgBox             = new Forms.frmMessageBox("DATABASE DOES NOT EXISTS");
                        oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                        oFrmMsgBox.ShowDialog();
                    }
                }
                else
                {
                    oFrmMsgBox             = new Forms.frmMessageBox("PLEASE SELECT DISTINATION FOLDER TO SAVE THE FILE.");
                    oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                }
                txtDBBackup.Text = string.Empty;
                return;

                #endregion
            }
            else
            {
                #region Restore

                if (txtDBRestore.Text.Trim() != String.Empty)
                {
                    oRestore = new DataAccess.SystemFunction();
                    //if (oRestore.IsDatabaseExits())
                    //{
                    //    oRestore.DropDatabase();
                    //}
                    oRestore.RestoreDatabase(txtDBRestore.Text);

                    oFrmMsgBox             = new Forms.frmMessageBox("DATABASE SUCCESSFULLY RESTORED");
                    oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                }
                txtDBRestore.Text = string.Empty;
                return;

                #endregion
            }
        }
Пример #6
0
        private void btnButton_Click(object sender, EventArgs e)
        {
            if (btnButton.Text.Trim() == "IMPORT")
            {
                if (txtImportPath.Text.Trim() == String.Empty)
                {
                    MessageBox.Show("Please select file to import");
                    return;
                }

                #region Import
                try
                {
                    if (cboImport.SelectedText == "BORROWER" || cboImport.Text == "BORROWER")
                    {
                        if (dgImport.Rows.Count > 0)
                        {
                            foreach (var iData in lstBorrower)
                            {
                                oBorrower = new DataAccess.Borrower();
                                if (!oBorrower.IsRecordExists(iData))
                                {
                                    oBorrower.InsertBorrower(iData);
                                }
                            }

                            oFrmMsgBox = new Forms.frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
                            oFrmMsgBox.m_MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                            oFrmMsgBox.ShowDialog();
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                #endregion
            }
            else
            {
                if (txtExportPath.Text.Trim() == string.Empty)
                {
                    MessageBox.Show(eVariable.TransactionMessage.PLEASE_SELECT_DISTINATION_PATH_TO_SAVE_THE_FILE.ToString().Replace("_", " "));
                    return;
                }

                if (dgExport.Rows.Count == 0)
                {
                    MessageBox.Show(eVariable.TransactionMessage.PLEASE_POPULATE_A_RECORD_FIRST.ToString().Replace("_", " "));
                    return;
                }

                #region Export
                ExtractData();
                #endregion
            }
        }
Пример #7
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (txtPassword.Text.Trim() == sKey.Trim())
     {
         this.Dispose();
     }
     else
     {
         oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.THE_PASSWORD_YOU_HAVE_ENTERED_IS_INCORRECT.ToString().Replace("_", " "));
         oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
         oFrmMsgBox.Left          = 10;
         oFrmMsgBox.ShowDialog();
         txtPassword.Focus();
     }
 }
Пример #8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oUser  = new DataAccess.User();
            oMUser = new Model.User();

            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;
            }

            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;
            oMUser.STATUS     = chkStats.Checked == true ? "ACTIVE" : "INACTIVE";

            if (eVariable.m_ActionType == ePublicVariable.eVariable.ACTION_TYPE.EDIT)
            {
                oUser.UpdateUser(oMUser);
                eVariable.ClearText(pnlBody);
                LoadRecords();
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
            }
            else
            {
                if (oUser.IsRecordExists(txtUsername.Text.Trim()))
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_IS_ALREADY_EXISTS.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }
                oUser.InsertUser(oMUser);
                eVariable.ClearText(pnlBody);
                LoadRecords();
                eVariable.m_ActionType   = eVariable.ACTION_TYPE.ADD;
                oFrmMsgBox               = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
            }
        }
Пример #9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oMLocation = new Model.Location();
            oLocation  = new DataAccess.Location();

            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)
            {
                oMLocation.LOCATION_ID = eVariable.sUniqueID;
                oMLocation.LOCATION    = txtLocation.Text;
                oMLocation.STATUS      = chkActive.Checked == true ? "ACTIVE" : "INACTIVE";
                oLocation.UpdateCategory(oMLocation);
            }
            else
            {
                oMLocation.LOCATION = txtLocation.Text;
                oMLocation.STATUS   = chkActive.Checked == true ? "ACTIVE" : "INACTIVE";

                if (oLocation.isRecordExists(oMLocation))
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_IS_ALREADY_EXISTS.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }


                oLocation.InsertLocation(oMLocation);
            }

            oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
            oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
            oFrmMsgBox.ShowDialog();
            eVariable.ClearText(pnlBody);
            LoadLocation();
        }
Пример #10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oMRole = new Model.Role();
            oRole  = new DataAccess.Role();

            if (IsRecordEmpty())
            {
                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)
            {
                oMRole.ID     = eVariable.sUniqueID;
                oMRole.ROLE   = txtRole.Text;
                oMRole.STATUS = chkActive.Checked == true ? "ACTIVE" : "INACTIVE";
                oRole.UpdateRole(oMRole);
            }
            else
            {
                oMRole.ROLE   = txtRole.Text;
                oMRole.STATUS = chkActive.Checked == true ? "ACTIVE" : "INACTIVE";

                if (oRole.isRecordExists(oMRole))
                {
                    oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_IS_ALREADY_EXISTS.ToString().Replace("_", " "));
                    oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    return;
                }

                oRole.InsertRole(oMRole);
            }

            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;
            LoadRole();
        }
Пример #11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oUser = new DataAccess.User();

            if (oMRole.ROLE != string.Empty)
            {
                oMUserConfig.BookDetail      = chkBookDetail.Checked;
                oMUserConfig.BookEntry       = chkBookEntry.Checked;
                oMUserConfig.BookAuthor      = chkAuthor.Checked;
                oMUserConfig.BookCategory    = chkCategory.Checked;
                oMUserConfig.BookLocation    = chkLocation.Checked;
                oMUserConfig.BookPolicy      = chkPolicy.Checked;
                oMUserConfig.BorrowerDetails = chkBorrowerDetails.Checked;
                oMUserConfig.BorrowerEntry   = chkBorrowerEntry.Checked;
                oMUserConfig.BorrowBook      = chkBorrowBook.Checked;
                oMUserConfig.ReturnBook      = chkReturnBook.Checked;
                oMUserConfig.PayBook         = chkPayBook.Checked;
                oMUserConfig.BorrowerRequest = chkBorrowerRequest.Checked;
                oMUserConfig.UserAccount     = chkUserAccount.Checked;
                oMUserConfig.UserAccess      = chkUserAccess.Checked;
                oMUserConfig.UserRole        = chkUserRole.Checked;
                oMUserConfig.ImportExport    = chkImportExport.Checked;
                oMUserConfig.RBookList       = chkRBookList.Checked;
                oMUserConfig.RBorrowerList   = chkRBorrowerList.Checked;
                oMUserConfig.ROLE            = oMRole.ROLE;

                if (!oUser.IsUserRoleExists(oMRole.ROLE))
                {
                    oUser.InsertUserAccess(oMUserConfig);
                }
                else
                {
                    oUser.UpdateUserAccess(oMUserConfig);
                }

                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
                oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                chkSelectAll.Checked = false;
            }
        }
Пример #12
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            oStudent = new DataAccess.Student();

            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;
            }

            foreach (DataRow row in oElection.getElectionCode("", "").Rows)
            {
                sElectionCode = row["CODE"].ToString();
            }

            foreach (DataRow row in oStudent.getStudent("", "").Rows)
            {
                oKeyGenerator = new CommonFunction.CommonFunction();
                oGenerateKey  = new DataAccess.SystemFunction();
                oMGenerateKey = new Model.GenerateKey();

                oMGenerateKey.GENERATED_KEY = oKeyGenerator.GetAssortedString(5);
                oMGenerateKey.VOTERS_ID     = row["STUDENT_ID"].ToString();
                oMGenerateKey.DATED_ADDED   = DateTime.Now.ToString("yyyy-MM-dd");
                oMGenerateKey.ELECTION_CODE = sElectionCode;
                oMGenerateKey.STATUS        = "ACTIVE";

                if (!oGenerateKey.IsKeyExists(oMGenerateKey.VOTERS_ID))
                {
                    oGenerateKey.InsertKey(oMGenerateKey);
                }
            }

            LoadRecords();
        }
Пример #13
0
        private void btnButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (btnButton.Text.Trim() == "BACKUP")
                {
                    #region Backup
                    oBackup = new DataAccess.BackupRestoreDB();

                    if (txtDBBackup.Text.Trim() != string.Empty)
                    {
                        if (oBackup.IsDatabaseExits())
                        {
                            if (oBackup.BackupDatabase(txtDBBackup.Text))
                            {
                                oFrmMsgBox = new Forms.frmMessageBox(eVariable.TransactionMessage.DATABASE_HAS_BEEN_SUCESSFULLY_BACKUP_IN_PATH.ToString().Replace("_", " ") + " " + txtDBBackup.Text);
                                oFrmMsgBox.m_MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                                oFrmMsgBox.ShowDialog();
                            }
                            else
                            {
                                oFrmMsgBox = new Forms.frmMessageBox(eVariable.TransactionMessage.DATABASE_BACKUP_FAILED.ToString().Replace("_", " "));
                                oFrmMsgBox.m_MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                                oFrmMsgBox.ShowDialog();
                            }
                        }
                        else
                        {
                            oFrmMsgBox = new Forms.frmMessageBox(eVariable.TransactionMessage.THE_DATABASE_DOES_NOT_EXITS.ToString().Replace("_", " "));
                            oFrmMsgBox.m_MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                            oFrmMsgBox.ShowDialog();
                        }
                    }
                    else
                    {
                        oFrmMsgBox = new Forms.frmMessageBox(eVariable.TransactionMessage.PLEASE_SELECT_DISTINATION_PATH_TO_SAVE_THE_FILE.ToString().Replace("_", " "));
                        oFrmMsgBox.m_MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                        oFrmMsgBox.ShowDialog();
                    }
                    txtDBBackup.Text = string.Empty;
                    return;

                    #endregion
                }
                else
                {
                    #region Restore

                    if (txtDBRestore.Text.Trim() != String.Empty)
                    {
                        oRestore = new DataAccess.BackupRestoreDB();

                        if (oRestore.RestoreDatabase(txtDBRestore.Text))
                        {
                            oFrmMsgBox = new Forms.frmMessageBox(eVariable.TransactionMessage.DATABASE_HAS_BEEN_SUCESSFULLY_RESTORED.ToString().Replace("_", " "));
                            oFrmMsgBox.m_MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                            oFrmMsgBox.ShowDialog();
                        }
                        else
                        {
                            oFrmMsgBox = new Forms.frmMessageBox(eVariable.TransactionMessage.DATABASE_RESTORATION_FAILED.ToString().Replace("_", " "));
                            oFrmMsgBox.m_MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                            oFrmMsgBox.ShowDialog();
                        }
                    }
                    txtDBRestore.Text = string.Empty;
                    return;

                    #endregion
                }
            }
            catch (Exception ex)
            {
            }
        }