public string ComponentCat(string ccid) { int id = 0; string sql = String.Format(@"SELECT id from yf_t_ComponentClass where ClassCCID = '{0}' and isactive = 1", ccid); Object rel = dal.ExecuteScalar(sql); if (rel != null) { int.TryParse(rel.ToString(), out id); } List <PLMComponentCat> list = new List <PLMComponentCat>(); sql = String.Format(@"SELECT classCode,className,id,ClassCCID from yf_t_ComponentClass where ClassParentID={0} and isactive = 1;", id); using (IDataReader reader = dal.ExecuteReader(sql)) { while (reader.Read()) { PLMComponentCat cat = new PLMComponentCat(); cat.Id = reader.GetInt32(2); cat.Code = reader.GetString(0); cat.Cname = reader.GetString(1); cat.Ccid = reader.GetString(3); list.Add(cat); } } return(xmlHelper.ToString <List <PLMComponentCat> >(list)); }
public string ComponentType() { List <PLMComponentCat> list = new List <PLMComponentCat>(); String sql = @"SELECT DISTINCT lbjcdm,lbjcmc from yx_t_splb where jb=3 and ccid like '-61-1166-%' and lbjcdm <> ''"; using (IDataReader reader = dal.ExecuteReader(sql)) { while (reader.Read()) { PLMComponentCat cat = new PLMComponentCat(); //cat.Id = reader.GetInt32(2); cat.Code = reader.GetString(0); cat.Cname = reader.GetString(1); list.Add(cat); } } return(xmlHelper.ToString <List <PLMComponentCat> >(list)); }