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

            if (rowsCount > 0)
            {
                Maticsoft.Model.DingProduct model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Maticsoft.Model.DingProduct();
                    if (dt.Rows[n]["DingID"].ToString() != "")
                    {
                        model.DingID = int.Parse(dt.Rows[n]["DingID"].ToString());
                    }
                    model.ProName = dt.Rows[n]["ProName"].ToString();
                    if (dt.Rows[n]["ProXingID"].ToString() != "")
                    {
                        model.ProXingID = int.Parse(dt.Rows[n]["ProXingID"].ToString());
                    }
                    if (dt.Rows[n]["ProTypeID"].ToString() != "")
                    {
                        model.ProTypeID = int.Parse(dt.Rows[n]["ProTypeID"].ToString());
                    }
                    model.DingNum     = dt.Rows[n]["DingNum"].ToString();
                    model.DingAddress = dt.Rows[n]["DingAddress"].ToString();
                    model.LinkPhoto   = dt.Rows[n]["LinkPhoto"].ToString();
                    model.DingEmail   = dt.Rows[n]["DingEmail"].ToString();
                    if (dt.Rows[n]["DingSex"].ToString() != "")
                    {
                        model.DingSex = int.Parse(dt.Rows[n]["DingSex"].ToString());
                    }
                    model.UsersName = dt.Rows[n]["UsersName"].ToString();
                    if (dt.Rows[n]["Dingtime"].ToString() != "")
                    {
                        model.Dingtime = DateTime.Parse(dt.Rows[n]["Dingtime"].ToString());
                    }
                    model.Dingcontent = dt.Rows[n]["Dingcontent"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.DingProduct model)
 {
     return(dal.Update(model));
 }
Example #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Maticsoft.Model.DingProduct model)
 {
     return(dal.Add(model));
 }