Ejemplo n.º 1
0
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Session["NewsShownType"] = "";

        LinkButton lb = (sender as LinkButton);
        Label1.Text = lb.Text;
        Session["NewsType"] = lb.Text;
        Session["NewsIDGroup"] = lb.ToolTip;

        string form_name = new tbl_modulesTableAdapter().GetFormNameFromID(Convert.ToInt16(lb.ToolTip.ToString()));

        string username = "******";
        string password = "******";

        if (Request.Cookies["username"] != null && Request.Cookies["password"] != null)
        {
            username = Request.Cookies["username"].Value.ToString();
            password = Request.Cookies["password"].Value.ToString();
        }
        string ModelID = new main_class().Load_Control(form_name, username, password);
        int i = ModelID.IndexOf("frm_AccessDenied");
        if (i == -1)
        {
            ods_NewsList.SelectParameters[0].DefaultValue = lb.ToolTip.ToString();
            GridView1.DataBind();
        }
        else
        {
            ods_NewsList.SelectParameters[0].DefaultValue = "-1";
            GridView1.DataBind();
        }

        Response.Redirect(Request.Url.PathAndQuery);
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Literal1.Text = Get_Right_Left();
        if (!IsPostBack)
        {

                string title = "";
                if (Session["NewsType"] != null)
                {
                    title = Session["NewsType"].ToString();
                }
                else
                {
                    if (Get_Right_Left() == "1") { Label1.Text = "اخبار و اطلاعیه های مرتبط با شرکت"; }
                    else { Label1.Text = "Atiehfould News"; }
                }

                Label1.Text = title;
                string NewsIDGroup = "14";
                if (Session["NewsIDGroup"] != null)
                {
                    NewsIDGroup = Session["NewsIDGroup"].ToString();
                }

                string newshown = "";

                if (Session["NewsShownType"] != null)
                {
                    newshown = "1";
                }

                if (Session[new main_class().Encode("NewsID")] == null)
                {

                string form_name = new tbl_modulesTableAdapter().GetFormNameFromID(Convert.ToInt16(NewsIDGroup));

                string username = "******";
                string password = "******";

                if (Request.Cookies["username"] != null && Request.Cookies["password"] != null)
                {
                    username = Request.Cookies["username"].Value.ToString();
                    password = Request.Cookies["password"].Value.ToString();
                }
                string ModelID = new main_class().Load_Control(form_name, username, password);
                int i = ModelID.IndexOf("frm_AccessDenied");
                if (i == -1)
                {
                    ods_NewsList.SelectParameters[0].DefaultValue = NewsIDGroup;
                    GridView1.DataBind();
                }
                else
                {
                    ods_NewsList.SelectParameters[0].DefaultValue = "-1";
                    GridView1.DataBind();
                }
            }
            else
            {
                Label2.Text = Session["NewsBody"].ToString();

                Panel1.Visible = true;//body
                Panel2.Visible = false;//news list;
                Session.Remove(new main_class().Encode("NewsID"));
            }
        }
    }