protected void btedit_ServerClick(object sender, EventArgs e)
    {
        try
        {
            content = Request.Form["txtContent"].ToString();
            string _ShortDes = txtShortDes.Value.Trim();
            ProductSystem managerProduct = new ProductSystem();
            if (managerProduct.ProductDesUpdate(int.Parse(id), content,_ShortDes))
            {
                diverror.Visible = true;
                string nameGroup = txtName.Value.Trim();
                diverror.InnerHtml = "Thông tin mô tả sản phẩm đã được cập nhật !";
                if (nameGroup.Length > 0)
                {
                    //UpdateGroupName:
                    managerProduct.ProductDesUpdateGroup(nameGroup, content);
                    diverror.InnerHtml += "<br />Sản phẩm theo nhóm đã được cập nhật mô tả !";
                    txtName.Value = "";
                }

            }
            else
            {
                diverror.Visible = true;
                diverror.InnerHtml = "Lỗi kết nối, xin bạn hãy thử lại";
            }
        }
        catch
        {
            diverror.InnerHtml = "Lỗi kết nối, xin bạn hãy thử lại";
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Request.QueryString["usd"] != null)
            {
                string usd = Request.QueryString["usd"].ToString();
                ProductSystem product = new ProductSystem();
                if (product.UpdateUSD(usd))
                {
                    usd_update = "Tỷ giá USD đã được cập nhật";
                }
                else
                {
                    usd_update = "Có lỗi không thể cập nhật tỷ giá usd";
                }
            }
        }
        catch
        {

        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     diverror.Visible = false;
     try
     {
         id = Request.QueryString["id"].ToString();
         srtback = Request.QueryString["back"].ToString();
         DataSet ds = new ProductSystem().ProductDesId(id);
         if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
         {
             content = ds.Tables[0].Rows[0]["des"].ToString();
             title = ds.Tables[0].Rows[0]["name"].ToString();
             specification = ds.Tables[0].Rows[0]["note"].ToString();
         }
         else
         {
             Response.Redirect("?menu=imgpro");
         }
     }
     catch
     {
         Response.Redirect("?menu=imgpro");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["ProductInCart"] != null)
            {
                ManagerCart = (ManagerProcart)Session["ProductInCart"];
            }
            try
            {
                string id = Request.QueryString["id"].ToString();
                string type = Request.QueryString["type"].ToString();
                if (type.Equals("1") || type.Equals("3") || type.Equals("4"))
                {
                    if (id.Length > 0)
                    {
                        ProductSystem Product = new ProductSystem();
                        DataSet ds = Product.ProductToCart(id,"");
                        if (ds.Tables.Count > 0)
                        {
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                proIncart.type = int.Parse(type);
                                proIncart.name = ds.Tables[0].Rows[0]["Name"].ToString() + " " + ds.Tables[0].Rows[0]["state"].ToString();
                                proIncart.urlImage = ds.Tables[0].Rows[0]["UrlImage"].ToString();
                                string strPrice = ds.Tables[0].Rows[0]["SellingPrice"].ToString();
                                if (strPrice.Length > 0)
                                {
                                    proIncart.price = float.Parse(strPrice);
                                }
                                string strwarranty = ds.Tables[0].Rows[0]["WarrantyMonth"].ToString();
                                if (strwarranty.Length > 0)
                                {
                                    proIncart.warranty = int.Parse(strwarranty);
                                }
                                proIncart.id = int.Parse(id);
                                proIncart.number = 1;
                                proIncart.currency = ds.Tables[0].Rows[0]["currency"].ToString();
                                proIncart.rate = float.Parse(ds.Tables[0].Rows[0]["rate"].ToString());
                                proIncart.setTotal();
                                ManagerCart.AddNewPro(proIncart);
                                Session["ProductInCart"] = ManagerCart;
                            }
                        }
                    }
                }
                else if(type.Equals("2"))
                {
                    //add component:
                    ComponentProductSystem Compoent = new ComponentProductSystem();
                    DataSet ds = Compoent.ComponenttoCart(id, Application["idtypeproduct"].ToString());
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            proIncart.type = 2;
                            proIncart.name = ds.Tables[0].Rows[0]["Name"].ToString();
                            proIncart.urlImage = ds.Tables[0].Rows[0]["UrlImage"].ToString();
                            string strPrice = ds.Tables[0].Rows[0]["SellingPrice"].ToString();
                            if (strPrice.Length > 0)
                            {
                                proIncart.price = float.Parse(strPrice);
                            }
                            string strwarranty = ds.Tables[0].Rows[0]["WarrantyMonth"].ToString();
                            if (strwarranty.Length > 0)
                            {
                                proIncart.warranty = int.Parse(strwarranty);
                            }
                            proIncart.id = int.Parse(id);
                            proIncart.number = 1;
                            proIncart.currency = ds.Tables[0].Rows[0]["currency"].ToString();
                            proIncart.rate = float.Parse(ds.Tables[0].Rows[0]["rate"].ToString());
                            proIncart.setTotal();
                            ManagerCart.AddNewPro(proIncart);
                            Session["ProductInCart"] = ManagerCart;
                        }
                    }
                }
                else if (type.Equals("11") || type.Equals("13") || type.Equals("14"))
                {
                    //delete product:
                    if (id.Length > 0)
                    {
                        proIncart.id = int.Parse(id);
                        if (type.Equals("11"))
                        {
                            proIncart.type = 1;
                        }
                        else if(type.Equals("13"))
                        {
                            proIncart.type = 3;
                        }
                        else if (type.Equals("14"))
                        {
                            proIncart.type = 4;
                        }
                        ManagerCart.DeletePro(proIncart);
                        Session["ProductInCart"] = ManagerCart;
                    }
                }
                else if (type.Equals("12"))
                {
                    //delete com:
                    if (id.Length > 0)
                    {
                        proIncart.id = int.Parse(id);
                        proIncart.type = 2;
                        ManagerCart.DeletePro(proIncart);
                        Session["ProductInCart"] = ManagerCart;
                    }
                }
            }
            catch
            {

            }
        }
        Response.Redirect("Default.aspx?menu=shoppingcart");
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     int id = 0;
     try
     {
         id = int.Parse(Request.QueryString["id"].ToString());
     }
     catch
     {
         Response.Redirect("Default.aspx?menu=pda");
     }
     try
     {
         unitPrice = Application["currency"].ToString();
         if (unitPrice.Equals("$"))
         {
             unitPrice = "VND";
         }
         Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()];
         bldetail = hash["detail"].ToString();
         thome = hash["home"].ToString();
         tpro = hash["pocketpc"].ToString();
         tname = hash["name"].ToString();
         tbrand = hash["brand"].ToString();
         tprice = hash["tprice"].ToString();
         twarranty = hash["twarranty"].ToString();
         twhere = hash["warehouse"].ToString();
         tstate = hash["state"].ToString();
         tnothave = hash["outstore"].ToString();
         tmonth = hash["tmonth"].ToString();
         torder = hash["torder"].ToString();
         tback = hash["bback"].ToString();
         tdes = hash["des"].ToString();
         ttechnology = hash["specification"].ToString();
         tcurrentAccess = hash["currentpage"].ToString();
         tlistpro = hash["similar"].ToString();
         tcurrentAccess = tcurrentAccess + ": <a href='?menu=home'>" + thome + "</a> &raquo; <a href='?menu=pda'>" + tpro + "</a> &raquo; ";
     }
     catch { }
     try
     {
         DataSet ds = new ProductSystem().ProductDetailTypeAll(id, (int)Application["apppda"]);
         GetDetailProduct(ds.Tables[0], ds.Tables[1], ds.Tables[4]);
         if (strpro.Length > 0)
         {
             GetSpecification(ds.Tables[2], ds.Tables[3]);
             GetGroupProduct(ds.Tables[5]);
         }
         else
         {
             Response.Redirect("Default.aspx?menu=pda");
         }
     }
     catch
     {
         Response.Redirect("Default.aspx?menu=pda");
     }
 }
 protected string ButtonUpload_UploadClick(object sender, WebControls.UploadButtonEventArgs e)
 {
     string message = "";
     try
     {
         if (Session["SSIdProUpload"] == null)
         {
             message = "Xin bạn hãy chọn sản phẩm muốn upload ảnh.";
             return message;
         }
         else
         {
             string strIdAndName = Session["SSIdProUpload"].ToString();
             string[] arrvalue = strIdAndName.Split(',');
             CvalidateImageForPost imgProcess = new CvalidateImageForPost();
             FileUpload file = e.FileUploadControl;
             string file_name = file.PostedFile.FileName;
             if (file_name.Length == 0)
             {
                 message = "Xin bạn hãy chọn file ảnh";
                 return message;
             }
             else
             {
                 if (!imgProcess.TestTypeFile(file))
                 {
                     message = "File Không hợp lệ";
                     return message;
                 }
                 else if (imgProcess.TestMaxSizeImage(file, 20480))
                 {
                     message = "Kích thước ảnh không quá 20 KB";
                     return message;
                 }
                 else
                 {
                     string _path = Server.MapPath("../image/img_pro/");
                     string namepro = "_";
                     if (arrvalue.Length == 3)
                     {
                         namepro = arrvalue[2];
                         namepro = namepro.Replace(" ", "");
                     }
                     string strgetTime = new CGetDataCommon().GetStrMonthDayYearSecondMinuteHour();
                     string nameNew = "pro_" + arrvalue[0] + "_" + strgetTime + "." + imgProcess.GetExtension(file_name);
                     Boolean isUpload = imgProcess.UploadFile(file, _path + nameNew);
                     if (isUpload)
                     {
                         ProductSystem ManagerPro = new ProductSystem();
                         Boolean isUpdate = ManagerPro.ProductUpdateImage(int.Parse(arrvalue[0]), nameNew);
                         if (isUpdate)
                         {
                             message = "";
                             //Xóa ảnh cũ đi:
                             imgProcess.DeleteFile(_path + arrvalue[1]);
                             return message;
                         }
                         else
                         {
                             //Lỗi không thể cập nhật vào cơ sở dữ liệu. Xóa ảnh vừa upload lên đi.
                             imgProcess.DeleteFile(_path + nameNew);
                             message = "Lỗi kết nối SQL server. Không thể cập nhật được ảnh. Xin hãy thử lại";
                             return message;
                         }
                     }
                     else
                     {
                         message = "Lỗi mạng hoặc không có quyền tạo file trong thư mục ảnh sản phẩm. Không thể Upload file ảnh. Xin bạn hãy thử lại";
                         return message;
                     }
                 }
             }
         }
     }
     catch
     {
         message = "Có các lỗi sau đây: Không có quyền tạo file trong thư mục ảnh sản phẩm. Hoặc không cập nhật được vào CSDL. Hoặc ảnh bạn chọn không còn tồn tại. Xin bạn hãy thử lại";
     }
     return message;
 }
