private void SelectYearMonth() { GeneralClass GC = new GeneralClass(); DataSet dsOT = new DataSet(); dsOT = null; //dsLOP.DataSource = null; label2.Text = String.Empty; if (cmbYear.SelectedIndex == 0) { pnlLOP.Visible = false; label2.Text = "Please Select Year"; return; } else if (cmb_Selectmnth.SelectedIndex == 0) { label2.Text = "Please Select Month"; } else if (cmbYear.SelectedIndex != 0 && cmb_Selectmnth.SelectedIndex != 0) { try { //Query for Geting Data form Excel sheet dsLOP = GC.ExcelConnectivityforLOP("Select * FROM [Sheet1$] where [Emp No]=" + LocalEmpId + "", "OleDbConnString_LossOfPay", cmb_Selectmnth.SelectedIndex.ToString(), cmbYear.SelectedItem.ToString()); if (dsLOP.Tables[0].Rows.Count > 0) { pnlLOP.Visible = true; dgvLOP.Visible = true; dgvLOP.AutoGenerateColumns = true; bindingSource1.DataSource = dsLOP.Tables[0]; dgvLOP.DataSource = bindingSource1; } else { pnlLOP.Visible = false; dgvLOP.Visible = false; label2.Visible = true; label2.Text = "No Details Available"; } } catch (Exception ex) { GC.ErrorLoging(ex.ToString()); pnlLOP.Visible = false; dgvLOP.Visible = false; label2.Visible = true; label2.Text = "No Details Available"; } } }
/// <summary> /// Redirecting to Welcome Screen form /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.LinkLabelLinkClickedEventArgs"/> instance containing the event data.</param> /// <remarks></remarks> private void SelectYearMonth() { GeneralClass GC = new GeneralClass(); DataSet dsOT = new DataSet(); dsOT = null; dgvOT.DataSource = null; lblErrorMsg.Text = String.Empty; if (cmbSelectYear.SelectedIndex == 0 && cmbSelectMonth.SelectedIndex == 0) { pnlOT.Visible = false; lblcomboxerror.Text = "Please Select Year And Month "; return; } else if (cmbSelectYear.SelectedIndex == 0) { pnlOT.Visible = false; lblcomboxerror.Text = "Please Select Year "; return; } else if (cmbSelectMonth.SelectedIndex == 0) { pnlOT.Visible = false; lblcomboxerror.Text = "Please Select Month "; return; } else if (cmbSelectYear.SelectedIndex != 0 && cmbSelectMonth.SelectedIndex != 0) { try { // Query for Geting Data form Excel sheet dsOT = GC.ExcelConnectivityforOT("Select * FROM [Sheet1$] where [Emp No]=" + localEmpId + "", cmbSelectMonth.SelectedIndex.ToString(), cmbSelectYear.SelectedItem.ToString(), locationType); if (dsOT.Tables[0].Rows.Count > 0) { pnlOT.Visible = true; dgvOT.AutoGenerateColumns = true; bindingSource1.DataSource = dsOT.Tables[0]; dgvOT.DataSource = bindingSource1; this.dgvOT.Columns["Emp No"].Visible = false; this.dgvOT.Columns["Payroll Area"].Visible = false; dgvOT.Visible = true; } else { pnlOT.Visible = false; lblErrorMsg.Visible = true; lblErrorMsg.Text = "No Details Available"; } } catch (Exception ex) { GC.ErrorLoging(ex.ToString()); pnlOT.Visible = false; lblErrorMsg.Visible = true; lblErrorMsg.Text = "No Details Available"; } } lblcomboxerror.Text = string.Empty; }