private void FillEmployeeDetails() { objFixedAsssetDB = new FixedAssetsDB(); DataTable dt = new DataTable(); try { if (cbSystemID.SelectedIndex > 0) { dt = objFixedAsssetDB.GetAssetSlNos("", cbSystemID.SelectedValue.ToString()).Tables[0]; if (dt.Rows.Count > 0) { txtEmpName.Text = dt.Rows[0]["EmpName"].ToString(); txtMobileNo.Text = dt.Rows[0]["ContactNo"].ToString(); txtAssetTagNo.Text = dt.Rows[0]["TagNo"].ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { objFixedAsssetDB = null; dt = null; } }
private void FillSystemID() { objFixedAsssetDB = new FixedAssetsDB(); DataTable dt = new DataTable(); cbSystemID.DataSource = null; try { if (cbBranch.SelectedIndex > 0) { dt = objFixedAsssetDB.GetAssetSlNos(cbBranch.SelectedValue.ToString(), "").Tables[0]; if (dt.Rows.Count > 0) { DataRow dr = dt.NewRow(); dr[0] = "--Select--"; dt.Rows.InsertAt(dr, 0); cbSystemID.DataSource = dt; cbSystemID.DisplayMember = "DisplayMember"; cbSystemID.ValueMember = "ValueMember"; } else { cbSystemID.SelectedIndex = -1; cbMoniter.SelectedIndex = -1; cbMotherboard.SelectedIndex = -1; cbPrinter.SelectedIndex = -1; cbProcesor.SelectedIndex = -1; cbRAM.SelectedIndex = -1; cbScanner.SelectedIndex = -1; cbHDD.SelectedIndex = -1; cbDVDorCD.SelectedIndex = -1; cbWebCam.SelectedIndex = -1; cbBiometrcs.SelectedIndex = -1; cbOperatingSys.SelectedIndex = -1; cbAntivirus.SelectedIndex = -1; txtEmpName.Text = ""; txtMobileNo.Text = ""; txtAssetTagNo.Text = ""; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { objDb = null; dt = null; } }