public List <InfoGenral> GetSchema(string tableName) { try { string sql = string.Empty; sql = @"SELECT c.ColumnName, c.name, c.IsIdentifier, t.AD_Table_ID, t.TableName FROM AD_Table t INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) WHERE c.AD_Reference_ID=10 AND t.TableName='" + tableName + @"' AND EXISTS (SELECT * FROM AD_Field f WHERE f.AD_Column_ID=c.AD_Column_ID AND f.IsDisplayed='Y' AND f.IsEncrypted='N' AND f.ObscureType IS NULL) ORDER BY c.IsIdentifier DESC, c.SeqNo"; DataSet ds = DB.ExecuteDataset(sql); if (ds == null || ds.Tables[0].Rows.Count == 0) { return(null); } List <InfoGenral> lstInfoGen = new List <InfoGenral>(); InfoGenral item = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (i == 3) { break; } item = new InfoGenral(); item.AD_Table_ID = Convert.ToInt32(ds.Tables[0].Rows[i]["AD_Table_ID"]); item.ColumnName = ds.Tables[0].Rows[i]["ColumnName"].ToString(); item.Name = ds.Tables[0].Rows[i]["Name"].ToString(); item.IsIdentifier = ds.Tables[0].Rows[i]["IsIdentifier"].ToString() == "Y" ? true : false; lstInfoGen.Add(item); } ds = null; return(lstInfoGen); } catch { return(null); } }
public List <InfoGenral> GetSchema(string tableName, string ad_Language, bool isBaseLangage) { try { //Change by mohit-to handle translation in general info. //Added 2 new parametere- string ad_Language, bool isBaseLangage. //Asked by mukesh sir- 09/03/2018 string sql = string.Empty; if (isBaseLangage) { sql = @"SELECT c.ColumnName, c.name, c.IsIdentifier, t.AD_Table_ID, t.TableName, C.IsTranslated FROM AD_Table t INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) WHERE c.AD_Reference_ID=10 AND t.TableName='" + tableName + @"' AND EXISTS (SELECT * FROM AD_Field f WHERE f.AD_Column_ID=c.AD_Column_ID AND f.IsDisplayed='Y' AND f.IsEncrypted='N' AND f.ObscureType IS NULL) ORDER BY c.IsIdentifier DESC, c.SeqNo"; } else { sql = @"SELECT c.ColumnName, trl.name, c.IsIdentifier, t.AD_Table_ID, t.TableName, C.IsTranslated FROM AD_Table t INNER JOIN AD_Column c ON (t.AD_Table_ID =c.AD_Table_ID) INNER JOIN AD_Column_Trl trl ON (c.AD_Column_ID=trl.AD_Column_ID) WHERE c.AD_Reference_ID=10 AND t.TableName ='" + tableName + @"' AND trl.AD_Language='" + ad_Language + @"' AND EXISTS(SELECT * FROM AD_Field f WHERE f.AD_Column_ID=c.AD_Column_ID AND f.IsDisplayed ='Y' AND f.IsEncrypted ='N' AND f.ObscureType IS NULL) ORDER BY c.IsIdentifier DESC,c.SeqNo"; } DataSet ds = DB.ExecuteDataset(sql); if (ds == null || ds.Tables[0].Rows.Count == 0) { return(null); } List <InfoGenral> lstInfoGen = new List <InfoGenral>(); InfoGenral item = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (i == 3) { break; } item = new InfoGenral(); item.AD_Table_ID = Convert.ToInt32(ds.Tables[0].Rows[i]["AD_Table_ID"]); item.ColumnName = ds.Tables[0].Rows[i]["ColumnName"].ToString(); item.Name = ds.Tables[0].Rows[i]["Name"].ToString(); item.IsIdentifier = ds.Tables[0].Rows[i]["IsIdentifier"].ToString() == "Y" ? true : false; // Change done by mohit asked by mukesh sir to show the data on info window from translated tab if logged in with langauge other than base language- 22/03/2018 item.IsTranslated = ds.Tables[0].Rows[i]["IsTranslated"].ToString() == "Y" ? true : false; lstInfoGen.Add(item); } ds = null; return(lstInfoGen); } catch { return(null); } }