Esempio n. 1
0
        public string RenderText(string delimeter = "\n")
        {
            StringBuilder sb = new StringBuilder();

            switch ((Types)this.Type)
            {
            case Types.Sponzor:
                return(Title + " v " + this.RenderDatum() + (AddInfoNum.HasValue ? ", " + Smlouva.NicePrice(AddInfoNum) : ""));

            case Types.SponzorZuctu:
                return("");    // Title + " v " + this.RenderDatum() + (AddInfoNum.HasValue ? ", " + Smlouva.NicePrice(AddInfoNum) : "") + " (z transp.účtu)";

            case Types.OsobniVztah:
                if (!string.IsNullOrEmpty(AddInfo) && Devmasters.Core.TextUtil.IsNumeric(AddInfo))
                {
                    Osoba o = Osoby.GetById.Get(Convert.ToInt32(AddInfo));
                    if (o != null)
                    {
                        return(this.Title + " s " + o.FullName());
                    }
                    else
                    {
                        return(this.Title + " " + Description);
                    }
                }
                else
                {
                    return(this.Title + " " + Description);
                }

            case Types.Popis:
            default:
                if (!string.IsNullOrEmpty(this.Title) && !string.IsNullOrEmpty(this.Description))
                {
                    return(this.Title + delimeter + this.Description);
                }
                else if (!string.IsNullOrEmpty(this.Title))
                {
                    return(this.Title);
                }
                else if (!string.IsNullOrEmpty(this.Description))
                {
                    return(this.Description);
                }
                else
                {
                    return(string.Empty);
                }
            }
        }
Esempio n. 2
0
        public void Accepted(string user)
        {
            this.reviewedBy   = user;
            this.reviewed     = DateTime.Now;
            this.reviewResult = (int)ReviewAction.Accepted;

            switch (this.ItemType)
            {
            case ItemTypes.osobaPhoto:
                var   data = Newtonsoft.Json.Linq.JObject.Parse(this.newValue);
                Osoba o    = Osoby.GetByNameId.Get(data.Value <string>("nameId"));
                if (o != null)
                {
                    var path      = HlidacStatu.Lib.Init.OsobaFotky.GetFullPath(o, "original.uploaded.jpg");
                    var pathSmall = HlidacStatu.Lib.Init.OsobaFotky.GetFullPath(o, "small.uploaded.jpg");
                    HlidacStatu.Util.IOTools.MoveFile(pathSmall, HlidacStatu.Lib.Init.OsobaFotky.GetFullPath(o, "small.jpg"));

                    if (Devmasters.Core.TextUtil.IsValidEmail(this.createdBy))
                    {
                        using (System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient())
                        {
                            var m = new System.Net.Mail.MailMessage()
                            {
                                From       = new System.Net.Mail.MailAddress("*****@*****.**"),
                                Subject    = o.FullName() + " - nová fotka schválena.",
                                IsBodyHtml = false,
                                Body       = "Vámi nahraná fotka byla právě schválena. Děkujeme za pomoc.\n\nHlídač Státu"
                            };
                            m.BodyEncoding    = System.Text.Encoding.UTF8;
                            m.SubjectEncoding = System.Text.Encoding.UTF8;

                            m.To.Add(this.createdBy);
                            m.Bcc.Add("*****@*****.**");
                            smtp.Send(m);
                        }
                    }
                }
                break;

            default:
                break;
            }

            this.Save();
        }
