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

            if (rowsCount > 0)
            {
                ZhangWei.Model.ProductUnit model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ZhangWei.Model.ProductUnit();
                    if (dt.Rows[n]["ProductUnit_ID"] != null && dt.Rows[n]["ProductUnit_ID"].ToString() != "")
                    {
                        model.ProductUnit_ID = int.Parse(dt.Rows[n]["ProductUnit_ID"].ToString());
                    }
                    if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "")
                    {
                        model.Name = dt.Rows[n]["Name"].ToString();
                    }
                    if (dt.Rows[n]["Employee_ID"] != null && dt.Rows[n]["Employee_ID"].ToString() != "")
                    {
                        model.Employee_ID = int.Parse(dt.Rows[n]["Employee_ID"].ToString());
                    }
                    if (dt.Rows[n]["CreateDate"] != null && dt.Rows[n]["CreateDate"].ToString() != "")
                    {
                        model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString());
                    }
                    if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "")
                    {
                        model.Remark = dt.Rows[n]["Remark"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ZhangWei.Model.ProductUnit model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(ZhangWei.Model.ProductUnit model)
 {
     return(dal.Add(model));
 }