void GetElectionCode() { oElection = new DataAccess.SystemFunction(); foreach (DataRow row in oElection.getElectionCode("", "").Rows) { lblElectionNo.Text = row["CODE"].ToString(); } }
void LoadKeys() { oElection = new DataAccess.SystemFunction(); dgDetails.Rows.Clear(); foreach (DataRow row in oElection.getElectionCode("", "").Rows) { dgDetails.Rows.Add(row["CODE"], Convert.ToDateTime(row["DATE_ADDED"]).ToString("yyyy-MM-dd h:mm:ss tt"), row["STATUS"]); sCurrentCode = row["CODE"].ToString(); } }
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(); }