Example #1
0
 private Task <OperationResult> InternalDeleteLineVehicleRelation(int RelationID, TerminalOperationClient client)
 {
     return(Task <OperationResult> .Run(() =>
     {
         var LineInfo = TerminalSettingsBLL.GetLineInformation(base.CurrentUserID, RelationID);
         if (LineInfo.Item1)
         {
             string PlateNum = LineInfo.Item2;
             string TerminalCode = LineInfo.Item3;
             int LineType = LineInfo.Item4;
             long LineID = LineInfo.Item5;
             var response = client.DeleteLine(TerminalCode, new RegionLineDeletionData()
             {
                 IDs = new uint[] { (uint)LineID }
             });
             OperationResult resultElement = null;
             if (!response.State)
             {
                 resultElement = new OperationResult()
                 {
                     Success = false,
                     Message = response.Message
                 };
             }
             else
             {
                 bool success = TerminalSettingsBLL.DeleteLineVehicleRelation(base.CurrentUserID, RelationID);
                 resultElement = new OperationResult()
                 {
                     Success = success,
                     Message = success ? DisplayText.OperationSucceeded : "车机端删除操作成功完成,删除数据库记录出错。"
                 };
             }
             TerminalSettingsBLL.InsertTerminalOperationsLog(
                 base.CurrentUserID, TerminalSettingType.RouteSettings_Delete, PlateNum, TerminalCode, false,
                 RelationID.ToString(), resultElement.Message, GetRemoteAddress()
                 );
             return resultElement;
         }
         else
         {
             string RecordNotExists = "数据库中找不到对应的设置记录。";
             TerminalSettingsBLL.InsertTerminalOperationsLog(
                 base.CurrentUserID, TerminalSettingType.RouteSettings_Delete,
                 null, null, false, RelationID.ToString(), RecordNotExists, GetRemoteAddress()
                 );
             return new OperationResult()
             {
                 Success = false,
                 Message = RecordNotExists
             };
         }
     }));
 }