public string ListBrand()
 {
     string bl_brand = "";
     string seeAll = "";
     string listbrand = "";
     string strreturn = "";
     try
     {
         Hashtable hashLang = (Hashtable)Application[Session["langcurrent"].ToString()];
         bl_brand = hashLang["blbrand"].ToString();
         seeAll = hashLang["sapro"].ToString();
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
     }
     if (Application["listBrandPro"] == null)
     {
         string arrBrand = "";
         //Read brand:
         BrandProduct_data ds = new BrandProductSystem().BrandProAllType((int)Application["idtypeproduct"]);
         DataTable table = ds.Tables[BrandProduct_data._table];
         int numBrand = table.Rows.Count;
         for (int i = 0; i < numBrand; i++)
         {
             string id = table.Rows[i][BrandProduct_data._id].ToString();
             string name = table.Rows[i][BrandProduct_data._name].ToString();
             arrBrand += "<a href='default.html?menu=pro&brand=" + id + "' onmouseover='OnMOMenu(" + id + "," + i + ",10,event);' onmouseout='TimeHidden();'>" + name + "</a><br />";
         }
         if (arrBrand.Length > 3)
         {
             Application["listBrandPro"] = arrBrand;
         }
         //listbrand = "<a href='default.html?menu=dasp&state=6'>" + strphanphoi + "</a><br />";
         //listbrand += "<a href='default.html?menu=dasp&state=1,2,3,5'>" + strnhapkhau + "</a><br />";
         listbrand += "<a href='default.html?menu=product'>" + seeAll + "</a><br />" + arrBrand;
     }
     else
     {
         //listbrand = "<a href='default.html?menu=dasp&state=6'>" + strphanphoi + "</a><br />";
         //listbrand += "<a href='default.html?menu=dasp&state=1,2,3,5'>" + strnhapkhau + "</a><br />";
         listbrand += "<a href='default.html?menu=product'>" + seeAll + "</a><br />";
         if (Application["listBrandPro"] != null)
         {
             listbrand += Application["listBrandPro"].ToString();
         }
     }
     strreturn = "<table width='100%' cellpadding='0' cellspacing='0'>";
     strreturn += "<tr><td class='bg_b1'></td><td class='bg_b2'><div class='text_bl'>" + bl_brand + "</div></td><td class='bg_b3'></td></tr>";
     strreturn += "<tr><td class='bg_b4'></td><td class='text_2'>" + listbrand + "</td><td class='bg_b5'></td></tr>";
     strreturn += "<tr><td class='bg_b7' colspan='3'></td></tr>";
     strreturn += "<tr><td height='8'></td></tr></table>";
     return strreturn;
 }
 public string ListBrand()
 {
     string bl_brand = "";
     string seeAll = "";
     string listbrand = "";
     string strreturn = "";
     try
     {
         Hashtable hashLang = (Hashtable)Application[Session["langcurrent"].ToString()];
         bl_brand = hashLang["blbrand"].ToString();
         seeAll = hashLang["sapro"].ToString();
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
     }
     if (Application["listBrandMobile"] == null)
     {
         string arrBrand = "";
         //Read brand:
         BrandProduct_data ds = new BrandProductSystem().BrandProAllType((int)Application["idtypemobile"]);
         DataTable table = ds.Tables[BrandProduct_data._table];
         int numBrand = table.Rows.Count;
         for (int i = 0; i < numBrand; i++)
         {
             string id = table.Rows[i][BrandProduct_data._id].ToString();
             string name = table.Rows[i][BrandProduct_data._name].ToString();
             arrBrand += "<a href='?menu=pro&brand=" + id + "'>- " + name + "</a><br />";
         }
         if (arrBrand.Length > 3)
         {
             Application["listBrandMobile"] = arrBrand;
         }
         listbrand = "<a href='?menu=product'>- " + seeAll + "</a><br />" + arrBrand;
     }
     else
     {
         listbrand = "<a href='?menu=product'>- " + seeAll + "</a><br />";
         if (Application["listBrandMobile"] != null)
         {
             listbrand += Application["listBrandMobile"].ToString();
         }
     }
     strreturn = "<table width='100%' cellpadding='0' cellspacing='0'>";
     strreturn += "<tr><td class='bgtl1'></td><td class='bgtc1' width='145'>" + bl_brand + "</td><td class='bgtr1'></td></tr>";
     strreturn += "<tr><td height='2'></td></tr>";
     strreturn += "<tr><td colspan='3' width='175' class='bgcl1'>" + listbrand + "</td></tr>";
     strreturn += "<tr><td height='10'></td></tr></table>";
     return strreturn;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if(Application["apppda"]==null)
            {
                Application["apppda"]=1;
            }
            Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()];
            tblpocketpc=hash["pocketpc"].ToString();
            DataSet dsBrand = new BrandProductSystem().BrandProAllType(int.Parse(Application["apppda"].ToString()));
            int num = dsBrand.Tables[0].Rows.Count;
            for (int i = 0; i < num; i++)
            {
                listbrand += dsBrand.Tables[0].Rows[i][BrandProduct_data._name].ToString() + "<br />";
            }
        }
        catch
        {

        }
    }
    private string BrandNameWithStateId(string StateId)
    {
        string str = "";
        try
        {
            string where = "";
            string typeproductid = Application["idtypeproduct"].ToString();

            DataSet ds = new DataSet();

            if (StateId.Equals("0"))
            {
                //Select All Brand Of laptop:
                ds = new BrandProductSystem().BrandProAllType(int.Parse(typeproductid));
                //where = "Where Id in(select id from v_web_producttype_brand where ProducttypeId=" + typeproductid + " group by id) order by Name";
            }
            else
            {
                where = "Where Id in(select BrandId from tbl_product where Producttypeid=" + typeproductid + " and cansales=1 and StateId in (" + StateId + ")  group by brandid) order by Name";
                ds = new BrandProductSystem().BrandNameWhere(where);
            }

            Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()];
            string strBrand = "Nhãn hiệu máy tính xách tay";
            int num = 0;
            if (ds.Tables[0].Rows.Count> 0)
            {
                num = ds.Tables[0].Rows.Count;
                str += "<table width='220' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFF1EA'>";
                str += "<tr><td colspan='3' class='text_b3'>";
                str += strBrand;
                str += "</td></tr>";
                str += "<tr><td height='4'></td></tr>";
                str += "<tr class='text_title'><td align='left'>";
                for (int i = 0; i < num; i++)
                {

                    if (StateId.Equals("0"))
                    {
                        str += "<div style='padding:3px;'><a href='default.html?menu=dasp&brand=" + ds.Tables[0].Rows[i]["Id"].ToString() + "'>" + ds.Tables[0].Rows[i]["name"].ToString() + "</a></div>";
                    }
                    else
                    {
                        str += "<div style='padding:3px;'><a href='default.html?menu=dasp&state=" + StateId + "&brand=" + ds.Tables[0].Rows[i]["Id"].ToString() + "'>" + ds.Tables[0].Rows[i]["name"].ToString() + "</a></div>"; ;
                    }

                }
                 str += "</td></tr>";
                str += "<tr><td height='4'></td></tr>";
            }
                str += "</table>";
        }
        catch
        {
            str = "";
        }
        return str;
    }
    public string[] GetValueSearch(string tsearch, string tPrice, string tBrand, string tCpu, string tScreen, string tcolor)
    {
        string[] values = new string[8] { "", "", "", "", "", "", "", "" };
        string str = "";
        string path = Server.MapPath("data/xml/");
        XmlDocument doc = new XmlDocument();
        int numNode = 0;
        try
        {
            XmlTextReader reader = new XmlTextReader(path + "price.xml");
            //Get Price:
            doc.Load(reader);
            reader.Close();
            XmlNodeList nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            //GetPrice:
            str = "<select class='text_box2' id='slpriceq'>";
            str += "<option value='0'>" + tPrice + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                string value = nodes[i].ChildNodes[1].InnerText + "," + nodes[i].ChildNodes[2].InnerText;
                str += "<option value='" + value + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[0] = str;
            //Get Brand:
            DataSet ds = new BrandProductSystem().BrandProAllType((int)Application["idtypeproduct"]);
            numNode = ds.Tables[0].Rows.Count;
            str = "<select class='text_box2' id='slbrandq'>";
            str += "<option value='0'>" + tBrand + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + ds.Tables[0].Rows[i]["id"].ToString() + "'>" + ds.Tables[0].Rows[i]["name"].ToString() + "</option>";
            }
            str += "</select>";
            values[1] = str;
            //Get Cpu:
            reader = new XmlTextReader(path + "cpusearch.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='text_box2' id='slcpuq'>";
            str += "<option value='0'>" + tCpu + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[2] = str;
            //Get Screen Size:
            reader = new XmlTextReader(path + "screensize.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='text_box2' id='slscreenq'>";
            str += "<option value='0'>" + tScreen + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[3] = str;

            //Get Color product:
            reader = new XmlTextReader(path + "colorsearch.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='text_box2' id='slcolorq'>";
            str += "<option value='0'>" + tcolor + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[4] = str;
            //Get Location:
            reader = new XmlTextReader(path + "location.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "";
            //Chỗ này có phân cấp note:
            XmlNodeList subNode;
            string alert = "";
            for (int i = 0; i < numNode; i++)
            {
                alert = "";
                if (nodes[i].ChildNodes[0].Attributes["alert"] != null)
                {
                    alert = "title='" + nodes[i].ChildNodes[0].Attributes["alert"].InnerText + "'";
                }
                str += "&raquo;<a " + alert + " href='default.html?menu=dasp&address=" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</a><br />";
                if (nodes[i].ChildNodes.Count >2)
                {
                    //subNode = nodes[i].ChildNodes;
                    subNode = nodes[i].ChildNodes[2].ChildNodes;
                    int numsub = subNode.Count;
                    for (int j = 0; j < numsub; j++)
                    {
                        str += "&nbsp;&nbsp; &#8226; <a href='default.html?menu=dasp&address=" + subNode[j].InnerText + "'>" + subNode[j].Attributes["text"].InnerText + "</a><br />";
                    }
                }
            }
            values[5] = str;
        }
        catch
        {

        }
        return values;
    }
    public string[] GetValueSearch(string tsearch, string tPrice, string tBrand, string tCpu, string tScreen, string tcolor)
    {
        string[] values = new string[8] { "", "", "", "", "", "", "", "" };
        string str = "";
        string path = Server.MapPath("data/xml/");
        XmlDocument doc = new XmlDocument();
        int numNode = 0;
        try
        {
            XmlTextReader reader = new XmlTextReader(path + "price.xml");
            //Get Price:
            doc.Load(reader);
            reader.Close();
            XmlNodeList nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            //GetPrice:
            str = "<select class='sl1' id='slpriceq'>";
            str += "<option value='0'>" + tPrice + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                string value = nodes[i].ChildNodes[1].InnerText + "," + nodes[i].ChildNodes[2].InnerText;
                str += "<option value='" + value + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[0] = str;
            //Get Brand:
            DataSet ds = new BrandProductSystem().BrandProAllType((int)Application["idtypemobile"]);
            numNode = ds.Tables[0].Rows.Count;
            str = "<select class='sl1' id='slbrandq'>";
            str += "<option value='0'>" + tBrand + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + ds.Tables[0].Rows[i]["id"].ToString() + "'>- " + ds.Tables[0].Rows[i]["name"].ToString() + "</option>";
            }
            str += "</select>";
            values[1] = str;
            //Get Cpu:
            reader = new XmlTextReader(path + "cpusearch.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='sl1' id='slcpuq'>";
            str += "<option value='0'>" + tCpu + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[2] = str;
            //Get Screen Size:
            reader = new XmlTextReader(path + "screensize.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='sl1' id='slscreenq'>";
            str += "<option value='0'>" + tScreen + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[3] = str;

            //Get Color product:
            reader = new XmlTextReader(path + "colorsearch.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='sl1' id='slcolorq'>";
            str += "<option value='0'>" + tcolor + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[4] = str;
        }
        catch
        {

        }
        return values;
    }
    public string[] GetValueSearch()
    {
        string[] values = new string[8] { "", "", "", "", "", "", "", "" };
        string str = "";
        string path = Server.MapPath("data/xml/");
        XmlDocument doc = new XmlDocument();
        int numNode = 0;
        try
        {
            XmlTextReader reader = new XmlTextReader(path + "price.xml");
            //Get Price:
            doc.Load(reader);
            reader.Close();
            XmlNodeList nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            //GetPrice:
            str = "<select class='text_box2' id='slprice'>";
            str += "<option value='0'>"+tPrice +"</option>";
            for (int i = 0; i < numNode; i++)
            {
                string value = nodes[i].ChildNodes[1].InnerText + "," + nodes[i].ChildNodes[2].InnerText;
                str += "<option value='" + value + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[0] = str;
            //Get Brand:
            DataSet ds = new BrandProductSystem().BrandProAllType((int)Application["idtypeproduct"]);
            numNode = ds.Tables[0].Rows.Count;
            str = "<select class='text_box2' id='slbrand'>";
            str += "<option value='0'>" + tBrand + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + ds.Tables[0].Rows[i]["id"].ToString() + "'>" + ds.Tables[0].Rows[i]["name"].ToString() + "</option>";
            }
            str += "</select>";
            values[1] = str;
            //Get Cpu:
            reader = new XmlTextReader(path + "cpusearch.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='text_box2' id='slcpu'>";
            str += "<option value='0'>" + tCpu + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[2] = str;
            //Get Hdd:
            reader = new XmlTextReader(path + "hddsize.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='text_box2' id='slhdd'>";
            str += "<option value='0'>" + tHdd + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[3] = str;
            //Get Ram:
            reader = new XmlTextReader(path + "ramsize.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='text_box2' id='slram'>";
            str += "<option value='0'>" + tRam + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[4] = str;
            //Get Screen Size:
            reader = new XmlTextReader(path + "screensize.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='text_box2' id='slscreen'>";
            str += "<option value='0'>" + tScreen + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[5] = str;

            //Get Color:
            reader = new XmlTextReader(path + "colorsearch.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='text_box2' id='slcolor'>";
            str += "<option value='0'>" + tcolor + "</option>";
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>" + nodes[i].ChildNodes[0].InnerText + "</option>";
            }
            str += "</select>";
            values[6] = str;
            //Get location:
            reader = new XmlTextReader(path + "location.xml");
            doc.Load(reader);
            reader.Close();
            nodes = doc.SelectNodes("/root/search");
            numNode = nodes.Count;
            str = "<select class='text_box2' id='sllocation'>";
            str += "<option value='0'>" + tlocation + "</option>";
            XmlNodeList subNode;
            for (int i = 0; i < numNode; i++)
            {
                str += "<option value='" + nodes[i].ChildNodes[1].InnerText + "'>&raquo; " + nodes[i].ChildNodes[0].InnerText + "</option>";
                //subNode = nodes[i].ChildNodes;
                if (nodes[i].ChildNodes.Count > 2)
                {
                    subNode = nodes[i].ChildNodes[2].ChildNodes;
                    int numsub = subNode.Count;
                    for (int j = 0; j < numsub; j++)
                    {
                        str += "<option value='" + subNode[j].InnerText + "'>&nbsp;&#8226; " + subNode[j].Attributes["text"].InnerText + "</option>";
                    }
                }
            }
            str += "</select>";
            values[7] = str;
        }
        catch
        {

        }
        return values;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] != null)
        {
            try
            {
                id = int.Parse(Request.QueryString["id"].ToString());
                DataSet dsAdvertise = new AdvertiseSystem().SpecialSelectId(id);
                if (dsAdvertise.Tables.Count > 0 && dsAdvertise.Tables[0].Rows.Count > 0)
                {
                    txttitle.Value = dsAdvertise.Tables[0].Rows[0]["title"].ToString();
                    content = dsAdvertise.Tables[0].Rows[0]["content"].ToString();
                    txtlink.Value = dsAdvertise.Tables[0].Rows[0]["link"].ToString();
                    idbrand = dsAdvertise.Tables[0].Rows[0]["idbrand"].ToString();
                    sort = dsAdvertise.Tables[0].Rows[0]["sort"].ToString();
                    nameurl1 = dsAdvertise.Tables[0].Rows[0]["urlimage1"].ToString();
                    nameurl2 = dsAdvertise.Tables[0].Rows[0]["urlimage2"].ToString();
                    if (nameurl1.Length > 0)
                    {
                        urlOld1 = "../image/advertise/" + nameurl1;

                    }
                    else
                    {
                        urlOld1 = "../image/common/notimgpro.png";
                    }
                    if (nameurl2.Length > 0)
                    {
                        urlOld2 = "../image/advertise/" + nameurl2;
                    }
                    else
                    {
                        urlOld2 = "../image/common/notimgpro.png";
                    }
                }
            }
            catch
            {
                Response.Redirect("?menu=advertisespecial");
            }
        }
        if (!IsPostBack)
        {
            //Adbrand:
            try
            {
                BrandProduct_data dsBrand = new BrandProductSystem().BrandProAllType(int.Parse(Application["idtypeproduct"].ToString()));
                ListItem Item = new ListItem("Chọn nhãn hiệu", "0");
                slBrand.Items.Add(Item);
                if (dsBrand.Tables.Count > 0 && dsBrand.Tables[0].Rows.Count > 0)
                {
                    int num = dsBrand.Tables[0].Rows.Count;
                    for (int i = 0; i < num; i++)
                    {
                        Item = new ListItem(dsBrand.Tables[0].Rows[i]["name"].ToString(), dsBrand.Tables[0].Rows[i]["id"].ToString());
                        slBrand.Items.Add(Item);
                        if (idbrand == dsBrand.Tables[0].Rows[i]["id"].ToString())
                        {
                            slBrand.Items[i + 1].Selected = true;
                        }
                    }
                }
                Item = new ListItem("1", "1");
                slsort.Items.Add(Item);
                for (int i = 2; i <= 14; i++)
                {
                    Item = new ListItem(i + "", i + "");
                    slsort.Items.Add(Item);
                    if (i + "" == sort)
                    {
                        slsort.Items[i - 1].Selected = true;
                    }
                }
            }
            catch
            { }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //Adbrand:
         try
         {
             BrandProduct_data dsBrand = new BrandProductSystem().BrandProAllType(int.Parse(Application["idtypeproduct"].ToString()));
             ListItem Item = new ListItem("Chọn nhãn hiệu", "0");
             slBrand.Items.Add(Item);
             if (dsBrand.Tables.Count > 0 && dsBrand.Tables[0].Rows.Count > 0)
             {
                 int num = dsBrand.Tables[0].Rows.Count;
                 for (int i = 0; i < num; i++)
                 {
                     Item = new ListItem(dsBrand.Tables[0].Rows[i]["name"].ToString(), dsBrand.Tables[0].Rows[i]["id"].ToString());
                     slBrand.Items.Add(Item);
                 }
             }
             Item = new ListItem("1", "1");
             slsort.Items.Add(Item);
             for (int i = 2; i <= 14; i++)
             {
                 Item = new ListItem(i + "", i + "");
                 slsort.Items.Add(Item);
             }
         }
         catch
         { }
     }
 }
    protected void Onchange_ServerClick(object sender, EventArgs e)
    {
        try
        {
            int idtype = 1;
            if (SlType.Text.Equals("1"))
            {
                idtype = int.Parse(Application["idtypeproduct"].ToString());
            }
            else if (SlType.Text.Equals("2"))
            {
                idtype = int.Parse(Application["idtypemobile"].ToString());
            }
            BrandProduct_data dsBrand = new BrandProductSystem().BrandProAllType(idtype);
            ListItem Item = new ListItem("Chọn nhãn hiệu", "0");
            slBrand.Items.Clear();
            slBrand.Items.Add(Item);
            if (dsBrand.Tables.Count > 0 && dsBrand.Tables[0].Rows.Count > 0)
            {
                int num = dsBrand.Tables[0].Rows.Count;
                for (int i = 0; i < num; i++)
                {
                    Item = new ListItem(dsBrand.Tables[0].Rows[i]["name"].ToString(), dsBrand.Tables[0].Rows[i]["id"].ToString());
                    slBrand.Items.Add(Item);
                }
            }
        }
        catch
        {

        }
    }
Beispiel #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //SetOnline:
         myTitle = TitleDefault;
         myKey = KeyDefault;
         if (Session["online"] == null)
         {
             Session["online"] = true;
             SetVisited();
         }
         if (Application["idtypeproduct"] == null)
         {
             //Application["ratepromain"] = 1;
             SetAppTypeProduct();
         }
         Application["ratepromain"] = SetRateProduct(Application["idtypeproduct"].ToString());
         //For language support:
         if(Application["langsupport"] == null)
         {
             //Read Languagesupport:
             string _fileSupport = Server.MapPath("data/xml/language_support.xml");
             XmlDocument _docfile = new XmlDocument();
             XmlTextReader _reader = new XmlTextReader(_fileSupport);
             _docfile.Load(_reader);
             _reader.Close();
             XmlNodeList _listNode = _docfile.SelectNodes("/lang_support/lang");
             int numSupport = _listNode.Count;
             ArrayList _list = new ArrayList();
             string _urlFileLang=Server.MapPath("data/xml/");
             for (int i = 0; i < numSupport; i++)
             {
                 XmlNodeList _subList = _listNode[i].ChildNodes;
                 string[] arrvalue = new string[3] { "", "", "" };
                 arrvalue[0] = _subList[1].InnerText;
                 arrvalue[1] = _subList[3].InnerText;
                 arrvalue[2] = _subList[4].InnerText;
                 _list.Add(arrvalue);
                 GetApplication(arrvalue[1],_urlFileLang);
             }
             Application["langsupport"] = _list;
         }
         //for Session language current:
         if (Session["langcurrent"] == null)
         {
             ArrayList _list =(ArrayList)Application["langsupport"];
             string[] arrvalue = (string[])_list[0];
             Session["langcurrent"] = arrvalue[1];
         }
         if (Application["AppDownloadPrice"] == null)
         {
             StreamReader myFile1 = new StreamReader(Server.MapPath("data/file/Downloadprice.txt"));
             Application["AppDownloadPrice"] = myFile1.ReadToEnd();
             myFile1.Close();
         }
         plhheader.Controls.Add(Page.LoadControl("block/header.ascx"));
         plhmenu.Controls.Add(Page.LoadControl("block/menu.ascx"));
         plhsearchmenu.Controls.Add(Page.LoadControl("block/searchheader.ascx"));
         plhleft.Controls.Add(Page.LoadControl("block/left.ascx"));
         plhright.Controls.Add(Page.LoadControl("block/right.ascx"));
         plhcenter.Controls.Add(Page.LoadControl("block/center.ascx"));
         if (Application["AppFooter"] == null)
         {
             StreamReader myFile = new StreamReader(Server.MapPath("data/file/footer.txt"));
             footer = myFile.ReadToEnd();
             Application["AppFooter"] = footer;
             myFile.Close();
         }
         else
         {
             footer = Application["AppFooter"].ToString();
         }
         //Create title:
         string menu = "";
         if (Request.QueryString["menu"] != null)
         {
             menu = Request.QueryString["menu"].ToString();
             if (menu == "product")
             {
                 myTitle = "may tinh xach tay,máy tính xách tay,maytinhxachtay.com";
                 myKey = "may tinh xach tay - máy tính xách tay";
             }
             else if (menu == "com")
             {
                 myTitle = "linh kien may tinh, maytinhxachtay.com";
                 myKey = "linh kien may tinh";
             }
             else if (menu == "pro")
             {
                 if (Request.QueryString["brand"] != null)
                 {
                     string brandid = Request.QueryString["brand"];
                     DataSet dsbrand = new BrandProductSystem().BrandNameWhere("where id=" + brandid);
                     if (dsbrand.Tables.Count > 0 && dsbrand.Tables[0].Rows.Count > 0)
                     {
                         myTitle = "may tinh xach tay - " + dsbrand.Tables[0].Rows[0]["Name"] + ", maytinhxachtay.com";
                         myKey = "may tinh xach tay - " + dsbrand.Tables[0].Rows[0]["Name"];
                     }
                 }
             }
             else if (menu == "dc")
             {
                 if (Request.QueryString["id"] != null)
                 {
                     string id = Request.QueryString["id"];
                     DataSet dspro = new ComponentProductSystem().ComponentNameId(id);
                     if (dspro.Tables.Count > 0 && dspro.Tables[0].Rows.Count > 0)
                     {
                         myTitle = dspro.Tables[0].Rows[0]["Name"] + ", maytinhxachtay.com";
                         myKey = dspro.Tables[0].Rows[0]["Name"] + " - may tinh xach tay";
                     }
                 }
             }
             else if (menu == "dp" || menu == "dpda")
             {
                 if (Request.QueryString["id"] != null)
                 {
                     string id = Request.QueryString["id"];
                     DataSet dspro = new ProductSystem().ProductNameId(id);
                     if (dspro.Tables.Count > 0 && dspro.Tables[0].Rows.Count > 0)
                     {
                         myTitle = dspro.Tables[0].Rows[0]["Name"] + ", maytinhxachtay.com";
                         myKey = dspro.Tables[0].Rows[0]["Name"] + " - may tinh xach tay";
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
     }
 }