Ejemplo n.º 1
0
    private void LoadData()
    {
        grdThuocTinh.DataSource = null;
        grdThuocTinhCon.DataSource = null;
        grdThuocTinh.DataBind();
        grdThuocTinhCon.DataBind();
        if (int.Parse("0" + tvNhomSanPham.SelectedValue) > 0)
        {
            ThuocTinh tt = new ThuocTinh();
            DataSet ds;

            int NhomSanPhamID = int.Parse("0" + tvNhomSanPham.SelectedValue);

            ds = tt.SelectByThuocTinhChaID(0);
            ds.Tables[0].DefaultView.RowFilter = "NhomSanPhamID = " + NhomSanPhamID;

            ds.Tables[0].DefaultView.Sort = "ThuocTinhID DESC";
            grdThuocTinh.DataSource = ds.Tables[0];
            grdThuocTinh.DataBind();

            if (ViewState["id"] == null)
                grdThuocTinh.SelectedIndex = 0;
            else
                setSelected(int.Parse(ViewState["id"].ToString()));

            LoadThuocTinhCon();
        }
        if (grdThuocTinh.Rows.Count <= 0)
            lblThuocTinh.Visible = true;
        else
            lblThuocTinh.Visible = false;
    }
Ejemplo n.º 2
0
    private void LoadThuocTinhCon()
    {
        if (grdThuocTinh.SelectedDataKey != null)
        {
            ThuocTinh tt = new ThuocTinh();
            int ThuocTinhChaID = int.Parse("0" + grdThuocTinh.SelectedDataKey.Value);
            DataSet ds = tt.SelectByThuocTinhChaID(ThuocTinhChaID);

            grdThuocTinhCon.DataSource = ds;
            grdThuocTinhCon.DataBind();
        }
    }
Ejemplo n.º 3
0
    private void LoadSubProperties(int ThuocTinhId)
    {
        try
        {
            divProperties.InnerHtml = "";
            ThuocTinh tt = new ThuocTinh();
            DataSet ds = tt.SelectByThuocTinhChaID(ThuocTinhId);

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    int ThuocTinhConID = int.Parse(dr["ThuocTinhID"].ToString());
                    if (CheckShowedProperty(ThuocTinhConID))
                    {
                        divProperties.InnerHtml = "";
                        DataSet dstt = tt.SelectByID(ThuocTinhConID);

                        if (dstt.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < dstt.Tables[0].Rows.Count; i++)
                            {
                                string strHref = "&spid=" + ThuocTinhConID + "_" + ThuocTinhId;
                                if (Request.Url.ToString().IndexOf(strHref) != -1)
                                {
                                    //Request.Url.ToString().Replace(strHref + "_del", "");
                                    divProperties.InnerHtml += "<a style='color:pink;' href=\"" + Request.Url;
                                    divProperties.InnerHtml += "\">";
                                    divProperties.InnerHtml += dstt.Tables[0].Rows[i]["TenThuocTinh"].ToString().Trim();
                                    divProperties.InnerHtml += "</a>";
                                    divProperties.InnerHtml += "&nbsp;&nbsp;   <a href=\"" + Request.Url;
                                    divProperties.InnerHtml +=
                                        "\" ><img style='cursor:hand;width:12px;border:0px;' src=\"images/del.gif\" ></img></a><br>";
                                    divProperties.InnerHtml = divProperties.InnerHtml.Replace(strHref, "");
                                }
                                //else
                                //{
                                //   // Request.Url.ToString().Replace(strHref, strHref + "_del");
                                //    divProperties.InnerHtml += "<a style='color:pink;' href=\"" + this.Request.Url;
                                //    divProperties.InnerHtml += "\">";
                                //    divProperties.InnerHtml += dstt.Tables[0].Rows[i]["TenThuocTinh"].ToString().Trim();
                                //    divProperties.InnerHtml += "</a>";
                                //    divProperties.InnerHtml += "&nbsp;&nbsp;   <a href=\"" + this.Request.Url;
                                //    divProperties.InnerHtml += "\" ><img style='cursor:hand;width:8px;border:0px;' src=\"images/delete.gif\" ></img></a><br>";
                                //    divProperties.InnerHtml = divProperties.InnerHtml.ToString().Replace(strHref, strHref + "_del");
                                //}
                            }
                        }
                        break;
                    }
                    else
                    {
                        divProperties.InnerHtml += "<a style='color:pink;' href=\"" + Request.Url;
                        //if (Request.QueryString["spid"] == null)
                        divProperties.InnerHtml += "&spid=" + dr["ThuocTinhID"] + "_" + ThuocTinhId;
                        //else
                        //{
                        //    string strSpid = this.Request.Url.;
                        //    divProperties.InnerHtml.Replace("", "");
                        //}
                        divProperties.InnerHtml += "\">";
                        divProperties.InnerHtml += dr["TenThuocTinh"].ToString().Trim();
                        divProperties.InnerHtml += "</a><br>";
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }