Ejemplo n.º 1
0
    private void LoadData(string Id)
    {
        try
        {
            ThuocTinh tt = new ThuocTinh();
            DataSet ds = tt.SelectByID(Convert.ToInt32(Id));

            if (ds.Tables[0].Rows.Count > 0)
            {
                txtTenThuocTinh.Text = ds.Tables[0].Rows[0]["TenThuocTinh"].ToString();
                txtThuTu.Text = ds.Tables[0].Rows[0]["ThuTu"].ToString();
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Ejemplo n.º 2
0
    private void LoadThuocTinhSanPham(int sanphamid)
    {
        int thuoctinhid = 0;
        int thuoctinhchaid = 0;
        ThuocTinhSanPham ttsp = new ThuocTinhSanPham();
        DataSet ds = ttsp.SelectBySanPhamID(sanphamid);
        if (ds.Tables[0].Rows.Count > 0)
        {
            thuoctinhid = int.Parse(ds.Tables[0].Rows[0]["ThuocTinhID"].ToString());
            ThuocTinh tt = new ThuocTinh();
            DataSet dstt = tt.SelectByID(thuoctinhid);
            if (dstt.Tables[0].Rows.Count > 0)
            {
                thuoctinhchaid = int.Parse(dstt.Tables[0].Rows[0]["thuoctinhchaid"].ToString());
            }
        }
        ddlThuocChinhCha.SelectedValue = thuoctinhchaid.ToString();
        LoadThuocTinh();

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            foreach (ListItem li in lbiThuocTinh.Items)
            {
                if (li.Value == dr["ThuocTinhID"].ToString())
                    li.Selected = true;
            }
        }
    }
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());
        }
    }