private void datagridServiceRecords_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e) { lblRowsCount.Text = dgvServiceRecord.Rows.Count.ToString(); if (dgvServiceRecord.Rows.Count == 0 && (TempHolder.searchedEmpID != null)) { btnImport.Visible = true; } if (dgvServiceRecord.Rows.Count == 0) { lblNoServiceRecord.Visible = true; txtFrom.ResetText(); txtTo.ResetText(); txtSchoolName.ResetText(); txtStation.ResetText(); txtBranch.ResetText(); txtDesignation.ResetText(); txtStatus.ResetText(); txtSalary.ResetText(); txtCause.ResetText(); txtLAWOP.ResetText(); TempHolder.clearLastRecord(); } detectLastRow(); }
public void clearDisplay() { TempHolder.clearLastRecord(); if (dgvServiceRecord.Rows.Count > 0) { dgvServiceRecord.Rows.Clear(); } btnDelete.Enabled = false; lblNoServiceRecord.Visible = false; txtSchoolName.ResetText(); txtStation.ResetText(); txtBranch.ResetText(); txtDesignation.ResetText(); txtStatus.ResetText(); txtFrom.ResetText(); txtTo.ResetText(); txtSalary.ResetText(); txtCause.ResetText(); txtLAWOP.ResetText(); btnImport.Visible = false; btnEdit.Enabled = false; btnExport.Enabled = false; btnAddRecord.Enabled = false; }
private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { TempHolder.quitExcel(); if (!fromLogout) { Application.Exit(); } }
public void clearDisplay() { Console.WriteLine("Clear Display -Main"); TempHolder.clearSearchTempValues(); pictureBox1.Invalidate(); pictureBox1.Image = Properties.Resources.default_avatar; lblUploadedPicture.ResetText(); lblemployee_id_hidden.ResetText(); lblemployee_id_hidden.ResetText(); txtSchoolName.ResetText(); txtDesignation.ResetText(); txtDateOfOriginalAppointment.ResetText(); //tabs TempHolder.uc_PersonalInfo.clearDisplay(); TempHolder.uc_ServiceRecord.clearDisplay(); }
public bool getPreviousRowInfo(int selectedindex) { //-1 means adding new int prevRowIndex; if (dgvServiceRecord.RowCount > 0) { if (selectedindex > 0) { prevRowIndex = selectedindex - 1; } else if (selectedindex == -1) { prevRowIndex = dgvServiceRecord.RowCount - 1; } else { MessageBox.Show("First row is your currently selected row there is no previous service record", "Oops", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } TempHolder.setPrevRowVar(getDGVString(prevRowIndex, 0), getDGVString(prevRowIndex, 1), getDGVString(prevRowIndex, 2), getDGVString(prevRowIndex, 3), getDGVString(prevRowIndex, 4), getDGVString(prevRowIndex, 5), getDGVString(prevRowIndex, 6), getDGVString(prevRowIndex, 7), getDGVString(prevRowIndex, 8), getDGVString(prevRowIndex, 9), getDGVString(prevRowIndex, 10)); return(true); } else { MessageBox.Show("There is no previous service record", "Oops", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } return(false); }
public void detectLastRow() { int lastIndex = dgvServiceRecord.Rows.Count - 1; if (lastIndex != -1) { TempHolder.lastServiceRecordId = dgvServiceRecord.Rows[lastIndex].Cells[0].Value.ToString(); string school = dgvServiceRecord.Rows[lastIndex].Cells[1].Value.ToString(); string from = dgvServiceRecord.Rows[lastIndex].Cells[2].Value.ToString(); string to = dgvServiceRecord.Rows[lastIndex].Cells[3].Value.ToString(); string designation = dgvServiceRecord.Rows[lastIndex].Cells[4].Value.ToString(); string status = dgvServiceRecord.Rows[lastIndex].Cells[5].Value.ToString(); string salary = dgvServiceRecord.Rows[lastIndex].Cells[6].Value.ToString(); string station = dgvServiceRecord.Rows[lastIndex].Cells[7].Value.ToString(); string branch = dgvServiceRecord.Rows[lastIndex].Cells[8].Value.ToString(); string cause = dgvServiceRecord.Rows[lastIndex].Cells[9].Value.ToString(); string lawop = dgvServiceRecord.Rows[lastIndex].Cells[10].Value.ToString(); DateTime dt; if (DateTime.TryParse(from, out dt)) { TempHolder.lastFrom = dt.ToString("MM/dd/yyyy"); } if (DateTime.TryParse(to, out dt)) { TempHolder.lastTo = dt.ToString("MM/dd/yyyy"); TempHolder.lastIsPresent = false; } else if (to.ToLower().Equals("present")) { TempHolder.lastIsPresent = true; } TempHolder.searchedLastSchool = school; TempHolder.lastDesignation = designation; TempHolder.lastStatus = status; if (salary.Length == 0) { TempHolder.lastSalary = "0.00"; } TempHolder.lastSalary = salary; TempHolder.lastStation = station; TempHolder.lastBranch = branch; TempHolder.lastCause = cause; TempHolder.lastLAWOP = lawop; String searchValue = "original"; int rowIndex = -1; foreach (DataGridViewRow row in dgvServiceRecord.Rows) { if (row.Cells[9].Value.ToString().ToLower().Contains(searchValue)) { rowIndex = row.Index; break; } } if (rowIndex != -1) { TempHolder.searchedOriginalAppointment = dgvServiceRecord.Rows[rowIndex].Cells[2].Value.ToString(); } else { TempHolder.searchedOriginalAppointment = null; } } else { TempHolder.clearLastRecord(); } TempHolder.mainForm.showOtherEmpInfo(); }