public DataSet GetCarFeatures(string sCarId) { DataSet ds = new DataSet(); CarFeatures objCarFeatures = new CarFeatures(); ArrayList arr = new ArrayList(); DataSet dsNewFeatures = new DataSet(); dsNewFeatures.Tables.Add(); dsNewFeatures.Tables[0].Columns.Add("FeatureTypeName"); dsNewFeatures.Tables[0].Columns.Add("FeatureName"); ds = objCarFeatures.GetCarFeatures_New(sCarId); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (i == 0) { dsNewFeatures.Tables[0].Rows.Add(); dsNewFeatures.Tables[0].Rows[dsNewFeatures.Tables[0].Rows.Count - 1][0] = ds.Tables[0].Rows[i]["FeatureTypeName"].ToString(); dsNewFeatures.Tables[0].Rows[dsNewFeatures.Tables[0].Rows.Count - 1][1] = ds.Tables[0].Rows[i]["FeatureName"].ToString(); } else { if (ds.Tables[0].Rows[i - 1]["FeatureTypeName"].ToString().Trim() != ds.Tables[0].Rows[i]["FeatureTypeName"].ToString().Trim()) { dsNewFeatures.Tables[0].Rows.Add(); dsNewFeatures.Tables[0].Rows[dsNewFeatures.Tables[0].Rows.Count - 1][0] = ds.Tables[0].Rows[i]["FeatureTypeName"].ToString(); dsNewFeatures.Tables[0].Rows[dsNewFeatures.Tables[0].Rows.Count - 1][1] = ds.Tables[0].Rows[i]["FeatureName"].ToString(); } else if (ds.Tables[0].Rows[i - 1]["FeatureTypeName"].ToString().Trim() == ds.Tables[0].Rows[i]["FeatureTypeName"].ToString().Trim()) { dsNewFeatures.Tables[0].Rows[dsNewFeatures.Tables[0].Rows.Count - 1][1] = dsNewFeatures.Tables[0].Rows[dsNewFeatures.Tables[0].Rows.Count - 1][1] + ", " + ds.Tables[0].Rows[i]["FeatureName"].ToString(); } } } } return dsNewFeatures; }
public ArrayList GetCarFeatures_New(string sCarId) { DataSet ds = new DataSet(); CarFeatures objCarFeatures = new CarFeatures(); ArrayList arr = new ArrayList(); ds = objCarFeatures.GetCarFeatures_New(sCarId); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { arr.Add(ds.Tables[0].Rows[i]["FeatureTypeName"].ToString() + "," + ds.Tables[0].Rows[i]["FeatureName"].ToString()); } } return arr; }