Пример #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hch.iDisk.Model.File> DataTableToList(DataTable dt)
        {
            List <Hch.iDisk.Model.File> modelList = new List <Hch.iDisk.Model.File>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hch.iDisk.Model.File model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model     = new Hch.iDisk.Model.File();
                    model.FId = dt.Rows[n]["FId"].ToString();
                    if (dt.Rows[n]["DirId"].ToString() != "")
                    {
                        model.DirId = int.Parse(dt.Rows[n]["DirId"].ToString());
                    }
                    model.FName = dt.Rows[n]["FName"].ToString();
                    if (dt.Rows[n]["FDate"].ToString() != "")
                    {
                        model.FDate = DateTime.Parse(dt.Rows[n]["FDate"].ToString());
                    }
                    if (dt.Rows[n]["FSize"].ToString() != "")
                    {
                        model.FSize = long.Parse(dt.Rows[n]["FSize"].ToString());
                    }
                    if (dt.Rows[n]["FVisibility"].ToString() != "")
                    {
                        model.FVisibility = int.Parse(dt.Rows[n]["FVisibility"].ToString());
                    }
                    if (dt.Rows[n]["FUrl"].ToString() != "")
                    {
                        model.FUrl = dt.Rows[n]["FUrl"].ToString();
                    }
                    model.FDesc = dt.Rows[n]["FDesc"].ToString();
                    if (dt.Rows[n]["FUserId"].ToString() != "")
                    {
                        model.FUserId = int.Parse(dt.Rows[n]["FUserId"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<Hch.iDisk.Model.File> DataTableToList(DataTable dt)
 {
     List<Hch.iDisk.Model.File> modelList = new List<Hch.iDisk.Model.File>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Hch.iDisk.Model.File model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Hch.iDisk.Model.File();
             model.FId=dt.Rows[n]["FId"].ToString();
             if(dt.Rows[n]["DirId"].ToString()!="")
             {
                 model.DirId=int.Parse(dt.Rows[n]["DirId"].ToString());
             }
             model.FName=dt.Rows[n]["FName"].ToString();
             if(dt.Rows[n]["FDate"].ToString()!="")
             {
                 model.FDate=DateTime.Parse(dt.Rows[n]["FDate"].ToString());
             }
             if(dt.Rows[n]["FSize"].ToString()!="")
             {
                 model.FSize=long.Parse(dt.Rows[n]["FSize"].ToString());
             }
             if(dt.Rows[n]["FVisibility"].ToString()!="")
             {
                 model.FVisibility=int.Parse(dt.Rows[n]["FVisibility"].ToString());
             }
             if(dt.Rows[n]["FUrl"].ToString()!="")
             {
                 model.FUrl=dt.Rows[n]["FUrl"].ToString();
             }
             model.FDesc=dt.Rows[n]["FDesc"].ToString();
             if(dt.Rows[n]["FUserId"].ToString()!="")
             {
                 model.FUserId=int.Parse(dt.Rows[n]["FUserId"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Пример #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hch.iDisk.Model.File model)
 {
     return(dal.Update(model));
 }
Пример #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(Hch.iDisk.Model.File model)
 {
     dal.Add(model);
 }
Пример #5
0
 /// <summary>
 /// �Ƴ�һ���ļ�
 /// </summary>
 /// <param name="file"></param>
 public void Remove(File file)
 {
     Files.Remove(file);
 }
Пример #6
0
 /// <summary>
 /// ���һ���ļ�
 /// </summary>
 /// <param name="file"></param>
 public void AddFile(File file)
 {
     Files.Add(file);
 }