コード例 #1
0
        /// <summary>
        /// </summary>
        public List <OutApplication> GetConfirmOutApplicationByNextOperatorID(int accountID)
        {
            List <OutApplication> OutApplicationList = _OutApplicationDal.GetNeedConfirmOutApplication();
            List <OutApplication> returnlist         = new List <OutApplication>();

            foreach (OutApplication application in OutApplicationList)
            {
                bool error = false;
                foreach (OutApplicationItem item in application.Item)
                {
                    Account nextOperator = _OutDiyProcessUtility.GetNextOperator(application.DiyProcess,
                                                                                 item, application.Account.Id);

                    if (nextOperator == null || nextOperator.AccountType == VisibleType.None)
                    {
                        if (item.OutApplicationFlow[item.OutApplicationFlow.Count - 1].Step != -1)
                        {
                            _OutApplicationDal.UpdateOutApplicationItemStatusByItemID(item.ItemID,
                                                                                      RequestUtility.MakeDisAggree(
                                                                                          item.Status));
                            error = true;
                            continue;
                        }
                    }
                    else if (accountID == nextOperator.Id)
                    {
                        returnlist.Add(application);
                        break;
                    }
                }
                if (error)
                {
                    new OutApplicationMail().SendErrorMail(application.PKID);
                }
            }
            AccountDetail(returnlist);
            return(returnlist);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        public static bool ApproveOneItem(OutApplicationItem item, bool isAgree, Account account,
                                          OutApplication outApplication, string remark,
                                          IOutApplication dalOutApplication, OutDiyProcessUtility outDiyProcess,
                                          bool isAdjust, bool isChangeAdjust, decimal adjustHour,
                                          out Account nextOperator)
        {
            if (!isAdjust)
            {
                adjustHour = 0;
            }
            nextOperator    = null;
            item            = dalOutApplication.GetOutApplicationItemByItemID(item.ItemID);
            item.AdjustHour = adjustHour;
            bool ans = RequestStatus.CanApproveStatus(item.Status) &&
                       account.Id ==
                       outDiyProcess.GetNextOperator(outApplication.DiyProcess, item, outApplication.Account.Id).Id;

            if (ans)
            {
                if (!isAgree)
                {
                    using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                    {
                        RequestStatus requestStatus = RequestUtility.GetStatus(item.Status, isAgree, 1);
                        dalOutApplication.UpdateOutApplicationItemStatusByItemID(item.ItemID,
                                                                                 requestStatus);
                        dalOutApplication.InsertOutApplicationFlow(item.ItemID,
                                                                   new OutApplicationFlow(0, account,
                                                                                          DateTime.Now,
                                                                                          remark,
                                                                                          requestStatus,
                                                                                          -1));
                        nextOperator = null;
                        item.Status  = requestStatus;
                        if (outApplication.OutType.ID == OutType.OutCity.ID)
                        {
                            if (isChangeAdjust)
                            {
                                dalOutApplication.UpdateOutApplicationItemAdjustByItemID(item.ItemID, isAdjust, adjustHour);
                                item.Adjust = isAdjust;
                            }
                            new UpdateAdjustRestByOut(item, outApplication.Account.Id).Excute();
                        }
                        ts.Complete();
                    }
                }
                else
                {
                    //现在做到第几步,就是上一步加1
                    int step =
                        outDiyProcess.GetNextStep(item.OutApplicationFlow, outApplication.DiyProcess);
                    RequestStatus      requestStatus      = RequestUtility.GetStatus(item.Status, isAgree, step);
                    OutApplicationFlow OutApplicationFlow =
                        new OutApplicationFlow(0, account, DateTime.Now, remark, requestStatus, step);
                    using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                    {
                        dalOutApplication.InsertOutApplicationFlow(item.ItemID, OutApplicationFlow);
                        dalOutApplication.UpdateOutApplicationItemStatusByItemID(item.ItemID, requestStatus);
                        item.Status = requestStatus;
                        if (outApplication.OutType.ID == OutType.OutCity.ID)
                        {
                            if (isChangeAdjust)
                            {
                                dalOutApplication.UpdateOutApplicationItemAdjustByItemID(item.ItemID, isAdjust, adjustHour);
                                item.Adjust = isAdjust;
                            }
                            new UpdateAdjustRestByOut(item, outApplication.Account.Id).Excute();
                        }
                        ts.Complete();
                    }
                    nextOperator =
                        outDiyProcess.GetNextOperator(outApplication.DiyProcess, step, outApplication.Account.Id);
                }
            }
            return(ans);
        }