예제 #7
0
    // For listname:
    private string GetListName()
    {
        string str = "";
        try
        {
            int id = int.Parse(Request.QueryString["idbrand"].ToString());
            DataSet ds = new ProductSystem().ListNamePro((int)Application["idtypeproduct"], id);
            Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()];
            string strhave = hash["thname"].ToString();
            string strnothave = hash["tnothname"].ToString();
            if (ds.Tables.Count > 0)
            {
                string nameBrand = "";
                string noteBrand = "";
                if (ds.Tables[1].Rows.Count > 0)
                {
                    nameBrand = ds.Tables[1].Rows[0]["name"].ToString();
                    noteBrand = ds.Tables[1].Rows[0]["Note"].ToString();
                }
                string number = "0";
                if (ds.Tables[2].Rows.Count > 0)
                {
                    number = ds.Tables[2].Rows[0]["number"].ToString();
                }
                int numName = ds.Tables[0].Rows.Count;
                if (numName > 7)
                {
                    str += "<table width='620' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFF1EA'>";
                }
                else
                {
                    str += "<table width='310' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFF1EA'>";
                }
                str += "<tr><td colspan='3' class='text_b3'>";
                if (number.Equals("0"))
                {
                    str += string.Format(strnothave, "<span class='text_3'>" + nameBrand + "</span>");
                    if (noteBrand.Length > 0)
                    {
                        str += "<div class='nbrand'>" + noteBrand + "</div>";
                    }
                    str += "</td></tr>";
                }
                else
                {
                    str += string.Format(strhave, "<span class='text_3'>" + nameBrand + "</span>","<span class='text_3'>" + number + "</span>");
                    if (noteBrand.Length > 0)
                    {
                        str += "<div class='nbrand'>" + noteBrand + "</div>";
                    }
                    str += "</td></tr>";
                    //Cộng thêm mô tả nhãn hiệu ở đây:
                    str += "<tr><td height='4'></td></tr>";
                    if (numName > 7)
                    {
                        int middle = numName / 2;
                        str += "<tr class='text_title' style='line-height:20px;' align='left'><td style='padding:3px;' valign='top'>";
                        for (int i = 0; i < middle; i++)
                        {
                            str += "<a href='default.html?menu=dasp&text=" + ds.Tables[0].Rows[i]["name"].ToString() + "'>" + ds.Tables[0].Rows[i]["name"].ToString() + " (" + ds.Tables[0].Rows[i]["number"].ToString() + ")</a><br />";
                        }
                        str += "</td><td class='bg_line4'></td><td style='padding:3px;' valign='top'>";
                        for (int i = middle; i < numName; i++)
                        {
                            str += "<a href='default.html?menu=dasp&text=" + ds.Tables[0].Rows[i]["name"].ToString() + "'>" + ds.Tables[0].Rows[i]["name"].ToString() + " (" + ds.Tables[0].Rows[i]["number"].ToString() + ")</a><br />";
                        }
                        str += "</tr>";
                        str += "<tr><td height='4'></td></tr>";
                    }
                    else
                    {
                        str += "<tr><td height='4'></td></tr>";
                        for (int i = 0; i < numName; i++)
                        {
                            str += "<tr class='text_title'><td align='left' style='padding:3px;'>";
                            str += "<a href='default.html?menu=dasp&text=" + ds.Tables[0].Rows[i]["name"].ToString() + "'>" + ds.Tables[0].Rows[i]["name"].ToString() + " (" + ds.Tables[0].Rows[i]["number"].ToString() + ")</a>";
                            str += "</td></tr>";
                        }
                        str += "<tr><td height='4'></td></tr>";
                    }
                }
                str += "</table>";
            }

        }
        catch
        {
            str = "";
        }
        return str;
    }
