Ejemplo n.º 1
0
 /// <summary>
 /// 判断是否要发送当前运营历史的前一条记录
 /// </summary>
 /// <param name="aircraft"></param>
 /// <param name="currentOperationHistory"></param>
 /// <returns></returns>
 public static OperationHistory GetOperationHistory(Aircraft aircraft, OperationHistory currentOperationHistory, FleetEntities dbContext)
 {
     if (aircraft == null || aircraft.OperationHistories.Count <= 1)
     {
         return null;
     }
     else
     {
         //当前运营历史的前一条记录
         var oh = dbContext.OperationHistories.Where(
                 o => o.OperationHistoryID != currentOperationHistory.OperationHistoryID && o.AircraftID == aircraft.AircraftID).OrderByDescending(
                     o => o.StartDate).FirstOrDefault();
         if (oh != null && currentOperationHistory.StartDate != null)
         {
             return oh;
         }
         else
         {
             return null;
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 创建新的运营历史
 /// </summary>
 /// <param name="approvalHistory">批文明细</param>
 /// <param name="aircraft">飞机</param>
 /// <param name="service"></param>
 private static void CreateOperationHistory(PlanHistory planDetail, Aircraft aircraft, IFleetService service)
 {
     var operationHistory = new OperationHistory
         {
             ApprovalHistory = planDetail.ApprovalHistory,
             Airlines = service.CurrentAirlines,
             Aircraft = aircraft,
             ImportCategory = planDetail.ApprovalHistory.ImportCategory,
             Status = (int)OpStatus.Draft,
         };
     if (planDetail is OperationPlan) (planDetail as OperationPlan).OperationHistory = operationHistory;
     service.EntityContainer.GetEntitySet<OperationHistory>().Add(operationHistory);
     // 更改运营历史状态
     operationHistory.Status = (int)OpStatus.Draft;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 创建新的运力分配
 /// </summary>
 /// <param name="operation"></param>
 /// <param name="service"></param>
 /// <returns></returns>
 internal SubOperationHistory CreateNewSubOperation(OperationHistory operation, IFleetService service)
 {
     var subOperation = new SubOperationHistory
         {
             SubOperationHistoryID = Guid.NewGuid(),
             OperationHistory = operation,
             StartDate = DateTime.Now,
             Status = (int)OpStatus.Draft,
         };
     service.EntityContainer.GetEntitySet<SubOperationHistory>().Add(subOperation);
     return subOperation;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 设置前一条的商业数据的结束时间为当前商业数据的开始时间减去一天
 /// </summary>
 /// <param name="aircraft"></param>
 /// <param name="currentOperationHistory"> </param>
 public static void SetPreviousOperationHistory(Aircraft aircraft, OperationHistory currentOperationHistory, FleetEntities dbContext)
 {
     if (currentOperationHistory != null && currentOperationHistory.StartDate != null)
     {
         //获取前一条商业数据
         var formerOperationHistory = GetOperationHistory(aircraft, currentOperationHistory, dbContext);
         if (formerOperationHistory == null) return;
         //设置前一条商业数据的结束时间为当前商业数据的开始时间减去一天
         formerOperationHistory.EndDate = currentOperationHistory.StartDate.Value.AddDays(-1);
     }
 }
Ejemplo n.º 5
0
 private void UpdatepreviousOperationHistory(OperationHistory obj)
 {
     LogicHistoryHandle.SetPreviousOperationHistory(obj.Aircraft, obj,this._FE);
 }