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

            if (rowsCount > 0)
            {
                Hownet.Model.Size model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.Size();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.Name = dt.Rows[n]["Name"].ToString();
                    model.Sn   = dt.Rows[n]["Sn"].ToString();
                    if (dt.Rows[n]["IsUse"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsUse"].ToString() == "1") || (dt.Rows[n]["IsUse"].ToString().ToLower() == "true"))
                        {
                            model.IsUse = true;
                        }
                        else
                        {
                            model.IsUse = false;
                        }
                    }
                    if (dt.Rows[n]["IsEnd"].ToString() != "")
                    {
                        model.IsEnd = int.Parse(dt.Rows[n]["IsEnd"].ToString());
                    }
                    if (dt.Rows[n]["SizeTypeID"].ToString() != "")
                    {
                        model.SizeTypeID = int.Parse(dt.Rows[n]["SizeTypeID"].ToString());
                    }
                    if (dt.Rows[n]["Orders"] != null && dt.Rows[n]["Orders"].ToString() != "")
                    {
                        model.Orders = int.Parse(dt.Rows[n]["Orders"].ToString());
                    }
                    model.A = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Hownet.Model.Size model)
 {
     dal.Update(model);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.Size model)
 {
     return(dal.Add(model));
 }