Esempio n. 3
0
        public void Denied(string user, string reason)
        {
            this.reviewedBy   = user;
            this.reviewed     = DateTime.Now;
            this.reviewResult = (int)ReviewAction.Denied;
            this.comment      = reason;
            if (Devmasters.Core.TextUtil.IsValidEmail(this.createdBy))
            {
                switch (this.ItemType)
                {
                case ItemTypes.osobaPhoto:
                    using (System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient())
                    {
                        var   data = Newtonsoft.Json.Linq.JObject.Parse(this.newValue);
                        Osoba o    = Osoby.GetByNameId.Get(data.Value <string>("nameId"));
                        if (o != null)
                        {
                            var m = new System.Net.Mail.MailMessage()
                            {
                                From       = new System.Net.Mail.MailAddress("*****@*****.**"),
                                Subject    = o.FullName() + " - nová fotka neschválena.",
                                IsBodyHtml = false,
                                Body       = "Vámi nahraná fotka nebyla schválena k uveřejnění.\nDůvod:" + reason + "\n\nDěkujeme za pomoc.\n\nHlídač Státu"
                            };
                            m.BodyEncoding    = System.Text.Encoding.UTF8;
                            m.SubjectEncoding = System.Text.Encoding.UTF8;
                            m.To.Add(this.createdBy);
                            m.Bcc.Add("*****@*****.**");
                            smtp.Send(m);
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            this.Save();
        }
Esempio n. 4
0
        public string RenderHtml(string delimeter = ", ")
        {
            string zdroj = "";

            if (!string.IsNullOrEmpty(this.Zdroj))
            {
                if (this.Zdroj.ToLower().StartsWith("http"))
                {
                    zdroj = string.Format(" <a target='_blank' href='{0}'>{1}</a>", this.Zdroj, "<span class='text-muted' title='Jedná se o peněžní nebo nepeněžní dar' alt='Jedná se o peněžní nebo nepeněžní dar'>(<span class='glyphicon glyphicon-link' aria-hidden='true'></span> zdroj</span>)");
                }
                else
                {
                    zdroj = string.Format(" ({0})", this.Zdroj);
                }
            }
            StringBuilder sb = new StringBuilder();

            switch ((Types)this.Type)
            {
            case Types.Sponzor:
                return(Title + " v " + this.RenderDatum() + (AddInfoNum.HasValue ? ", " + Smlouva.NicePrice(AddInfoNum) : "") + zdroj);

            case Types.SponzorZuctu:
                return("");    // Title + " v " + this.RenderDatum() + (AddInfoNum.HasValue ? ", " + Smlouva.NicePrice(AddInfoNum) : "") + " (z transp.účtu)" + zdroj;

            case Types.OsobniVztah:
                if (!string.IsNullOrEmpty(AddInfo) && Devmasters.Core.TextUtil.IsNumeric(AddInfo))
                {
                    Osoba o = Osoby.GetById.Get(Convert.ToInt32(AddInfo));
                    if (o != null)
                    {
                        return(this.Title + " s " + string.Format("<a href=\"{0}\">{1}</a>", o.GetUrlOnWebsite(), o.FullName()) + zdroj);
                    }
                    else
                    {
                        return(this.Title + " " + Description + zdroj);
                    }
                }
                else
                {
                    return(this.Title + " " + Description + zdroj);
                }

            case Types.Popis:
            default:
                if (!string.IsNullOrEmpty(this.Title) && !string.IsNullOrEmpty(this.Description))
                {
                    return(this.Title + delimeter + this.Description + zdroj);
                }
                else if (!string.IsNullOrEmpty(this.Title))
                {
                    return(this.Title + zdroj);
                }
                else if (!string.IsNullOrEmpty(this.Description))
                {
                    return(this.Description + zdroj);
                }
                else
                {
                    return(string.Empty);
                }
            }
        }
Esempio n. 5
0
        public string RenderText(string delimeter = "\n")
        {
            StringBuilder sb = new StringBuilder();

            switch ((Types)this.Type)
            {
            case Types.ClenStrany:
                sb.AppendFormat("Člen strany {1} {0} ", this.RenderDatum(), this.AddInfo);
                return(sb.ToString());

            case Types.Poslanec:
                sb.AppendFormat("Poslanec {0} ", this.RenderDatum());
                if (!string.IsNullOrEmpty(this.AddInfo))
                {
                    sb.Append(" za " + AddInfo);
                }
                return(sb.ToString());

            case Types.Senator:
                sb.AppendFormat("Senator {0} ", this.RenderDatum());
                if (!string.IsNullOrEmpty(this.AddInfo))
                {
                    sb.Append(" za " + AddInfo);
                }
                return(sb.ToString());

            case Types.Sponzor:
                return(Title + " v " + this.RenderDatum() + (AddInfoNum.HasValue ? ", hodnota daru " + Smlouva.NicePrice(AddInfoNum)  : ""));

            case Types.OsobniVztah:
            case Types.Pribuzny:
                if (!string.IsNullOrEmpty(AddInfo) && Devmasters.Core.TextUtil.IsNumeric(AddInfo))
                {
                    Osoba o = Osoby.GetById.Get(Convert.ToInt32(AddInfo));
                    if (o != null)
                    {
                        return(this.Title + " s " + o.FullName());
                    }
                    else
                    {
                        return(this.Title + " " + Description);
                    }
                }
                else
                {
                    return(this.Title + " " + Description);
                }

            case Types.Popis:
            default:
                if (!string.IsNullOrEmpty(this.Title) && !string.IsNullOrEmpty(this.Description))
                {
                    return(this.Title + delimeter + this.Description);
                }
                else if (!string.IsNullOrEmpty(this.Title))
                {
                    return(this.Title);
                }
                else if (!string.IsNullOrEmpty(this.Description))
                {
                    return(this.Description);
                }
                else
                {
                    return(string.Empty);
                }
            }
        }