Ejemplo n.º 1
0
        public HttpResponseMessage UpdateGlobalConfiguration(List <AL_GetAlertConfiguration> Configuration)
        {
            Response   result = new Response();
            AL_AlertBL model  = new AL_AlertBL();

            model.UpdateConfiguration("Update_Alert_Configurations", Configuration);
            result.Message = "Alerts configured successfully.";
            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Ejemplo n.º 2
0
        public HttpResponseMessage UpdateConfiguration(List <AL_GetAlertConfiguration> Configuration)
        {
            Response   result = new Response();
            AL_AlertBL model  = new AL_AlertBL();

            model.UpdateConfiguration("Update_User_Alert_Configurations", Configuration);
            result.Message = "User Alert Permissions Saved Successfully.";
            result.Status  = "true";
            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Ejemplo n.º 3
0
        public HttpResponseMessage Subscription(AL_Subscription Subscription)
        {
            Response   result = new Response();
            AL_AlertBL model  = new AL_AlertBL();

            model.Subscription("Subscribe_Insert_List", Subscription.KeyCode, Subscription.SubscriptionList);

            result.Message = "User Alert Permissions Saved Successfully.";
            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Ejemplo n.º 4
0
        public HttpResponseMessage Subscribe(string KeyCode, int EntityId, string ConfigId, int UserId)
        {
            Response   result = new Response();
            AL_AlertBL model  = new AL_AlertBL();

            model.Subscribe("Subscribe_Insert", KeyCode, EntityId, ConfigId, UserId);

            result.Message = "Alerts Subscribed Succesfully!";
            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Ejemplo n.º 5
0
        public HttpResponseMessage NotificationBellUpdate(List <AL_GetNotification> Info)
        {
            AL_AlertBL model = new AL_AlertBL();

            model.UpdateNotification("NotificationBellUpdate", Info);
            Response result = new Response();

            result.Message = "Alerts Read Succesfully!";
            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        public HttpResponseMessage RoleConfiguration(AL_GetAlertConfiguration Configuration)
        {
            Response   result = new Response();
            AL_AlertBL model  = new AL_AlertBL();

            if (Configuration.KeyCode != null)
            {
                List <AL_GetAlertConfiguration> ModelResult = model.Configuration("Get_Alert_Role_Configurations", Configuration);
                return(Request.CreateResponse(HttpStatusCode.OK, ModelResult));
            }
            else
            {
                result.Message = "KeyCode is required!";
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
        }
Ejemplo n.º 8
0
        public HttpResponseMessage GlobalConfiguration(AL_GetAlertConfiguration Configuration)
        {
            Response   result = new Response();
            AL_AlertBL model  = new AL_AlertBL();
            var        dd     = System.Web.HttpContext.Current.Application["User"];

            if (Configuration.KeyCode != null)
            {
                List <AL_GetAlertConfiguration> ModelResult = model.Configuration("Get_Alert_Configurations", Configuration);
                return(Request.CreateResponse(HttpStatusCode.OK, ModelResult));
            }
            else
            {
                result.Message = "KeyCode is required!";
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
        }
Ejemplo n.º 9
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 == */
        }
Ejemplo n.º 10
0
        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));
        }
Ejemplo n.º 11
0
        public ActionResult New(PM_Project p)
        {
            Response   res   = new Response();
            AL_AlertBL model = new AL_AlertBL();

            try
            {
                // Insert Project Status Change Notification - Start
                AL_GetAlertSubscription Temp = new AL_GetAlertSubscription();
                Temp = model.IsSubscribed("IsSubscribed", (int)ViewBag.UserId, 0, (int)p.ProjectId, "Project Status Change");
                if (Temp.IsSubscribed)
                {
                    int status = model.InsertAlert("Insert_Alert", (int)p.ProjectId, (int)ViewBag.UserId, 0, (int)p.ProjectId, "Project Status Change", (int)p.StatusId);
                }
                // Insert Project Status Change Notification - End

                int                  x               = 0;
                PM_ProjectBL         pb              = new PM_ProjectBL();
                PM_GazetteHolidaysBL gh              = new PM_GazetteHolidaysBL();
                PM_WorkGroupsBL      PWG             = new PM_WorkGroupsBL();
                PM_TaskStagesBL      pM_TaskStagesBL = new PM_TaskStagesBL();
                if (p.WorkingDays != null)
                {
                    p.WorkingDays = p.WorkingDays.Substring(0, p.WorkingDays.Length - 1);
                }
                if (p.ProjectId > 0)
                {
                    pb.Manage("Update", p);

                    Int64 UID = ViewBag.UserId;
                    pb.ProjectUserPermission("UpdateUserPermissions", p.ManagerId, p.ProjectId);
                    //pb.ProjectUserPermission("UpdateUserPermissions", UID, p.ProjectId);
                    Permission.UpdateEntity(ViewBag.UserId);
                    PWG.Manage("Insert", p.ProjectId, p.WorkGroups);
                    if (p.GH != null)
                    {
                        p.GH[0].ProjectId = p.ProjectId;
                        gh.Manage("Delete", p.GH[0]);
                        gh.InsertBulk(p.ProjectId, p.GH);
                    }
                    else
                    {
                        PM_GazetteHolidays g = new PM_GazetteHolidays();
                        g.ProjectId = p.ProjectId;
                        g.Date      = DateTime.Now;
                        gh.Manage("Delete", g);
                        pb.ProjectUserPermission("UpdateUserPermissions", p.ManagerId, p.ProjectId);
                        //pb.ProjectUserPermission("UpdateUserPermissions", UID, p.ProjectId);
                        Permission.UpdateEntity(ViewBag.UserId);
                    }

                    // Update AND Add Task Stages
                    if (p.TS?.Count > 0)
                    {
                        bool IsEXE = pM_TaskStagesBL.UpdateOrAdd("UpdateOrAdd", p.ProjectId, p.TS);
                    }



                    res.Message = "Update successfully";
                }
                else
                {
                    p.IsActive = true;
                    var PId = pb.Manage("Insert", p);
                    PWG.Manage("Insert", PId, p.WorkGroups);

                    Int64 UID = ViewBag.UserId;
                    pb.ProjectUserPermission("InsertUserPermissions", p.ManagerId, PId);
                    pb.ProjectUserPermission("InsertUserPermissions", UID, PId);
                    Permission.UpdateEntity(ViewBag.UserId);
                    if (p.GH != null)
                    {
                        gh.InsertBulk(PId, p.GH);
                    }

                    if (p?.TS?.Count > 0)
                    {
                        var IsInserted = pM_TaskStagesBL.InsertBulk(PId, p.TS);
                    }
                    res.Value = PId;
                    Permission.AddProject(PId);
                    res.Message = "Save successfully";
                }
                res.Status = "success";
            }
            catch (Exception ex)
            {
                res.Status = "danger";
                if (ex.Message == "Object cannot be cast from DBNull to other types.")
                {
                    res.Message = "You Can't Insert Project who is already entered with same name and same client ";
                }
                else
                {
                    res.Message = ex.Message;
                }
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }