Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            pinboardOffer = (DataObjectPinboardOffer)dataObject;
            udc           = UserDataContext.GetUserDataContext();

            if (UserProfile.Current.IsAnonymous)
            {
                this.CTCTBTN.Visible = false;
            }

            this.CTCTBTN.NavigateUrl = string.Format("Javascript:radWinOpen('/Pages/popups/MessageSend.aspx?MsgType=pbo&recid={0}&objid={1}', '{2}', 510, 490, false, null)", pinboardOffer.UserID, pinboardOffer.ObjectID, language.GetString("CommandPinboardContactTitle").StripForScript());

            // Disable tooltip managers by default -> tooltip managers without targets don't work
            this.RTTM.Visible    = false;
            this.RTTMIMG.Visible = false;
            if (pinboardOffer != null)
            {
                foreach (string tooltipId in _4screen.CSB.DataAccess.Business.AdWordHelper.GetCampaignObjectIds(pinboardOffer.ObjectID.Value))
                {
                    this.RTTM.TargetControls.Add(tooltipId, true);
                    this.RTTM.Visible = true;
                }
            }

            this.DESCLIT.Text = pinboardOffer.DescriptionLinked;

            decimal price;

            if (pinboardOffer.Price.EndsWith("0") || decimal.TryParse(pinboardOffer.Price, out price))
            {
                this.PRICELIT.Text = string.Format("{0}: {1} CHF", language.GetString("CommandPinboardPrice"), pinboardOffer.Price);
            }
            else if (pinboardOffer.Price != "")
            {
                this.PRICELIT.Text = string.Format("{0}: {1}", language.GetString("CommandPinboardPrice"), pinboardOffer.Price);
            }
            else
            {
                this.PRICELIT.Text = string.Format("{0}: {1}", language.GetString("CommandPinboardPrice"), language.GetString("CommandPinboardNoPrice"));
            }

            pinboardPictures = DataObjects.Load <DataObjectPicture>(new QuickParameters {
                RelationParams = new RelationParams {
                    ParentObjectID = pinboardOffer.ObjectID, ChildObjectType = Helper.GetObjectTypeNumericID("Picture")
                }, ShowState = ObjectShowState.Published, Amount = 0, Direction = QuickSortDirection.Asc, PageNumber = 0, PageSize = 999999, SortBy = QuickSort.RelationSortNumber, Udc = UserDataContext.GetUserDataContext()
            });

            foreach (DataObjectPicture picture in pinboardPictures)
            {
                string imageId = "Img_" + picture.ObjectID.Value.ToString();
                this.RTTMIMG.TargetControls.Add(imageId, true);
                this.RTTMIMG.Visible = true;
                LiteralControl image = new LiteralControl(string.Format("<div style=\"float:left;width:110px;\"><div><img class ='articlepic' src=\"{0}{1}\" id=\"{2}\" /></div><div>{3}</div></div>", _4screen.CSB.Common.SiteConfig.MediaDomainName, picture.GetImage(PictureVersion.S), imageId, picture.Title));
                this.PhImgs.Controls.Add(image);
            }
        }
