Exemplo n.º 1
0
        /// <summary>
        /// Maps alert details
        /// </summary>
        /// <param name="alert">alert detail</param>
        /// <returns>Entities alertType data</returns>
        internal static Entities.AlertType MapAlertDetails(Entity.Alert alert)
        {
            var objAlertType = new Entities.AlertType();
            if (alert != null)
            {
                objAlertType.Description = alert.Description;
                objAlertType.TypeId = Convert.ToString(alert.TypeId, CultureInfo.InvariantCulture);

                objAlertType.IsOverride = alert.IsOverride;
                objAlertType.ExpiryDate = alert.ExpiryDate;
                objAlertType.DueDate = alert.StartDate;
                objAlertType.IsSoundEnable = alert.IsSoundEnable;
                objAlertType.AddedDate = alert.AddedDate;
                objAlertType.MessageFrom = alert.MessageFrom;
                objAlertType.DepartmentId = alert.CrewDepartmentId;

                if (alert.IsTemplate)
                {
                    objAlertType.TemplateName = alert.TemplateName;
                    objAlertType.OrderCode = alert.Rank;
                    objAlertType.IsTemplate = alert.IsTemplate;
                }

                if (alert.AlertId != null)
                {
                    objAlertType.ModifiedBy = alert.UserName;
                    objAlertType.AlertTypeId = alert.AlertId;
                }
                else
                {
                    objAlertType.AddedBy = alert.UserName;
                }

                objAlertType.ApplicationId = Convert.ToString(DIContainer.Instance.Resolve<IApplicationSettings>().ApplicationId, CultureInfo.CurrentCulture);
                objAlertType.IsMessage = alert.IsMessage;

                if (alert.Persons.Count > 0)
                {
                    var shipId = DIContainer.Instance.Resolve<IApplicationSettings>().ShipId;
                    foreach (var personAlertData in alert.Persons)
                    {
                        var objPersonAlert = new Entities.Alert();
                        objPersonAlert.PersonId = personAlertData.PersonId;
                        objPersonAlert.PersonTypeId = personAlertData.PersonTypeId;
                        objPersonAlert.ShipId = shipId;
                        objPersonAlert.VoyageId = personAlertData.VoyageId;
                        objPersonAlert.StatusId = personAlertData.StatusId;
                        objAlertType.Alerts.Add(objPersonAlert);
                    }
                }
            }

            return objAlertType;
        }
Exemplo n.º 2
0
        private void DisplayAlert(Entities.Alert alert)
        {
            //PopupWin popup = new PopupWin();

            //int height = 75;
            //int gap = 15;
            //string title = String.Empty;
            //string message = String.Empty;
            //string link = String.Empty;

            //popup.ActionType = PopupAction.RaiseEvents;
            //popup.AutoShow = true;
            //popup.DockMode = PopupDocking.BottomRight;
            //popup.Height = new Unit(height.ToString() + "px");
            //popup.OffsetY = (height + gap) * plcHolderAlerts.Controls.Count;

            //popup.LinkClicked += new EventHandler(popup_LinkClicked);
            //popup.PopupClosed += new EventHandler(popup_PopupClosed);

            //Facade.IReferenceData facReferenceData = new Facade.ReferenceData();

            //switch (alert.AlertType)
            //{
            //    case eAlertType.CheckJobResourcing:
            //        title = "Job " + alert.ObjectId.ToString() + " requires attention.";
            //        message = "One of the resources being used on this job requires your attention.";
            //        break;
            //    case eAlertType.DriverRequestedInformation:
            //        title = "Driver requires information.";
            //        message = facReferenceData.GetDriverNameForResourceId(alert.ObjectId) + " has requested information.";
            //        break;
            //    case eAlertType.APointRequiresIntegration:
            //        title = "A Point Requires Integration";
            //        message = "A job that requires integration is waiting for one or more points to be resolved.";
            //        break;
            //    default:
            //        title = "Unknown alert type";
            //        message = "The alert type was not recognised.";
            //        break;
            //}

            //facReferenceData.Dispose();

            //popup.Attributes.Add("alertId", alert.AlertId.ToString());
            //popup.Attributes.Add("alertTypeId", ((int) alert.AlertType).ToString());
            //popup.Attributes.Add("objectId", alert.ObjectId.ToString());

            //popup.Title = title;
            //popup.Message = message;

            //plcHolderAlerts.Controls.Add(popup);
        }
Exemplo n.º 3
0
        public long CreateAlert(ServiceDataContracts.Alert alert)
        {
            var a = new Entities.Alert();

            a.End     = alert.End;
            a.Message = alert.Message;
            a.Period  = alert.Period;
            a.Start   = alert.Start;

            db.Alerts.Add(a);
            db.SaveChanges();

            return(a.Id);
        }