예제 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ZhangWei.Model.sysdiagrams> DataTableToList(DataTable dt)
        {
            List <ZhangWei.Model.sysdiagrams> modelList = new List <ZhangWei.Model.sysdiagrams>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ZhangWei.Model.sysdiagrams model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ZhangWei.Model.sysdiagrams();
                    if (dt.Rows[n]["name"] != null && dt.Rows[n]["name"].ToString() != "")
                    {
                        model.name = dt.Rows[n]["name"].ToString();
                    }
                    if (dt.Rows[n]["principal_id"] != null && dt.Rows[n]["principal_id"].ToString() != "")
                    {
                        model.principal_id = int.Parse(dt.Rows[n]["principal_id"].ToString());
                    }
                    if (dt.Rows[n]["diagram_id"] != null && dt.Rows[n]["diagram_id"].ToString() != "")
                    {
                        model.diagram_id = int.Parse(dt.Rows[n]["diagram_id"].ToString());
                    }
                    if (dt.Rows[n]["version"] != null && dt.Rows[n]["version"].ToString() != "")
                    {
                        model.version = int.Parse(dt.Rows[n]["version"].ToString());
                    }
                    if (dt.Rows[n]["definition"] != null && dt.Rows[n]["definition"].ToString() != "")
                    {
                        model.definition = (byte[])dt.Rows[n]["definition"];
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ZhangWei.Model.sysdiagrams model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(ZhangWei.Model.sysdiagrams model)
 {
     return(dal.Add(model));
 }