示例#1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Dianda.Model.Document_File> DataTableToList(DataTable dt)
        {
            List <Dianda.Model.Document_File> modelList = new List <Dianda.Model.Document_File>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Dianda.Model.Document_File model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Dianda.Model.Document_File();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["FolderID"].ToString() != "")
                    {
                        model.FolderID = int.Parse(dt.Rows[n]["FolderID"].ToString());
                    }
                    model.FileName = dt.Rows[n]["FileName"].ToString();
                    model.FileType = dt.Rows[n]["FileType"].ToString();
                    model.Icon     = dt.Rows[n]["Icon"].ToString();
                    if (dt.Rows[n]["Sizeof"].ToString() != "")
                    {
                        model.Sizeof = decimal.Parse(dt.Rows[n]["Sizeof"].ToString());
                    }
                    model.FilePath = dt.Rows[n]["FilePath"].ToString();
                    if (dt.Rows[n]["IsShare"].ToString() != "")
                    {
                        model.IsShare = int.Parse(dt.Rows[n]["IsShare"].ToString());
                    }
                    if (dt.Rows[n]["DELFLAG"].ToString() != "")
                    {
                        model.DELFLAG = int.Parse(dt.Rows[n]["DELFLAG"].ToString());
                    }
                    if (dt.Rows[n]["DATETIME"].ToString() != "")
                    {
                        model.DATETIME = DateTime.Parse(dt.Rows[n]["DATETIME"].ToString());
                    }
                    model.UserID = dt.Rows[n]["UserID"].ToString();
                    if (dt.Rows[n]["ShareID"].ToString() != "")
                    {
                        model.ShareID = int.Parse(dt.Rows[n]["ShareID"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Dianda.Model.Document_File model)
 {
     dal.Update(model);
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Dianda.Model.Document_File model)
 {
     return(dal.Add(model));
 }