예제 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string func = Request.QueryString["menu"].ToString();
            string id="0";
            switch (func)
            {
                case ("lang"):
                    string flag = "";
                    id = Request.QueryString["id"].ToString();
                    Session["langcurrent"] = id;
                    ArrayList _list = (ArrayList)Application["langsupport"];
                    int numLang = _list.Count;
                    for (int i = 0; i < numLang; i++)
                    {
                        string[] arrstr = (string[])_list[i];
                        if (Session["langcurrent"].ToString().Equals(arrstr[1]))
                        {
                            flag += "<img id='" + arrstr[1] + "' src='image/flag/" + arrstr[2] + "' class='img_flag2' title='" + arrstr[0] + "'/>";
                        }
                        else
                        {
                            flag += "<img id='" + arrstr[1] + "' src='image/flag/" + arrstr[2] + "' class='img_flag1' title='" + arrstr[0] + "' onclick='OnChangeLang(this);'/>";
                        }
                    }
                    Session["strlangsupport"] = flag;
                    Response.Write("ok");
                    break;
                case("specpro"):
                    id = Request.QueryString["id"].ToString();
                    string Specification = new ProductSystem().ProductDesandStock(id);
                    Response.Write(Specification);
                    break;
                case("promotion"):
                    id = Request.QueryString["id"].ToString();
                    string promotion = new ProductSystem().PromotionSelectId(id);
                    Response.Write(promotion);
                    break;
                case("logout"):
                    Session["infoUser"] = null;
                    Response.Write("ok");
                    break;
                case("compare"):
                    string sl1 = "0";
                    string sl2 = "0";
                    try
                    {
                        string[] arr = Request.QueryString["id"].ToString().Split(',');
                        int id1 = int.Parse(arr[0]);
                        int id2 = int.Parse(arr[1]);
                        DataSet ds = new ProductSystem().ProductSelectNameWithBrand(id1, id2, int.Parse(Application["idtypeproduct"].ToString()));
                        int num = ds.Tables[0].Rows.Count;
                        if (num > 0)
                        {
                            num = num - 1;
                            sl1 = "";
                            for (int i = 0; i < num; i++)
                            {
                                sl1 +=ds.Tables[0].Rows[i]["id"].ToString() + ":" + ds.Tables[0].Rows[i]["name"].ToString() + ";";
                            }
                            sl1 += ds.Tables[0].Rows[num]["id"].ToString() + ":" + ds.Tables[0].Rows[num]["name"].ToString();
                        }
                        num = ds.Tables[1].Rows.Count;
                        if (num > 0)
                        {
                            num = num - 1;
                            sl2 = "";
                            for (int i = 0; i < num; i++)
                            {
                                sl2 += ds.Tables[1].Rows[i]["id"].ToString() + ":" + ds.Tables[1].Rows[i]["name"].ToString() + ";";
                            }
                            sl2 += ds.Tables[1].Rows[num]["id"].ToString() + ":" + ds.Tables[1].Rows[num]["name"].ToString();
                        }
                    }
                    catch
                    { }
                    Response.Write(sl1 + "<>" + sl2);
                    break;
                case "bestsell":
                    string strbest = "";
                    try
                    {
                        string blBestSell = "";
                        string tprice = "";
                        string currency = "USD";
                        currency = Application["currency"].ToString();
                        Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()];
                        blBestSell = hash["blbestsell"].ToString();
                        tprice = hash["tprice"].ToString();
                        strMVAT = hash["msvat"].ToString();
                        strbest = "<div class='td_bd1'>";
                        strbest += "<table border='0' cellpadding='0' cellspacing='0' width='100%' bgcolor='#FFF1EA'>";
                        strbest+="<tr><td class='text_b3'>"+ blBestSell +"</td></tr>";
                        strbest += GetProBestSell(tprice, currency);
                        strbest += "</table>";
                        strbest += "</div>&nbsp;";
                    }
                    catch
                    {

                    }
                    Response.Write(strbest);
                    break;
                //originaltop
                case "originaltop":
                    string stroriginal = "";
                    try
                    {
                        string bloriginal = "";
                        string tprice = "";
                        string seeall = "";
                        string currency = "USD";
                        currency = Application["currency"].ToString();
                        Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()];
                        bloriginal = hash["loriginal"].ToString();
                        tprice = hash["tprice"].ToString();
                        seeall = hash["saoriginal"].ToString();
                        strMVAT = hash["msvat"].ToString();
                        stroriginal = "<div class='td_bd1'>";
                        stroriginal += "<table border='0' cellpadding='0' cellspacing='0' width='100%' bgcolor='#FFF1EA'>";
                        stroriginal += "<tr><td class='text_b3'>" + bloriginal + "</td></tr>";
                        stroriginal += GetProOriginal(tprice, currency);
                        stroriginal += "<tr><td class='text_title' align='center'><a href='default.html?menu=originalpro'>" + seeall + "</a></td></tr>";
                        stroriginal += "</table>";
                        stroriginal += "</div>&nbsp;";
                    }
                    catch
                    {

                    }
                    Response.Write(stroriginal);
                    break;
                case "justhave":
                    string strjusthave = "";
                    try
                    {
                        string bljusthave = "";
                        string tprice = "";
                        string currency = "USD";
                        currency = Application["currency"].ToString();
                        Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()];
                        bljusthave = hash["justh"].ToString();
                        tprice = hash["tprice"].ToString();
                        strMVAT = hash["msvat"].ToString();
                        strjusthave = "<div class='td_bd1'>";
                        strjusthave += "<table border='0' cellpadding='0' cellspacing='0' width='100%' bgcolor='#FFF1EA'>";
                        strjusthave += "<tr><td class='text_b3'>" + bljusthave + " <img src='image/common/hot.gif'/></td></tr>";
                        strjusthave += GetJustHave(tprice, currency);
                        strjusthave += "</table>";
                        strjusthave += "</div>&nbsp;";
                    }
                    catch
                    {

                    }
                    Response.Write(strjusthave);
                    break;
                case "advertise":
                    Response.Write(Advertise());
                    break;
                case "brand":
                    Response.Write(ListBrand());
                    break;
                case"statistic":
                    Response.Write(GetStatistic());
                    break;
                case ("quicksearch"):
                    Response.Write(BuildPageSearch());
                    break;
                case ("aspecial"):
                    Response.Write(GetAdvertiseSpecial());
                    break;
                case ("listName"):
                    Response.Write(GetListName());
                    break;
                case ("stateproduct"):
                    id = Request.QueryString["id"].ToString();
                    Response.Write(BrandNameWithStateId(id));
                    break;
            }
        }
        catch { }
    }
