Exemple #1
0
        /// <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);
        }
Exemple #2
0
 /// <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;
 }
Exemple #3
0
 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);
     });
 }
Exemple #4
0
        /// <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);
        }
Exemple #5
0
 /// <summary>
 /// 移除一个目录
 /// </summary>
 /// <param name="dir"></param>
 public void RemoveDirtory(Dirtory dir)
 {
     Dirtories.Remove(dir);
 }
Exemple #6
0
 /// <summary>
 /// 添加一个目录
 /// </summary>
 public void AddDirtory(Dirtory dir)
 {
     Dirtories.Add(dir);
 }
Exemple #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hch.iDisk.Model.Dirtory model)
 {
     return(dal.Update(model));
 }
Exemple #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hch.iDisk.Model.Dirtory model)
 {
     return(dal.Add(model));
 }
Exemple #9
0
 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);
         });
 }
Exemple #10
0
 /// <summary>
 /// �Ƴ�һ��Ŀ¼
 /// </summary>
 /// <param name="dir"></param>
 public void RemoveDirtory(Dirtory dir)
 {
     Dirtories.Remove(dir);
 }
Exemple #11
0
 /// <summary>
 /// ���һ��Ŀ¼
 /// </summary>
 public void AddDirtory(Dirtory dir)
 {
     Dirtories.Add(dir);
 }