public void _getData( string queryString ) { radHeader1.Checked = true; dt = new DataTable(); dtCache = new DataTable(); datamethods2 dtmth = new datamethods2(); if (useRIMSConnString == true) dt = dtmth._dataTable_NoParameter_RIMS(queryString); // use RIMS connstring else dt = dtmth._dataTable_NoParameter(queryString); // use RnS connString if (dtmth.sqlUserError == string.Empty) { dv = new DataView(); dv = dt.DefaultView; grdSearch.DataSource = dv; dtCache = dt; } if (strHeader1.Trim() == string.Empty) { radHeader1.Text = "ID"; } else { radHeader1.Text = strHeader1; } if (strHeader2.Trim() == string.Empty) { radHeader2.Text = "Description"; radHeader2.Visible = false; } else { radHeader2.Text = strHeader2; } if (strHeader3.Trim() == string.Empty) { radHeader3.Text = "Description 2"; radHeader3.Visible = false; } else { radHeader3.Text = strHeader3; } if (strHeader4.Trim() == string.Empty) { radHeader4.Text = "Description 3"; radHeader4.Visible = false; } else { radHeader4.Text = strHeader4; } }
private void button1_Click(object sender, EventArgs e) { datamethods2 dmth = new datamethods2(); if (radrecrnoonly.Checked == true && txtsearchvalue.Text.Trim() != string.Empty) { database2BindingSource.DataSource = database2TableAdapter.GetDataByRecrnoOnly(prv_recrno.Trim()); this.reportViewer1.RefreshReport(); } // for like if (radlikeonly.Checked == true && txtsearchvalue.Text.Trim() != string.Empty) { try { string selValue = cmblikeselection.SelectedItem.ToString(); String sqlSelect = @"select distinct * from database2 " + " where ltrim(rtrim(" + selValue.Trim() + ")) LIKE '" + txtsearchvalue.Text.Trim() + "%'"; DataTable dt = new DataTable(); dt = dmth._dataTable_NoParameter(sqlSelect, ConfigurationManager.ConnectionStrings["rnsConString"].ConnectionString); if (dmth.sqlUserError.Trim() == string.Empty) { // bind the datasource to the selected query datatable if (dt.Rows.Count > 0) { database2BindingSource.DataSource = dt; this.reportViewer1.RefreshReport(); } else MessageBox.Show("Records records not found!", "RnS Notification"); } else { MessageBox.Show(dmth.sqlUserError.Trim()); MessageBox.Show("Error occured, pls, try again(1)!", "RnS Notification"); dt.Dispose(); } } catch { dmth.sqlUserError.Trim(); MessageBox.Show("Error occured, pls, try again(2)!", "RnS Notification"); } } if (radall.Checked == true ) { database2BindingSource.DataSource = database2TableAdapter.GetData(); this.reportViewer1.RefreshReport(); } }
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 audittray() { datamethods2 dthm = new datamethods2(); dthm.audittray("Setup/Modify User " + txtusername.Text.Trim()); }
private void saveRecords() { if (txtid.Text.Trim() == string.Empty) { MessageBox.Show("ID can't be empty!","Missing ID"); return; } if (txtusername.Text.Trim() == string.Empty) { MessageBox.Show("Username can't be empty!", "Missing Username"); return; } if (txtpassword.Text.Trim() == string.Empty) { MessageBox.Show("Password can't be empty!", "Missing Password"); return; } if (newRecords == true ) { if (txtconfirm.Text.Trim() == string.Empty) { MessageBox.Show("Confirm Password pls.", "Missing Password"); return; } if (txtpassword.Text.Trim() != txtconfirm.Text.Trim()) { MessageBox.Show("Password and Confirm Password are not the same!", "Missing Password"); return; } } string strid = "'" + txtid.Text.Trim() + "'"; string strusername = "******" + txtusername.Text + "'"; string strpassword = "******" + txtpassword.Text + "'"; string boolSuspend = "'" + chksuspended.Checked + "'"; string booldatabase1 = "'" + chkdatabase1.Checked + "'"; string booldatabase2 = "'" + chkdatabase2.Checked + "'"; string boolclientsetup = "'" + chkclients.Checked + "'"; string booldownload = "'" + chkdownload.Checked + "'"; string boolusersetup = "'" + chkusers.Checked + "'"; string boolcrequest = "'" + chkclientrequest.Checked + "'"; string boolothersetup = "'" + chksetups.Checked + "'"; string boolreports = "'" + chkreports.Checked + "'"; // // save new records if (newRecords == true) { datamethods2 dthm = new datamethods2(); string sqlInsert = string.Empty; sqlInsert = @" insert into useracct (userid,pwd,names,suspend,database1,database2, clientsetup,download,usersetup,crequest,othersetup,reports) values (" + strid + "," + strpassword + "," + strusername + "," + boolSuspend + "," + booldatabase1 + "," + booldatabase2 + "," + boolclientsetup + "," + booldownload + "," + boolusersetup + "," + boolcrequest + "," + boolothersetup + "," + boolreports + ")"; int returnVal = dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError); else { MessageBox.Show("Records Saved.", "RnS Notification"); clearScreen(); } } else { datamethods2 dthm = new datamethods2(); string sqlInsert = string.Empty; sqlInsert = @" update useracct set pwd = " + strpassword + "," + " names= " + strusername + "," + " suspend = " + boolSuspend+ "," + " database1 = " + booldatabase1 + "," + " database2 = " + booldatabase2 + "," + " clientsetup = " + boolclientsetup + "," + " download= "+ booldownload + "," + " usersetup= " + boolusersetup + "," + " crequest= " + boolcrequest + "," + " othersetup= " + boolothersetup + "," + " reports= " + boolreports + " where userid = " + strid ; int returnVal = dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError); else { MessageBox.Show("Update was successful Saved.", "RnS Notification"); clearScreen(); } } }
private void saveRecords() { if (txtid.Text.Trim() == string.Empty) { MessageBox.Show("ID can't be empty!", "Missing ID"); return; } if (txtsurname.Text.Trim() == string.Empty) { MessageBox.Show("Username can't be empty!", "Missing Username"); return; } if (txtfirstname.Text.Trim() == string.Empty) { MessageBox.Show("Username can't be empty!", "Missing Username"); return; } string strid = "'" + txtid.Text.Trim() + "'"; string strsurname = "'" + txtsurname.Text + "'"; string strfirstname = "'" + txtfirstname.Text + "'"; string strtxtmiddlename= "'" + txtmiddlename.Text + "'"; string strinitials = "'" + txtinitials.Text + "'"; string strtitle = "'" + cmbtitle.SelectedItem.ToString().Trim() + "'"; string straddress = "'" + txtaddress.Text + "'"; string strgender = "'" + cmbgender.SelectedItem.ToString().Trim() + "'"; string strdob = "'" + mskdob.Text + "'"; string strage = "'" + mskage.Text + "'"; string stremail = "'" + txtemail.Text + "'"; string strphone = "'" + mskphone.Text + "'"; string strlocation = "'" + txtlocation.Text + "'"; string strqualification = "'" + txtqualification.Text + "'"; string strgrade = "'" + txtgrade.Text + "'"; string strdocscreened = "'" + chkdocscreened.Checked + "'"; string straptested = "'" + chkaptested.Checked + "'"; string strtransfered = "'" + chktransfered.Checked + "'"; string strTextResult = "'" + cmbtestresult.SelectedItem.ToString().Trim() + "'"; // // save new records if (newRecords == true) { datamethods2 dthm = new datamethods2(); string sqlInsert = string.Empty; sqlInsert = @" insert into database1 (recrno,surname,firstname,middlename,initials,address, title,sex,birthdate,age,phone,email,lgadescr,qualdescr,gradedescr,screened,aptest, active,testresult,lgacode,qualcode,gradecode) values (" + strid + "," + strsurname + "," + strfirstname + "," + strtxtmiddlename + "," + strinitials + "," + straddress + "," + strtitle + "," + strgender + "," + strdob + "," + strage + "," + strphone + "," + stremail + "," + strlocation + "," + strqualification + "," + strgrade + "," + strdocscreened + "," + straptested + "," + strtransfered + "," + strTextResult + "," + "'" + prv_location + "'" + "," + "'" + prv_qual + "'" + "," + "'" + prv_grade + "'" + "," + ")"; int returnVal = dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError); else { MessageBox.Show("Records Saved.", "RnS Notification"); clearScreen(); } } else { datamethods2 dthm = new datamethods2(); string sqlInsert = string.Empty; sqlInsert = @" update database1 set surname = " + strsurname + "," + " firstname= " + strfirstname + "," + " middlename = " + strtxtmiddlename + "," + " initials = " + strinitials + "," + " address = " + straddress + "," + " title = " + strtitle + "," + " sex= " + strgender + "," + " birthdate= " + strdob + "," + " age= " + strage + "," + " phone= " + strphone + "," + " email= " + stremail + "," + " lgadescr= " + strlocation + "," + " qualdescr= " + strqualification + "," + " gradedescr= " + strgrade + "," + " screened= " + strdocscreened + "," + " aptest= " + straptested + "," + " active= " + strtransfered + "," + " testresult= " + strTextResult + "," + " lgacode= " + "'" + prv_location + "'" + "," + " qualcode= " + "'" + prv_qual + "'" + "," + " gradecode= " + "'" + prv_grade + "'" + " where recrno = " + strid; int returnVal = dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError); else { MessageBox.Show("Update was successful Saved.", "RnS Notification"); clearScreen(); } } }
private void saveRecords_database1() { 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 < grdCandidate.Rows.Count; x++) { if (grdCandidate.Rows[x].Cells[0].Value.ToString() != null && grdCandidate.Rows[x].Cells[0].Value.ToString().Trim() != string.Empty) { if (Convert.ToBoolean(grdCandidate.Rows[x].Cells[4].Value) == true) lstRecrno.Add(grdCandidate.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("Select not made", "RnS Notification"); return; } // save the records datamethods2 dthm = new datamethods2(); DataTable dt = new DataTable(); string sqlQueury = "Select distinct * from database1 "; sqlQueury += sqlInsertwhere; MessageBox.Show(sqlQueury); dt = dthm._dataTable_NoParameter(sqlQueury); if (dthm.sqlUserError == string.Empty) { if (dt.Rows.Count > 0) { _totalSaved = 0; for (int x = 0; x < dt.Rows.Count; x++) { // insert into database 2 string sqlInsert = string.Empty; sqlInsert = @" Insert into database2 " + "(recrno,surname,firstname,middlename,initials,address, " + " title,sex,age,phone,email,lgacode,lgadescr,birthdate,gradecode,gradedescr,screened,aptest,active," + " qualdescr,qualcode,manager,testsult,modifiedby," + " inview,documented,medical,interviewed,shl,induction)" + " values ('" + dt.Rows[x]["recrno"].ToString() + "'," + "'" + dt.Rows[x]["surname"].ToString() + "'," + "'" + dt.Rows[x]["firstname"].ToString() + "'," + "'" + dt.Rows[x]["middlename"].ToString() + "'," + "'" + dt.Rows[x]["initials"].ToString() + "'," + "'" + dt.Rows[x]["address"].ToString() + "'," + "'" + dt.Rows[x]["title"].ToString() + "'," + "'" + dt.Rows[x]["sex"].ToString() + "'," + "'" + (DateTime.Now.Year - Convert.ToDateTime(dt.Rows[x]["birthdate"]).Year).ToString() + "'," + "'" + dt.Rows[x]["phone"].ToString() + "'," + "'" + dt.Rows[x]["email"].ToString() + "'," + "'" + dt.Rows[x]["lgacode"].ToString() + "'," + "'" + dt.Rows[x]["lgadescr"].ToString() + "'," + "'" + dt.Rows[x]["birthdate"].ToString() + "'," + "'" + " " + "'," + "'" + " " + "'," + "'" + false + "'," + "'" + false + "'," + "'" + false + "'," + "'" + " " + "'," + "'" + " " + "'," + "'" + Program.pbUserName.Trim()+ "'," + "'" + " " + "'," + "'" + " " + "'," + "'" + false + "'," + "'" + false + "'," + "'" + false + "'," + "'" + false + "'," + "'" + false + "'," + "'" + false + ")"; MessageBox.Show(sqlInsert); dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError, "RnS Notification"); else { string strTime = DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + x.ToString(); // insert into candidtaerequest 2 sqlInsert = string.Empty; //sqlInsert = @" Insert into candidatecallup " // + "(recrno,reqid,position,requestid,clientid,datesent, " // + " interview,ippased,employed,remarks)" // + " values ('" + dt.Rows[x]["recrno"].ToString() + "'," // + "'" + strTime + "'," // + "'" + lblposition.Text + "'," // + "'" + txtrequestid.Text + "'," // + "'" + txtclientid.Text + "'," // + "'" + "01/01/1900" + "'," // + "'" + false + "'," // + "'" + false + "'," // + "'" + false + "'," // + "'" + " " + "'" // + ")"; sqlInsert = @" Insert into candidatecallup " + "(recrno,reqid,posdescr,requestid,clientid, position,,reqdescr)" + " values ('" + dt.Rows[x]["recrno"].ToString() + "'," + "'" + strTime + "'," + "'" + lblposition.Text + "'," + "'" + txtrequestid.Text + "'," + "'" + txtclientid.Text + "'," + "'" + prv_Poscode.Trim() + "'" + "'" + lblrequestdescr.Text.Trim() + "'" + ")"; dthm._update_Insert_NoParameter(sqlInsert); // update into database1 sqlInsert = string.Empty; sqlInsert = @" update database1 set active = 'true' where recrno = '" + dt.Rows[x]["recrno"].ToString() + "'"; dthm._update_Insert_NoParameter(sqlInsert); _totalSaved += 1; try { grdCandidate.Rows[x].Cells[8].Value = true; } catch { } } } } else MessageBox.Show("There are no records to processed", "RnS Notification"); } else MessageBox.Show(dthm.sqlUserError, "RnS Notification"); if (_totalSaved > 0) MessageBox.Show(_totalSaved.ToString() + " records was committed Successfully", "RnS Notification"); }
private void populateGrid() { string strid = "'" + txtid.Text + "'"; String sqlSelect = @"select * from candidatecallup where recrno = " + strid; //DataTable dt = new DataTable(); datamethods2 dtmth = new datamethods2(); dt_callup.Rows.Clear(); dt_callup = dtmth._dataTable_NoParameter(sqlSelect); if (dtmth.sqlUserError == string.Empty) { if (dt_callup.Rows.Count > 0) { _addColumns(dt_callup); } } else { MessageBox.Show(dtmth.sqlUserError, "RnS Notification"); } }
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 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 _getOnlineRecords() { string strQuery = string.Empty; strQuery = "select recrno ,Surname, Othernames,Initials from recruittab where used = 'false'"; datamethods2 dmth = new datamethods2(); DataTable dt = new DataTable(); dt = dmth._dataTable_NoParameter_webdb(strQuery); if (dmth.sqlUserError == String.Empty) { if (dt.Rows.Count > 0) { dgvSource.Rows.Clear(); for (int x = 0; x < dt.Rows.Count; x++) { int n = dgvSource.Rows.Add(); dgvSource.Rows[n].Cells[0].Value = dt.Rows[x]["recrno"].ToString().Trim(); dgvSource.Rows[n].Cells[1].Value = dt.Rows[x]["surname"].ToString().Trim(); dgvSource.Rows[n].Cells[2].Value = dt.Rows[x]["othernames"].ToString().Trim(); dgvSource.Rows[n].Cells[3].Value = dt.Rows[x]["initials"].ToString().Trim(); } } else { MessageBox.Show("Records not available! ","RnS Notification"); } } else { MessageBox.Show(dmth.sqlUserError,"RnS Notification"); } }
private void _getDownloaded() { string strQuery = string.Empty; strQuery = "select recrno,Surname, firstname, middlename, Initials from database1"; datamethods2 dmth = new datamethods2(); DataTable dt = new DataTable(); dt = dmth._dataTable_NoParameter(strQuery); if (dmth.sqlUserError == String.Empty) { if (dt.Rows.Count > 0) { dgvDestination.Rows.Clear(); for (int x = 0; x < dt.Rows.Count; x++) { int n = dgvDestination.Rows.Add(); dgvDestination.Rows[n].Cells[0].Value = dt.Rows[x]["recrno"].ToString().Trim(); dgvDestination.Rows[n].Cells[1].Value = dt.Rows[x]["surname"].ToString(); dgvDestination.Rows[n].Cells[2].Value = dt.Rows[x]["firstname"].ToString().Trim() + " " + dt.Rows[x]["middlename"].ToString().Trim(); dgvDestination.Rows[n].Cells[3].Value = dt.Rows[x]["initials"].ToString().Trim(); dgvDestination.Rows[n].Cells[4].Value = true; } } else { MessageBox.Show("Records not available! ", "RnS Notification"); } } else { MessageBox.Show(dmth.sqlUserError, "RnS Notification"); } }
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; }
private void saveRecords_database2() { string strRecrno = String.Empty; string sqlInsertwhere = string.Empty; List<string> lstRecrno = new List<string>(); int _totalSaved = 0; datamethods2 dthm = new datamethods2(); // get all the recrno for (int x = 0; x < grdCandidate.Rows.Count; x++) { try { if (Convert.ToBoolean(grdCandidate.Rows[x].Cells[7].Value)== true && grdCandidate.Rows[x].Cells[0].Value.ToString().Trim() != string.Empty) { string strTime = DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + x.ToString(); MessageBox.Show(DateTime.Now.Date.ToString("yyyy/MM/dd")); // insert into candidtaerequest 2 string sqlInsert = string.Empty; sqlInsert = @" Insert into candidatecallup " + "(recrno,reqid,posdescr,request,clientid,position,reqdescr,dcallup)" + " values ('" + grdCandidate.Rows[x].Cells[0].Value.ToString() + "'," + "'" + strTime + "'," + "'" + lblposition.Text + "'," + "'" + txtrequestid.Text + "'," + "'" + txtclientid.Text + "'," + "'" + prv_Poscode.Trim() + "'," + "'" + lblrequestdescr.Text.Trim() + "'," + "'" + DateTime.Now.Date.ToString("yyyy/MM/dd") + "'" + ")"; dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError, "RnS Notification"); else { _totalSaved += 1; } // update the status of the grid try { grdCandidate.Rows[x].Cells[8].Value = true; } catch { } } } catch { } } if (_totalSaved > 0) MessageBox.Show(_totalSaved.ToString() + " records was committed Successfully", "RnS Notification"); }
private void Sample_report_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'rnsDataSet.clientrequest' table. You can move, or remove it, as needed. this.clientrequestTableAdapter.Fill(this.rnsDataSet.clientrequest); // TODO: This line of code loads data into the 'rnsDataSet.clientrequest' table. You can move, or remove it, as needed. //SqlConnection conn = new SqlConnection(); //conn.ConnectionString = ConfigurationManager.ConnectionStrings["rnsConString"].ConnectionString; //if (conn.State == ConnectionState.Closed) conn.Open(); //SqlCommand comm = new SqlCommand("select * from clientrequest where clientid = ''", conn); //rnsDataSet dr = new rnsDataSet(); // TODO: This line of code loads data into the 'rnsDataSet.clientrequest' table. You can move, or remove it, as needed. // TODO: This line of code loads data into the 'sampledataset.clientrequest' table. You can move, or remove it, as needed. datamethods2 dmth = new datamethods2(); //rnsDataSet dsrns = new rnsDataSet(); //MessageBox.Show(dsrns.Tables.Count.ToString()); //SqlDataAdapter da = new SqlDataAdapter(); //da.Fill(dsrns); this.reportViewer1.RefreshReport(); this.reportViewer1.RefreshReport(); }
private void populateGrid() { string strClientId = "'" + txtclientid.Text +"'"; string strRequestId = "'" + Program._searchedValue.Trim() + "'"; //if (!= string.Empty) txtrequestid.Text = Program._searchedValue; String sqlSelect = @"select * from clientrequest where clientid = " + strClientId + " and requestid = " + strRequestId; DataTable dt = new DataTable(); datamethods2 dtmth = new datamethods2(); dt = dtmth._dataTable_NoParameter(sqlSelect); if (dtmth.sqlUserError == string.Empty) { if (dt.Rows.Count > 0) { txtrequestid.Text = Program._searchedValue.Trim(); dtpdeadline.Value = Convert.ToDateTime(dt.Rows[0]["drequest"]); dtprequesteddate.Value = Convert.ToDateTime(dt.Rows[0]["reqdate"]); txttitle.Text = Program._searchedValue2; if (Convert.ToBoolean(dt.Rows[0]["status"]) == true) { chkactive.Checked = true; chkactive.Enabled = false; dtpdeadline.Enabled = false; } _addColumns(dt); } else { // create a new request id string strTime = DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString(); string strdate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString(); string newRequestId = txtclientid.Text.Trim().ToUpper() + "/" + strdate + "/" + strTime; txtrequestid.Text = newRequestId; dtpdeadline.Text = DateTime.Now.Date.ToString(); txttitle.Text = ""; } _formatCells(); } else { MessageBox.Show(dtmth.sqlUserError,"RnS Notification"); } txtrequestid.Enabled = false; //mskrequestdate.Focus(); }
private void saveRecords() { if (txtid.Text.Trim() == string.Empty) { MessageBox.Show("ID can't be empty!", "Missing ID"); return; } if (txtsurname.Text.Trim() == string.Empty) { MessageBox.Show("Username can't be empty!", "Missing Username"); return; } if (txtfirstname.Text.Trim() == string.Empty) { MessageBox.Show("Username can't be empty!", "Missing Username"); return; } if (txtclient.Text.Trim() != string.Empty) { if (txtrequest.Text.Trim() == string.Empty) { MessageBox.Show("Specify the client request!", "Missing request"); return; } } if (txtclient.Text.Trim() != string.Empty && txtrequest.Text.Trim() != string.Empty) { // if position is not selected if (txtposition.Text == String.Empty) { MessageBox.Show("Specified Position", "RnS Notification"); return; } // checked employment infos if (chkclientinterview.Checked == true) { // if emplyment type si not selected if (cmbemploymenttype.SelectedIndex == 0) { MessageBox.Show("Specified Employment Type", "RnS Notification"); return; } // if position is not selected if (txtposition.Text == String.Empty) { MessageBox.Show("Specified Position", "RnS Notification"); return; } // if int location is not selected if (interiewlocation.Text == String.Empty) { MessageBox.Show("Specified Interview Location", "RnS Notification"); return; } // if int location is not selected if (cmbintassessment.SelectedIndex==0) { MessageBox.Show("Specified Interview Assessment", "RnS Notification"); return; } } // if int location is not selected if (chkcinduction.Checked==true && cmbcindsult.SelectedIndex == 0 ) { MessageBox.Show("Specified Induction Result", "RnS Notification"); return; } } string strentrydate = string.Empty; if (mskrecordmanagerdate.MaskFull == false) strentrydate = "'" + DateTime.Now.ToString("yyyy/MM/dd") + "'"; else strentrydate = "'" + Convert.ToDateTime(mskrecordmanagerdate.Text).ToString("yyyy/MM/dd") + "'"; string strid = "'" + txtid.Text.Trim() + "'"; string strsurname = "'" + txtsurname.Text + "'"; string strfirstname = "'" + txtfirstname.Text + "'"; string strtxtmiddlename = "'" + txtmiddlename.Text + "'"; string strinitials = "'" + txtinitials.Text + "'"; string strtitle = "'" + cmbtitle.Text + "'"; string straddress = "'" + txtaddress.Text + "'"; string strgender = "'" + cmbgender.Text + "'"; string strdob = "'" + dtpdob.Value.ToString("yyyy/MM/dd") + "'"; string strage = "'" + mskage.Text + "'"; string stremail = "'" + txtemail.Text + "'"; string strphone = "'" + mskphone.Text + "'"; string strlocation = "'" + txtlocation.Text + "'"; string strqualification = "'" + txtqualification.Text + "'"; string strgrade = "'" + txtgrade.Text + "'"; string straptested = "'" + chkaptested.Checked + "'"; string stremployed = "'" + chkcinduction.Checked + "'"; string strdocumented = "'" + chkdocumented.Checked + "'"; string stractive = "'" + chkactive.Checked + "'"; string strmedical = "'" + chkmedical.Checked + "'"; string stricslinterviewd = "'" + chkicslinterview.Checked + "'"; string strdtpclientinterviewdate = dtpclientinterviewdate.Text; string strmskresumptiondate = dtpresumptiondate.Text; string strRequestdescr = "'" + txtrequest.Text + "'"; string strModifiedBy = "'" + Program.pbUserName + "'"; // // save new records if (newRecords == true) { strModifiedBy = "'" + string.Empty + "'"; datamethods2 dthm = new datamethods2(); string sqlInsert = string.Empty; sqlInsert = @" insert into database2 (recrno,surname,firstname,middlename,initials,address, title,sex,birthdate,age,phone,email,lgadescr,qualdescr,gradedescr,aptest, documented,active,interviewed, medical, intersult, medsult, medissue, essay, essaysult, induction, inductsult, shl, manager, lgacode, gradecode, qualcode, testsult, entrydate, modifydate, modifiedby ) values (" + strid + "," + strsurname + "," + strfirstname + "," + strtxtmiddlename + "," + strinitials + "," + straddress + "," + strtitle + "," + strgender + "," + strdob + "," + strage + "," + strphone + "," + stremail + "," + strlocation + "," + strqualification + "," + strgrade + "," + straptested + "," + strdocumented + "," + stractive + "," + stricslinterviewd + "," + strmedical + "," + "'" + cmdtinterviewresult.SelectedItem.ToString().Trim() + "'" + "," + "'" + cmbmedicalresult.SelectedItem.ToString().Trim() + "'" + "," + "'" + txtmedissue.Text.Trim() + "'" + "," + "'" + chkessay.Checked + "'" + "," + "'" + cmbessayresult.SelectedItem.ToString().Trim() + "'" + "," + "'" + chkinduction.Checked + "'" + "," + "'" + cmbinductionresult.SelectedItem.ToString().Trim() + "'" + "," + "'" + chkshl.Checked + "'" + "," + "'" + txtmanager.Text.Trim() + "'" + "," + "'" + prv_location + "'" + "," + "'" + prv_grade + "'" + "," + "'" + prv_qual + "'" + "," + "'" + cmbtestresult.SelectedItem.ToString().Trim() + "'" + "," + strentrydate + "," + "'" + "" + "'" + "," + strModifiedBy + ")"; int returnVal = dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError); else { saveToClientRequest(); MessageBox.Show("Records Saved.", "RnS Notification"); clearScreen(); } } else // do update { datamethods2 dthm = new datamethods2(); string sqlInsert = string.Empty; sqlInsert = @" update database2 set surname = " + strsurname + "," + " firstname= " + strfirstname + ", middlename = " + strtxtmiddlename + ", initials = " + strinitials + "," + " address = " + straddress + "," + " title = " + strtitle + "," + " sex= " + strgender + "," + " birthdate= " + strdob + "," + " age= " + strage + "," + " phone= " + strphone + "," + " email= " + stremail + "," + " lgadescr= " + strlocation + "," + " qualdescr= " + strqualification + "," + " gradedescr= " + strgrade + "," + " aptest= " + straptested + "," + " documented= " + strdocumented + "," + " active= " + stractive + "," + " medical= " + strmedical + "," + " interviewed = " + stricslinterviewd + "," + "intersult= " + "'" + cmdtinterviewresult.SelectedItem.ToString().Trim() + "'" + "," + "medsult= " + "'" + cmbmedicalresult.SelectedItem.ToString().Trim() + "'" + "," + "medissue= " + "'" + txtmedissue.Text.Trim() + "'" + "," + "essay= " + "'" + chkessay.Checked + "'" + "," + "essaysult= " + "'" + cmbessayresult.SelectedItem.ToString().Trim() + "'" + "," + "induction= " + "'" + chkinduction.Checked + "'" + "," + "inductsult= " + "'" + cmbinductionresult.SelectedItem.ToString().Trim() + "'" + "," + "shl= " + "'" + chkshl.Checked + "'" + "," + "manager= " + "'" + txtmanager.Text.Trim() + "'" + "," + "lgacode= " + "'" + prv_location.Trim() + "'" + "," + "gradecode= " + "'" + prv_grade.Trim() + "'" + "," + "qualcode= " + "'" + prv_qual.Trim() + "'" + "," + "testsult= " + "'" + cmbtestresult.SelectedItem.ToString().Trim() + "'" + "," + "entrydate= " + strentrydate + "," + "modifydate= " + "'" + DateTime.Now.ToString("yyyy/MM/dd") + "'" + "," + "modifiedby= " + "'" + Program.pbUserName + "'" + " where recrno = " + strid; int returnVal = dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError); else { saveToClientRequest(); updateDatabase1_active(); MessageBox.Show("Done.", "RnS Notification"); clearScreen(); } } }
private void saveRecords() { if (chkactive.Enabled == false) { MessageBox.Show("This request is closed", "RnS Notification"); return; } if (txtclientid.Text.Trim() == string.Empty) { MessageBox.Show("Client can't be empty!", "Missing Client ID"); return; } if (txtrequestid.Text.Trim() == string.Empty) { MessageBox.Show("Request ID can't be empty!", "Missing Request ID"); return; } //if (dtpdeadline.Text.Trim() == string.Empty) //{ // MessageBox.Show("Request Date can't be empty!", "Missing Request Date"); // return; //} if (txttitle.Text.Trim() == string.Empty) { MessageBox.Show("Request Title can't be empty!", "Missing Request Title"); return; } string strClientID = txtclientid.Text.Trim() ; string strrequestid = txtrequestid.Text ; string strrequestdate = dtprequesteddate.Value.ToShortDateString(); string strDeadeline = dtpdeadline.Value.ToShortDateString(); string strTitle= txttitle.Text; if (strrequestdate == string.Empty) strrequestdate = DateTime.Now.ToString(); string strActive = chkactive.Checked.ToString(); int _totalSaved = 0; datamethods2 dthm = new datamethods2(); for (int x = 0; x < grdClientRequest.Rows.Count; x++) { if (grdClientRequest.Rows[x].Cells[1].Value.ToString() != null && grdClientRequest.Rows[x].Cells[1].Value.ToString().Trim() != string.Empty) { string reqid = grdClientRequest.Rows[x].Cells[0].Value.ToString(); string sPosition = grdClientRequest.Rows[x].Cells[1].Value.ToString(); string qual1 = grdClientRequest.Rows[x].Cells[2].Value.ToString(); string qual2 = grdClientRequest.Rows[x].Cells[3].Value.ToString(); string qual3 = grdClientRequest.Rows[x].Cells[4].Value.ToString(); string qual4 = grdClientRequest.Rows[x].Cells[5].Value.ToString(); string RequestNo = grdClientRequest.Rows[x].Cells[6].Value.ToString(); string Location = grdClientRequest.Rows[x].Cells[7].Value.ToString(); string SupplyNo = grdClientRequest.Rows[x].Cells[8].Value.ToString(); string InterviewNo = grdClientRequest.Rows[x].Cells[9].Value.ToString(); string EmployedNo = grdClientRequest.Rows[x].Cells[10].Value.ToString(); string Remarks = grdClientRequest.Rows[x].Cells[11].Value.ToString(); Boolean newkeyid = Convert.ToBoolean(grdClientRequest.Rows[x].Cells[12].Value); string strposcode = grdClientRequest.Rows[x].Cells[13].Value.ToString(); string strlgacode = grdClientRequest.Rows[x].Cells[14].Value.ToString(); if (newkeyid == false) //existing: do Update { string sqlUpdate = string.Empty; sqlUpdate = @" update clientrequest set position = '" + sPosition + "'," + " qual1= '" + qual1 + "'," + " qual2 = '" + qual2 + "'," + " qual3 = '" + qual3 + "'," + " qual4 = '" + qual4 + "'," + " RequestNo = '" + RequestNo + "'," + " Location= '" + Location + "'," + " EmployedNo= '" + EmployedNo + "'," + " InterviewNo= '" + InterviewNo + "'," + " SupplyNo= '" + SupplyNo + "'," + " status= '" + strActive + "'," + " drequest= '" + dtpdeadline.Value.ToString("yyyy/MM/dd") + "'," + " reqdate= '" + dtprequesteddate.Value.ToString("yyyy/MM/dd") + "'," + " title= '" + strTitle + "'," + " poscode= '" + strposcode.Trim() + "'," + " lgacode = '" + strlgacode + "'," + " Remarks= '" + Remarks + "'" + " where clientid = '" + strClientID + "'" + " and requestid= '" + strrequestid + "'" + " and reqid= '" + reqid + "'"; dthm._update_Insert_NoParameter(sqlUpdate); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError,"RnS Notification"); else { _totalSaved += 1; } } else // new: do insert { string sqlInsert = string.Empty; sqlInsert = @" Insert into clientrequest " + "(position,qual1,qual2,qual3,qual4,RequestNo, " + " poscode,lgacode,Location,EmployedNo,InterviewNo,SupplyNo,Remarks,status,drequest,reqdate,clientid,requestid,reqid,title)" + " values ('" + sPosition + "'," + "'" + qual1 + "'," + "'" + qual2 + "'," + "'" + qual3 + "'," + "'" + qual4 + "'," + "'" + RequestNo + "'," + "'" + strposcode.Trim() + "'," + "'" + strlgacode.Trim() + "'," + "'" + Location + "'," + "'" + EmployedNo + "'," + "'" + InterviewNo + "'," + "'" + SupplyNo + "'," + "'" + Remarks + "'," + "'" + strActive + "'," + "'" + dtpdeadline.Value.ToString("yyyy/MM/dd") + "'," + "'" + dtprequesteddate.Value.ToString("yyyy/MM/dd") + "'," + "'" + strClientID + "'," + "'" + strrequestid + "'," + "'" + reqid + "'," + "'" + strTitle + "'" + ")"; dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError, "RnS Notification"); else { _totalSaved += 1; } } } } if (_totalSaved > 0) { MessageBox.Show(_totalSaved.ToString() + " records was committed Successfully", "RnS Notification"); clearScreen(); } else MessageBox.Show(_totalSaved.ToString() + " records was committed Successfully", "RnS Notification"); }
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; 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 updateDatabase1_active() { string strid = "'" + txtid.Text.Trim() + "'"; datamethods2 dthm = new datamethods2(); string sqlInsert = string.Empty; sqlInsert = @" update database1 set active = 'true' where recrno = " + strid; int returnVal = dthm._update_Insert_NoParameter(sqlInsert); if (dthm.sqlUserError.Trim() != string.Empty) MessageBox.Show(dthm.sqlUserError); }
private void populateGrid() { if (txtclientid.Text == string.Empty || txtrequestid.Text == string.Empty) { MessageBox.Show("Both Client and Request must be specified","RnS Notification"); return; } grdCandidate.Rows.Clear(); dt_shortlisted.Rows.Clear(); string strClientId = "'" + txtclientid.Text + "'"; string strRequestId = "'" + Program._searchedValue.Trim() + "'"; int _totalSaved = 0; _totalSaved = 0; List<string> lstRecrno = new List<string>(); string strParam = string.Empty; string strWhereCaluse = string.Empty; if (cmbgender.SelectedItem.ToString().Trim() != string.Empty) strParam = strParam + " and a.sex = '" + cmbgender.SelectedItem.ToString().Trim() + "'"; if (txtlocation.Text.Trim() != string.Empty) strParam = strParam + " and a.lgacode = '" + prv_location.Trim() + "'"; if (txtqualification.Text.Trim() != string.Empty) strParam = strParam + " and a.qualcode = '" + prv_qual.Trim() + "'"; if (txtgrade.Text.Trim() != string.Empty) strParam = strParam + " and a.gradecode = '" + prv_grade.Trim() + "'"; if (chkaptested.Checked == true) { if (cmbtestresult.Text.Trim() == string.Empty) { MessageBox.Show("Specify Test Result", "RnS Notification"); return; } if (cmbtestresult.Text.Trim() != string.Empty) { strParam = strParam + " and a.aptest = 'true' and a.testsult = '" + cmbtestresult.Text.Trim() + "'"; } } if (mskage.Text != string.Empty && mskage2.Text != string.Empty) { if ( Convert.ToInt32(mskage.Text) < Convert.ToInt32(mskage2.Text)) { strParam = strParam + " and a.age between " + mskage.Text + " and " + mskage2.Text; } if (Convert.ToInt32(mskage.Text) > Convert.ToInt32(mskage2.Text)) { strParam = strParam + " and a.age between " + mskage2.Text + " and " + mskage.Text; } if (Convert.ToInt32(mskage.Text) == Convert.ToInt32(mskage2.Text)) { strParam = strParam + " and a.age between " + mskage2.Text + " and " + mskage.Text; } } //if (!= string.Empty) txtrequestid.Text = Program._searchedValue; // ----- selection from database 1 if ( raddatabase1.Checked == true ) { String sqlSelect = @"select distinct a.* from database1 a where a.recrno not in (select recrno from database2)" + strParam; // String sqlSelect = @"select distinct * from database1 // where active = 'false' and recrno not in (select recrno from database2)" + strParam; DataTable dt = new DataTable(); datamethods2 dtmth = new datamethods2(); dt = dtmth._dataTable_NoParameter(sqlSelect); if (dtmth.sqlUserError == string.Empty) { if (dt.Rows.Count > 0) { dt_shortlisted = dt; _addColumns(dt); } else MessageBox.Show("Requested records not found!", "RnS Notification"); } else { MessageBox.Show(dtmth.sqlUserError, "RnS Notification"); } } // ----- selection from database 2 //interview if (chkicslinterview.Checked == true) { if (cmdtinterviewresult.Text.Trim() == string.Empty) { MessageBox.Show("Specify ICSL Interview Result", "RnS Notification"); return; } if (cmdtinterviewresult.Text.Trim() != string.Empty) { strParam = strParam + " and a.interviewed = 'true' and a.intersult = '" + cmdtinterviewresult.Text.Trim() + "'"; } } //medical if (chkmedical.Checked == true) { if (cmbmedicalresult.Text.Trim() == string.Empty) { MessageBox.Show("Specify Medical Result", "RnS Notification"); return; } if (cmbmedicalresult.Text.Trim() != string.Empty) { strParam = strParam + " and a.medical = 'true' and a.medsult = '" + cmbmedicalresult.Text.Trim() + "'"; } } //essay if (chkessay.Checked == true) { if (cmbessayresult.Text.Trim() == string.Empty) { MessageBox.Show("Specify Essay Result", "RnS Notification"); return; } if (cmbessayresult.Text.Trim() != string.Empty) { strParam = strParam + " and a.essay = 'true' and a.essaysult = '" + cmbessayresult.Text.Trim() + "'"; } } //induction if (chkinduction.Checked == true) { if (cmbinductionresult.Text.Trim() == string.Empty) { MessageBox.Show("Specify ICSL Induction assessment", "RnS Notification"); return; } if (cmbinductionresult.Text.Trim() != string.Empty) { strParam = strParam + " and a.induction = 'true' and a.inductsult = '" + cmbinductionresult.Text.Trim() + "'"; } } //documented if (chkdocumented.Checked == true) strParam = strParam + " and a.documented = 'true' "; //chkshl if (chkshl.Checked == true) strParam = strParam + " and a.shl = 'true' "; //client induction if (chkcinduction.Checked == true) { if (cmbcindsult.Text.Trim() == string.Empty) { MessageBox.Show("Specify client Induction assessment", "RnS Notification"); return; } if (cmbcindsult.Text.Trim() != string.Empty) { strParam = strParam + " and b.cinduction = 'true' and b.cindsult = '" + cmbcindsult.Text.Trim() + "'"; } } //client interview if (chkcinterview.Checked == true) { if (chkcintsult.Text.Trim() == string.Empty) { MessageBox.Show("Specify client interview assessment", "RnS Notification"); return; } strParam = strParam + " and b.cinterview = 'true' and b.cintersult = '" + chkcintsult.Text.Trim() + "'"; } //emp type if (cmbemploymenttype.Text.Trim() != string.Empty) { strParam = strParam + " and b.emptype = '" + cmbemploymenttype.Text.Trim() + "'"; } if (raddatabase2.Checked == true) { String sqlSelect = @"select distinct a.* from database2 a, candidatecallup b where a.recrno = b.recrno and (a.active = 'false' or a.active = 'true' )" + strParam; //MessageBox.Show(sqlSelect); //return; DataTable dt = new DataTable(); datamethods2 dtmth = new datamethods2(); dt = dtmth._dataTable_NoParameter(sqlSelect); if (dtmth.sqlUserError == string.Empty) { if (dt.Rows.Count > 0) { dt_shortlisted = dt; _addColumns(dt); } else MessageBox.Show("Requested records not found!", "RnS Notification"); } else { MessageBox.Show(dtmth.sqlUserError, "RnS Notification"); } } grdCandidate.Focus(); raddatabase1.Enabled = false; raddatabase2.Enabled = false; }