Exemple #1
0
        private void ReturnCT(string inputSN, string lender, string editor)
        {

            logger.Debug("(BorrowAndReturn)ReturnCT start, inputSN:" + inputSN + " editor:" + editor + " lender:" + lender);

            try
            {
                checkForReturned(inputSN);
                var partRepository = RepositoryFactory.GetInstance().GetRepository<IPartSnRepository, PartSn>();
                //inputSNvar partObj = (PartSn)partRepository.Find(inputSN);

                BorrowLog item = new BorrowLog();

                item.Status = "R";
                item.Sn = inputSN;
                item.Model = "KP";
                item.Returner = lender;
                item.Acceptor = editor;

                var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

                productRepository.UpdateBorrowLog(item);
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(BorrowAndReturn)ReturnCT end, inputSN:" + inputSN + " editor:" + editor + " lender:" + lender);

            }

        }
Exemple #2
0
        private void BorrowCT(string inputSN, string borrower, string editor)
        {
            logger.Debug("(BorrowAndReturn)BorrowCT start, inputSN:" + inputSN + " editor:" + editor + " borrower:" + borrower);

            try
            {
                checkForBorrowed(inputSN);
                var partRepository = RepositoryFactory.GetInstance().GetRepository<IPartSnRepository, PartSn>();

                BorrowLog item = new BorrowLog();

                item.Status = "B";
                item.Sn = inputSN;
                item.Model = "KP";
                item.Borrower = borrower;
                item.Lender = editor;

                var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

                productRepository.AddBorrowLog(item);
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(BorrowAndReturn)BorrowCT end, inputSN:" + inputSN + " editor:" + editor + " borrower:" + borrower);
            }
        }
Exemple #3
0
        /// <summary>
        /// insert borrow log
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            var CurrentRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();

            MB currenMB = CurrentSession.GetValue(Session.SessionKeys.MB) as MB;
            string model = "10";

            if (currenMB == null)
            {
                model = (string)CurrentSession.GetValue(Session.SessionKeys.ModelName);
            }
            else
            {
                if (currenMB.MBStatus.Station == "P0" || currenMB.MBStatus.Station == "09")
                {
                    model = currenMB.MBStatus.Station;
                }
            }
            
            string borrower = (string)CurrentSession.GetValue(Session.SessionKeys.Borrower);

            IList<BorrowLog> borrowLog = CurrentRepository.GetBorrowLogBySno(Key, "B");
            if (borrowLog != null && borrowLog.Count > 0)
            {
                var ex2 = new FisException("CHK125", new string[] { });
                throw ex2;
            }

            BorrowLog item = new BorrowLog();
            item.ID = int.MinValue;
            item.Status = this.Status;
            item.Sn = Key;
            item.Model = model;
            item.Borrower = borrower;
            item.Lender = this.Editor;
            item.Returner = "";
            item.Acceptor = "";
            item.Bdate = DateTime.Now;

            var CurrentProductRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            CurrentProductRepository.AddBorrowLogDefered(CurrentSession.UnitOfWork, item);
            return base.DoExecute(executionContext);
        }
Exemple #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var CurrentRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();

            string Returner = CurrentSession.GetValue(Session.SessionKeys.Borrower) as string;

            IList<BorrowLog> borrowLogList = CurrentRepository.GetBorrowLogBySno(Key, "B");
            if (borrowLogList != null && borrowLogList.Count > 0)
            {
                CurrentSession.AddValue(Session.SessionKeys.ReturnWC, borrowLogList[0].Model);
            }
            else
            {
                var ex2 = new FisException("CHK126", new string[] { });
                throw ex2;
            }

            BorrowLog item = new BorrowLog();

            item.Status = this.Status;
            item.Sn = Key;
            item.Returner = Returner;
            item.Acceptor = this.Editor;
            item.Rdate = DateTime.Now;
            CurrentRepository.UpdateBorrowLogDefered(CurrentSession.UnitOfWork, item,"B");
            return base.DoExecute(executionContext);
        }
Exemple #5
0
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                       

            var productObj = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            string borrower = (string)CurrentSession.GetValue(Session.SessionKeys.Borrower);

            IList<BorrowLog> borrowLog = productRepository.GetBorrowLogBySno(productObj.ProId);
            if (!(borrowLog == null || borrowLog.Count == 0))
            {
                foreach (BorrowLog bl in borrowLog)
                {
                    if (bl.Status.ToUpper() == "B")
                    {
                        var ex2 = new FisException("CHK125", new string[] { });
                        throw ex2;
                    }
                }
               
            }

            BorrowLog item = new BorrowLog();

            item.Status = this.Status;
            item.Sn = productObj.ProId;
            item.Model = productObj.Model;
            item.Borrower = borrower;
            item.Lender = this.Editor;

            productRepository.AddBorrowLogDefered(CurrentSession.UnitOfWork, item);
            return base.DoExecute(executionContext);
        }