Esempio n. 1
0
 private static bool SendMessage(List <string> friendIds, string subject, string body, string msgMode, string msgId)
 {
     try
     {
         foreach (string strFriendId in friendIds)
         {
             _4screen.CSB.DataAccess.Business.Message message = new _4screen.CSB.DataAccess.Business.Message(SiteConfig.GetSiteContext(UserProfile.Current));
             message.MsgID        = Guid.NewGuid();
             message.FromUserID   = UserProfile.Current.UserId;
             message.UserId       = new Guid(strFriendId);
             message.TypOfMessage = (int)MessageTypes.NormalMessage;
             message.Subject      = subject;
             message.MsgText      = body;
             message.ShowInInbox  = true;
             message.ShowInOutbox = true;
             if (msgMode.ToLower() == "reply")
             {
                 _4screen.CSB.DataAccess.Business.Message.SetAnswered(new Guid(msgId));
             }
             if (msgMode.ToLower() == "forward")
             {
                 _4screen.CSB.DataAccess.Business.Message.SetForwarded(new Guid(msgId));
             }
             message.SendNormalMessage();
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _4screen.CSB.Extensions.Business.TrackingManager.TrackEventPage(null, null, IsPostBack, LogSitePageType.Messaging);
            msgType = Request.QueryString["MsgType"];
            msgMode = Request.QueryString["MsgMode"];
            msgId   = Request.QueryString["MsgId"];

            _4screen.CSB.DataAccess.Business.Message message = _4screen.CSB.DataAccess.Business.Message.LoadMessage(new Guid(msgId), SiteConfig.GetSiteContext(UserProfile.Current));

            Guid userId;

            if (message.UserId == UserProfile.Current.UserId) // Inbox
            {
                userId = message.FromUserID;
                lnkBack.NavigateUrl = "/M/Admin/MyMessagesInbox.aspx";
            }
            else // Outbox
            {
                userId = message.UserId;
                lnkBack.NavigateUrl = "/M/Admin/MyMessagesOutbox.aspx";
            }
            lnkBack.ID = null;
            MembershipUser user = Membership.GetUser(userId);

            litInfo.Text    = language.GetString("LabelMessageFrom") + user.UserName;
            litSubject.Text = message.Subject;
            litBody.Text    = message.MsgText;

            if (message.TypOfMessage != 5)
            {
                string link = string.Format("/M/Admin/MessageSend.aspx?MsgType=Msg&amp;MsgMode=Reply&amp;RecId={0}&amp;MsgId={1}&amp;ReturnUrl={2}", message.FromUserID, message.MsgID, Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(lnkBack.NavigateUrl)));
                phReplyLink.Controls.Add(new LiteralControl(string.Format("<a href='{0}' class='button' target='_self'>{1}</a>", link, GuiLanguage.GetGuiLanguage("WebUI.Mobile").GetString("CommandRespond"))));
            }
        }
Esempio n. 3
0
        protected void OnMsgboxItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            _4screen.CSB.DataAccess.Business.Message message = (_4screen.CSB.DataAccess.Business.Message)e.Item.DataItem;

            if (message.UserId == UserProfile.Current.UserId && !message.IsRead)
            {
                ((HtmlTableRow)e.Item.FindControl("trMsg")).Attributes.Add("class", "messageUnread");
            }
            ((HtmlTableRow)e.Item.FindControl("trMsg")).ID = null;

            string userOutput = string.Empty;

            if (msgboxType == "Inbox")
            {
                userOutput = message.FromUserName;
            }
            else if (msgboxType == "Outbox")
            {
                userOutput = message.UserName;
            }
            else if (msgboxType == "Flagged")
            {
                if (message.UserId == UserProfile.Current.UserId)  // Inbox
                {
                    userOutput = message.FromUserName;
                }
                else // Outbox
                {
                    userOutput = message.UserName;
                }
            }

            PlaceHolder    panel          = (PlaceHolder)e.Item.FindControl("phMsg");
            MessagePreview messagePreview = (MessagePreview)LoadControl("/M/Admin/UserControls/MessagePreview.ascx");

            messagePreview.Message     = message;
            messagePreview.MsgUserName = userOutput;

            panel.Controls.Add(messagePreview);

            if (message.TypOfMessage != (int)MessageTypes.InviteToCommunity)
            {
                panel = (PlaceHolder)e.Item.FindControl("phAct");
                LiteralControl lit = new LiteralControl();
                if (msgboxType != "Outbox")
                {
                    lit.Text = string.Format(@"<a class='button' target='_self' href='/M/Admin/MessageSend.aspx?MsgType=Msg&amp;MsgMode=Reply&amp;RecId={0}&amp;MsgId={1}&amp;ReturnUrl={3}'>{2}</a><br/>", UserProfile.Current.UserId, message.MsgID, GuiLanguage.GetGuiLanguage("WebUI.Mobile").GetString("CommandRespond"), Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(Request.RawUrl)));
                }
                lit.Text += string.Format(@"<a class='button' target='_self' href='/M/Admin/MessageSend.aspx?MsgType=Msg&amp;MsgMode=Forward&amp;MsgId={0}&amp;ReturnUrl={2}'>{1}</a><br/>", message.MsgID, GuiLanguage.GetGuiLanguage("WebUI.Mobile").GetString("CommandForward"), Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(Request.RawUrl)));
                panel.Controls.Add(lit);
                LinkButton deleteButton = new LinkButton();
                deleteButton.Text            = GuiLanguage.GetGuiLanguage("WebUI.Mobile").GetString("CommandDelete");
                deleteButton.CommandArgument = message.MsgID.ToString();
                deleteButton.Click          += new EventHandler(OnDeleteClick);
                deleteButton.CssClass        = "button";
                panel.Controls.Add(deleteButton);
            }
        }
