Ejemplo n.º 1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void  Add(RelayTest.Model.ModelPAR_COMMAND_SEND model)
 {
     try
     {
         Log.Info("BllPAR_COMMAND_SEND->Add---START");
         ConnectionOpen();
         dal.SetDBAccess(GetDBAccess());
         dal.Add(model);
     }
     catch (Exception ex)
     {
         Log.Error("BllPAR_COMMAND_SEND->Add---FAILED", ex);
         throw ex;
     }
     finally
     {
         ConnectionClose();
         Log.Info("BllPAR_COMMAND_SEND->Add---finally");
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">相应的数据实体</param>
 /// <returns>真表示有记录被更新,否表示没有记录被更新</returns>
 public bool Update(RelayTest.Model.ModelPAR_COMMAND_SEND model)
 {
     try
     {
         Log.Info("BllPAR_COMMAND_SEND->Update---START");
         ConnectionOpen();
         dal.SetDBAccess(GetDBAccess());
         return(dal.Update(model));
     }
     catch (Exception ex)
     {
         Log.Error("BllPAR_COMMAND_SEND->Update---FAILED", ex);
         throw ex;
     }
     finally
     {
         ConnectionClose();
         Log.Info("BllPAR_COMMAND_SEND->Update---finally");
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <RelayTest.Model.ModelPAR_COMMAND_SEND> DataTableToList(DataTable dt)
        {
            try
            {
                Log.Info("BllPAR_COMMAND_SEND->DataTableToList---START");
                ConnectionOpen();
                dal.SetDBAccess(GetDBAccess());
                List <RelayTest.Model.ModelPAR_COMMAND_SEND> modelList = new List <RelayTest.Model.ModelPAR_COMMAND_SEND>();
                int rowsCount = dt.Rows.Count;
                if (rowsCount > 0)
                {
                    RelayTest.Model.ModelPAR_COMMAND_SEND model;
                    for (int n = 0; n < rowsCount; n++)
                    {
                        model = new RelayTest.Model.ModelPAR_COMMAND_SEND();
                        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_SENDPAR_ORDER"].ToString() != "")
                        {
                            model.F_SENDPAR_ORDER = decimal.Parse(dt.Rows[n]["F_SENDPAR_ORDER"].ToString());
                        }
                        model.F_SENDPAR_DATA_TYPE = dt.Rows[n]["F_SENDPAR_DATA_TYPE"].ToString();
                        if (dt.Rows[n]["F_SENDPAR_DATA_LENGTH"].ToString() != "")
                        {
                            model.F_SENDPAR_DATA_LENGTH = decimal.Parse(dt.Rows[n]["F_SENDPAR_DATA_LENGTH"].ToString());
                        }
                        model.F_SENDPAR_DEFAULT_VALUE = dt.Rows[n]["F_SENDPAR_DEFAULT_VALUE"].ToString();
                        model.F_SENDPAR_UNIT          = dt.Rows[n]["F_SENDPAR_UNIT"].ToString();
                        if (dt.Rows[n]["F_SENDPAR_SET"].ToString() != "")
                        {
                            model.F_SENDPAR_SET = decimal.Parse(dt.Rows[n]["F_SENDPAR_SET"].ToString());
                        }
                        if (dt.Rows[n]["F_SENDPAR_DISPLAY"].ToString() != "")
                        {
                            model.F_SENDPAR_DISPLAY = decimal.Parse(dt.Rows[n]["F_SENDPAR_DISPLAY"].ToString());
                        }
                        model.F_SENDPAR_MEMO = dt.Rows[n]["F_SENDPAR_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_SEND->DataTableToList---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllPAR_COMMAND_SEND->DataTableToList---finally");
            }
        }