using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Drawing;

public partial class MasterAdmin_Notic : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                getmessage();
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }  
    }
    private void getmessage()
    {
        try
        {
            SqlParameter[] get_user_details = new SqlParameter[]
            {
                new SqlParameter("@LOGINID",Session["WhitelabelId"].ToString())
            };
            SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.mainConnectionString, CommandType.StoredProcedure, "UDP_GETWHITELABELNOTIC", get_user_details);
            if (dr.Read())
            {
                txt_Heading.Text = Convert.ToString(dr["msgHeading"]);
                txt_Message.Text = Convert.ToString(dr["AddContent"]);                              
            }
        }
        catch (Exception ex)
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OhCrap", String.Format("alert('There is some technical problem. Please try again');"), true);
        }
    }
    protected void btn_Submit_Click(object sender, EventArgs e)
    {
        try
        {
            SqlParameter[] eGenmessage = new SqlParameter[]
            { 
                new SqlParameter("@Loginid",Session["WhitelabelId"].ToString()), 
                new SqlParameter("@msgHeading",txt_Heading.Text ),
                new SqlParameter ("@AddContent",txt_Message.Text)               
            };
            SqlHelper.ExecuteNonQuery(SqlHelper.mainConnectionString, CommandType.StoredProcedure, "UDP_insert_WhiteLabelAddcontent", eGenmessage);
            lblerror.Text = "Notice Update Successfully";
            lblerror.ForeColor = Color.Blue;
        }
        catch (Exception ex)
        {
            //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OhCrap", String.Format("alert('There is some technical problem. Please try again');"), true);
            throw (ex);
        }
    }
}
