Esempio n. 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <RelayTest.Model.ModelTEST_PREPARE_ATTATCH> DataTableToList(DataTable dt)
        {
            try
            {
                Log.Info("BllTEST_PREPARE_ATTATCH->DataTableToList---START");
                ConnectionOpen();
                dal.SetDBAccess(GetDBAccess());
                List <RelayTest.Model.ModelTEST_PREPARE_ATTATCH> modelList = new List <RelayTest.Model.ModelTEST_PREPARE_ATTATCH>();
                int rowsCount = dt.Rows.Count;
                if (rowsCount > 0)
                {
                    RelayTest.Model.ModelTEST_PREPARE_ATTATCH model;
                    for (int n = 0; n < rowsCount; n++)
                    {
                        model = new RelayTest.Model.ModelTEST_PREPARE_ATTATCH();
                        model.F_TEST_TASK_ID = dt.Rows[n]["F_TEST_TASK_ID"].ToString();
                        model.F_ATTATCHNAME  = dt.Rows[n]["F_ATTATCHNAME"].ToString();
                        if (dt.Rows[n]["F_ATTATCHMENT"].ToString() != "")
                        {
                            model.F_ATTATCHMENT = (byte[])dt.Rows[n]["F_ATTATCHMENT"];
                        }
                        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("BllTEST_PREPARE_ATTATCH->DataTableToList---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllTEST_PREPARE_ATTATCH->DataTableToList---finally");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">相应的数据实体</param>
 /// <returns>真表示有记录被更新,否表示没有记录被更新</returns>
 public bool Update(RelayTest.Model.ModelTEST_PREPARE_ATTATCH model)
 {
     try
     {
         Log.Info("BllTEST_PREPARE_ATTATCH->Update---START");
         ConnectionOpen();
         dal.SetDBAccess(GetDBAccess());
         return(dal.Update(model));
     }
     catch (Exception ex)
     {
         Log.Error("BllTEST_PREPARE_ATTATCH->Update---FAILED", ex);
         throw ex;
     }
     finally
     {
         ConnectionClose();
         Log.Info("BllTEST_PREPARE_ATTATCH->Update---finally");
     }
 }