Ejemplo n.º 1
0
    /// <summary>
    /// Add new message to the database
    /// </summary>
    /// <param name="msg1">ch_messages object</param>
    public static void NewUsrMsg(ch_messages msg1)
    {
        string strSql1 = "INSERT INTO ch_messages(msg_date, msg_title, msg_content, msg_checked)  ";

        strSql1 += "VALUES('" + msg1.msg_Date + "', '" + msg1.msg_Title + "', '" + msg1.msg_Content + "', " + Convert.ToInt32(msg1.msg_Checked) + ")";
        Connect.DoAction(strSql1, "ch_messages");

        string strSql2 = "SELECT LAST(msg_id) FROM ch_messages";
        int    maxId   = Convert.ToInt32(Connect.MathAction(strSql2, "ch_messages"));

        string strSql3 = "INSERT INTO ch_users_messages(msg_id, msg_sender_id, msg_reciver_id)  ";

        strSql3 += "VALUES(" + maxId + ", '" + msg1.msg_Sender_Id + "', '" + msg1.msg_Reciver_Id + "')";
        Connect.DoAction(strSql3, "ch_users_messages");
    }
Ejemplo n.º 2
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        ch_messages msg = new ch_messages();

        msg.msg_Date       = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss");
        msg.msg_Sender_Id  = Session["usr_id"].ToString();
        msg.msg_Reciver_Id = ddlTo.SelectedValue;
        msg.msg_Title      = txtTitle.Text.Trim();
        msg.msg_Content    = txtContent.Text.Trim();
        msg.msg_Checked    = false;

        ch_messagesSvc.NewUsrMsg(msg);

        lblPopupTitle.Text   = "ההודעה נשלחה";
        lblPopupContent.Text = "לחץ אוקיי לכל ההודעות";
        pnlPopup.Visible     = true;
    }