예제 #1
0
 /// <summary>
 /// 移除申请明细
 /// </summary>
 /// <param name="requestDetail"></param>
 /// <param name="service"></param>
 /// <returns></returns>
 internal void RemoveRequestDetail(ApprovalHistory requestDetail, IFleetService service)
 {
     // 获取相关的计划明细
     var planHistories =
         service.EntityContainer.GetEntitySet<PlanHistory>()
                .Where(ph => ph.ApprovalHistoryID == requestDetail.ApprovalHistoryID).ToList();
     // 相关计划明细的申请明细置为空
     planHistories.ForEach(ph => ph.ApprovalHistory = null);
     // 相关计划飞机的管理状态改为计划
     requestDetail.PlanAircraft.Status = (int)ManageStatus.Plan;
     // 移除申请明细
     service.EntityContainer.GetEntitySet<ApprovalHistory>().Remove(requestDetail);
 }
예제 #2
0
 internal void RemoveRequestDetail(ApprovalHistory requestDetail)
 {
     this.service.RemoveRequestDetail(requestDetail);
     this._needReFreshViewApprovalHistory = true;
     RaiseViewApprovalHistory();
     this._needReFreshViewPlanHistory = true;
     RaiseViewPlanHistory();
 }
예제 #3
0
 /// <summary>
 /// 拒绝申请
 /// </summary>
 /// <param name="requestDetail"></param>
 /// <param name="service"></param>
 internal void RejectRequest(ApprovalHistory requestDetail, IFleetService service)
 {
     // 相关计划飞机的管理状态改为计划
     requestDetail.PlanAircraft.Status = (int)ManageStatus.Plan;
 }
예제 #4
0
 /// <summary>
 /// 批准申请
 /// </summary>
 /// <param name="requestDetail"></param>
 /// <param name="service"></param>
 internal void ApproveRequest(ApprovalHistory requestDetail, IFleetService service)
 {
     // 相关计划飞机的管理状态改为批文
     requestDetail.PlanAircraft.Status = (int)ManageStatus.Approval;
 }
예제 #5
0
        /// <summary>
        /// 创建新申请明细
        /// </summary>
        /// <param name="request"></param>
        /// <param name="planHistory"></param>
        /// <param name="service"></param>
        /// <returns></returns>
        internal ApprovalHistory CreateNewRequestDetail(Request request, PlanHistory planHistory, IFleetService service)
        {
            // 创建新的申请明细
            var requestDetail = new ApprovalHistory
                {
                    ApprovalHistoryID = Guid.NewGuid(),
                    Request = request,
                    PlanAircraft = planHistory.PlanAircraft,
                    ImportCategory = planHistory.TargetCategory,
                    Airlines = planHistory.Airlines,
                    Annual = planHistory.Annual,
                    RequestDeliverMonth = planHistory.PerformMonth,
                    SeatingCapacity = planHistory.SeatingCapacity,
                    CarryingCapacity = planHistory.CarryingCapacity,
                };
            // 把申请明细赋给关联的计划明细
            planHistory.ApprovalHistory = requestDetail;
            // 计划飞机管理状态修改为申请
            requestDetail.PlanAircraft.Status = (int)ManageStatus.Request;

            service.EntityContainer.GetEntitySet<ApprovalHistory>().Add(requestDetail);
            return requestDetail;
        }
예제 #6
0
 //创建管理的批文
 private void CreateManaApprovalHistory(ApprovalHistory NewApprovalHistory)
 {
     if (!this._FE.ManaApprovalHistories.Any(p => p.ApprovalHistoryID == NewApprovalHistory.ApprovalHistoryID))
     {
         ManaApprovalHistory m = new ManaApprovalHistory();
         m.ApprovalHistoryID = NewApprovalHistory.ApprovalHistoryID;
         this._FE.ManaApprovalHistories.Add(m);
     }
 }
예제 #7
0
 //断开与该申请明细的关系
 private void DeleteApprovalHistoryRelation(ApprovalHistory OriginApprovalHistory)
 {
     if (OriginApprovalHistory != null)
     {
         //更新计划历史运营计划
         IQueryable<PlanHistory> PlanHistories = this._FE.PlanHistories.Where(p => p.ApprovalHistoryID == OriginApprovalHistory.ApprovalHistoryID);
         foreach (PlanHistory PlanHistory in PlanHistories)
         {
             PlanHistory.ApprovalHistoryID = null;
             PlanHistory.ApprovalHistory = null;
         }
         //更新运营计划
         IQueryable<OperationPlan> OperationPlans = this._FE.OperationPlans.Where(p => p.ApprovalHistoryID == OriginApprovalHistory.ApprovalHistoryID);
         foreach (OperationPlan OperationPlan in OperationPlans)
         {
             OperationPlan.ApprovalHistoryID = null;
             OperationPlan.ApprovalHistory = null;
         }
         //删除运行历史
         IQueryable<OperationHistory> OperationHistories = this._FE.OperationHistories.Where(p => p.OperationHistoryID == OriginApprovalHistory.ApprovalHistoryID);
         foreach (OperationHistory OperationHistory in OperationHistories)
         {
             this._FE.OperationHistories.Remove(OperationHistory);
         }
         //删除管理的批文
         IQueryable<ManaApprovalHistory> ManaOperationHistories = this._FE.ManaApprovalHistories.Where(p => p.ApprovalHistoryID == OriginApprovalHistory.ApprovalHistoryID);
         foreach (ManaApprovalHistory ManaOperationHistory in ManaOperationHistories)
         {
             this._FE.ManaApprovalHistories.Remove(ManaOperationHistory);
         }
         //删除批文历史(申请明细)
         IQueryable<ApprovalHistory> ApprovalHistories = this._FE.ApprovalHistories.Where(p => p.ApprovalHistoryID == OriginApprovalHistory.ApprovalHistoryID);
         foreach (ApprovalHistory ApprovalHistory in ApprovalHistories)
         {
             this._FE.ApprovalHistories.Remove(ApprovalHistory);
         }
     }
 }