Esempio n. 1
0
        /// <summary>
        /// 根据DataTable转换成List对象数组
        /// </summary>
        public List <MultiColorPen.Model.b_msgattachment> DataTableToList(DataTable dt)
        {
            List <MultiColorPen.Model.b_msgattachment> modelList = new List <MultiColorPen.Model.b_msgattachment>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                MultiColorPen.Model.b_msgattachment model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new MultiColorPen.Model.b_msgattachment();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.msgcode  = dt.Rows[n]["msgcode"].ToString();
                    model.name     = dt.Rows[n]["name"].ToString();
                    model.filename = dt.Rows[n]["filename"].ToString();
                    if (dt.Rows[n]["downtimes"].ToString() != "")
                    {
                        model.downtimes = int.Parse(dt.Rows[n]["downtimes"].ToString());
                    }
                    if (dt.Rows[n]["isenable"].ToString() != "")
                    {
                        model.isenable = int.Parse(dt.Rows[n]["isenable"].ToString());
                    }
                    if (dt.Rows[n]["sort"].ToString() != "")
                    {
                        model.sort = int.Parse(dt.Rows[n]["sort"].ToString());
                    }
                    if (dt.Rows[n]["createtime"].ToString() != "")
                    {
                        model.createtime = DateTime.Parse(dt.Rows[n]["createtime"].ToString());
                    }
                    model.createman = dt.Rows[n]["createman"].ToString();
                    if (dt.Rows[n]["isdelete"].ToString() != "")
                    {
                        model.isdelete = int.Parse(dt.Rows[n]["isdelete"].ToString());
                    }
                    if (dt.Rows[n]["deletetime"].ToString() != "")
                    {
                        model.deletetime = DateTime.Parse(dt.Rows[n]["deletetime"].ToString());
                    }
                    model.deleteman = dt.Rows[n]["deleteman"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(MultiColorPen.Model.b_msgattachment model)
 {
     return(dal.Update(model) ? 1 : 0);
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(MultiColorPen.Model.b_msgattachment model)
 {
     return(dal.Add(model)?1:0);
 }