private void initVariables() { //249, 29 pnlLeaveSanctionLimitOuter.Location = new Point(249, 20); pnlLeaveTypeOuter.Location = new Point(249, 20); pnlLeaveOfficeMapOuter.Location = new Point(249, 20); pnlLeaveSanctionLimitOuter.Parent = pnlUI; pnlLeaveTypeOuter.Parent = pnlUI; pnlLeaveOfficeMapOuter.Parent = pnlUI; pnlLeaveSanctionLimitInner.Parent = pnlLeaveSanctionLimitOuter; pnlLeaveTypeInner.Parent = pnlLeaveTypeOuter; pnlLeaveOfficeMapInner.Parent = pnlLeaveOfficeMapOuter; OfficeDB.fillOfficeComboNew(cmbLomOffice); CatalogueValueDB.fillCatalogValueComboNew(cmbLslDesignation, "Designation"); CatalogueValueDB.fillCatalogValueComboNew(cmbGender, "Gender"); LeaveSettingsdb.fillLeaveComboNew(cmbLomLeaveID); LeaveSettingsdb.fillLeaveComboNew(cmbLslLeaveID); cmbGender.Items.Add("All"); btnNew.Visible = false; pnlLeaveOfficeMapOuter.Visible = false; pnlLeaveSanctionLimitOuter.Visible = false; pnlLeaveTypeOuter.Visible = false; }
private void btnLeaveOfficeMapping_Click(object sender, EventArgs e) { OfficeDB.fillOfficeComboNew(cmbLomOffice); CatalogueValueDB.fillCatalogValueComboNew(cmbLslDesignation, "Designation"); CatalogueValueDB.fillCatalogValueComboNew(cmbGender, "Gender"); LeaveSettingsdb.fillLeaveComboNew(cmbLomLeaveID); cmbGender.Items.Add("All"); LeaveSettingsdb.fillLeaveComboNew(cmbLslLeaveID); leaveofficemapping(); }
private void initVariables() { try { fillDocumentStatusCombo(cmbStatus); OfficeDB.fillOfficeComboNew(cmbOffice); } catch (Exception) { } }
private void initVariables() { try { lbldatetime.Text = UpdateTable.getSQLDateTime().Date.ToString("dd-MM-yyyy"); int count = grdList.RowCount; lblOffice.Visible = false; cmbfilterOffice.Visible = false; lbldatetime.Visible = false; lbldate.Visible = false; dtpdate.Visible = false; pnlEditButtons.Visible = false; if (Main.itemPriv[2]) { pnlEditButtons.Visible = true; OfficeDB.fillOfficeComboNew(cmbfilterOffice); lblOffice.Visible = true; cmbfilterOffice.Visible = true; lbldate.Visible = true; dtpdate.Visible = true; dtpdate.Format = DateTimePickerFormat.Custom; dtpdate.CustomFormat = "dd-MM-yyyy"; dtpdate.Enabled = true; dtpdate.Value = UpdateTable.getSQLDateTime(); } else { DateTime.TryParse(systime, out a); if (grdList.RowCount > 0 && UpdateTable.getSQLDateTime().TimeOfDay < a.TimeOfDay) { pnlEditButtons.Visible = true; } lbldatetime.Visible = true; } emplOfficeID = EmployeeDB.getEmployeeOffice(Login.empLoggedIn); } catch (Exception) { } }
private void ListOffice() { try { grdList.Rows.Clear(); OfficeDB dbrecord = new OfficeDB(); List <office> Offices = dbrecord.getOffices(); foreach (office off in Offices) { grdList.Rows.Add(off.OfficeID, off.name, off.RegionID + "-" + off.RegionName, off.Address1, off.Address2, off.Address3, off.Address4, ComboFIll.getStatusString(off.status)); } } catch (Exception) { MessageBox.Show("Error in Office listing"); } enableBottomButtons(); pnlOfficeList.Visible = true; }
private void ListFilteredLeave(int opt, string officeID) { try { DateTime dttemp = DateTime.Now; grdList.Rows.Clear(); grdList.Columns.Clear(); AttendanceDB Adb = new AttendanceDB(); OfficeDB dbrecord = new OfficeDB(); grdList.Columns.Add("OfficeID", "OfficeID"); grdList.Columns.Add("Office", "Office"); grdList.Columns["OfficeID"].Frozen = true; grdList.Columns["OfficeID"].Visible = false; grdList.Columns["Office"].Frozen = true; List <catalogue> statuslist = Adb.getCatalogues(); List <office> Offices = dbrecord.getOffices().Where(w => w.status == 1).ToList(); foreach (catalogue stat in statuslist) { grdList.Columns.Add(stat.catalogueID, stat.description); grdList.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; //////grdList.Columns.cell = "Double click for details"; } grdList.Columns.Add("Total", "Total"); grdList.Columns["Total"].Width = 70; List <attendance> emptotlst = Adb.getEmployeeoffceList("Total", "Total"); foreach (office off in Offices) { if (off.RegionID.Equals("Overseas")) { continue; } grdList.Rows.Add(); grdList.Rows[grdList.Rows.Count - 1].Cells["OfficeID"].Value = off.OfficeID; grdList.Rows[grdList.Rows.Count - 1].Cells["Office"].Value = off.name; List <attendance> emplst = emptotlst.Where(x => x.officeID == off.OfficeID).ToList(); int colcount = 0; foreach (DataGridViewColumn cl in grdList.Columns) { if (cl.Name != "Office" && cl.Name != "OfficeID") { int emplstcount = emplst.Where(x => x.AttendenceStatus == cl.Name).Count(); grdList.Rows[grdList.Rows.Count - 1].Cells[cl.Name].Value = emplstcount; grdList.Rows[grdList.Rows.Count - 1].Cells[cl.Name].ToolTipText = "Double click for details"; colcount += Convert.ToInt32(grdList.Rows[grdList.Rows.Count - 1].Cells[cl.Name].Value); } } grdList.Rows[grdList.RowCount - 1].Cells["Total"].Value = colcount; grdList.Rows[grdList.RowCount - 1].Cells["Total"].ToolTipText = "Double click for details"; } grdList.Rows.Add(); grdList.Rows[grdList.Rows.Count - 1].Cells["OfficeID"].Value = "Total"; grdList.Rows[grdList.Rows.Count - 1].Cells["Office"].Value = "Total"; foreach (DataGridViewColumn dgc in grdList.Columns) { int rowcount = 0; foreach (DataGridViewRow dgr in grdList.Rows) { if (dgc.Name != "Office" && dgc.Name != "OfficeID") { rowcount += Convert.ToInt32(dgr.Cells[dgc.Name].Value); } } if (dgc.Name != "Office" && dgc.Name != "OfficeID") { grdList.Rows[grdList.RowCount - 1].Cells[dgc.Name].Value = rowcount; grdList.Rows[grdList.RowCount - 1].Cells[dgc.Name].ToolTipText = "Double click for details"; } } grdList.CurrentCell.Selected = false; grdList.Visible = true; pnlgrdList.Visible = true; } catch (Exception ex) { MessageBox.Show("Error 3 : ListFilteredLeave() - " + ex.ToString()); } }
private void btnSave_Click(object sender, EventArgs e) { try { office off = new office(); OfficeDB offDB = new OfficeDB(); off.OfficeID = txtID.Text; off.name = txtName.Text; try { //////off.RegionID = cmbRegion.SelectedItem.ToString().Trim().Substring(0, cmbRegion.SelectedItem.ToString().Trim().IndexOf('-')); off.RegionID = ((Structures.ComboBoxItem)cmbRegion.SelectedItem).HiddenValue; //////off.RegionName = cmbRegion.SelectedItem.ToString().Trim().Substring(cmbRegion.SelectedItem.ToString().Trim().IndexOf('-') + 1); off.RegionName = ((Structures.ComboBoxItem)cmbRegion.SelectedItem).ToString(); } catch (Exception) { off.RegionID = ""; off.RegionName = ""; } off.Address1 = txtaddress1.Text; off.Address2 = txtaddress2.Text; off.Address3 = txtaddress3.Text; off.Address4 = txtaddress4.Text; off.status = ComboFIll.getStatusCode(cmbStatus.SelectedItem.ToString()); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btn.Text; if (offDB.validateOffice(off)) { if (btnText.Equals("Update")) { if (offDB.updateOffice(off)) { MessageBox.Show("Office updated"); closeAllPanels(); ListOffice(); } else { MessageBox.Show("Failed to update Office"); } } else if (btnText.Equals("Save")) { if (offDB.insertOffice(off)) { MessageBox.Show("Office Added"); closeAllPanels(); ListOffice(); } else { MessageBox.Show("Failed to Insert Office"); } } } else { MessageBox.Show("Office Data Validation failed"); } } catch (Exception) { MessageBox.Show("Failed Adding / Editing Office"); } }