Пример #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ECAMSDataAccess.PlcDBSimModel> DataTableToList(DataTable dt)
        {
            List <ECAMSDataAccess.PlcDBSimModel> modelList = new List <ECAMSDataAccess.PlcDBSimModel>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ECAMSDataAccess.PlcDBSimModel model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ECAMSDataAccess.PlcDBSimModel();
                    if (dt.Rows[n]["PlcAddr"] != null && dt.Rows[n]["PlcAddr"].ToString() != "")
                    {
                        model.PlcAddr = dt.Rows[n]["PlcAddr"].ToString();
                    }
                    if (dt.Rows[n]["Val"] != null && dt.Rows[n]["Val"].ToString() != "")
                    {
                        model.Val = int.Parse(dt.Rows[n]["Val"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ECAMSDataAccess.PlcDBSimModel model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(PlcDBSimModel model)
 {
     return(dal.Add(model));
 }