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

            if (rowsCount > 0)
            {
                Hownet.Model.CardReaderList model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.CardReaderList();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    else
                    {
                        model.ID = 0;
                    }
                    if (dt.Rows[n]["NID"].ToString() != "")
                    {
                        model.NID = int.Parse(dt.Rows[n]["NID"].ToString());
                    }
                    else
                    {
                        model.NID = 0;
                    }
                    if (dt.Rows[n]["Location"].ToString() != "")
                    {
                        model.Location = int.Parse(dt.Rows[n]["Location"].ToString());
                    }
                    else
                    {
                        model.Location = 0;
                    }
                    model.Remark = dt.Rows[n]["Remark"].ToString();
                    if (dt.Rows[n]["TypeID"].ToString() != "")
                    {
                        model.TypeID = int.Parse(dt.Rows[n]["TypeID"].ToString());
                    }
                    else
                    {
                        model.TypeID = 0;
                    }
                    model.A = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Hownet.Model.CardReaderList model)
 {
     dal.Update(model);
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.CardReaderList model)
 {
     return(dal.Add(model));
 }