Esempio n. 4
0
        protected void OnRepRequestsItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            _4screen.CSB.DataAccess.Business.Message message = (_4screen.CSB.DataAccess.Business.Message)e.Item.DataItem;

            PlaceHolder placeHolder = (PlaceHolder)e.Item.FindControl("FT");
            Literal     literal     = new Literal();

            literal.Text = message.DateSent.ToShortDateString();
            placeHolder.Controls.Add(literal);

            DataObjectUser user = null;

            placeHolder = (PlaceHolder)e.Item.FindControl("UD");
            string linkMsgeUrl = string.Empty;

            if (requestType == "YouMe")
            {
                user        = DataObject.Load <DataObjectUser>(message.FromUserID);
                linkMsgeUrl = string.Format("/M/Admin/MessageSend.aspx?MsgType=Msg&RecId={0}&ReturnUrl={1}", message.FromUserID, Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(Request.RawUrl)));
            }
            else if (requestType == "MeYou")
            {
                user        = DataObject.Load <DataObjectUser>(message.UserId);
                linkMsgeUrl = string.Format("/M/Admin/MessageSend.aspx?MsgType=Msg&RecId={0}&ReturnUrl={1}", message.UserId, Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(Request.RawUrl)));
            }
            Control control = LoadControl("/UserControls/Templates/SmallOutputUser2.ascx");

            ((ISmallOutputUser)control).DataObjectUser = user;
            placeHolder.Controls.Add(control);

            placeHolder = (PlaceHolder)e.Item.FindControl("FPAN");

            HyperLink linkMsg = new HyperLink();

            linkMsg.Target      = "_self";
            linkMsg.NavigateUrl = linkMsgeUrl;
            linkMsg.Text        = GuiLanguage.GetGuiLanguage("WebUI.Mobile").GetString("CommandSendMessage");
            linkMsg.CssClass    = "button";
            placeHolder.Controls.Add(linkMsg);

            if (requestType == "YouMe")
            {
                LinkButton linkAccept = new LinkButton();
                linkAccept.CommandArgument = message.MsgID.ToString();
                linkAccept.Text            = GuiLanguage.GetGuiLanguage("WebUI.Mobile").GetString("CommandAcceptUser");
                linkAccept.CssClass        = "button";
                linkAccept.Click          += new EventHandler(OnAcceptClick);
                placeHolder.Controls.Add(linkAccept);


                LinkButton linkReject = new LinkButton();
                linkReject.CommandArgument = message.MsgID.ToString();
                linkReject.Text            = GuiLanguage.GetGuiLanguage("WebUI.Mobile").GetString("CommandRejectUser");
                linkReject.CssClass        = "button";
                linkReject.Click          += new EventHandler(OnRejectClick);
                placeHolder.Controls.Add(linkReject);
            }
        }
