/// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(RelayTest.Model.ModelDEV_COILPOWER_INFO model)
 {
     try
     {
         Log.Info("BllDEV_COILPOWER_INFO->Add---START");
         ConnectionOpen();
         dal.SetDBAccess(GetDBAccess());
         dal.Add(model);
     }
     catch (Exception ex)
     {
         Log.Error("BllDEV_COILPOWER_INFO->Add---FAILED", ex);
         throw ex;
     }
     finally
     {
         ConnectionClose();
         Log.Info("BllDEV_COILPOWER_INFO->Add---finally");
     }
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">相应的数据实体</param>
 /// <returns>真表示有记录被更新,否表示没有记录被更新</returns>
 public bool Update(RelayTest.Model.ModelDEV_COILPOWER_INFO model)
 {
     try
     {
         Log.Info("BllDEV_COILPOWER_INFO->Update---START");
         ConnectionOpen();
         dal.SetDBAccess(GetDBAccess());
         return(dal.Update(model));
     }
     catch (Exception ex)
     {
         Log.Error("BllDEV_COILPOWER_INFO->Update---FAILED", ex);
         throw ex;
     }
     finally
     {
         ConnectionClose();
         Log.Info("BllDEV_COILPOWER_INFO->Update---finally");
     }
 }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <RelayTest.Model.ModelDEV_COILPOWER_INFO> DataTableToList(DataTable dt)
        {
            try
            {
                Log.Info("BllDEV_COILPOWER_INFO->DataTableToList---START");
                ConnectionOpen();
                dal.SetDBAccess(GetDBAccess());
                List <RelayTest.Model.ModelDEV_COILPOWER_INFO> modelList = new List <RelayTest.Model.ModelDEV_COILPOWER_INFO>();
                int rowsCount = dt.Rows.Count;
                if (rowsCount > 0)
                {
                    RelayTest.Model.ModelDEV_COILPOWER_INFO model;
                    for (int n = 0; n < rowsCount; n++)
                    {
                        model = new RelayTest.Model.ModelDEV_COILPOWER_INFO();

                        //线圈电源编号
                        model.F_COILPOWER_ID = dt.Rows[n]["F_COILPOWER_ID"].ToString();

                        //线圈电源输出功率
                        if (dt.Rows[n]["F_COILPOWER_POWER"].ToString() != "")
                        {
                            model.F_COILPOWER_POWER = decimal.Parse(dt.Rows[n]["F_COILPOWER_POWER"].ToString());
                        }

                        //线圈电源运行状态
                        if (dt.Rows[n]["F_COILPOWER_RUN_STATUS"].ToString() != "")
                        {
                            model.F_COILPOWER_RUN_STATUS = decimal.Parse(dt.Rows[n]["F_COILPOWER_RUN_STATUS"].ToString());
                        }

                        //备注
                        model.F_COILPOWER_MEMO = dt.Rows[n]["F_COILPOWER_MEMO"].ToString();

                        //创建时间
                        if (dt.Rows[n]["F_CREATE_TIME"].ToString() != "")
                        {
                            model.F_CREATE_TIME = DateTime.Parse(dt.Rows[n]["F_CREATE_TIME"].ToString());
                        }

                        //操作员
                        model.F_OPERATOR_ID = dt.Rows[n]["F_OPERATOR_ID"].ToString();

                        //操作时间
                        if (dt.Rows[n]["F_OPERATIONTIME"].ToString() != "")
                        {
                            model.F_OPERATIONTIME = DateTime.Parse(dt.Rows[n]["F_OPERATIONTIME"].ToString());
                        }

                        //是否删除
                        if (dt.Rows[n]["F_DEL"].ToString() != "")
                        {
                            model.F_DEL = decimal.Parse(dt.Rows[n]["F_DEL"].ToString());
                        }

                        //线圈电源名称
                        model.F_COILPOWER_NAME = dt.Rows[n]["F_COILPOWER_NAME"].ToString();

                        //校准编号
                        model.F_COILPOWER_CALIBRATION = dt.Rows[n]["F_COILPOWER_CALIBRATION"].ToString();

                        //通信端口
                        model.F_COM_ADDRESS = dt.Rows[n]["F_COM_ADDRESS"].ToString();

                        //通信地址
                        if (dt.Rows[n]["F_COILPOWER_ADDRESS"].ToString() != "")
                        {
                            model.F_COILPOWER_ADDRESS = decimal.Parse(dt.Rows[n]["F_COILPOWER_ADDRESS"].ToString());
                        }

                        //线圈电源输出电压上限
                        if (dt.Rows[n]["F_COILPOWER_VOLTAGE_CEILING"].ToString() != "")
                        {
                            model.F_COILPOWER_VOLTAGE_CEILING = decimal.Parse(dt.Rows[n]["F_COILPOWER_VOLTAGE_CEILING"].ToString());
                        }

                        //线圈电源输出电压下限
                        if (dt.Rows[n]["F_COILPOWER_VOLTAGE_FLOOR"].ToString() != "")
                        {
                            model.F_COILPOWER_VOLTAGE_FLOOR = decimal.Parse(dt.Rows[n]["F_COILPOWER_VOLTAGE_FLOOR"].ToString());
                        }

                        //线圈电源输出电流上限
                        if (dt.Rows[n]["F_COILPOWER_CURRENT_CEILING"].ToString() != "")
                        {
                            model.F_COILPOWER_CURRENT_CEILING = decimal.Parse(dt.Rows[n]["F_COILPOWER_CURRENT_CEILING"].ToString());
                        }

                        //线圈电源输出电流下限
                        if (dt.Rows[n]["F_COILPOWER_CURRENT_FLOOR"].ToString() != "")
                        {
                            model.F_COILPOWER_CURRENT_FLOOR = decimal.Parse(dt.Rows[n]["F_COILPOWER_CURRENT_FLOOR"].ToString());
                        }


                        modelList.Add(model);
                    }
                }
                return(modelList);
            }
            catch (Exception ex)
            {
                Log.Error("BllDEV_COILPOWER_INFO->DataTableToList---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllDEV_COILPOWER_INFO->DataTableToList---finally");
            }
        }