/// <summary> /// 获得数据列表 /// </summary> public List <Hch.iDisk.Model.Dirtory> DataTableToList(DataTable dt) { List <Hch.iDisk.Model.Dirtory> modelList = new List <Hch.iDisk.Model.Dirtory>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hch.iDisk.Model.Dirtory model; for (int n = 0; n < rowsCount; n++) { model = new Hch.iDisk.Model.Dirtory(); if (dt.Rows[n]["DirId"].ToString() != "") { model.DirId = int.Parse(dt.Rows[n]["DirId"].ToString()); } if (dt.Rows[n]["ParentDirId"].ToString() != "") { model.ParentDirId = int.Parse(dt.Rows[n]["ParentDirId"].ToString()); } if (dt.Rows[n]["UId"].ToString() != "") { model.UId = int.Parse(dt.Rows[n]["UId"].ToString()); } model.DirName = dt.Rows[n]["DirName"].ToString(); model.DirDesc = dt.Rows[n]["DirDesc"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// ��������б� /// </summary> public List<Hch.iDisk.Model.Dirtory> DataTableToList(DataTable dt) { List<Hch.iDisk.Model.Dirtory> modelList = new List<Hch.iDisk.Model.Dirtory>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hch.iDisk.Model.Dirtory model; for (int n = 0; n < rowsCount; n++) { model = new Hch.iDisk.Model.Dirtory(); if(dt.Rows[n]["DirId"].ToString()!="") { model.DirId=int.Parse(dt.Rows[n]["DirId"].ToString()); } if(dt.Rows[n]["ParentDirId"].ToString()!="") { model.ParentDirId=int.Parse(dt.Rows[n]["ParentDirId"].ToString()); } if(dt.Rows[n]["UId"].ToString()!="") { model.UId=int.Parse(dt.Rows[n]["UId"].ToString()); } model.DirName=dt.Rows[n]["DirName"].ToString(); model.DirDesc=dt.Rows[n]["DirDesc"].ToString(); modelList.Add(model); } } return modelList; }
private void SearchDir(Dirtory dir, string dirName, List <Dirtory> dirs) { dir.Dirtories.ForEach(e => { if (e.DirName == dirName) { dirs.Add(e); } SearchDir(e, dirName, dirs); }); }
/// <summary> /// 获取一个指定ID的目录 /// </summary> /// <param name="DirId"></param> /// <returns></returns> public Dirtory SearchDirtory(int DirId) { Dirtory dir = null; Dirtories.ForEach(e => { if (e.DirId == DirId) { dir = e; } }); return(dir); }
/// <summary> /// 移除一个目录 /// </summary> /// <param name="dir"></param> public void RemoveDirtory(Dirtory dir) { Dirtories.Remove(dir); }
/// <summary> /// 添加一个目录 /// </summary> public void AddDirtory(Dirtory dir) { Dirtories.Add(dir); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hch.iDisk.Model.Dirtory model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hch.iDisk.Model.Dirtory model) { return(dal.Add(model)); }
private void SearchDir(Dirtory dir,string dirName, List<Dirtory> dirs) { dir.Dirtories.ForEach(e => { if (e.DirName == dirName) dirs.Add(e); SearchDir(e, dirName, dirs); }); }
/// <summary> /// �Ƴ�һ��Ŀ¼ /// </summary> /// <param name="dir"></param> public void RemoveDirtory(Dirtory dir) { Dirtories.Remove(dir); }
/// <summary> /// ���һ��Ŀ¼ /// </summary> public void AddDirtory(Dirtory dir) { Dirtories.Add(dir); }