Ejemplo n.º 1
0
 //增加申请明细
 private void AddRequestHistories(Request NewRequest)
 {
     for (int i = NewRequest.ApprovalHistories.Count() - 1; i >= 0; i--)
     {
         var NewApprovalHistory = NewRequest.ApprovalHistories.ElementAt(i);
         //处理航空公司
         NewApprovalHistory.Airlines = null;
         //更新计划飞机
         UpdatePlanAircraft(NewApprovalHistory.PlanAircraft);
         NewApprovalHistory.PlanAircraft = null;
         // 增加申请对应的批文历史
         ApprovalHistory OriginApprovalHistory = this._FE.ApprovalHistories.Where(p => p.ApprovalHistoryID == NewApprovalHistory.ApprovalHistoryID).FirstOrDefault();
         if (OriginApprovalHistory == null)
         {
             //增加申请明细
             NewApprovalHistory.Request = null;
             this._FE.ApprovalHistories.Add(NewApprovalHistory);
         }
         else
         {
             //更新申请明细
             NewApprovalHistory.Request = null;
             this.Update<ApprovalHistory>(_FE, OriginApprovalHistory, NewApprovalHistory);
         }
         //创建管理的批文
         CreateManaApprovalHistory(NewApprovalHistory);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 往批文添加申请
 /// </summary>
 /// <param name="approvalDoc"></param>
 /// <param name="request"></param>
 /// <param name="service"></param>
 /// <returns></returns>
 internal Request AddRequestToApprovalDoc(ApprovalDoc approvalDoc, Request request, IFleetService service)
 {
     // 把申请赋给相关批文
     request.ApprovalDoc = approvalDoc;
     // 申请状态改为已审批
     request.Status = (int)ReqStatus.Examined;
     // 相关申请明细对应计划飞机置为批准,其管理状态置为批文
     request.ApprovalHistories.ToList().ForEach(ah =>
         {
             ah.IsApproved = true;
             ah.PlanAircraft.Status = (int)ManageStatus.Approval;
         });
     return request;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 移除申请
 /// </summary>
 /// <param name="request"></param>
 /// <param name="service"></param>
 internal void RemoveRequest(Request request, IFleetService service)
 {
     // 从相关批文移除申请
     request.ApprovalDoc = null;
     // 申请状态改为已提交
     request.Status = (int)ReqStatus.Submited;
     // 相关申请明细对应计划飞机置为未批准,其管理状态置为申请
     request.ApprovalHistories.ToList().ForEach(ah =>
         {
             ah.IsApproved = false;
             ah.PlanAircraft.Status = (int)ManageStatus.Request;
         });
 }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 创建新申请
 /// </summary>
 /// <param name="service"></param>
 /// <returns></returns>
 internal Request CreateNewRequest(IFleetService service)
 {
     var request = new Request
         {
             RequestID = Guid.NewGuid(),
             Airlines = service.CurrentAirlines,
             Status = (int)ReqStatus.Draft,
             CreateDate = DateTime.Now,
         };
     service.EntityContainer.GetEntitySet<Request>().Add(request);
     return request;
 }
Ejemplo n.º 6
0
 private void UpdateRequestApprovalDoc(Request NewRequest)
 {
     if (NewRequest == null) return;
     //处理批文ID
     if (NewRequest.ApprovalDocID != null)
     {
         ApprovalDoc ApprovalDoc = this._FE.ApprovalDocs.Where(q => q.ApprovalDocID == NewRequest.ApprovalDocID).FirstOrDefault();
         if (ApprovalDoc == null)
         {
             NewRequest.ApprovalDocID = null;
         }
     };
     //批文对象不需要
     NewRequest.ApprovalDoc = null;
 }
Ejemplo n.º 7
0
        //删除申请明细
        private void DeleteRequestHistories(Request NewRequest, Request OriginRequest)
        {
            if (OriginRequest == null) return;
            //获取原申请明细
            ICollection<ApprovalHistory> OriginApprovalHistories = this._FE.ApprovalHistories.Where(p => p.RequestID == OriginRequest.RequestID).ToList();
            //对原申请明细进行处理, 不在新申请明细中的需要删除
            for (int i = OriginApprovalHistories.Count() - 1; i >= 0; i--)
            {
                var OriginApprovalHistory = OriginApprovalHistories.ElementAt(i);

                if (!NewRequest.ApprovalHistories.Any(p => p.ApprovalHistoryID == OriginApprovalHistory.ApprovalHistoryID))
                {
                    //断开与该申请明细的关系 TODO
                    DeleteApprovalHistoryRelation(OriginApprovalHistory);
                    //删除该申请明细
                    this._FE.ApprovalHistories.Remove(OriginApprovalHistory);
                }
            }
        }
Ejemplo n.º 8
0
 //更新申请明细
 private void UpdateRequestHistories(Request NewRequest, Request OriginRequest)
 {
     foreach (var NewApprovalHistory in NewRequest.ApprovalHistories)
     {
         //获取原批文历史
         ApprovalHistory OriginApprovalHistory = this._FE.ApprovalHistories.Where(p => p.ApprovalHistoryID == NewApprovalHistory.ApprovalHistoryID).FirstOrDefault();
         if (OriginApprovalHistory == null)
         {
             NewApprovalHistory.Request = null;
             // 增加申请对应的批文历史
             this._FE.ApprovalHistories.Add(NewApprovalHistory);
         }
         else
         {
             NewApprovalHistory.Request = null;
             // 更新申请对应的批文历史
             this._FE.Update<ApprovalHistory>(OriginApprovalHistory, NewApprovalHistory);
         }
     }
 }
Ejemplo n.º 9
0
 //增加申请明细
 private void AddRequestHistories(Request NewRequest)
 {
     foreach (var NewApprovalHistory in NewRequest.ApprovalHistories)
     {
         // 增加申请对应的批文历史
         ApprovalHistory OriginApprovalHistory = this._FE.ApprovalHistories.Where(p => p.ApprovalHistoryID == NewApprovalHistory.ApprovalHistoryID).FirstOrDefault();
         if (OriginApprovalHistory == null)
         {
             NewApprovalHistory.Request = null;
             this._FE.ApprovalHistories.Add(NewApprovalHistory);
             //创建管理的批文
              ManaApprovalHistory m = new ManaApprovalHistory();
              m.ApprovalHistoryID = NewApprovalHistory.ApprovalHistoryID;
              this._FE.ManaApprovalHistories.Add(m);
         }
         else
         {
             NewApprovalHistory.Request = null;
             this._FE.Update<ApprovalHistory>(OriginApprovalHistory, NewApprovalHistory);
         }
     }
 }
Ejemplo n.º 10
0
 internal void RemoveRequest(Request request)
 {
     this.service.RemoveRequest(request);
     this._needReFreshViewEnRouteRequest = true;
     this.RaiseViewEnRouteRequest();
     this._needReFreshViewRequest = true;
     this.RaiseViewRequest();
     this.SelRequest = ViewRequest.LastOrDefault();
 }
Ejemplo n.º 11
0
 internal void AddRequestToApprovalDoc(Request request)
 {
     var req = this.service.AddRequestToApprovalDoc(this.SelApprovalDoc, request);
     this._needReFreshViewEnRouteRequest = true;
     this.RaiseViewEnRouteRequest();
     this._needReFreshViewRequest = true;
     this.RaiseViewRequest();
     this.SelRequest = req;
 }