예제 #9
0
    public string ProducttoExcel(string Currency, int idbrand, int idtype)
    {
        ProductSystem product = new ProductSystem();
        DataSet ds = product.ProductExportPrice(Currency, idbrand, idtype);
        string table = "";
        try
        {
            DataTable TableCurrency = new DataTable();
            DataTable TablePro = new DataTable();
            DataTable TableWhere = new DataTable();
            timecurrent = DateTime.Now;
            timecurrent = timecurrent.ToUniversalTime();
            timecurrent = timecurrent.AddHours(7);
            float rate = (float)Application["ratepromain"];
            if (ds.Tables.Count > 0)
            {
                TableCurrency = ds.Tables[0];
                TablePro = ds.Tables[1];
                TableWhere = ds.Tables[2];
                float Exchange = 0, price = 0;
                float priceStand = 0;
                if (TableCurrency.Rows.Count > 0)
                {
                    Exchange = float.Parse(TableCurrency.Rows[0]["Rate"].ToString());
                }
                int numPro = TablePro.Rows.Count;
                int maxWhere = TableWhere.Rows.Count;
                string CurrentBrand = "";
                string currentId = "";
                //create HastTableWhere:
                Hashtable hashwhere = new Hashtable();
                int numwhere = TableWhere.Rows.Count;
                string idpro = "";
                DateTime time = new DateTime();
                for (int j = 0; j < numwhere; j++)
                {
                    idpro = TableWhere.Rows[j]["productid"].ToString();
                    int idstate = int.Parse(TableWhere.Rows[j]["id"].ToString());
                    string message = "";
                    time = DateTime.Now.ToUniversalTime();
                    time = time.AddHours(7);
                    if (idstate <= 5)
                    {

                    }
                    else
                    {
                        if (idstate == 6)
                        {
                            time = time.AddHours(24);
                        }
                        else if (idstate == 7)
                        {
                            time = time.AddHours(24);
                        }
                        else if (idstate == 8)
                        {
                            time = time.AddHours(48);
                        }
                        else if (idstate == 9)
                        {
                            if (TableWhere.Rows[j]["DisContinued"].ToString().Equals("7"))
                            {
                                time = (DateTime)TableWhere.Rows[j]["FirstImportDate"];
                                message = "(Đợt mới sẽ có ngày <font color='red'>" + time.ToString("dd/MM") + "</font>)";
                                continue;
                            }
                            else
                            {
                                time = time.AddHours(72);
                            }
                        }
                        else
                        {
                            continue;
                        }
                        message = "(Có thêm hàng ngày <font color='red'>" + time.ToString("dd/MM") + "</font>)";
                    }
                    try
                    {
                        if (hashwhere[idpro] != null)
                        {
                            hashwhere[idpro] = hashwhere[idpro].ToString() + "<br />* " + TableWhere.Rows[j]["address"].ToString() + message;
                        }
                        else
                        {
                            hashwhere[idpro] = "* " + TableWhere.Rows[j]["address"].ToString() + message;
                        }
                    }
                    catch
                    { }
                }
                table = "<table border='1' cellpadding='3' cellspacing='0' bordercolor='#676767' style='border-collapse:collapse;color:#000000;font-family:Arial, Helvetica,sans-serif;font-size:10px;'>";
                table += "<tr height='1'><td style='width:140px;'></td><td style='width:65px;'></td><td style='width:425px;'></td><td style='width:70px;'></td><td style='width:58px;'></td><td style='width:60px;'></td><td style='width:140px;'></td></tr>";
                table += "<tr height='36'><td colspan='7' align='center' style='vertical-align:middle;'><font style='font-size:19px;text-decoration:underline;font-weight:bold;'>";
                table += "WWW.MayTinhXachTay.com</font></td></tr>";

                table += "<tr height='45' style='line-height:18px'><td  style='font-weight:bold;font-size:14px;border-width:0px;vertical-align:top;'>TP.Hồ Chí Minh:</td><td colspan='6' style='font-size:12px;border-width:0px;vertical-align:middle;'>Showroom Nguyễn Ngọc Laptop,236-Cao Thắng nối dài. P12. Q 10-TP.HCM,(08)22430786,(08)22148675,0946769396.<br />";
                table += "Showroom Công Nghệ Di Động BTX, 77C Bùi thị xuân - P. Phạm Ngũ Lão - Q1 - TP.HCM, Tel: (08) 224.887.36, (08) 224.887.37, 0169.2204.686<br />Showroom Công Nghệ Di Động CMT8, 740-742 CMT8, F5, Q. Tân Bình - TP.HCM, Tel: 08.6.6567.069, 08.6.2680.865, 0902.894749</td></tr>";
                table += "<tr height='30' style='line-height:18px'><td style='font-weight:bold;font-size:14px;border-width:0px;vertical-align:top;'>Hà Nội:</td><td colspan='6' style='font-size:12px;border-width:0px;'>Showroom Điện Tử Sài Gòn, 270 Đào Duy Anh - Q. Đống Đa, Hà Nội, Tel: (04)35724492, (04)35724493, 0915025448, 0955169893. Fax: 84-4-5724519<br />";
                table += "Showroom Nguyễn Ngọc Laptop, 32 Thái Hà -Q. Đống Đa, Hà Nội: (04)35378840, (04)35378841, 0912745204, 0955925454. Fax: 84-4-5378839</td></tr>";
                table += "<tr height='20' style='line-height:18px'><td style='font-weight:bold;font-size:14px;border-width:0px;vertical-align:top;'>Đà Nẵng:</td><td colspan='6' style='font-size:12px;border-width:0px;'>Showroom Công Nghệ Di Động, 144 Hàm Nghi- Đà Nẵng, Tel: 0511 3656848, 01263664142, 01254480698";
                table += "</td></tr>";
                table += "<tr height='20' style='line-height:18px'><td style='font-weight:bold;font-size:14px;border-width:0px;vertical-align:top;'>Cần Thơ:</td><td colspan='6' style='font-size:12px;border-width:0px;'>Showroom Công Nghệ Di Động Tây Đô, 102 Trần Hưng Đạo - Q Ninh Kiều - TP Cần Thơ. Tel: 07106266889, 07106262979";
                table += "</td></tr>";
                table += "<tr height='20' style='line-height:18px'><td style='font-weight:bold;font-size:14px;border-width:0px;vertical-align:top;'>Quy Nhơn:</td><td colspan='6' style='font-size:12px;border-width:0px;'>Showroom Công nghệ di động Quy Nhơn 27 Lý Thường Kệt - P. Lê Hồng Phong - TP. Quy Nhơn ";
                table += "</td></tr>";
                table += "<tr height='20' style='line-height:18px'><td style='font-weight:bold;font-size:14px;border-width:0px;vertical-align:top;'>Long Xuyên:</td><td colspan='6' style='font-size:12px;border-width:0px;'>Công Nghệ Di Động Long Xuyên ";
                table += "</td></tr>";
                table += "<tr height='20' style='line-height:18px'><td style='font-weight:bold;font-size:14px;border-width:0px;vertical-align:top;'>Nha Trang:</td><td colspan='6' style='font-size:12px;border-width:0px;'>Công Nghệ Di Động Nha Trang ";
                table += "</td></tr>";
                //table += "</table>";
                //
                table +="<tr><td colspan='7' style='border-width:0px;' height='10'></td></tr>";
                table += "<tr height='22'><td colspan='7' style='border-width:0px;'>";
                table += "Báo giá chưa kể thuế VAT 5%, các máy tính bán đều phải cộng VAT và hoá đơn. Thanh toán bằng tiền mặt hoặc chuyển khoản.<br />";
                table += "</td></tr>";
                table += "<tr><td colspan='7' style='border-width:0px;' height='10'></td></tr>";
                table += "<tr height='28' style='vertical-align:middle;text-align:left;font-size:14px;'>";
                if (rate != 1)
                {
                    table += "<td colspan='3' style='border-width:0px;'><b>Báo giá máy tính xách tay</b>: Ngày <i>" + timecurrent.ToString("dd/MM/yy") + ", " + timecurrent.ToShortTimeString() + "(Giờ Hà Nội)</i></td><td align='center' style='border-width:0px;'>" + Exchange + "</td><td colspan='3' style='border-width:0px;'></td></tr>";
                }
                else
                {
                    table += "<td colspan='3' style='border-width:0px;'><b>Báo giá máy tính xách tay</b>: Ngày <i>" + timecurrent.ToString("dd/MM/yy") + ", " + timecurrent.ToShortTimeString() + "(Giờ Hà Nội)</i></td><td align='center' style='border-width:0px;'></td><td colspan='3' style='border-width:0px;'></td></tr>";
                }
                //table += "<td colspan='3' style='border-width:0px;'><b>Báo giá máy tính xách tay</b>: Ngày <i>" + timecurrent.ToString("dd/MM/yy") + ", " + timecurrent.ToShortTimeString() + "(Giờ Hà Nội)</i></td><td align='center' style='border-width:0px;'></td><td colspan='3' style='border-width:0px;'></td></tr>";
                table += "<tr height='34' style='vertical-align:middle;text-align:center;font-size:12px;font-weight:bold;'>";
                table += "<td colspan='2'>Tên và nhãn hiệu sản phẩm</td>";
                table += "<td>Mô tả sản phẩm</td>";
                table += "<td>Giá VND<br />(x1000đ)</td>";
                table += "<td>So sánh<br /></td>";
                table += "<td>Bảo hành<br />(Tháng)</td>";
                table += "<td>Nơi bán<br />(Stock)</td></tr>";
                if (numPro > 0)
                {
                    CurrentBrand = TablePro.Rows[0]["Brand"].ToString();
                    table += "<tr height='28'><td colspan='7' align='left' style='padding-left:20px;vertical-align:middle;font-size:12px;text-decoration:underline;font-weight:bold;'>" + CurrentBrand + "</td></tr>";
                }
                for (int i = 0; i < numPro; i++)
                {
                    string whereHave = "";
                    currentId = TablePro.Rows[i]["Id"].ToString();
                    if (hashwhere[currentId] != null)
                    {
                        whereHave = hashwhere[currentId].ToString();
                    }
                    else
                    {
                        continue;
                    }
                    price = float.Parse(TablePro.Rows[i]["SellingPrice"].ToString());
                    priceStand = (float)Math.Round(Exchange * price, 0);
                    if (!CurrentBrand.Equals(TablePro.Rows[i]["Brand"].ToString()))
                    {
                        CurrentBrand = TablePro.Rows[i]["Brand"].ToString();
                        table += "<tr height='28'><td colspan='7' align='left' style='padding-left:20px;vertical-align:middle;font-size:12px;text-decoration:underline;font-weight:bold;'>" + CurrentBrand + "</td></tr>";
                    }
                    table += "<tr height='120' style='vertical-align:middle;'>";
                    table += "<td colspan='2' style='font-size:12px;font-weight:bold;'>" + TablePro.Rows[i]["Name"].ToString() + " " + TablePro.Rows[i]["state"].ToString() + "</td>";
                    table += "<td style='vertical-align:middle;text-align:justify;'>" + TablePro.Rows[i]["Note"].ToString() + "</td>";
                    string subprice = "0";
                    try
                    {
                        subprice = priceStand.ToString("N").Split('.')[0];
                        if (subprice.Equals("0"))
                        {
                            subprice = "Đang cập nhật";
                        }
                    }
                    catch
                    { }
                    table += "<td align='center'>" + subprice + "</td>";
                    if (price == 0)
                    {
                        table += "<td align='center'></td>";
                    }
                    else
                    {
                        table += "<td align='center'>" + price + "</td>";
                    }
                    table += "<td align='center'>" + TablePro.Rows[i]["WarrantyMonth"].ToString() + "</td>";
                    table += "<td>" + whereHave + "</td></tr>";
                }
                table += "<tr height='40'><td colspan='7' style='border-width:0px;vertical-align:middle;text-align:justify;'>";
                table += "Chú ý: Mọi sản phẩm, hàng hóa, dịch vụ và giá cả bán ra đều dựa trên hiện trạng thực tế của sản phẩm, hàng hóa dịch vụ đó tại thời điểm bán ra và theo điều kiện bảo hành và điều kiện mua bán trong sổ bảo hành đi kèm.";
                table += "</td></tr>";
                table += "</table>";
            }
        }
        catch
        {
        }
        return table;
    }
