/// <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); }
/// <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; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hch.iDisk.Model.File model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Hch.iDisk.Model.File model) { dal.Add(model); }
/// <summary> /// �Ƴ�һ���ļ� /// </summary> /// <param name="file"></param> public void Remove(File file) { Files.Remove(file); }
/// <summary> /// ���һ���ļ� /// </summary> /// <param name="file"></param> public void AddFile(File file) { Files.Add(file); }