public DataSet GetViewList() { DataSet ds = dal.GetViewList(); Hownet.DAL.WorkType dalWT = new Hownet.DAL.WorkType(); DataTable dtWT = dalWT.GetList("").Tables[0]; ds.Tables[0].Columns.Add("WorkTypeName", typeof(string)); ds.Tables[0].Columns.Add("DefaultWT", typeof(string)); string ss = string.Empty; string dd = string.Empty; string nnn = string.Empty; string mmm = string.Empty; DataRow[] drs; try { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { ss = ds.Tables[0].Rows[i]["WorkTypeID"].ToString(); dd = ds.Tables[0].Rows[i]["DefaultWorkType"].ToString(); nnn = string.Empty; mmm = string.Empty; if (ss.IndexOf(',') > -1) { string[] aaa = ss.Split(','); for (int j = 0; j < aaa.Length; j++) { drs = dtWT.Select("(ID=" + int.Parse(aaa[j]) + ")"); if (drs.Length > 0) { nnn = nnn + drs[0]["Name"].ToString() + ","; } //DataTable dtt = dalWT.GetList("(ID=" + int.Parse(aaa[j]) + ")").Tables[0]; //if (dtt.Rows.Count > 0) // nnn = nnn + dtt.Rows[0]["Name"].ToString() + ","; } } else if (ss.Length > 0) { drs = dtWT.Select("(ID=" + int.Parse(ss) + ")"); if (drs.Length > 0) { nnn = nnn + drs[0]["Name"].ToString() + ","; } //DataTable dtt = dalWT.GetList("(ID=" + int.Parse(ss) + ")").Tables[0]; //if (dtt.Rows.Count > 0) // nnn = nnn + dtt.Rows[0]["Name"].ToString() + ","; } if (nnn.Length > 0) { nnn = nnn.Remove(nnn.Length - 1, 1); } ds.Tables[0].Rows[i]["WorkTypeName"] = nnn; if (dd.IndexOf(',') > -1) { string[] aaa = dd.Split(','); for (int j = 0; j < aaa.Length; j++) { drs = dtWT.Select("(ID=" + int.Parse(aaa[j]) + ")"); if (drs.Length > 0) { mmm = mmm + drs[0]["Name"].ToString() + ","; } //DataTable dtt = dalWT.GetList("(ID=" + int.Parse(aaa[j]) + ")").Tables[0]; //if (dtt.Rows.Count > 0) // nnn = nnn + dtt.Rows[0]["Name"].ToString() + ","; } } else if (dd.Length > 0) { drs = dtWT.Select("(ID=" + int.Parse(dd) + ")"); if (drs.Length > 0) { mmm = mmm + drs[0]["Name"].ToString() + ","; } //DataTable dtt = dalWT.GetList("(ID=" + int.Parse(ss) + ")").Tables[0]; //if (dtt.Rows.Count > 0) // nnn = nnn + dtt.Rows[0]["Name"].ToString() + ","; } if (mmm.Length > 0) { mmm = mmm.Remove(mmm.Length - 1, 1); } ds.Tables[0].Rows[i]["DefaultWT"] = mmm; } } catch (Exception ex) { } return(ds); }