コード例 #1
0
        /// <summary>
        /// 根据type、code、teststation修改数据
        /// </summary>
        /// <param name="runInTimeControl"></param>
        /// <param name="type"></param>
        /// <param name="code"></param>
        /// <param name="testStation"></param>
        //public void UpdateRunInTimeControlByTypeCodeAndTestStation(RunInTimeControlInfoMaintain runInTimeControlInfoMaintain, string type, string code, string testStation)
        //{
        //    RunInTimeControl runInTimeControl = new RunInTimeControl();
        //    runInTimeControl.Code = runInTimeControlInfoMaintain.Code;
        //    runInTimeControl.Type = runInTimeControlInfoMaintain.Type;
        //    runInTimeControl.Hour = runInTimeControlInfoMaintain.Hour;
        //    runInTimeControl.Remark = runInTimeControlInfoMaintain.Remark;
        //    runInTimeControl.Editor = runInTimeControlInfoMaintain.Editor;
        //    runInTimeControl.TestStation = runInTimeControlInfoMaintain.TestStation;
        //    runInTimeControl.ControlType = runInTimeControlInfoMaintain.ControlType;
        //    runInTimeControl.Udt = runInTimeControlInfoMaintain.Udt;
        //    try
        //    {
        //        if ((!runInTimeControl.Code.Equals(code)) || (!runInTimeControl.TestStation.Equals(testStation)))
        //        {
        //            RunInTimeControlInfoMaintain runInTimeContr = productRepository.GetRunInTimeControlByTypeCodeAndStation(runInTimeControl.Type, runInTimeControl.Code, runInTimeControl.TestStation);
        //            if (runInTimeContr != null)
        //            {
        //                //已经存在具有相同runintimecontrol记录
        //                List<string> erpara = new List<string>();
        //                FisException ex;
        //                ex = new FisException("DMT102", erpara);
        //                throw ex;
        //            }
        //        }
        //        UnitOfWork uow = new UnitOfWork();
        //        productRepository.UpdateRunInTimeControlByTypeCodeAndTestStation(runInTimeControl, type, code, testStation);
        //    }
        //    catch (FisException e)
        //    {
        //        logger.Error(e.mErrmsg);
        //        throw e;
        //    }
        //    catch (Exception e)
        //    {
        //        logger.Error(e.Message);
        //        throw;
        //    }
        //}
        public void UpdateRunInTimeControlById(RunInTimeControlInfoMaintain runInTimeControlInfoMaintain)
        {
            RunInTimeControl runInTimeControl = new RunInTimeControl();
            runInTimeControl.Code = runInTimeControlInfoMaintain.Code;
            runInTimeControl.Type = runInTimeControlInfoMaintain.Type;
            runInTimeControl.Hour = runInTimeControlInfoMaintain.Hour;
            runInTimeControl.Remark = runInTimeControlInfoMaintain.Remark;
            runInTimeControl.Editor = runInTimeControlInfoMaintain.Editor;
            runInTimeControl.TestStation = runInTimeControlInfoMaintain.TestStation;
            runInTimeControl.ControlType = runInTimeControlInfoMaintain.ControlType;
            runInTimeControl.Udt = DateTime.Now;// runInTimeControlInfoMaintain.Udt;
            runInTimeControl.ID = runInTimeControlInfoMaintain.ID;

            try
            {

                RunInTimeControlInfoMaintain runInTimeContr = productRepository.GetRunInTimeControlExceptId(runInTimeControl.Type, runInTimeControl.Code, runInTimeControl.TestStation, runInTimeControl.ID);
                if (runInTimeContr != null)
                {
                    //已经存在具有相同runintimecontrol记录
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT102", erpara);
                    throw ex;
                }
            
                UnitOfWork uow = new UnitOfWork();
                productRepository.InsertRunInTimeControlLogDefered(uow, runInTimeControl.ID);
                productRepository.UpdateRunInTimeControlByIdDefered(uow,runInTimeControl);
                uow.Commit();

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
        }
コード例 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="runInTimeControlInfoMaintain"></param>
        /// <returns></returns>
        //public int UpdateRunInTimeControlByTypeAndCode(RunInTimeControlInfoMaintain runInTimeControlInfoMaintain)
        //{
        //    RunInTimeControl runInTimeControl = new RunInTimeControl();
        //    runInTimeControl.Code = runInTimeControlInfoMaintain.Code;
        //    runInTimeControl.Type = runInTimeControlInfoMaintain.Type;
        //    runInTimeControl.Hour = runInTimeControlInfoMaintain.Hour;
        //    runInTimeControl.Remark = runInTimeControlInfoMaintain.Remark;
        //    runInTimeControl.Editor = runInTimeControlInfoMaintain.Editor;
        //    runInTimeControl.TestStation = runInTimeControlInfoMaintain.TestStation;
        //    runInTimeControl.ControlType = runInTimeControlInfoMaintain.ControlType;
        //    runInTimeControl.Udt = runInTimeControlInfoMaintain.Udt;
        //    try
        //    {
        //        RunInTimeControlInfoMaintain runInTimeContr = productRepository.GetRunInTimeControlByTypeCodeAndStation(runInTimeControl.Type, runInTimeControl.Code, runInTimeControl.TestStation);
        //        if (runInTimeContr == null)
        //        {
        //            UnitOfWork uow = new UnitOfWork();
        //            productRepository.UpdateRunInTimeControlByTypeAndCodeDefered(uow, runInTimeControl);
        //            productRepository.InsertRunInTimeControlLogDefered(uow, runInTimeControl.Type, runInTimeControl.Code);
        //            uow.Commit();
        //        }
        //        else
        //        {
        //            //已经存在具有相同runintimecontrol记录
        //            List<string> erpara = new List<string>();
        //            FisException ex;
        //            ex = new FisException("DMT102", erpara);
        //            throw ex;
        //        }
        //    }
        //    catch (FisException e)
        //    {
        //        logger.Error(e.mErrmsg);
        //        throw e;
        //    }
        //    catch (Exception e)
        //    {
        //        logger.Error(e.Message);
        //        throw;
        //    }
        //    return runInTimeControlInfoMaintain.ID;
        //}
        //记录log信息
        //INSERT RunInTimeControlLog(Code, [Type], [Hour], Remark, Editor, Cdt)
        //                  SELECT Code, [Type], Hour, Remark, Editor, Udt
        //                            FROM RunInTimeControl
        //                            WHERE [Type] = ? AND Code = ?  
        //public void InsertRunInTimeControlLog(string type, string code)
        //{
        //    try
        //    {
        //        productRepository.InsertRunInTimeControlLog(type, code);
        //    }
        //    catch (FisException e)
        //    {
        //        logger.Error(e.mErrmsg);
        //        throw e;
        //    }
        //    catch (Exception e)
        //    {
        //        logger.Error(e.Message);
        //        throw;
        //    }
        //}

        //新增RunInTimeControl纪录,返回ID (对象带出)
        //INSERT RunInTimeControl(Code, [Type], [Hour], Remark, Editor, Cdt, Udt)
        //                   VALUES(?, ?, ?, ?, ?, GETDATE(), GETDATE()) 
        public int InsertRunInTimeControl(RunInTimeControlInfoMaintain runInTimeControlInfoMaintain)
        {
            RunInTimeControl runInTimeControl = new RunInTimeControl();
            runInTimeControl.Code = runInTimeControlInfoMaintain.Code;
            runInTimeControl.Type = runInTimeControlInfoMaintain.Type;
            runInTimeControl.Hour = runInTimeControlInfoMaintain.Hour;
            runInTimeControl.Remark = runInTimeControlInfoMaintain.Remark;
            runInTimeControl.Editor = runInTimeControlInfoMaintain.Editor;
            runInTimeControl.TestStation = runInTimeControlInfoMaintain.TestStation;
            runInTimeControl.ControlType = runInTimeControlInfoMaintain.ControlType;
            runInTimeControl.Cdt = runInTimeControlInfoMaintain.Cdt;
            runInTimeControl.Udt = runInTimeControlInfoMaintain.Udt;
            try
            {
                RunInTimeControlInfoMaintain runInTimeContr = productRepository.GetRunInTimeControlByTypeCodeAndStation(runInTimeControl.Type, runInTimeControl.Code, runInTimeControl.TestStation);
                if (runInTimeContr == null)
                {
                    UnitOfWork uow = new UnitOfWork();
                    productRepository.InsertRunInTimeControlDefered(uow, runInTimeControl);
                    //productRepository.InsertRunInTimeControlLogDefered(uow, runInTimeControlInfoMaintain.Type, runInTimeControlInfoMaintain.Code);
                    uow.Commit();
                }
                else
                { //已经存在具有相同runintimecontrol记录
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT102", erpara);
                    throw ex;

                }
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
            return runInTimeControl.ID;
        }