Ejemplo n.º 1
0
 //增加批文明细
 private void AddApprovalDocHistories(ApprovalDoc NewApprovalDoc)
 {
     foreach (var NewRequest in NewApprovalDoc.Requests)
     {
         Request OriginRequest = this._FE.Requests.Where(p => p.RequestID == NewRequest.RequestID).FirstOrDefault();
         if (OriginRequest == null)
         {
             NewRequest.ApprovalDoc = null;
             //增加申请明细
             AddRequestHistories(NewRequest);
             NewRequest.ApprovalHistories = null;
             //增加申请
             this._FE.Requests.Add(NewRequest);
         }
         else
         {
             NewRequest.ApprovalDoc = null;
             //更新申请明细
             this.UpdateRequestHistories(NewRequest, OriginRequest);
             NewRequest.ApprovalHistories = null;
             //更新申请
             this._FE.Update<Request>(OriginRequest, NewRequest);
         }
     }
 }
Ejemplo n.º 2
0
 //增加批文明细
 private void AddApprovalDocHistories(ApprovalDoc NewApprovalDoc)
 {
     foreach (var NewRequest in NewApprovalDoc.Requests)
     {
         //处理航空公司
         NewRequest.Airlines = null;
         //处理批文明细
         Request OriginRequest = this._FE.Requests.Where(p => p.RequestID == NewRequest.RequestID).FirstOrDefault();
         if (OriginRequest == null)
         {
             //申请对应的批文对象需要设置为空,才能调用ADD方法
             NewRequest.ApprovalDoc = null;
             //增加申请明细
             AddRequestHistories(NewRequest);
             NewRequest.ApprovalHistories = null;
             //增加申请
             this._FE.Requests.Add(NewRequest);
         }
         else
         {
             //删除申请明细
             DeleteRequestHistories(NewRequest, OriginRequest);
             //申请对应的批文对象需要设置为空,才能调用ADD方法
             NewRequest.ApprovalDoc = null;
             //更新申请明细
             UpdateRequestHistories(NewRequest, OriginRequest);
             NewRequest.ApprovalHistories = null;
             //更新申请
             this.Update<Request>(_FE, OriginRequest, NewRequest);
         }
     }
 }
Ejemplo n.º 3
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.º 4
0
 /// <summary>
 /// 创建新批文
 /// </summary>
 /// <param name="service"></param>
 /// <returns></returns>
 internal ApprovalDoc CreateNewApprovalDoc(IFleetService service)
 {
     var approvalDoc = new ApprovalDoc
         {
             ApprovalDocID = Guid.NewGuid(),
             Status = (int)OpStatus.Draft,
         };
     service.EntityContainer.GetEntitySet<ApprovalDoc>().Add(approvalDoc);
     return approvalDoc;
 }