예제 #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int id=0;
     try
     {
         id = int.Parse(Request.QueryString["id"].ToString());
     }
     catch{
         Response.Redirect("Default.aspx?menu=home");
     }
     try
     {
         unitPrice = Application["currency"].ToString();
         Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()];
         bldetail = hash["detail"].ToString();
         thome = hash["home"].ToString();
         tpro = hash["product"].ToString();
         tname = hash["name"].ToString();
         tbrand = hash["brand"].ToString();
         tprice = hash["tprice"].ToString();
         twarranty = hash["twarranty"].ToString();
         tnview = hash["tnview"].ToString();
         twhere = hash["warehouse"].ToString();
         tstate = hash["state"].ToString();
         tnothave = hash["outstore"].ToString();
         tmonth = hash["tmonth"].ToString();
         torder = hash["torder"].ToString();
         tback = hash["bback"].ToString();
         tcompare = hash["bcompare"].ToString();
         tdes=hash["des"].ToString();
         ttechnology = hash["specification"].ToString();
         tcurrentAccess = hash["currentpage"].ToString();
         tlistpro = hash["similar"].ToString();
         tupdate = hash["tupdate"].ToString();
         strMVAT = hash["msvat"].ToString();
         tcurrentAccess = tcurrentAccess + ": <a href='default.aspx?menu=home'>" + thome + "</a> &raquo; <a href='default.aspx?menu=product' onmouseover='OnMOMenu(0,1,11,event);' onmouseout='TimeHidden();'>" + tpro + "</a> &raquo; ";
     }catch{}
     try
     {
         DataSet ds = new ProductSystem().GetDetailProductTypeNew(id, (int)Application["idtypeproduct"]);
         GetDetailProduct(ds.Tables[0], ds.Tables[1], ds.Tables[4], ds.Tables[6], ds.Tables[7]);
         if (strpro.Length > 0)
         {
             GetSpecification(ds.Tables[2], ds.Tables[3]);
             GetGroupProduct(ds.Tables[5]);
         }
         else
         {
             Response.Redirect("Default.aspx?menu=home");
         }
     }
     catch
     {
         Response.Redirect("Default.aspx?menu=home");
     }
 }
