Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["ACCOUNT"] == null)
        {
            Response.Redirect("../Login.aspx");
        }

        try
        {
            this.itemId = int.Parse(Request["id"].ToString());
        }
        catch
        {
            Response.Redirect("/Category/ListCategory.aspx");
        }

        DanhMuc objDanhMuc = new DanhMuc();

        objData = objDanhMuc.getItem(itemId);
        if (objData == null)
        {
            Response.Redirect("/Category/ListCategory.aspx");
        }
        if ((int)objData["DanhMucId"] == 0)
        {
            Response.Redirect("/Category/ListCategory.aspx");
        }

        try
        {
            danhmuc = objDanhMuc.getDanhMuc((int)objData["DanhMucId"])["NameDanhMuc"].ToString();
        }
        catch { }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["ACCOUNT"] == null)
        {
            Response.Redirect("../Login.aspx");
        }

        try
        {
            this.itemId = int.Parse(Request["id"].ToString());
        }
        catch
        {
            Response.Redirect("/Category/ListCategory.aspx");
        }

        DanhMuc objDanhMuc = new DanhMuc();

        DataRow danhuc = objDanhMuc.getDanhMuc(itemId);

        if (danhuc == null)
        {
            Response.Redirect("/Category/ListCategory.aspx");
        }

        Session["TITLE"] = danhuc["NameDanhMuc"].ToString().ToUpper();


        DataTable objData = objDanhMuc.getList(itemId);

        //dtlAccount.DataSource = objData.DefaultView;
        //dtlAccount.DataBind();

        cpData.MaxPages      = 1000;
        cpData.PageSize      = 15;
        cpData.DataSource    = objData.DefaultView;
        cpData.BindToControl = dtlData;
        dtlData.DataSource   = cpData.DataSourcePaged;
        dtlData.DataBind();

        index = 1;
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["ACCOUNT"] == null)
        {
            Response.Redirect("../Login.aspx");
        }

        try
        {
            this.itemId = int.Parse(Request["id"].ToString());
        }
        catch
        {
            itemId = 0;
        }

        try
        {
            this.group = int.Parse(Request["dm"].ToString());
        }
        catch
        {
            group = 0;
        }

        if (itemId == 0 && group == 0)
        {
            Response.Redirect("/Category/ListCategory.aspx");
        }

        if (itemId != 0)
        {
            objData = objDanhMuc.getItem(itemId);
            if (objData == null)
            {
                Response.Redirect("/Category/ListCategory.aspx");
            }
            if ((int)objData["DanhMucId"] == 0)
            {
                Response.Redirect("/Category/ListCategory.aspx");
            }
            group = (int)objData["DanhMucId"];

            if (!Page.IsPostBack)
            {
                txtNameDanhMuc.Text = objData["NameDanhMuc"].ToString();
                txtNote.Text        = objData["Note"].ToString();
                ckbState.Checked    = (bool)objData["State"];
            }
        }
        else if (!Page.IsPostBack)
        {
            ckbState.Checked = true;
        }

        DataRow danhuc = objDanhMuc.getDanhMuc(group);

        if (danhuc == null)
        {
            Response.Redirect("/Category/ListCategory.aspx");
        }

        Session["TITLE"] = danhuc["NameDanhMuc"].ToString().ToUpper();
    }