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

            if (rowsCount > 0)
            {
                ZhangWei.Model.BackStock model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ZhangWei.Model.BackStock();
                    if (dt.Rows[n]["BackStock_ID"] != null && dt.Rows[n]["BackStock_ID"].ToString() != "")
                    {
                        model.BackStock_ID = int.Parse(dt.Rows[n]["BackStock_ID"].ToString());
                    }
                    if (dt.Rows[n]["BackDate"] != null && dt.Rows[n]["BackDate"].ToString() != "")
                    {
                        model.BackDate = DateTime.Parse(dt.Rows[n]["BackDate"].ToString());
                    }
                    if (dt.Rows[n]["Dept_ID"] != null && dt.Rows[n]["Dept_ID"].ToString() != "")
                    {
                        model.Dept_ID = int.Parse(dt.Rows[n]["Dept_ID"].ToString());
                    }
                    if (dt.Rows[n]["StoreHouse_ID"] != null && dt.Rows[n]["StoreHouse_ID"].ToString() != "")
                    {
                        model.StoreHouse_ID = int.Parse(dt.Rows[n]["StoreHouse_ID"].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]["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.BackStock model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(ZhangWei.Model.BackStock model)
 {
     return(dal.Add(model));
 }