public int GetEmployeeManagerLevel(int iEmplID, string sColumnName = "FK_HREmployeeManagerID") { DataSet ds = GMCDbUtil.ExecuteQuery(string.Format("SELECT {0} FROM HREmployees WHERE HREmployeeID = {1}", sColumnName, iEmplID)); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0][0] != DBNull.Value) { return(Convert.ToInt32(ds.Tables[0].Rows[0][0])); } return(0); }
private List <DataRow> GetLocalDataSet(string strSelect, string strTable, string strWhere) { List <DataRow> lstDr = new List <DataRow>(); if (dsTmp.Tables.Cast <DataTable>().Where(x => x.TableName.Equals(strTable)).Count() > 0) { lstDr = dsTmp.Tables[strTable].Select(strWhere).ToList(); } if (lstDr.Count == 0) { DataSet ds = GMCDbUtil.ExecuteQuery(string.Format("SELECT {0} FROM {1} WHERE {2}", strSelect, strTable, strWhere)); if (ds != null && ds.Tables.Count > 0) { lstDr = ds.Tables[0].Rows.Cast <DataRow>().ToList(); } } lstDr.ForEach(x => AddRowToDataSet(x, strTable)); return(lstDr); }