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

            if (rowsCount > 0)
            {
                ZhangWei.Model.StockPile model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ZhangWei.Model.StockPile();
                    if (dt.Rows[n]["StockPile_ID"] != null && dt.Rows[n]["StockPile_ID"].ToString() != "")
                    {
                        model.StockPile_ID = int.Parse(dt.Rows[n]["StockPile_ID"].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]["Product_ID"] != null && dt.Rows[n]["Product_ID"].ToString() != "")
                    {
                        model.Product_ID = int.Parse(dt.Rows[n]["Product_ID"].ToString());
                    }
                    if (dt.Rows[n]["FirstEnterDate"] != null && dt.Rows[n]["FirstEnterDate"].ToString() != "")
                    {
                        model.FirstEnterDate = DateTime.Parse(dt.Rows[n]["FirstEnterDate"].ToString());
                    }
                    if (dt.Rows[n]["LastLeaveDate"] != null && dt.Rows[n]["LastLeaveDate"].ToString() != "")
                    {
                        model.LastLeaveDate = DateTime.Parse(dt.Rows[n]["LastLeaveDate"].ToString());
                    }
                    if (dt.Rows[n]["Quantity"] != null && dt.Rows[n]["Quantity"].ToString() != "")
                    {
                        model.Quantity = decimal.Parse(dt.Rows[n]["Quantity"].ToString());
                    }
                    if (dt.Rows[n]["Price"] != null && dt.Rows[n]["Price"].ToString() != "")
                    {
                        model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ZhangWei.Model.StockPile model)
 {
     return(dal.Update(model));
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ZhangWei.Model.StockPile model)
 {
     return(dal.Add(model));
 }