예제 #1
0
        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 == */
        }
예제 #2
0
        public int Insert_TrackingAlarms(string Filter, string TrackerID, int VID, double Latitude, double Longitude, FM_Tracker_Alarms objAlarms)
        {
            SqlCommand loCommand = DataContext.OpenConnection();

            try
            {
                loCommand = DataContext.SetStoredProcedure(loCommand, "FM_ManageVehicleTracking");
                loCommand = DataContext.StartTransaction(loCommand);
                bool result = DataContext.ExecuteNonQuery(DataContext.AddParameters(loCommand, "@Filter", Filter, "@IMEI", TrackerID, "@VehicleId", VID, "@Latitude", Latitude, "@Longitude", Longitude, "@AlarmCode", objAlarms.AlrmCodes.ToString(), "@AlarmThreshodVal", objAlarms.ThresholdVal.ToString(), "@AlarmCurrentVal", objAlarms.CurrentVal.ToString(), "@Status", objAlarms.Status));
                DataContext.EndTransaction(loCommand);
                return(Convert.ToInt32(result));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DataContext.CloseConnection(loCommand);
            }
        }
예제 #3
0
 //Tracker Alarms
 public int Insert_TrackingAlarms(string Filter, string TrackerID, int VID, double Latitude, double Longitude, FM_Tracker_Alarms objTrackerAlarms)
 {
     return(model.Insert_TrackingAlarms(Filter, TrackerID, VID, Latitude, Longitude, objTrackerAlarms));
 }