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

                        //试验任务编号
                        model.F_TEST_TASK_ID = dt.Rows[n]["F_TEST_TASK_ID"].ToString();

                        //样品数量
                        if (dt.Rows[n]["F_SAMPLE_NUM"].ToString() != "")
                        {
                            model.F_SAMPLE_NUM = decimal.Parse(dt.Rows[n]["F_SAMPLE_NUM"].ToString());
                        }

                        //样品组别
                        model.F_SAMPLE_GROUP_NUM = dt.Rows[n]["F_SAMPLE_GROUP_NUM"].ToString();

                        //其他信息
                        model.F_SAMPLE_MEMO = dt.Rows[n]["F_SAMPLE_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("BllTEST_SAMPLE_INFO->DataTableToList---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllTEST_SAMPLE_INFO->DataTableToList---finally");
            }
        }