예제 #11
0
    public string ProducttoExcel(string Currency, int idbrand, int idtype)
    {
        ProductSystem product = new ProductSystem();
        DataSet ds = product.ProductExportPrice(Currency, idbrand, idtype);
        string table = "";
        try
        {
            DataTable TableCurrency = new DataTable();
            DataTable TablePro = new DataTable();
            DataTable TableWhere = new DataTable();
            timecurrent = DateTime.Now;
            timecurrent = timecurrent.ToUniversalTime();
            timecurrent = timecurrent.AddHours(7);
            float rate = (float)Application["ratepromain"];
            if (ds.Tables.Count > 0)
            {
                TableCurrency = ds.Tables[0];
                TablePro = ds.Tables[1];
                TableWhere = ds.Tables[2];
                float Exchange = 0, price = 0;
                float priceStand = 0;
                if (TableCurrency.Rows.Count > 0)
                {
                    Exchange = float.Parse(TableCurrency.Rows[0]["Rate"].ToString());
                }
                int numPro = TablePro.Rows.Count;
                int maxWhere = TableWhere.Rows.Count;
                string CurrentBrand = "";
                string currentId = "";
                //create HastTableWhere:
                Hashtable hashwhere = new Hashtable();
                int numwhere = TableWhere.Rows.Count;
                string idpro = "";
                DateTime time = new DateTime();
                for (int j = 0; j < numwhere; j++)
                {
                    idpro = TableWhere.Rows[j]["productid"].ToString();
                    int idstate = int.Parse(TableWhere.Rows[j]["id"].ToString());
                    string message = "";
                    time = DateTime.Now.ToUniversalTime();
                    time = time.AddHours(7);
                    if (idstate <= 5)
                    {

                    }
                    else
                    {
                        if (idstate == 6)
                        {
                            time = time.AddHours(24);
                        }
                        else if (idstate == 7)
                        {
                            time = time.AddHours(24);
                        }
                        else if (idstate == 8)
                        {
                            time = time.AddHours(48);
                        }
                        else if (idstate == 9)
                        {
                            if (TableWhere.Rows[j]["DisContinued"].ToString().Equals("7"))
                            {
                                time = (DateTime)TableWhere.Rows[j]["FirstImportDate"];
                                message = "(Đợt mới sẽ có ngày <font color='red'>" + time.ToString("dd/MM") + "</font>)";
                                continue;
                            }
                            else
                            {
                                time = time.AddHours(72);
                            }
                        }
                        else
                        {
                            continue;
                        }
                        message = "(Có thêm hàng ngày <font color='red'>" + time.ToString("dd/MM") + "</font>)";
                    }
                    try
                    {
                        if (hashwhere[idpro] != null)
                        {
                            hashwhere[idpro] = hashwhere[idpro].ToString() + "<br />* " + TableWhere.Rows[j]["address"].ToString() + message;
                        }
                        else
                        {
                            hashwhere[idpro] = "* " + TableWhere.Rows[j]["address"].ToString() + message;
                        }
                    }
                    catch
                    { }
                }
                table = "<table border='1' cellpadding='3' cellspacing='0' bordercolor='#676767' style='border-collapse:collapse;color:#000000;font-family:Arial, Helvetica,sans-serif;font-size:10px;'>";
                table += "<tr height='1'><td style='width:140px;'></td><td style='width:65px;'></td><td style='width:425px;'></td><td style='width:70px;'></td><td style='width:58px;'></td><td style='width:60px;'></td><td style='width:140px;'></td></tr>";
                table += "<tr height='36'><td colspan='7' align='center' style='vertical-align:middle;'><font style='font-size:19px;text-decoration:underline;font-weight:bold;'>";
                table += "WWW.MayTinhXachTay.com</font></td></tr>";
                //table += "<table border='0' width='100%'>";
                table += "<tr height='30' style='line-height:18px'><td  style='font-weight:bold;font-size:14px;border-width:0px;vertical-align:top;'>TP.Hồ Chí Minh:</td><td colspan='6' style='font-size:12px;border-width:0px;vertical-align:middle;'>236 Cao Thắng (Nối dài) P12 Q10. TP HCM. Tel :84-8-8621611, 84-8-8621482.<br />";
                table += "77c Bùi Thị Xuân - Q1 - TP.HCM, Tel: 08 2248.8736.</td></tr>";
                table += "<tr height='30' style='line-height:18px'><td style='font-weight:bold;font-size:14px;border-width:0px;vertical-align:top;'>Hà Nội:</td><td colspan='6' style='font-size:12px;border-width:0px;'>270 Đào Duy Anh - Q. Đống Đa, Hà Nội. Tel: 84-4-5724492, 84-4-5724493. Fax: 84-4-5724519.<br />";
                table += "32 Thái Hà -Q. Đống Đa, Hà Nội: (04)5378840, (04)5378841. Fax: 84-4-5378839.</td></tr>";
                table += "<tr height='20' style='line-height:18px'><td style='font-weight:bold;font-size:14px;border-width:0px;vertical-align:top;'>Đà Nẵng:</td><td colspan='6' style='font-size:12px;border-width:0px;'>144 Hàm Nghi- Đà Nẵng, Tel: 0511 3656848.";
                table += "</td></tr>";
                //table += "</table>";
                //
                table +="<tr><td colspan='7' style='border-width:0px;' height='10'></td></tr>";
                table += "<tr height='22'><td colspan='7' style='border-width:0px;'>";
                table += "Báo giá chưa kể thuế VAT 5%, các máy tính bán đều phải cộng VAT và hoá đơn. Thanh toán bằng tiền mặt hoặc chuyển khoản.<br />";
                table += "Bảo hành một năm áp dụng cho các máy tính xách tay. Riêng máy cũ bảo hành 3 tháng(trong đó PIN, màn hình, ổ cứng bảo hành 1 tháng)";
                table += "</td></tr>";
                table += "<tr><td colspan='7' style='border-width:0px;' height='10'></td></tr>";
                table += "<tr height='28' style='vertical-align:middle;text-align:left;font-size:14px;'>";
                if (rate != 1)
                {
                    table += "<td colspan='3' style='border-width:0px;'><b>Báo giá máy tính xách tay</b>: Ngày <i>" + timecurrent.ToString("dd/MM/yy") + ", " + timecurrent.ToShortTimeString() + "(Giờ Hà Nội)</i></td><td align='center' style='border-width:0px;'></td><td colspan='3' style='border-width:0px;'></td></tr>";
                }
                else
                {
                    table += "<td colspan='3' style='border-width:0px;'><b>Báo giá máy tính xách tay</b>: Ngày <i>" + timecurrent.ToString("dd/MM/yy") + ", " + timecurrent.ToShortTimeString() + "(Giờ Hà Nội)</i></td><td align='center' style='border-width:0px;'>" + Exchange + "</td><td colspan='3' style='border-width:0px;'></td></tr>";
                }
                //table += "<td colspan='3' style='border-width:0px;'><b>Báo giá máy tính xách tay</b>: Ngày <i>" + timecurrent.ToString("dd/MM/yy") + ", " + timecurrent.ToShortTimeString() + "(Giờ Hà Nội)</i></td><td align='center' style='border-width:0px;'></td><td colspan='3' style='border-width:0px;'></td></tr>";
                table += "<tr height='34' style='vertical-align:middle;text-align:center;font-size:12px;font-weight:bold;'>";
                table += "<td colspan='2'>Tên và nhãn hiệu sản phẩm</td>";
                table += "<td>Mô tả sản phẩm</td>";
                table += "<td>Giá VND<br />(x1000đ)</td>";
                table += "<td>So sánh<br />(USD)</td>";
                table += "<td>Bảo hành<br />(Tháng)</td>";
                table += "<td>Nơi bán<br />(Stock)</td></tr>";
                if (numPro > 0)
                {
                    CurrentBrand = TablePro.Rows[0]["Brand"].ToString();
                    table += "<tr height='28'><td colspan='7' align='left' style='padding-left:20px;vertical-align:middle;font-size:12px;text-decoration:underline;font-weight:bold;'>" + CurrentBrand + "</td></tr>";
                }
                for (int i = 0; i < numPro; i++)
                {
                    string whereHave = "";
                    currentId = TablePro.Rows[i]["Id"].ToString();
                    if (hashwhere[currentId] != null)
                    {
                        whereHave = hashwhere[currentId].ToString();
                    }
                    else
                    {
                        continue;
                    }
                    price = float.Parse(TablePro.Rows[i]["SellingPrice"].ToString());
                    priceStand = (float)Math.Round(Exchange * price, 0);
                    if (!CurrentBrand.Equals(TablePro.Rows[i]["Brand"].ToString()))
                    {
                        CurrentBrand = TablePro.Rows[i]["Brand"].ToString();
                        table += "<tr height='28'><td colspan='7' align='left' style='padding-left:20px;vertical-align:middle;font-size:12px;text-decoration:underline;font-weight:bold;'>" + CurrentBrand + "</td></tr>";
                    }
                    table += "<tr height='70' style='vertical-align:middle;'>";
                    table += "<td colspan='2' style='font-size:12px;font-weight:bold;'>" + TablePro.Rows[i]["Name"].ToString() + " " + TablePro.Rows[i]["state"].ToString() + "</td>";
                    table += "<td align='center'>" + TablePro.Rows[i]["Note"].ToString() + "</td>";
                    string subprice = "0";
                    try
                    {
                        subprice = priceStand.ToString("N").Split('.')[0];
                        if (subprice.Equals("0"))
                        {
                            subprice = "Đang cập nhật";
                        }
                    }
                    catch
                    { }
                    table += "<td align='center'>" + subprice + "</td>";
                    if (rate != 1)
                    {
                        table += "<td align='center'></td>";
                    }
                    else
                    {
                        if (price == 0)
                        {
                            table += "<td align='center'>Đang cập nhật</td>";
                        }
                        else
                        {
                            table += "<td align='center'>" + price + "</td>";
                        }
                    }
                    table += "<td align='center'>" + TablePro.Rows[i]["WarrantyMonth"].ToString() + "</td>";
                    table += "<td>" + whereHave + "</td></tr>";
                }
                table += "</table>";
            }
        }
        catch
        {
        }
        return table;
    }