Esempio n. 5
0
 void OnRejectClick(object sender, EventArgs e)
 {
     _4screen.CSB.DataAccess.Business.Message message = new _4screen.CSB.DataAccess.Business.Message(SiteConfig.GetSiteContext(UserProfile.Current));
     message.Load(new Guid(((LinkButton)sender).CommandArgument));
     _4screen.CSB.Extensions.Business.IncentivePointsManager.AddIncentivePointEvent("FRIEND_REJECT_MOBILE_DEVICE", UserDataContext.GetUserDataContext());
     _4screen.CSB.DataAccess.Business.Message.DeleteMessage(message.MsgID, message.UserId);
     _4screen.CSB.DataAccess.Business.Message.DeleteMessage(message.MsgID, message.FromUserID);
     Reload();
 }
Esempio n. 6
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            Extensions.Business.TrackingManager.TrackEventPage(null, null, IsPostBack, LogSitePageType.Messaging);

            msgMode    = (Request.QueryString["MsgMode"] != null) ? Request.QueryString["MsgMode"].ToLower() : string.Empty;
            msgId      = Request.QueryString["MsgId"] ?? string.Empty;
            receiverId = Request.QueryString["RecId"] ?? string.Empty;
            returnUrl  = !string.IsNullOrEmpty(Request.QueryString["ReturnURL"]) ? Encoding.ASCII.GetString(Convert.FromBase64String(Request.QueryString["ReturnURL"])) : "/M/Admin/Dashboard.aspx";

            lnkBack.NavigateUrl = returnUrl;
            lnkBack.ID          = null;

            if (!string.IsNullOrEmpty(receiverId))
            {
                RenderDirectMessage();
            }
            else
            {
                RenderNormalMessage();
            }

            if (msgMode.ToLower() == "reply")
            {
                _4screen.CSB.DataAccess.Business.Message message = _4screen.CSB.DataAccess.Business.Message.LoadMessage(new Guid(msgId), SiteConfig.GetSiteContext(UserProfile.Current));
                txtSubject.Text = "Re: " + message.Subject;
                DataObjectUser doUser = DataObject.Load <DataObjectUser>(message.FromUserID);
                txtBody.Text = string.Format("\r\n{0} {1}: \r\n{2}", doUser.Nickname, GuiLanguage.GetGuiLanguage("WebUI.Mobile").GetString("LableMessageWrote"), message.MsgText);
            }
            else if (msgMode.ToLower() == "forward")
            {
                _4screen.CSB.DataAccess.Business.Message message = _4screen.CSB.DataAccess.Business.Message.LoadMessage(new Guid(msgId), SiteConfig.GetSiteContext(UserProfile.Current));
                txtSubject.Text = "Fw: " + message.Subject.Replace("Fw: ", string.Empty);
                DataObjectUser doUser = DataObject.Load <DataObjectUser>(message.FromUserID);

                txtBody.Text = string.Format("\r\n{0} {1}: \r\n{2}", doUser.Nickname, GuiLanguage.GetGuiLanguage("WebUI.Mobile").GetString("LableMessageWrote"), message.MsgText);
            }
        }