Пример #2
0
        private void SetSubjectAndBody()
        {
            if (!IsPostBack)
            {
                if (messageType.ToLower() == "rec")
                {
                    txtSubject.Text = language.GetString("LableMessageRecommedation");
                    string perparedLink = rawLink;
                    if (!rawLink.ToLower().StartsWith("http"))
                    {
                        perparedLink = _4screen.CSB.Common.SiteConfig.HostName + rawLink;
                    }

                    string mailBody = GuiLanguage.GetGuiLanguage("Templates").GetString("EmailRecommendation");
                    mailBody = mailBody.Replace("<%SITE_URL%>", _4screen.CSB.Common.SiteConfig.SiteURL);
                    if (UserDataContext.GetUserDataContext().IsAuthenticated)
                    {
                        DataObjectUser user = DataObject.Load <DataObjectUser>(UserProfile.Current.UserId);
                        mailBody = mailBody.Replace("<%FROM_USERNAME%>", user.Vorname);
                    }
                    else
                    {
                        mailBody = mailBody.Replace("<%FROM_USERNAME%>", string.Empty);
                    }
                    mailBody            = mailBody.Replace("<%LINK%>", perparedLink);
                    txtBody.Content     = mailBody;
                    txtSubject.ReadOnly = true;
                }
                else if (messageType.ToLower() == "msg")
                {
                    txtSubject.Text = language.GetString("LableMessagePrivateMessage");
                }
                else if (messageType.ToLower() == "ymr")
                {
                    txtSubject.Text     = languageShared.GetString("CommandFriendshipQuery");
                    txtSubject.ReadOnly = true;
                }
                else if (messageType.ToLower() == "invite")
                {
                    txtSubject.Text     = language.GetString("LableMessageInviteToCommunity");
                    txtSubject.ReadOnly = true;
                }
                else if (messageType.ToLower() == "rep")
                {
                    if (objectType == Helper.GetObjectTypeNumericID("User"))
                    {
                        txtSubject.Text = languageShared.GetString("CommandUserReport");
                    }
                    else if (objectType == Helper.GetObjectTypeNumericID("Community"))
                    {
                        txtSubject.Text = languageShared.GetString("CommandCommunityReport");
                    }
                    else if (objectType.HasValue)
                    {
                        txtSubject.Text = string.Format(languageShared.GetString("CommandObjectReport"), Helper.GetObjectName(objectType.Value, true));
                    }
                    else
                    {
                        txtSubject.Text = languageShared.GetString("CommandPageReport");
                    }
                    txtSubject.ReadOnly = true;
                }
                else if (messageType.ToLower() == "pbs" && objectId.HasValue)
                {
                    DataObjectPinboardSearch pinboardSearch = DataObject.Load <DataObjectPinboardSearch>(objectId);
                    if (pinboardSearch.State != ObjectState.Added)
                    {
                        txtSubject.Text     = language.GetString("TextPinboardSearch") + " '" + pinboardSearch.Title + "'";
                        txtSubject.ReadOnly = true;
                    }
                }
                else if (messageType.ToLower() == "pbo" && objectId.HasValue)
                {
                    DataObjectPinboardOffer pinboardOffer = DataObject.Load <DataObjectPinboardOffer>(objectId);
                    if (pinboardOffer.State != ObjectState.Added)
                    {
                        txtSubject.Text     = language.GetString("TextPinboardOffer") + " '" + pinboardOffer.Title + "'";
                        txtSubject.ReadOnly = true;
                    }
                }
                if (receiverType.ToLower() == "member" && objectId.HasValue)
                {
                    bool isOwner  = false;
                    bool isMember = false;
                    if (UserProfile.Current.UserId != Guid.Empty)
                    {
                        isOwner = Community.GetIsUserOwner(UserProfile.Current.UserId, objectId.Value, out isMember);
                    }
                    if (!isOwner)
                    {
                        receiverType = string.Empty;
                    }
                }


                if (messageMode.ToLower() == "reply")
                {
                    DataAccess.Business.Message message = DataAccess.Business.Message.LoadMessage(new Guid(messageId), _4screen.CSB.Common.SiteConfig.GetSiteContext(UserProfile.Current));
                    if (Regex.IsMatch(message.Subject, "^Re.*?:"))
                    {
                        Match match = Regex.Match(message.Subject, @"^Re\[(\d*?)\]:");
                        if (match.Groups.Count == 2) // Other replies
                        {
                            int replyNumber;
                            int.TryParse(match.Groups[1].ToString(), out replyNumber);
                            replyNumber++;
                            txtSubject.Text = Regex.Replace(message.Subject, @"^Re\[\d*?\]:", "Re[" + replyNumber + "]:");
                        }
                        else // Second reply
                        {
                            txtSubject.Text = Regex.Replace(message.Subject, @"^Re:", "Re[2]:");
                        }
                    }
                    else // First reply
                    {
                        txtSubject.Text = "Re: " + message.Subject;
                    }
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "SetTitle", "GetRadWindow().SetTitle('" + language.GetString("LableMessageAnswer").StripForScript() + "');", true);
                    DataObjectUser doUser = DataObject.Load <DataObjectUser>(message.FromUserID);
                    if (!message.MsgText.StartsWith("<i>"))
                    {
                        message.MsgText = string.Format("<i>{0}</i>", message.MsgText);
                    }
                    txtBody.Content = string.Format("<br/><i><b>{0} {1}: </i></b><br>{2}", doUser.Nickname, language.GetString("LableMessageWrote"), message.MsgText);
                }
                else if (messageMode.ToLower() == "forward")
                {
                    DataAccess.Business.Message message = DataAccess.Business.Message.LoadMessage(new Guid(messageId), _4screen.CSB.Common.SiteConfig.GetSiteContext(UserProfile.Current));
                    txtSubject.Text = "Fw: " + message.Subject.Replace("Fw: ", string.Empty);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "SetTitle", "GetRadWindow().SetTitle('" + language.GetString("LableMessageForward").StripForScript() + "');", true);
                    DataObjectUser doUser = DataObject.Load <DataObjectUser>(message.FromUserID);
                    if (!message.MsgText.StartsWith("<i>"))
                    {
                        message.MsgText = string.Format("<i>{0}</i>", message.MsgText);
                    }
                    txtBody.Content = string.Format("<br/><i><b>{0} {1}: </i></b><br>{2}", doUser.Nickname, language.GetString("LableMessageWrote"), message.MsgText);
                }
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            pinboardOffer = DataObject.Load <DataObjectPinboardOffer>(ObjectID, null, true);

            if (pinboardOffer.State == ObjectState.Added)
            {
                pinboardOffer.ObjectID    = ObjectID;
                pinboardOffer.Title       = GuiLanguage.GetGuiLanguage("Shared").GetString("LabelUnnamed");
                pinboardOffer.CommunityID = CommunityID;
                pinboardOffer.ShowState   = ObjectShowState.Draft;
                pinboardOffer.Insert(UserDataContext.GetUserDataContext());
                pinboardOffer.Title = string.Empty;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["TG"]))
            {
                pinboardOffer.TagList = Server.UrlDecode(Request.QueryString["TG"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["OS"]))
            {
                pinboardOffer.Status = (ObjectStatus)int.Parse(Request.QueryString["OS"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["SS"]))
            {
                pinboardOffer.ShowState = (ObjectShowState)int.Parse(Request.QueryString["SS"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CR"]))
            {
                pinboardOffer.Copyright = int.Parse(Request.QueryString["CR"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["GC"]))
            {
                string[] geoLatLong = Request.QueryString["GC"].Split(',');
                double   geoLat, geoLong = double.MinValue;
                if (geoLatLong.Length == 2)
                {
                    if (double.TryParse(geoLatLong[0], out geoLat) && double.TryParse(geoLatLong[1], out geoLong))
                    {
                        pinboardOffer.Geo_Lat  = geoLat;
                        pinboardOffer.Geo_Long = geoLong;
                    }
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["ZP"]))
            {
                pinboardOffer.Zip = Server.UrlDecode(Request.QueryString["ZP"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CI"]))
            {
                pinboardOffer.City = Server.UrlDecode(Request.QueryString["CI"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["RE"]))
            {
                pinboardOffer.Street = Server.UrlDecode(Request.QueryString["RE"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CO"]))
            {
                pinboardOffer.CountryCode = Server.UrlDecode(Request.QueryString["CO"]);
            }

            FillEditForm();
        }