예제 #1
0
        /// <summary>
        /// Sends the specified c.
        /// </summary>
        /// <param name="c">The c.</param>
        /// <param name="signalID">The signal ID.</param>
        public void Send(Comment c, int signalID)
        {
            try
            {
                SignalManager sm = new SignalManager();
                Signal s = sm.LoadSingnal(signalID);

                this.BccReceivers.Add(new MailAddress(s.Email));

                List<SignalSubscription> subscriptions = sm.GetSubscriptions(signalID);

                foreach (SignalSubscription sc in subscriptions)
                {
                    MailAddress ma = new MailAddress(sc.Email);
                    if (!this.BccReceivers.Contains(ma))
                        this.BccReceivers.Add(ma);
                }

                this.CreateXML(s, c);
                base.Transform();
                base.Send();
            }
            catch (Exception ex)
            {
                LogUtils.Log("Error sending alert communication", ex);
            }
        }
예제 #2
0
 private void BuildPage()
 {
     SignalManager sm = new SignalManager();
     Signal s = sm.LoadSingnal(int.Parse(GetFromQueryString("ID")));
 }
예제 #3
0
        private void RenderPage()
        {
            if (QueryStringContains("id"))
            {
                SignalManager sm = new SignalManager();
                Signal s = sm.LoadSingnal(int.Parse(GetFromQueryString("id")));
                divTitle.InnerHtml = s.Subject;
                plhDescription.Controls.Add(new LiteralControl(s.Description));

                this.Title = String.Format(this.Title, s.Subject, s.Address, s.City);
                metaOgDescription.Attributes["content"] = s.Excerpt;
                ogTitle.Attributes["content"] = String.Format(ogTitle.Attributes["content"], s.Subject, s.Address, s.City);

                if (!s.ShowName)
                    ltAuthor.Text = "Anonimo";
                else
                    ltAuthor.Text = s.Name;

                lblAddress.Text = s.Address;

                ltTimeFrame.Text = SignalUtils.GetTimeframe(s.CreationDate);

                CategoryManager cm = new CategoryManager();
                ltCategory.Text = cm.Load(s.CategoryID).Name;

                string markerImage = "MARKERIMAGE_ALERT";
                if (s.Status == Signal.SignalStatus.Resolved)
                    markerImage = "MARKERIMAGE_OK";

                JsonObject currentMarker = new JsonObject();
                currentMarker["id"] = s.SignalID.ToString();
                currentMarker["lat"] = s.Latitude;//.ToString(new CultureInfo("en-US"));
                currentMarker["lng"] = s.Longitude;//.ToString(new CultureInfo("en-US"));
                currentMarker["zoom"] = s.Zoom;//.ToString();
                currentMarker["image"] = new OpenSignals.Framework.Core.Utility.JsUtils.JsConstant(markerImage);
                currentMarker["zip"] = s.Zip;
                currentMarker["status"] = s.Status;

                ClientScript.RegisterClientScriptBlock(this.GetType(), "currentMarker", "currentMarker=" + currentMarker.ToString() + ";", true);

                if (!s.Attachment.Equals(string.Empty))
                {
                    divPhoto.Visible = true;
                    lnkPhoto.HRef = WebUtils.GetImageUrl(UploadPaths.Big, s.Attachment);
                    imgPhoto.ImageUrl = WebUtils.GetImageUrl(UploadPaths.Small, s.Attachment);
                    ogImage.Attributes["content"] = WebUtils.GetImageUrl(UploadPaths.Small, s.Attachment);
                }

                switch (s.Status)
                {
                    case Signal.SignalStatus.ReOpened:
                        divStatusReopened.Visible = true;
                        divStatusReopened.InnerHtml = String.Format(divStatusReopened.InnerHtml, s.ReopenDate.ToShortDateString(), s.ReopenDescription);
                        break;
                    case Signal.SignalStatus.Approved:
                        divStatusNotResolved.Visible = true;
                        break;
                    case Signal.SignalStatus.Resolved:
                        divStatusResolved.Visible = true;
                        divStatusResolved.InnerHtml = String.Format(divStatusResolved.InnerHtml, s.ResolutionDate, s.ResolutionDescription);
                        break;
                    case Signal.SignalStatus.Expired:
                        divStatusExpired.Visible = true;
                        break;
                }

                switch (s.CriticalLevel)
                {
                    case Signal.CriticalLevels.Normal:
                        lblCriticalLevel.Text = "Bassa";
                        lblCriticalLevel.CssClass = "criticalNormal";
                        break;
                    case Signal.CriticalLevels.Medium:
                        lblCriticalLevel.Text = "Media";
                        lblCriticalLevel.CssClass = "criticalMedium";
                        break;
                    case Signal.CriticalLevels.High:
                        lblCriticalLevel.Text = "Alta";
                        lblCriticalLevel.CssClass = "criticalHigh";
                        break;
                }

                if (sm.SearchNearZip(s.Zip, s.SignalID).Count == 0)
                {
                    liMapNearby.Visible = false;
                    mapNearby.Visible = false;
                }
            }
        }
예제 #4
0
        public void ChangeSignalStatus(int signalID, int newStatus, string description, string sessionKey)
        {
            CheckRequest(sessionKey);

            SignalManager sm = new SignalManager();
            Signal s = sm.LoadSingnal(signalID);
            s.Status = newStatus;

            switch (newStatus)
            {
                case Signal.SignalStatus.ReOpened:
                    s.ReopenDate = DateTime.Now;
                    s.ReopenDescription = WebUtils.FormatHtml(description);
                    break;
                case Signal.SignalStatus.Resolved:
                    s.ResolutionDate = DateTime.Now;
                    s.ResolutionDescription = WebUtils.FormatHtml(description);
                    break;
            }

            sm.ChangeSignalStatus(s);

            SignalAlertEmail email = new SignalAlertEmail();
            email.Send(signalID);
        }