コード例 #1
0
        protected new void Page_Load(object sender, EventArgs e)
        {
            try
            {
                idx     = Int32.Parse(Request["idx"]);
                type    = Request["type"].ToString();
                pkg_idx = Int32.Parse(Request["pkg_idx"].ToString());
                if (type == "group")
                {
                    pkg_idx = idx;
                }
            }
            catch (Exception)
            {
                Response.Redirect("Tests.aspx");
            }
            base.Page_Load(sender, e);



            ((MainLayout)(Master)).setPageHead("Starting Test...");

            if (CustomTestsLogic.is_custom(idx, access_manager_))
            {
                DoTestById(idx);
            }
            else
            {
                try
                {
                    ShopManager.check_sold_item(access_manager_, idx, type, pkg_idx);
                }
                catch (Exception ee)
                {
                    denied.Visible = true;
                    deniedLbl.Text = ee.Message;
                }
            }


            if (denied.Visible != true)
            {
                if ("test" == type)
                {
                    DoTestById(idx);
                }
                else if ("download" == type)
                {
                    DoPdfDownload(idx);
                }
                else if ("group" == type)
                {
                    DoSelectTest(idx);
                }
            }
        }
コード例 #2
0
        protected void ctView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string nme = e.CommandName;
            int    i   = Convert.ToInt32(e.CommandArgument);
            int    idx = Int32.Parse(((Label)ctView.Rows[i].Cells[0].FindControl("id_lbl")).Text);

            if (nme == "edt")
            {
                Response.Redirect(String.Format("CreateCustomTest.aspx?idx={0}", idx));
            }

            if (nme == "del")
            {
                if (CustomTestsLogic.is_owner(idx, access_manager_))
                {
                    CustomTestsLogic.del_test(((System.Data.SqlClient.SqlConnection)access_manager_.Connection), idx);
                    ctView.DataBind();
                }
            }
        }