Example #1
0
    // danh muc :

    private void loadDanhMuc()
    {
        danhmucBLL bs = new danhmucBLL();

        menusubtitle.DataSource = bs.getMenu();
        menusubtitle.DataBind();
    }
Example #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        danhmucBLL bs  = new danhmucBLL();
        string     ten = txtTen.Text.Trim();

        if (bs.kiemtraTrungLap(ten) == false)
        {
            bool tf = bs.danhmucadd(ten);
            if (tf == true)
            {
                Response.Redirect("danhmuc.aspx?add=t");
            }
            else
            {
                lbError.Text = "<div class='error'>"
                               + "<div class='tl'></div><div class='tr'></div>"
                               + "<div class='desc'>"
                               + "<p>Thêm bị lỗi !</p>"
                               + "</div>"
                               + "<div class='bl'></div><div class='br'></div>"
                               + "</div>";
            }
        }
        else
        {
            lbError.Text = "<div class='error'>"
                           + "<div class='tl'></div><div class='tr'></div>"
                           + "<div class='desc'>"
                           + "<p>Tên danh mục này đã tồn tại !</p>"
                           + "</div>"
                           + "<div class='bl'></div><div class='br'></div>"
                           + "</div>";
        }
    }
Example #3
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        string     ten = txtTen.Text.Trim();
        int        id  = Convert.ToInt32(Request.QueryString["id"]);
        danhmucBLL bs  = new danhmucBLL();

        if (bs.kiemtraTrungLap(ten) == false)
        {
            if (bs.danhmucedit(id, ten) == true)
            {
                Response.Redirect("danhmuc.aspx?edit=t");
            }
            else
            {
                lbError.Text = "<div class='error'>"
                               + "<div class='tl'></div><div class='tr'></div>"
                               + "<div class='desc'>"
                               + "<p>Sửa danh mục bị lỗi !</p>"
                               + "</div>"
                               + "<div class='bl'></div><div class='br'></div>"
                               + "</div>";
            }
        }
        else
        {
            lbError.Text = "<div class='error'>"
                           + "<div class='tl'></div><div class='tr'></div>"
                           + "<div class='desc'>"
                           + "<p>Danh mục này đã tồn tại !</p>"
                           + "</div>"
                           + "<div class='bl'></div><div class='br'></div>"
                           + "</div>";
        }
    }
Example #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int        id = Convert.ToInt32(Request.QueryString["id"]);
         danhmucBLL bs = new danhmucBLL();
         if (Request.QueryString["id"] != null)
         {
             List <danhmucDAL> ds = bs.getDanhMucbyId(id);
             if (ds.Count == 1)
             {
                 txtTen.Text = ds[0].ten_danhmuc;
             }
             else
             {
                 Response.Redirect("error.aspx");
             }
         }
         else
         {
             Response.Redirect("error.aspx");
         }
         ddlDM.DataSource     = bs.getDanhMuclv(1);
         ddlDM.DataValueField = "groupdanhmuc";
         ddlDM.DataTextField  = "ten_danhmuc";
         ddlDM.DataBind();
         List <danhmucDAL> list = bs.getDanhMucbyId(id);
         ddlDM.SelectedValue = Convert.ToString(list[0].groupdanhmuc - 0.1);
     }
 }
Example #5
0
 protected void ddlView_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlView.Text != "Tất cả")
     {
         danhmucBLL b  = new danhmucBLL();
         int        id = b.getIdDanhMucbyName(ddlView.Text);
         Response.Redirect("sanpham.aspx?v=" + id + "&val=" + ddlView.Text);
     }
 }
Example #6
0
    // load danh muc;
    private void loadDanhMuc()
    {
        danhmucBLL bs = new danhmucBLL();

        ddlDM.DataSource     = bs.getDanhMuclv(2);
        ddlDM.DataTextField  = "ten_danhmuc";
        ddlDM.DataValueField = "id_danhmuc";
        ddlDM.DataBind();
    }
Example #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         danhmucBLL bs = new danhmucBLL();
         ddlDM.DataSource     = bs.getDanhMuclv(1);
         ddlDM.DataValueField = "groupdanhmuc";
         ddlDM.DataTextField  = "ten_danhmuc";
         ddlDM.DataBind();
     }
 }
Example #8
0
    // load danh muc tim kiem

    private void dannhmuc()
    {
        danhmucBLL         bs   = new danhmucBLL();
        IList <danhmucDAL> list = bs.getDanhMucTimKiem();

        search_se.Items.Add("Tất cả");
        for (int i = 0; i <= list.Count - 1; i++)
        {
            search_se.Items.Add(list[i].ten_danhmuc);
        }
    }
Example #9
0
    private void loadDMlv2Xem(double u)
    {
        danhmucBLL bs = new danhmucBLL();

        rpLV1.DataSource = bs.getDanhMuclvXem(u);
        rpLV1.DataBind();
        for (int i = 0; i <= rpLV1.Items.Count - 1; i++)
        {
            Label lbDanhMucSTT = rpLV1.Items[i].FindControl("lbDanhMucSubSTT") as Label;
            lbDanhMucSTT.Text = (i + 1).ToString();
        }
    }
Example #10
0
    // load danh muc san pham()
    private void loaddanhmuc()
    {
        danhmucBLL        bs   = new danhmucBLL();
        List <danhmucDAL> list = bs.getDanhMucTimKiem();

        ddlTimKiem.Items.Add("Tất cả");
        ddlView.Items.Add("Tất cả");
        for (int i = 0; i <= list.Count - 1; i++)
        {
            ddlTimKiem.Items.Add(list[i].ten_danhmuc);
            ddlView.Items.Add(list[i].ten_danhmuc);
        }
    }
Example #11
0
 protected void btnTim_Click(object sender, EventArgs e)
 {
     if (ddlTimKiem.Text == "Tất cả")
     {
         danhmucBLL b = new danhmucBLL();
         Response.Redirect("sanpham.aspx?t=" + 0 + "&n=" + txtTimKiem.Text + "&val=" + ddlTimKiem.Text);
     }
     else
     {
         danhmucBLL b  = new danhmucBLL();
         int        id = b.getIdDanhMucbyName(ddlTimKiem.Text);
         Response.Redirect("sanpham.aspx?t=" + id + "&n=" + txtTimKiem.Text + "&val=" + ddlTimKiem.Text);
     }
 }
Example #12
0
    private void loadDMlv1()
    {
        danhmucBLL        bs   = new danhmucBLL();
        List <danhmucDAL> list = bs.getDanhMuclv(1);

        rpLV2.DataSource = bs.getDanhMuclv(1);
        rpLV2.DataBind();

        for (int i = 0; i <= list.Count - 1; i++)
        {
            Label lbDanhMucSTT = rpLV2.Items[i].FindControl("lbDanhMucSTT") as Label;
            lbDanhMucSTT.Text = (i + 1).ToString();
        }
    }
Example #13
0
    //
    // lay ten danh muc

    private void getTitle()
    {
        danhmucBLL        bs = new danhmucBLL();
        List <danhmucDAL> ds = bs.getDanhMucbyId(id);

        if (ds.Count() == 1)
        {
            lbDanhMuc.Text = ds[0].ten_danhmuc;
            ltite.Text     = ds[0].ten_danhmuc;
            lbtitle.Text   = ds[0].ten_danhmuc;
        }
        else
        {
            Response.Redirect("error.aspx");
        }
    }
Example #14
0
    protected void btnCapNhatCon_Click(object sender, EventArgs e)
    {
        bool   tfcon = false;
        bool   check = false;
        string id    = "";

        // xoa danh muc con:

        for (int i = 0; i <= rpLV1.Items.Count - 1; i++)
        {
            CheckBox cbDell = rpLV1.Items[i].FindControl("cbDell") as CheckBox;
            if (cbDell.Checked)
            {
                id   += cbDell.ToolTip + ",";
                check = true;
            }
        }

        int hidd = id.Length;

        danhmucBLL bs = new danhmucBLL();

        if (check == true)
        {
            string id_danhmuc_dt = id.Remove(hidd - 1);
            tfcon = bs.del(id_danhmuc_dt);
            if (tfcon == true)
            {
                Response.Redirect("danhmuc.aspx?up=t");
            }
            else
            {
                lbError.Text = "<div class='error'> " +
                               " <div class='tl'></div><div class='tr'></div>"
                               + "<div class='desc'>"
                               + "	<p>Cập nhật thất bại!</p>"
                               + "</div>"
                               + "<div class='bl'></div><div class='br'></div>"
                               + "</div>";
            }
        }
    }
Example #15
0
    private void loadDMlv2()
    {
        danhmucBLL bs = new danhmucBLL();
        //DropDownList ddlLevel = rpLV1.Items[0].FindControl("ddlLevel") as DropDownList;
        List <danhmucDAL> ds = bs.getDanhMuclv(1);

        ddlLevel.Items.Add("Tất cả");
        ddlLevel.DataSource     = ds;
        ddlLevel.DataTextField  = "ten_danhmuc";
        ddlLevel.DataValueField = "groupdanhmuc";
        ddlLevel.DataBind();
        double            index = Convert.ToDouble(ddlLevel.SelectedValue) + 0.1;
        List <danhmucDAL> list  = bs.getDanhMuclvXem(index);

        rpLV1.DataSource = list;
        rpLV1.DataBind();
        for (int i = 0; i <= rpLV1.Items.Count - 1; i++)
        {
            Label lbDanhMucSTT = rpLV1.Items[i].FindControl("lbDanhMucSubSTT") as Label;
            lbDanhMucSTT.Text = (i + 1).ToString();
        }
    }
Example #16
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        string     ten   = txtTen.Text.Trim();
        double     index = Convert.ToDouble(ddlDM.SelectedValue) + 0.1;
        int        id    = Convert.ToInt32(Request.QueryString["id"]);
        danhmucBLL bs    = new danhmucBLL();

        if (bs.danhmucedit(id, ten, index) == true)
        {
            Response.Redirect("danhmuc.aspx?edit=t");
        }
        else
        {
            lbError.Text = "<div class='error'>"
                           + "<div class='tl'></div><div class='tr'></div>"
                           + "<div class='desc'>"
                           + "<p>Sửa danh mục bị lỗi !</p>"
                           + "</div>"
                           + "<div class='bl'></div><div class='br'></div>"
                           + "</div>";
        }
    }
Example #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["id"] != null)
         {
             int               id = Convert.ToInt32(Request.QueryString["id"]);
             danhmucBLL        bs = new danhmucBLL();
             List <danhmucDAL> ds = bs.getDanhMucbyId(id);
             if (ds.Count == 1)
             {
                 txtTen.Text = ds[0].ten_danhmuc;
             }
             else
             {
                 Response.Redirect("error.aspx");
             }
         }
         else
         {
             Response.Redirect("error.aspx");
         }
     }
 }