private void saveToClientRequest() { if (txtclient.Text.Trim() == string.Empty || txtrequest.Text.Trim() == string.Empty) { return; } string strid = "'" + txtid.Text.Trim() + "'"; string strdocumented = "'" + chkdocumented.Checked + "'"; string stricslinterviewd = "'" + chkicslinterview.Checked + "'"; string strdtpclientinterviewdate = "'" + dtpclientinterviewdate.Value.ToString("yyyy/MM/dd") + "'"; string strmskresumptiondate = "'" + dtpresumptiondate.Value.ToString("yyyy/MM/dd") + "'"; string strRequestdescr = "'" + txtrequest.Text + "'"; string queryString = @"select distinct * from candidatecallup where recrno = " + strid + " and clientid = '"+ txtclient.Text.Trim() + "'" + " and request = '" + prv_requestcode.Trim() + "'" + " and position = '" + prv_posit.Trim() +"'" + " and reqid = '" + strReqId.Trim() + "'"; datamethods2 dthm = new datamethods2(); SqlDataReader drRecords = dthm._dataReader_NoParameter(queryString); drRecords.Read(); if (!drRecords.HasRows) { drRecords.Close(); drRecords.Dispose(); string sqlInsert = string.Empty; sqlInsert = @" insert into candidatecallup ( reqid, recrno, emptype, intlocdesr, intloccode, clientid, position, posdescr, cinterview, cintersult, remarks, intervdate, rdate, request, reqdescr, cinduction, cindsult) " + " values (" + "'" + strReqId + "'" + "," + strid + "," + "'" + cmbemploymenttype.Text.Trim() + "'" + "," + "'" + interiewlocation.Text + "'" + "," + "'" + prv_intlocation + "'" + "," + "'" + txtclient.Text + "'" + "," + "'" + prv_posit + "'" + "," + "'" + txtposition.Text + "'" + "," + "'" + chkclientinterview.Checked + "'" + "," + "'" + cmbintassessment.Text.Trim() + "'" + "," + "'" + txtremarks.Text + "'" + "," + strdtpclientinterviewdate + "," + strmskresumptiondate + "," + "'" + prv_requestcode + "'" + "," + strRequestdescr + "," + "'" + chkcinduction.Checked + "'" + "," + "'" + cmbcindsult.Text.Trim() + "'" + ")" ; int returnVal = dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError); } else // do update { drRecords.Close(); drRecords.Dispose(); string sqlUpdate = string.Empty; sqlUpdate = @" update candidatecallup set " + "emptype= " + "'" + cmbemploymenttype.Text.Trim() + "'" + "," + "intlocdesr= " + "'" + interiewlocation.Text + "'" + "," + "intloccode= " + "'" + prv_intlocation + "'" + "," + "clientid= " + "'" + txtclient.Text + "'" + "," + "position= " + "'" + prv_posit + "'" + "," + "posdescr= " + "'" + txtposition.Text + "'" + "," + "cinterview= " + "'" + chkclientinterview.Checked + "'" + "," + "cintersult= " + "'" + cmbintassessment.Text.Trim() + "'" + "," + "remarks= " + "'" + txtremarks.Text + "'" + "," + "intervdate= " + strdtpclientinterviewdate + "," + "request= " + "'" + prv_requestcode + "'" + "," + "reqdescr = " + "'" + txtrequest.Text + "'" + "," + "rdate= " + strmskresumptiondate + "," + "cinduction= " + "'" + chkcinduction.Checked + "'" + "," + "cindsult= " + "'" + cmbcindsult.Text.Trim() + "'" + " where recrno = " + strid + " and reqid = '" + strReqId + "'" ; //MessageBox.Show(Convert.ToDateTime(strmskdatesentout).ToString("yyyy/MM/dd")); int returnVal = dthm._update_Insert_NoParameter(sqlUpdate); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError); } }
private void populateScreen() { string strid = txtid.Text; clearScreen(); txtid.Text = strid; string queryString = string.Empty; queryString = "select distinct * from database2 where recrno = " + "'" + strid + "'"; datamethods2 dthm = new datamethods2(); SqlDataReader drRecords = dthm._dataReader_NoParameter(queryString); drRecords.Read(); if (drRecords.HasRows) { newRecords = false; txtsurname.Text = drRecords["surname"].ToString(); txtfirstname.Text = drRecords["firstname"].ToString(); txtmiddlename.Text = drRecords["middlename"].ToString(); chkaptested.Checked = Convert.ToBoolean(drRecords["aptest"]); chkdocumented.Checked = Convert.ToBoolean(drRecords["documented"]); chkactive.Checked = Convert.ToBoolean(drRecords["active"]); chkmedical.Checked = Convert.ToBoolean(drRecords["medical"]); txtinitials.Text = drRecords["initials"].ToString(); cmbtitle.Text = drRecords["title"].ToString(); txtaddress.Text = drRecords["address"].ToString(); cmbgender.Text = drRecords["sex"].ToString(); dtpdob.Value = Convert.ToDateTime(drRecords["birthdate"]); // -- calacualte the age DateTime dtime = Convert.ToDateTime(drRecords["birthdate"]); Int32 int_year = dtime.Year; Int32 int_month = dtime.Month; Int32 int_Day = dtime.Day; Int32 int_yearDiff = DateTime.Now.Date.Year-dtime.Year; if (int_yearDiff > 0) { if (DateTime.Now.Date.Month >= int_month) { if(DateTime.Now.Day >= int_Day ) { mskage.Text = (int_yearDiff).ToString(); } else mskage.Text = (int_yearDiff-1).ToString(); } else mskage.Text = (int_yearDiff - 1).ToString(); } else mskage.Text ="0"; // ------------------ txtemail.Text = drRecords["email"].ToString(); mskphone.Text = drRecords["phone"].ToString(); txtlocation.Text = drRecords["lgadescr"].ToString(); prv_location = drRecords["lgacode"].ToString(); txtqualification.Text = drRecords["qualdescr"].ToString(); prv_qual = drRecords["qualcode"].ToString(); txtgrade.Text = drRecords["gradedescr"].ToString(); prv_grade = drRecords["gradecode"].ToString(); chkicslinterview.Checked = Convert.ToBoolean(drRecords["interviewed"]); cmdtinterviewresult.Text = drRecords["intersult"].ToString(); cmbtestresult.Text = drRecords["testsult"].ToString(); cmbmedicalresult.Text = drRecords["medsult"].ToString(); txtmedissue.Text = drRecords["medissue"].ToString(); chkessay.Checked = Convert.ToBoolean(drRecords["essay"]); cmbessayresult.Text = drRecords["essaysult"].ToString(); chkshl.Checked = Convert.ToBoolean(drRecords["shl"]); chkinduction.Checked = Convert.ToBoolean(drRecords["induction"]); cmbinductionresult.Text = drRecords["inductsult"].ToString(); txtmanager.Text = drRecords["manager"].ToString(); mskrecordmanagerdate.Text = drRecords["entrydate"].ToString(); mskmodifieddate.Text = drRecords["modifydate"].ToString(); txtmodifiedby.Text = drRecords["modifiedby"].ToString(); if (chkactive.Checked == true) chkactive.Enabled = false; drRecords.Dispose(); //populateCandidateCallups(); } else { drRecords.Close(); drRecords.Dispose(); queryString = "select distinct * from database1 where recrno = " + "'" + strid + "'"; drRecords = dthm._dataReader_NoParameter(queryString); drRecords.Read(); if (drRecords.HasRows) { newRecords = true; txtsurname.Text = drRecords["surname"].ToString(); txtfirstname.Text = drRecords["firstname"].ToString(); txtmiddlename.Text = drRecords["middlename"].ToString(); chkaptested.Checked = Convert.ToBoolean(drRecords["aptest"]); txtinitials.Text = drRecords["initials"].ToString(); cmbtitle.Text = drRecords["title"].ToString(); txtaddress.Text = drRecords["address"].ToString(); cmbgender.Text = drRecords["sex"].ToString(); dtpdob.Text = drRecords["birthdate"].ToString(); mskage.Text = drRecords["age"].ToString(); txtemail.Text = drRecords["email"].ToString(); mskphone.Text = drRecords["phone"].ToString(); cmbtestresult.Text = drRecords["testresult"].ToString(); txtlocation.Text = drRecords["lgadescr"].ToString(); prv_location = drRecords["lgacode"].ToString(); txtqualification.Text = drRecords["qualdescr"].ToString(); prv_qual = drRecords["qualcode"].ToString(); txtgrade.Text = drRecords["gradedescr"].ToString(); prv_grade = drRecords["gradecode"].ToString(); } drRecords.Dispose(); } txtid.Enabled = false; populateGrid(); }
private void populateScreen() { string strid = txtid.Text; txtusername.Text = ""; txtpassword.Text = ""; txtconfirm.Text = ""; txtusername.Text = ""; chkclientrequest.Checked = false; chkclients.Checked = false; chkdatabase1.Checked = false; chkdatabase2.Checked = false; chkdownload.Checked = false; chksetups.Checked = false; chksuspended.Checked = false; chkusers.Checked = false; string queryString = string.Empty; queryString= "select distinct * from useracct where userid = " + "'" +strid+ "'"; datamethods2 dthm = new datamethods2(); SqlDataReader drRecords = dthm._dataReader_NoParameter(queryString); drRecords.Read(); if (drRecords.HasRows) { newRecords = false; txtusername.Text = drRecords["names"].ToString(); txtpassword.Text = drRecords["pwd"].ToString(); txtconfirm.Text = drRecords["pwd"].ToString(); chkclientrequest.Checked = Convert.ToBoolean( drRecords["crequest"]); chkclients.Checked = Convert.ToBoolean(drRecords["clientsetup"]); chkdatabase1.Checked = Convert.ToBoolean(drRecords["database1"]); chkdatabase2.Checked = Convert.ToBoolean(drRecords["database2"]); chkdownload.Checked = Convert.ToBoolean(drRecords["download"]); chksetups.Checked = Convert.ToBoolean(drRecords["othersetup"]); chksuspended.Checked = Convert.ToBoolean(drRecords["suspend"]); chkusers.Checked = Convert.ToBoolean(drRecords["usersetup"]); chkreports.Checked = Convert.ToBoolean(drRecords["reports"]); } drRecords.Dispose(); pictureBox6.Focus(); txtid.Enabled = false; }
private void populateScreen() { string strid = txtid.Text; txtsurname.Text = ""; txtfirstname.Text = ""; txtmiddlename.Text = ""; txtinitials.Text = ""; chkdocscreened.Checked = false; chkaptested.Checked = false; cmbtitle.SelectedIndex = 0; txtaddress.Text = ""; cmbgender.SelectedIndex = 0; mskdob.Text = ""; mskage.Text = ""; txtemail.Text = ""; mskphone.Text = ""; txtlocation.Text = ""; txtqualification.Text = ""; txtgrade.Text = ""; txtid.Enabled = false; newRecords = true; chktransfered.Checked = false; string queryString = string.Empty; queryString = "select distinct * from database1 where recrno = " + "'" + strid + "'"; datamethods2 dthm = new datamethods2(); SqlDataReader drRecords = dthm._dataReader_NoParameter(queryString); drRecords.Read(); if (drRecords.HasRows) { newRecords = false; txtsurname.Text = drRecords["surname"].ToString(); txtfirstname.Text = drRecords["firstname"].ToString(); txtmiddlename.Text = drRecords["middlename"].ToString(); chkdocscreened.Checked = Convert.ToBoolean(drRecords["screened"]); chkaptested.Checked = Convert.ToBoolean(drRecords["aptest"]); txtinitials.Text = drRecords["initials"].ToString(); cmbtitle.Text = drRecords["title"].ToString(); txtaddress.Text = drRecords["address"].ToString(); cmbgender.Text = drRecords["sex"].ToString(); mskdob.Text = drRecords["birthdate"].ToString(); mskage.Text = drRecords["age"].ToString(); txtemail.Text = drRecords["email"].ToString(); mskphone.Text = drRecords["phone"].ToString(); txtlocation.Text = drRecords["lgadescr"].ToString(); txtqualification.Text = drRecords["qualdescr"].ToString(); txtgrade.Text = drRecords["gradedescr"].ToString(); chktransfered.Checked = Convert.ToBoolean(drRecords["active"]); cmbtestresult.Text = drRecords["testresult"].ToString(); prv_grade = drRecords["gradecode"].ToString(); prv_location = drRecords["lgacode"].ToString(); prv_qual = drRecords["qualcode"].ToString(); } drRecords.Dispose(); pictureBox6.Focus(); txtid.Enabled = false; }
private void login() { if (txtuserid.Text.Trim() == string.Empty) { MessageBox.Show("ID can't be empty!", "Missing ID"); return; } if (txtpassword.Text.Trim() == string.Empty) { MessageBox.Show("Password can't be empty!", "Missing Password"); return; } txtuserid.Enabled = false; txtpassword.Enabled = false; string strid = "'" + txtuserid.Text.Trim() + "'"; string strpassword = "******" + txtpassword.Text + "'"; string queryString = string.Empty; queryString = @"select distinct * from useracct where userid = " + strid + " and pwd = " + strpassword ; datamethods2 dthm = new datamethods2(); SqlDataReader drRecords; drRecords = dthm._dataReader_NoParameter(queryString); if (dthm.sqlUserError != String.Empty) { MessageBox.Show(dthm.sqlUserError); drRecords.Close(); drRecords.Dispose(); return; } drRecords.Read(); if (drRecords.HasRows) { // get the access right vaiables if (Convert.ToBoolean(drRecords["suspend"]) == true) { MessageBox.Show("Users Suspended!", "RnS Notification"); txtuserid.Enabled = true; txtpassword.Enabled = true; return; } Program.pbClientRequestAccess = Convert.ToBoolean(drRecords["crequest"]); Program.pbClientSetupAccess = Convert.ToBoolean(drRecords["clientsetup"]); Program.pbDatabase1Access = Convert.ToBoolean(drRecords["database1"]); Program.pbDatabase2Access = Convert.ToBoolean(drRecords["database2"]); Program.pbDownloadAcess = Convert.ToBoolean(drRecords["download"]); Program.pbSetupAccess = Convert.ToBoolean(drRecords["othersetup"]); Program.pbUserSetupAccess = Convert.ToBoolean(drRecords["usersetup"]); Program.pbReportAccess = Convert.ToBoolean(drRecords["reports"]); Program.pbUserName = drRecords["names"].ToString().Trim(); Program.pbUserID = drRecords["userid"].ToString().Trim(); MessageBox.Show("Welcome User: "******"RnS Notification"); // open the main form Form1 frm_fm1 = new Form1(); frm_fm1.FormClosed += new FormClosedEventHandler(frm2_FormClosed); frm_fm1.Show(); this.Hide(); } else { MessageBox.Show("Invalid Users...", "RnS Notification"); txtuserid.Enabled = true; txtpassword.Enabled = true; } drRecords.Close(); drRecords.Dispose(); }
private void saveRecords() { if (dgvDestination.Rows.Count == 0 ) { MessageBox.Show("Move records into destination table", "RnS Notification"); return; } lblprocessing.Text = "Processing pls wait..."; string strRecrno = String.Empty; string sqlInsertwhere = string.Empty; List<string> lstRecrno = new List<string>(); int _totalSaved = 0; // get all the recrno for (int x = 0; x < dgvDestination.Rows.Count; x++) { if (dgvDestination.Rows[x].Cells[0].Value.ToString() != null && dgvDestination.Rows[x].Cells[0].Value.ToString().Trim() != string.Empty) { if (Convert.ToBoolean(dgvDestination.Rows[x].Cells[4].Value) == false) lstRecrno.Add(dgvDestination.Rows[x].Cells[0].Value.ToString().Trim()); } } if (lstRecrno.Count > 0) { sqlInsertwhere = "where recrno = '" + lstRecrno[0] + "'"; if (lstRecrno.Count - 1 > 0) { for (int x = 1; x < lstRecrno.Count; x++) { sqlInsertwhere += " or recrno = '" + lstRecrno[x] + "'"; } } } if (sqlInsertwhere.Trim() == string.Empty) // do insert { MessageBox.Show("There are no new records to save", "RnS Notification"); lblprocessing.Visible = false; return; } // save the records datamethods2 dthm = new datamethods2(); DataTable dt = new DataTable(); string sqlQueury = "Select * from recruittab "; sqlQueury += sqlInsertwhere; dt = dthm._dataTable_NoParameter_webdb(sqlQueury); if (dthm.sqlUserError == string.Empty) { if (dt.Rows.Count > 0) { _totalSaved = 0; string strLgaDescr = String.Empty; for (int x = 0; x < dt.Rows.Count; x++) { lblprocessing.Visible = true; lblprocessing.Text = "Processing Record " + (x + 1).ToString() + " of " + dt.Rows.Count.ToString(); string strSex = "Male"; if (dt.Rows[x]["sex"].ToString() == "2") { strSex = "Female"; } strLgaDescr = ""; if (dt.Rows[x]["lga"].ToString().Trim() != string.Empty ) { string sqlgetDescr = string.Empty; sqlgetDescr = "select desc1 from codestab where option1='LGACODE' and code = '" + dt.Rows[x]["lga"].ToString() + "'"; SqlDataReader dr = dthm._dataReader_NoParameter(sqlgetDescr, ConfigurationManager.ConnectionStrings["rnsConString_rims"].ConnectionString); if (dthm.sqlUserError == string.Empty) { dr.Read(); if (dr.HasRows) strLgaDescr = dr["desc1"].ToString(); } dr.Dispose(); dr.Close(); } string sqlInsert = string.Empty; sqlInsert = @" Insert into database1 " + "(recrno,surname,firstname,middlename,initials,address, " + " title,sex,age,phone,email,lgacode,lgadescr,birthdate,gradecode,gradedescr,qualcode,qualdescr,testresult,screened,aptest,active)" + " values ('" + dt.Rows[x]["recrno"].ToString() + "'," + "'" + dt.Rows[x]["surname"].ToString() + "'," + "'" + dt.Rows[x]["othernames"].ToString() + "'," + "'" + dt.Rows[x]["initials"].ToString() + "'," + "'" + " " + "'," + "'" + dt.Rows[x]["address"].ToString() + "'," + "'" + dt.Rows[x]["title"].ToString() + "'," + "'" + strSex + "'," + "'" + (DateTime.Now.Year - Convert.ToDateTime(dt.Rows[x]["birthdate"]).Year).ToString() + "'," + "'" + dt.Rows[x]["phone"].ToString() + "'," + "'" + dt.Rows[x]["email"].ToString() + "'," + "'" + dt.Rows[x]["lga"].ToString() + "'," + "'" + strLgaDescr + "'," + "'" + dt.Rows[x]["birthdate"].ToString() + "'," + "'" + " " + "'," + "'" + " " + "'," + "'" + " " + "'," + "'" + " " + "'," + "'" + " " + "'," + "'" + false + "'," + "'" + false + "'," + "'" + false + "')"; dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError, "RnS Notification"); else { _totalSaved += 1; // update the webdb recruittaab string sqlUpdate = string.Empty; sqlUpdate = @" update recruittab set used = 'true'" + " where recrno = '" + dt.Rows[x]["recrno"].ToString() + "'"; dthm._update_Insert_NoParameter(sqlUpdate, ConfigurationManager.ConnectionStrings["rnsConString_webdb"].ConnectionString); try { dgvDestination.Rows[x].Cells[4].Value = true; } catch { } } } } else { MessageBox.Show("There are no records to processed", "RnS Notification"); lblprocessing.Visible = false; } } else MessageBox.Show("dthm.sqlUserError","RnS Notification"); if (_totalSaved > 0) MessageBox.Show(_totalSaved.ToString() + " records was committed Successfully", "RnS Notification"); lblprocessing.Visible = false; }