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

            if (rowsCount > 0)
            {
                ZhangWei.Model.Product_Supplier model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ZhangWei.Model.Product_Supplier();
                    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]["Supplier_ID"] != null && dt.Rows[n]["Supplier_ID"].ToString() != "")
                    {
                        model.Supplier_ID = int.Parse(dt.Rows[n]["Supplier_ID"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ZhangWei.Model.Product_Supplier model)
 {
     return(dal.Update(model));
 }
Example #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(ZhangWei.Model.Product_Supplier model)
 {
     return(dal.Add(model));
 }