Esempio n. 1
0
        /// <summary>
        /// Creates a business object using a model as a source
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Sedogo.BusinessObjects.Message CreateMessageBO(MessageModel model)
        {
            var msg = new Sedogo.BusinessObjects.Message(model.CreatedByFullName);

            if(!string.IsNullOrEmpty(model.message)) msg.messageText = model.message;
            if(model.Event.HasValue) msg.eventID = model.Event.Value;
            msg.userID = model.user;
            msg.postedByUserID = model.author;
            msg.messageRead = model.read;

            return msg;
        }
Esempio n. 2
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int userID = int.Parse(Session["loggedInUserID"].ToString());

            sidebarControl.userID = userID;
            SedogoUser user = new SedogoUser(Session["loggedInUserFullName"].ToString(), userID);
            sidebarControl.user = user;
            bannerAddFindControl.userID = userID;

            PopulateMessageList(userID);

            string replyID = "";
            if (Request.QueryString["ReplyID"] != null)
            {
                replyID = (string)Request.QueryString["ReplyID"];
            }
            string replyMessageID = "";
            if (Session["MessageID"] != null)
            {
                if ((string)Session["MessageID"] != "")
                {
                    replyMessageID = (string)Session["MessageID"];
                }
            }
            Session["MessageID"] = null;

            if (replyID != "")
            {
                SedogoEvent sEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), int.Parse(replyID));

                string url = "sendUserMessage.aspx?UID=" + sEvent.userID.ToString() + "&EID=" + replyID.ToString();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "openModal(\"" + url + "\");", true);
            }
            if (replyMessageID != "")
            {
                string eventID = "-1";
                if (Session["EventID"] != null)
                {
                    if ((string)Session["EventID"] != "")
                    {
                        eventID = (string)Session["EventID"];
                    }
                }
                Session["EventID"] = null;

                Sedogo.BusinessObjects.Message replyToMessage =
                    new Sedogo.BusinessObjects.Message(Session["loggedInUserFullName"].ToString(), int.Parse(replyMessageID));
                //SedogoUser messageToUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), -1);

                string url = "sendUserMessage.aspx?UID=" + replyToMessage.postedByUserID.ToString()
                    + "&PMID=-1&MID=" + replyMessageID.ToString() + "&Redir=Messages";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "openModal(\"" + url + "\");", true);
            }

            if (Session["SentUserMessage"] == "Y")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Your message has been sent');", true);
                Session["SentUserMessage"] = "N";
            }
        }
    }