/// <summary> /// Created By Ashwajit Bansod Dated : Sept-22-2017 /// for fetching the Data from Database for editing /// </summary> /// <param name="maintenanceId"></param> /// <returns></returns> public eFleetMaintenanceModel GeteFleetMaintenanceDetailsById(long maintenanceId) { try { var db = new workorderEMSEntities(); var ObjeFleetMaintenanceRepository = new eFleetMaintenanceRepository(); var editeFleetMaintenanceDetails = new eFleetMaintenanceModel(); var efleetmaintenanceDetails = ObjeFleetMaintenanceRepository.GetSingleOrDefault(u => u.MaintenanceID == maintenanceId); if (efleetmaintenanceDetails.MaintenanceID > 0) { AutoMapper.Mapper.CreateMap <eFleetMaintenance, eFleetMaintenanceModel>(); var objfleetVehicleMapper = AutoMapper.Mapper.Map(efleetmaintenanceDetails, editeFleetMaintenanceDetails); //if (editeFleetPMDetails.Meter == 423) //{ // editeFleetPMDetails.HoursValue = efleetDetails.ReminderMetric; //} } return(editeFleetMaintenanceDetails); } catch (Exception ex) { Exception_B.Exception_B.exceptionHandel_Runtime(ex, "public eFleetMaintenanceModel GeteFleetPMDetailsById(long maintenanceId)", "Exception While Editing Maintenence.", null); throw; } }
/// <summary> /// Created By Ashwajit Bansod Dated : Sept-22-2017 /// </summary> /// <param name="VehicleId"></param> /// <param name="loggedInUserId"></param> /// <returns></returns> public Result DeleteeFleetMaintenance(long maintenanceId, long loggedInUserId, string location) { var objDAR = new DARModel(); try { Result result; if (maintenanceId > 0) { if (true) { var objeFleetMaintenanceRepository = new eFleetMaintenanceRepository(); var data = objeFleetMaintenanceRepository.GetSingleOrDefault(v => v.MaintenanceID == maintenanceId && v.IsDeleted == false); if (data != null) { data.IsDeleted = true; data.DeletedBy = loggedInUserId; data.DeletedDate = DateTime.UtcNow; objeFleetMaintenanceRepository.Update(data); objeFleetMaintenanceRepository.SaveChanges(); objDAR.ActivityDetails = DarMessage.DeleteFleetMaintenance(location); objDAR.TaskType = (long)TaskTypeCategory.DeleteeFleetMaintenance; #region Save DAR objDAR.LocationId = data.LocationID; objDAR.UserId = loggedInUserId; objDAR.DeletedBy = data.DeletedBy; objDAR.DeletedOn = DateTime.UtcNow; result = _ICommonMethod.SaveDAR(objDAR); #endregion Save DAR return(Result.Delete); } } else { return(Result.Failed); } } else { return(Result.DoesNotExist); } return(Result.Delete); } catch (Exception ex) { Exception_B.Exception_B.exceptionHandel_Runtime(ex, "public Result DeleteeFleetMaintenance(long maintenanceId, long loggedInUserId)", "Exception While Deleting Preventative Maintenence.", null); throw; } }