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

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

                        //检测项目
                        model.F_TEST_ITEM = dt.Rows[n]["F_TEST_ITEM"].ToString();

                        //规格型号
                        model.F_TEST_MODEL = dt.Rows[n]["F_TEST_MODEL"].ToString();

                        //检测标准
                        model.F_TEST_STANDARD = dt.Rows[n]["F_TEST_STANDARD"].ToString();

                        //检测性质
                        model.F_TEST_PROPERTY = dt.Rows[n]["F_TEST_PROPERTY"].ToString();

                        //检测目的
                        model.F_TEST_AIM = dt.Rows[n]["F_TEST_AIM"].ToString();

                        //委托单位
                        model.F_TASK_DEPUTE_UNIT = dt.Rows[n]["F_TASK_DEPUTE_UNIT"].ToString();

                        //联系人
                        model.F_CONTACT = dt.Rows[n]["F_CONTACT"].ToString();

                        //电话
                        model.F_PHONE = dt.Rows[n]["F_PHONE"].ToString();

                        //email
                        model.F_EMAIL = dt.Rows[n]["F_EMAIL"].ToString();

                        //项目负责人
                        model.F_TEST_CHARGE = dt.Rows[n]["F_TEST_CHARGE"].ToString();

                        //委托日期
                        if (dt.Rows[n]["F_TASK_DEPUTE_DATE"].ToString() != "")
                        {
                            model.F_TASK_DEPUTE_DATE = DateTime.Parse(dt.Rows[n]["F_TASK_DEPUTE_DATE"].ToString());
                        }

                        //样品系列
                        model.F_TEST_SERIES = dt.Rows[n]["F_TEST_SERIES"].ToString();

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

                        //序列试验
                        if (dt.Rows[n]["F_SEQUENCE_TEST"].ToString() != "")
                        {
                            model.F_SEQUENCE_TEST = decimal.Parse(dt.Rows[n]["F_SEQUENCE_TEST"].ToString());
                        }

                        //试验状态
                        if (dt.Rows[n]["F_TEST_STATUS"].ToString() != "")
                        {
                            model.F_TEST_STATUS = decimal.Parse(dt.Rows[n]["F_TEST_STATUS"].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_INFO->DataTableToList---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllTEST_INFO->DataTableToList---finally");
            }
        }