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

                        //工作模式代码
                        model.F_WORKTYPE_CODE = dt.Rows[n]["F_WORKTYPE_CODE"].ToString();

                        //工作模式名称
                        model.F_WORKTYPE_NAME = dt.Rows[n]["F_WORKTYPE_NAME"].ToString();

                        //试验程序编码
                        model.F_PROGRAMM_CODE = dt.Rows[n]["F_PROGRAMM_CODE"].ToString();

                        //命令参数id值
                        if (dt.Rows[n]["F_SENDCOMMAND_PAR_ID"].ToString() != "")
                        {
                            model.F_SENDCOMMAND_PAR_ID = decimal.Parse(dt.Rows[n]["F_SENDCOMMAND_PAR_ID"].ToString());
                        }

                        //试验参数项名称
                        model.F_SENDPAR_NAME = dt.Rows[n]["F_SENDPAR_NAME"].ToString();

                        //排列顺序
                        if (dt.Rows[n]["F_ORDER"].ToString() != "")
                        {
                            model.F_ORDER = decimal.Parse(dt.Rows[n]["F_ORDER"].ToString());
                        }

                        //备注
                        model.F_WORKTYPE_MEMO = dt.Rows[n]["F_WORKTYPE_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());
                        }


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