예제 #12
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());
     }
 }
예제 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            tunit = Application["currency"].ToString();
            Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()];
            currentAccess = hash["currentpage"].ToString();
            thome = hash["home"].ToString();
            tblcompare = hash["blcompare"].ToString();
            tbrand = hash["brand"].ToString();
            tname = hash["name"].ToString();
            twarehouse = hash["warehouse"].ToString();
            tprice = hash["tprice"].ToString();
            twarranty = hash["twarranty"].ToString();
            tmonth = hash["tmonth"].ToString();
            tnote = hash["des"].ToString();
            tnothave = hash["outstore"].ToString();
            tspecification =hash["specification"].ToString();
            tback = hash["bback"].ToString();
            currentAccess += ": <a href='?menu=home'>" + thome + "</a> &raquo; " + tblcompare;
        }
        catch
        { }
        try
        {
            string[] arrId = new string[] {"0"};
            if (Request.QueryString["id"] != null)
            {
                arrId = Request.QueryString["id"].ToString().Split(',');
            }
            int id1 = 0;
            int id2 = 0;
            if (arrId.Length > 1)
            {
                id1 = int.Parse(arrId[0]);
                id2 = int.Parse(arrId[1]);
            }
            else
            {
                id1 = id2 = int.Parse(arrId[0]);
            }
            idcompare1 = id1.ToString();
            idcompare2 = id2.ToString();
            ProductSystem Products = new ProductSystem();
            DataSet DetailPro = Products.ProductSelectForCompare(id1, id2, int.Parse(Application["idtypeproduct"].ToString()));
            float rate = (float)Application["ratepromain"];
            float price1 = 1;
            string price11 = "0";
            string price12 = "0";
            if (DetailPro.Tables.Count > 0)
            {
                //Information product:
                if ((DetailPro.Tables[0].Rows.Count > 0) && (DetailPro.Tables[4].Rows.Count > 0))
                {
                    selectBrand = GetSelectBrand(DetailPro.Tables[8], DetailPro.Tables[0].Rows[0]["idbrand"].ToString(), DetailPro.Tables[4].Rows[0]["idbrand"].ToString());
                    strInfoPro = "<table border='0' cellspacing='0' cellpadding='2' width='100%'>";
                    string img1 = DetailPro.Tables[0].Rows[0]["UrlImage"].ToString();
                    string img2 = DetailPro.Tables[4].Rows[0]["UrlImage"].ToString();
                    price1 = float.Parse(DetailPro.Tables[0].Rows[0]["SellingPrice"].ToString());
                    price1 = price1 * rate;
                    price11 = price1.ToString("N").Split('.')[0];
                    price1 = float.Parse(DetailPro.Tables[4].Rows[0]["SellingPrice"].ToString());
                    price1 = price1 * rate;
                    price12 = price1.ToString("N").Split('.')[0];
                    string where1 = "";
                    string where2 = "";
                    int num = DetailPro.Tables[1].Rows.Count;
                    for (int i = 0; i < num; i++)
                    {
                        where1 += "* " + DetailPro.Tables[1].Rows[i]["address"].ToString() + "<br />";
                    }
                    num = DetailPro.Tables[5].Rows.Count;
                    for (int i = 0; i < num; i++)
                    {
                        where2 += "* " + DetailPro.Tables[5].Rows[i]["address"].ToString() + "<br />";
                    }
                    if (where1.Length == 0)
                    {
                        where1 = tnothave;
                    }
                    if (where2.Length == 0)
                    {
                        where2 = tnothave;
                    }
                    if (img1.Length > 0)
                    {
                        img1 = "<img src='image/img_pro/" + img1 + "' width='155' height='132' border='0'/>";
                    }
                    else
                    {
                        img1 = "<img src='image/common/notimgpro.png' width='155' height='132' border='0'/>";
                    }
                    if (img2.Length > 0)
                    {
                        img2 = "<img src='image/img_pro/" + img2 + "' width='155' height='132' border='0'/>";
                    }
                    else
                    {
                        img2 = "<img src='image/common/notimgpro.png' width='155' height='132' border='0'/>";
                    }
                    strInfoPro += "<tr><td></td>";
                    strInfoPro += "<td align='center'><a href='?menu=dp&id=" + id1 + "'>" + img1 + "</a></td>";
                    strInfoPro += "<td class='btd1' width='5'></td>";
                    strInfoPro += "<td align='center'><a href='?menu=dp&id=" + id2 + "'>" + img2 + "</a></td></tr>";
                    strInfoPro += "<tr><td colspan='4' class='bg_line2'></td></tr>";
                    strInfoPro += "<tr><td>" + tname + "</td><td class='text_title'><a href='?menu=dp&id=" + id1 + "'>" + DetailPro.Tables[0].Rows[0]["Name"].ToString() + "</a></td><td class='btd1'></td><td class='text_title'><a href='?menu=dp&id=" + id2 + "'>" + DetailPro.Tables[4].Rows[0]["Name"].ToString() + "</a></td></tr>";
                    strInfoPro += "<tr><td colspan='4' class='bg_line2'></td></tr>";
                    strInfoPro += "<tr><td>" + tbrand + "</td><td class='price'>" + DetailPro.Tables[0].Rows[0]["Brand"].ToString() + "</td><td class='btd1'></td><td class='price'>" + DetailPro.Tables[4].Rows[0]["Brand"].ToString() + "</td></tr>";
                    strInfoPro += "<tr><td colspan='4' class='bg_line2'></td></tr>";
                    strInfoPro += "<tr><td>" + twarehouse + "</td><td>" + where1 + "</td><td class='btd1'></td><td>" + where2 + "</td></tr>";
                    strInfoPro += "<tr><td colspan='4' class='bg_line2'></td></tr>";
                    strInfoPro += "<tr><td>" + tprice + "</td><td class='price'>" + price11 + " " + tunit + "</td><td class='btd1'></td><td class='price'>" + price12 + " " + tunit + "</td></tr>";
                    strInfoPro += "<tr><td colspan='4' class='bg_line2'></td></tr>";
                    strInfoPro += "<tr><td>" + twarranty + "</td><td class='price'>" + DetailPro.Tables[0].Rows[0]["WarrantyMonth"].ToString() + " " + tmonth + "</td><td class='btd1'></td><td class='price'>" + DetailPro.Tables[4].Rows[0]["WarrantyMonth"].ToString() + " " + tmonth + "</td></tr>";
                    strInfoPro += "<tr><td colspan='4' class='bg_line2'></td></tr>";
                    strInfoPro += "<tr><td width='111'>" + tnote + "</td><td width='225'>" + DetailPro.Tables[0].Rows[0]["Note"].ToString() + "</td><td class='btd1' width='5'></td><td width='225'>" + DetailPro.Tables[4].Rows[0]["Note"].ToString() + "</td></tr>";
                    strInfoPro += "<tr><td colspan='4' class='bg_line2'></td></tr>";
                    strInfoPro += "</table>";
                    strComponent = GetComponentPro(DetailPro.Tables[2], DetailPro.Tables[3], DetailPro.Tables[6], DetailPro.Tables[7]);
                }
                else
                {
                    Response.Redirect("Default.aspx?menu=home");
                }
            }

        }
        catch
        {
            Response.Redirect("Default.aspx?menu=home");
        }
    }