public HttpResponseMessage NotificationBell(AL_GetNotification Info) { AL_AlertBL model = new AL_AlertBL(); List <AL_GetNotification> ModelResult = model.GetNotification("NotificationBell", Info); //AL_GetNotification model = new AL_GetNotification(); //NotificationHub SRNotificationHub = new NotificationHub(); //var json = JsonConvert.SerializeObject(ModelResult); //SRNotificationHub.SendNotification(Info.AlertRecieverId.ToString(), json); return(Request.CreateResponse(HttpStatusCode.OK, ModelResult)); }
public void SendNotification(FM_Tracker_Alarms modelBind, string Vreg, int VID, int AssignTo) { /* == Insert Notification When Create New Vehicle Start == */ AL_SetNotification DumyObject = new AL_SetNotification(); AL_GetNotification UserNotify = new AL_GetNotification(); AL_AlertBL AlertModel = new AL_AlertBL(); string AlarmDescriptions = GetDescription(modelBind.AlrmCodes); WebConfig wc = new WebConfig(); string UserIDForNotication = wc.AppSettings("NotificationUserID"); DumyObject.AlertConfigId = 1005; DumyObject.EntityId = VID; DumyObject.Notification = "Car:" + Vreg + " generates " + AlarmDescriptions + " Alarm, current value: " + modelBind.CurrentVal; DumyObject.AlertRecieverId = 29; //11; //AssignTo; DumyObject.UserId = Convert.ToInt32(UserIDForNotication); //12;//(int)ViewBag.UserId; DumyObject.IsPushAlertSent = 1; DumyObject.IsPushAlertRead = 0; DumyObject.IsEmailAlertSent = 0; //sendEmail(); NotificationHub SRNotificationHub = new NotificationHub(); AL_Notification ReadNotification = new AL_Notification(); ReadNotification.SentTo = "11"; /* == Send Alerts based on Users == */ List <AL_GetNotification> ModelResultReceiver = AlertModel.SendNotification("InsertNotification", DumyObject); for (var x = 0; x < ModelResultReceiver.Count; x++) { UserNotify.AlertRecieverId = ModelResultReceiver[x].AlertRecieverId; List <AL_GetNotification> ModelResult = AlertModel.GetNotification("NotificationBell", UserNotify); var json = JsonConvert.SerializeObject(ModelResult); SRNotificationHub.SendNotification(ModelResultReceiver[x].AlertRecieverId.ToString(), json); } /* == Insert Notification When Create New Vehicle End == */ }
public HttpResponseMessage SendNotification(AL_Notification Notification) { NotificationHub SRNotificationHub = new NotificationHub(); AL_Notification ReadNotification = new AL_Notification(); ReadNotification.SentTo = Notification.UserID; //SRNotificationHub.SendNotification(ReadNotification.SentTo); AL_GetNotification UserNotify = new AL_GetNotification(); UserNotify.AlertRecieverId = 11; AL_AlertBL model = new AL_AlertBL(); List <AL_GetNotification> ModelResult = model.GetNotification("NotificationBell", UserNotify); var json = JsonConvert.SerializeObject(ModelResult); SRNotificationHub.SendNotification(ReadNotification.SentTo, json); Response result = new Response(); result.Message = "Alerts Sent Succesfully!"; return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public ActionResult Edit(FM_Vehicle modelBind) { try { FM_Vehicle modelList = new FM_Vehicle(); if (ModelState.IsValid) { string Picture = null; Picture = UploadImg("/Content/Images/Vehicles/Original/", "v-" + modelBind.ChassisNumber.Replace(" ", "_"), 150, 150); string Thumb = (!string.IsNullOrEmpty(Picture)) ? UploadImg("/Content/Images/Vehicles/Thumb/", "v-" + modelBind.ChassisNumber.Replace(" ", "_"), 32, 32) : null; if (!string.IsNullOrEmpty(Picture)) { model.Update_Vehicle("Edit_Vehicle_With_Image", modelBind.TypeId, modelBind.ManuId, modelBind.ModelId, modelBind.SubModelId, modelBind.Year, modelBind.ChassisNumber, modelBind.RegistrationNumber, true, modelBind.VehicleId, Picture.Replace(" ", "_"), modelBind.VehicleGroupId); } else { model.Update_Vehicle("Edit_Vehicle", modelBind.TypeId, modelBind.ManuId, modelBind.ModelId, modelBind.SubModelId, modelBind.Year, modelBind.ChassisNumber, modelBind.RegistrationNumber, true, modelBind.VehicleId, modelBind.VehicleGroupId); } ViewBag.EditResponse = "Success"; modelList = model.Get_EditVehicle("Get_EditVehicle", modelBind.VehicleId); //return RedirectToAction("List"); /* == Insert Notification When Create New Vehicle Start == */ AL_SetNotification DumyObject = new AL_SetNotification(); AL_GetNotification UserNotify = new AL_GetNotification(); DumyObject.AlertConfigId = 7; DumyObject.EntityId = modelBind.VehicleId; DumyObject.Notification = "Vehicle \"" + modelBind.RegistrationNumber + "\" Updated."; DumyObject.AlertRecieverId = 11; DumyObject.UserId = (int)ViewBag.UserId; DumyObject.IsPushAlertSent = 0; DumyObject.IsPushAlertRead = 0; DumyObject.IsEmailAlertSent = 0; //sendEmail(); NotificationHub SRNotificationHub = new NotificationHub(); AL_Notification ReadNotification = new AL_Notification(); ReadNotification.SentTo = "11"; /* == Send Alerts based on Users == */ List <AL_GetNotification> ModelResultReceiver = AlertModel.SendNotification("InsertNotification", DumyObject); for (var x = 0; x < ModelResultReceiver.Count; x++) { UserNotify.AlertRecieverId = ModelResultReceiver[x].AlertRecieverId; List <AL_GetNotification> ModelResult = AlertModel.GetNotification("NotificationBell", UserNotify); var json = JsonConvert.SerializeObject(ModelResult); SRNotificationHub.SendNotification(ModelResultReceiver[x].AlertRecieverId.ToString(), json); } /* == Insert Notification When Create New Vehicle End == */ } return(View(modelList)); } catch (Exception ex) { return(this.Json(new { success = false, message = ex.ToString() })); } }