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

            if (rowsCount > 0)
            {
                ZhangWei.Model.BuyOrder model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ZhangWei.Model.BuyOrder();
                    if (dt.Rows[n]["BuyOrder_ID"] != null && dt.Rows[n]["BuyOrder_ID"].ToString() != "")
                    {
                        model.BuyOrder_ID = int.Parse(dt.Rows[n]["BuyOrder_ID"].ToString());
                    }
                    if (dt.Rows[n]["WriteDate"] != null && dt.Rows[n]["WriteDate"].ToString() != "")
                    {
                        model.WriteDate = DateTime.Parse(dt.Rows[n]["WriteDate"].ToString());
                    }
                    if (dt.Rows[n]["InsureDate"] != null && dt.Rows[n]["InsureDate"].ToString() != "")
                    {
                        model.InsureDate = DateTime.Parse(dt.Rows[n]["InsureDate"].ToString());
                    }
                    if (dt.Rows[n]["EndDate"] != null && dt.Rows[n]["EndDate"].ToString() != "")
                    {
                        model.EndDate = DateTime.Parse(dt.Rows[n]["EndDate"].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]["Supplier_ID"] != null && dt.Rows[n]["Supplier_ID"].ToString() != "")
                    {
                        model.Supplier_ID = int.Parse(dt.Rows[n]["Supplier_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]["Produced"] != null && dt.Rows[n]["Produced"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Produced"].ToString() == "1") || (dt.Rows[n]["Produced"].ToString().ToLower() == "true"))
                        {
                            model.Produced = true;
                        }
                        else
                        {
                            model.Produced = false;
                        }
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ZhangWei.Model.BuyOrder model)
 {
     return(dal.Update(model));
 }
コード例 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ZhangWei.Model.BuyOrder model)
 {
     return(dal.Add(model));
 }