public void Publish(RIPMessage e, String topicName) { if (e != null) { int itemNum = (lstEvents.Items.Count < 1) ? 0 : lstEvents.Items.Count; lstEvents.Items.Add(itemNum.ToString()); RequestMessage p = GenericDataContractSerializer <RequestMessage> .DeserializeXml(e.Request); // lstEvents.Items[itemNum].SubItems.AddRange(new string[] { "sender id : " + p.SenderID + ", receiver id : " + p.ReceiverID + ", req type is : " + // p.RequestType.ToString() + " data : " +p.DataParams[1] , e.EventData }); lstEvents.Items[itemNum].SubItems.AddRange(new string[] { "sender id : " + p.SenderID, ", receiver id : " + p.ReceiverID, ", req type is : " + p.RequestType.ToString(), " data : " + p.DataParams[1], e.EventData }); _eventCount += 1; txtAstaEventCount.Text = _eventCount.ToString(); } }
public static string PDFCreationDAREMailforInspection(T obj1, ServiceResponseModel <UpdateEfleetInspectionTypeXML> result) { try { string returnPath = string.Empty; dynamic obj = obj1; var objEmailLogRepository = new EmailLogRepository(); var objEmailReturn = new List <EmailToManagerModel>(); var objListEmailog = new List <EmailLog>(); if (result.Data.Response == 1) { objEmailReturn = objEmailLogRepository.SendEmailToManagerForeFleetInspection(obj.LocationId, obj.UserId).Result; } if (result.Data.DamageTireStatus == true && result.Data.EmergencyAccessoriesStatus == true && result.Data.EngineExteriorStatus == true && result.Data.InteriorMileageDriverStatus == true && obj.Status == eFleetCheckInOut.PreTrip || obj.Status == eFleetCheckInOut.PostTrip) { var objTemplateModel = new TemplateModel(); //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app if (result.Data.DamageTireDetails != null) { var ObjReturnDamageTire = new eFleetDamageTireModel(); ObjReturnDamageTire = GenericDataContractSerializer <eFleetDamageTireModel> .DeserializeXml(result.Data.DamageTireDetails); objTemplateModel.DamageTire = ObjReturnDamageTire; } //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app if (result.Data.InteriorMileageDriverDetails != null) { var objInteriorMileageDriverDetails = new eFleetInteriorMileageDriverModel(); objInteriorMileageDriverDetails = GenericDataContractSerializer <eFleetInteriorMileageDriverModel> .DeserializeXml(result.Data.InteriorMileageDriverDetails); objTemplateModel.InteriorMileageDriver = objInteriorMileageDriverDetails; } //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app if (result.Data.EngineExteriorDetails != null) { var objEngineExteriorDetails = new eFleetEngineExteriorModel(); objEngineExteriorDetails = GenericDataContractSerializer <eFleetEngineExteriorModel> .DeserializeXml(result.Data.EngineExteriorDetails); objTemplateModel.EngineExterior = objEngineExteriorDetails; } //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app if (result.Data.EmergencyAccessoriesDetails != null) { var objEmergencyAccessoriesDetails = new eFleetEmergencyAccessoriesModel(); objEmergencyAccessoriesDetails = GenericDataContractSerializer <eFleetEmergencyAccessoriesModel> .DeserializeXml(result.Data.EmergencyAccessoriesDetails); objTemplateModel.EmergencyAccessories = objEmergencyAccessoriesDetails; } objTemplateModel.Status = obj.Status; objTemplateModel.UserName = obj.UserName; objTemplateModel.VehicleNumber = result.Data.VehicleNumber; objTemplateModel.QRCodeID = result.Data.QRCodeID; objTemplateModel.TimeZoneName = obj.TimeZoneName; objTemplateModel.TimeZoneOffset = obj.TimeZoneOffset; objTemplateModel.IsTimeZoneinDaylight = obj.IsTimeZoneinDaylight; string htmlData = TemplateDesigner.eFleetTemplate(objTemplateModel); returnPath = VehicleManager.SaveInspectionPDF(obj.QrcodeId, htmlData); if (objEmailReturn.Count > 0 && result.Data.Response == 1) { foreach (var item in objEmailReturn) { bool IsSent = false; var objEmailHelper = new EmailHelper(); objEmailHelper.emailid = item.ManagerEmail; objEmailHelper.ManagerName = item.ManagerName; objEmailHelper.VehicleMake = result.Data.Make; objEmailHelper.VehicleModel = result.Data.Model; objEmailHelper.VehicleIdentificationNumber = result.Data.VehicleNumber; objEmailHelper.LocationName = result.Data.LocationName; objEmailHelper.UserName = item.UserName; objEmailHelper.QrCodeId = obj.QrcodeId; objEmailHelper.InfractionStatus = obj.Status; objEmailHelper.MailType = "EFLEETINSPECTIONREPORT"; objEmailHelper.SentBy = item.RequestBy; objEmailHelper.LocationID = item.LocationID; objEmailHelper.TimeAttempted = DateTime.UtcNow.ToMobileClientTimeZone(objTemplateModel.TimeZoneName, objTemplateModel.TimeZoneOffset, objTemplateModel.IsTimeZoneinDaylight, false).ToString(); string[] attachFiles = new string[1]; for (var i = 0; i < attachFiles.Count(); i++) { attachFiles[i] = HttpContext.Current.Server.MapPath("~/Content/eFleetDocs/Inspection/" + returnPath); } IsSent = objEmailHelper.SendEmailWithTemplate(attachFiles); //Push Notification string message = PushNotificationMessages.eFleetInspectionReported(result.Data.LocationName, result.Data.QRCodeID, result.Data.VehicleNumber); PushNotification.GCMAndroid(message, item.DeviceId, objEmailHelper); if (IsSent == true) { var objEmailog = new EmailLog(); try { objEmailog.CreatedBy = item.RequestBy; objEmailog.CreatedDate = DateTime.UtcNow; objEmailog.DeletedBy = null; objEmailog.DeletedOn = null; objEmailog.LocationId = item.LocationID; objEmailog.ModifiedBy = null; objEmailog.ModifiedOn = null; objEmailog.SentBy = item.RequestBy; objEmailog.SentEmail = item.ManagerEmail; objEmailog.Subject = objEmailHelper.Subject; objEmailog.SentTo = item.ManagerUserId; objListEmailog.Add(objEmailog); } catch (Exception ex) { return(returnPath); } } } using (var context = new workorderEMSEntities()) { context.EmailLogs.AddRange(objListEmailog); context.SaveChanges();; } //var x = EmailLogRepository.InsertEntitiesNew("EmailLog", objListEmailog); //Task<bool> x = null; //foreach (var i in objListEmailog) //{ // x = objEmailLogRepository.SaveEmailLogAsync(i); //} } } return(returnPath); } catch (Exception ex) { Exception_B.Exception_B.exceptionHandel_Runtime(ex, "static bool PDFCreationDAREMailforInspection(T obj1, ServiceResponseModel<UpdateEfleetInspectionTypeXML> result)", "while creating PDF", result.Data.VehicleID); return(null); } }
/// <summary> /// CreatedBy : Bhushan Dod /// CreatedOn : Sep-08-2017 /// CreatedFor : Get eFleet Vehicle by ID /// </summary> /// <param name="vehicleId"></param> /// <returns></returns> public VehicleScanModel GeteFleetVehicleById(string QRCodeID, long locationId) { try { var ObjReturn = new VehicleScanModel(); //ServiceQrcShuttleBusModel objReturnShuttle = new ServiceQrcShuttleBusModel(); var ObjeFleetVehicleRepository = new eFleetVehicleRepository(); var ObjUserRepository = new UserRepository(); var ObjVehicleDetail = ObjeFleetVehicleRepository.GetSingleOrDefault(q => q.QRCodeID == QRCodeID && q.LocationID == locationId && q.IsDeleted == false); if (ObjVehicleDetail == null) { throw new Exception("Record not found."); } AutoMapper.Mapper.CreateMap <eFleetVehicle, VehicleScanModel>(); ObjReturn = AutoMapper.Mapper.Map(ObjVehicleDetail, ObjReturn); string HostingPrefix = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["hostingPrefix"], CultureInfo.InvariantCulture); string AssetImgURLPrefix = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["VehicleImage"], CultureInfo.InvariantCulture); ObjReturn.VehicleImage = HostingPrefix + AssetImgURLPrefix.Replace("~", "") + ObjVehicleDetail.VehicleImage; //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app if (ObjVehicleDetail.DamageTireDetails != null) { var ObjReturnDamageTire = new eFleetDamageTireModel(); ObjReturnDamageTire = GenericDataContractSerializer <eFleetDamageTireModel> .DeserializeXml(ObjVehicleDetail.DamageTireDetails); //ObjReturn.DamageTire = ObjReturnDamageTire; //ObjReturn.IsDamage = ObjReturnDamageTire.Damage.IsDamage; //ObjReturn.DarID = ObjReturnDamageTire.Damage.DamageDarId; } //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app if (ObjVehicleDetail.InteriorMileageDriverDetails != null) { var objInteriorMileageDriverDetails = new eFleetInteriorMileageDriverModel(); objInteriorMileageDriverDetails = GenericDataContractSerializer <eFleetInteriorMileageDriverModel> .DeserializeXml(ObjVehicleDetail.InteriorMileageDriverDetails); ObjReturn.ChShDescription = objInteriorMileageDriverDetails.Mileage.ChShDescription; ObjReturn.OldChShDescription = objInteriorMileageDriverDetails.Mileage.OldChShDescription; //ObjReturn.InteriorMileageDriver = objInteriorMileageDriverDetails; } //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app if (ObjVehicleDetail.EngineExteriorDetails != null) { var objEngineExteriorDetails = new eFleetEngineExteriorModel(); objEngineExteriorDetails = GenericDataContractSerializer <eFleetEngineExteriorModel> .DeserializeXml(ObjVehicleDetail.EngineExteriorDetails); //ObjReturn.EngineExterior = objEngineExteriorDetails; } //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app if (ObjVehicleDetail.EmergencyAccessoriesDetails != null) { var objEmergencyAccessoriesDetails = new eFleetEmergencyAccessoriesModel(); objEmergencyAccessoriesDetails = GenericDataContractSerializer <eFleetEmergencyAccessoriesModel> .DeserializeXml(ObjVehicleDetail.EmergencyAccessoriesDetails); //ObjReturn.EmergencyAccessories = objEmergencyAccessoriesDetails; } return(ObjReturn); } catch (Exception ex) { WorkOrderEMS.BusinessLogic.Exception_B.Exception_B.exceptionHandel_Runtime(ex, "VehicleScanModel GeteFleetVehicleById(long vehicleId, long locationId)", "while fetching GeteFleetVehicleById", QRCodeID); return(null); } }