public long Tinh_tong_tien()
    {
        long kq = 0L;

        Danh_sach_Laptop_Chon.ForEach(Laptop =>
        {
            long Don_gia_Ban = long.Parse(Laptop.GetAttribute("Don_gia_Ban"));
            int So_luong     = int.Parse(Laptop.GetAttribute("So_luong"));
            kq += Don_gia_Ban * So_luong;
        });
        return(kq);
    }
Beispiel #2
0
    public static XmlElement Tim_Laptop(string Ma_so, XmlElement Danh_sach_Laptop)
    {
        var Kq = (XmlElement)null;

        foreach (XmlElement Laptop in Danh_sach_Laptop.GetElementsByTagName("Laptop"))
        {
            if (Ma_so == Laptop.GetAttribute("Ma_so"))
            {
                Kq = Laptop;
            }
        }
        return(Kq);
    }
Beispiel #3
0
    public static string Tao_Chuoi_HTML_Danh_sach_Laptop_Xem(List <XmlElement> Danh_sach_Laptop)
    {
        var Chuoi_HTML_Danh_sach        = "<div class='row'>";
        var Chuoi_Chuc_nang_Chon_Laptop = "<form id='CHON_LAPTOP' name='CHON_LAPTOP' method='post'>" +
                                          "<input name='Th_Ma_so_Chuc_nang' type='hidden' value='CHON_LAPTOP' />" +
                                          $"<input id='Th_Ma_so_Laptop' name='Th_Ma_so_Laptop' type='hidden' />" +
                                          "</form>";

        foreach (XmlElement Laptop in Danh_sach_Laptop)
        {
            var Ten = Laptop.GetAttribute("Ten");
            var Ma_so = Laptop.GetAttribute("Ma_so");
            var Don_gia_Ban = long.Parse(Laptop.GetAttribute("Don_gia_Ban"));
            var So_luong_Ton = int.Parse(Laptop.GetAttribute("So_luong_Ton"));
            var Dinh_dang_Trang_thai = ""; var Chuoi_Trang_thai = "";
            var Chuoi_Chuc_nang_Them_Laptop = "<form method='post'>" +
                                              "<input name='Th_Ma_so_Chuc_nang' type='hidden' value='THEM_LAPTOP' />" +
                                              $"<input name='Th_Ma_so_Laptop' type='hidden' value='{Ma_so}' />" +
                                              $"<button type='submit' class='btn btn-primary hidden-sm-down btn-block ADD_BUTTON'>THÊM VÀO GIỎ HÀNG <img class='MINI_CART_ICON' src='{Dia_chi_Media}/CART_ICON.svg' /></button>" +
                                              "</form>";
            var Chuoi_Xu_ly_Click = $"Th_Ma_so_Laptop.value='{Ma_so}';CHON_LAPTOP.submit() ";
            if (So_luong_Ton == 0)
            {
                Dinh_dang_Trang_thai        = ";opacity:0.7";;
                Chuoi_Trang_thai            = "Tạm thời hết hàng";
                Chuoi_Chuc_nang_Them_Laptop = "";
            }
            var Chuoi_Hinh = $"<div class='KHUNG_HINH mx-auto' onclick=\"" + $"{Chuoi_Xu_ly_Click}" + "\">" +
                             $"<img src='{Dia_chi_Media}/{Ma_so}.png' class='img-thumbnail HINH'/>" +
                             "</div>";
            var Chuoi_Thong_tin = $"<div onclick=\"" + $"{Chuoi_Xu_ly_Click}" + "\">" +
                                  $"<strong>{Ten}</strong>" +
                                  $"<br/>Số lượng tồn: {So_luong_Ton}" +
                                  $"<br />Đơn giá: { Don_gia_Ban.ToString("c0", Dinh_dang_VN) }" +
                                  $"<br />{ Chuoi_Trang_thai }" +
                                  $"</div>";
            var Chuoi_HTML = $"<div class='KHUNG col-6 col-sm-4 col-md-3 col-lg-3' style='{Dinh_dang_Trang_thai}'>" +
                             $"<div class='THONG_TIN'>" +
                             $"{Chuoi_Hinh}" +
                             $"{Chuoi_Thong_tin}" +
                             $"{Chuoi_Chuc_nang_Them_Laptop}" +
                             $"</div>" +
                             "</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        }

        Chuoi_HTML_Danh_sach += Chuoi_Chuc_nang_Chon_Laptop + "</div>";
        return(Chuoi_HTML_Danh_sach);
    }
Beispiel #4
0
    public static string Tao_Chuoi_HTML_Danh_sach_Laptop_Chon(List <XmlElement> Danh_sach_Laptop)
    {
        var Chuoi_HTML_Danh_sach = "<div class='row'  >";

        if (Danh_sach_Laptop.Count > 0)
        {
            Chuoi_HTML_Danh_sach = "<div class='row' style='border:1px solid blue;margin:5px;padding:5px'>";
            var Chuoi_Chuc_nang_Dat_hang = "<div class='col-md-12'><form method='post'>" +
                                           "<input name='Th_Ma_so_Chuc_nang' type='hidden' value='DAT_HANG' />" +
                                           "<button type='submit' class='btn btn-danger'>Đặt hàng</button>" +
                                           "</form></div>";
            Chuoi_HTML_Danh_sach += Chuoi_Chuc_nang_Dat_hang;
        }



        foreach (XmlElement Laptop in Danh_sach_Laptop)
        {
            var Ten         = Laptop.GetAttribute("Ten");
            var Ma_so       = Laptop.GetAttribute("Ma_so");
            var Don_gia_Ban = long.Parse(Laptop.GetAttribute("Don_gia_Ban"));
            var Ban_hang    = (XmlElement)Laptop.GetElementsByTagName("Ban_hang")[0];
            var So_luong    = Laptop.GetAttribute("So_luong");
            var Chuoi_Hinh  = $"<img src='{Dia_chi_Media}/{ Ma_so}.png' " +
                              "style='width:90px;height:90px;' />";
            var Chuoi_Chuc_nang_Giam_So_luong = "<form method='post'>" +
                                                "<input name='Th_Ma_so_Chuc_nang' type='hidden' value='GIAM_SO_LUONG_LAPTOP' />" +
                                                $"<input name='Th_Ma_so_Laptop' type='hidden' value='{Ma_so}' />" +
                                                "<button type='submit' class='btn btn-danger'>-</button>" +
                                                "</form>";
            var Chuoi_Thong_tin = $"<div> " +
                                  $"<strong>{Ten}</strong>" +
                                  $"<br />{ Don_gia_Ban.ToString("c0", Dinh_dang_VN) }" +
                                  $"<br />Số lượng: { So_luong}" +
                                  $"{Chuoi_Chuc_nang_Giam_So_luong}" +
                                  $"</div>";
            var Chuoi_HTML = $"<div class='col-md-3' style='margin-bottom:10px' >" +
                             $"{Chuoi_Hinh}" + $"{Chuoi_Thong_tin}" +
                             "</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        }
        Chuoi_HTML_Danh_sach += "</div>";

        return(Chuoi_HTML_Danh_sach);
    }
Beispiel #5
0
    public static List <XmlElement> Tra_cuu_Laptop(
        string Chuoi_Tra_cuu, List <XmlElement> Danh_sach_Laptop)
    {
        Chuoi_Tra_cuu = Chuoi_Tra_cuu.ToUpper();
        var Danh_sach_Kq = new List <XmlElement>();

        foreach (XmlElement Laptop in Danh_sach_Laptop)
        {
            var Ten = Laptop.GetAttribute("Ten");

            if (Ten.ToUpper().Contains(Chuoi_Tra_cuu) || Laptop.SelectSingleNode("Nhom_Lap_top/@Ma_so").Value == Chuoi_Tra_cuu)
            {
                Danh_sach_Kq.Add(Laptop);
            }
        }


        return(Danh_sach_Kq);
    }
Beispiel #6
0
    public static string Tao_Chuoi_HTML_Danh_sach_Laptop_Xem(List <XmlElement> Danh_sach_Laptop)
    {
        var Chuoi_HTML_Danh_sach = "<div class='row'>";

        foreach (XmlElement Laptop in Danh_sach_Laptop)
        {
            var Ten                  = Laptop.GetAttribute("Ten");
            var Ma_so                = Laptop.GetAttribute("Ma_so");
            var So_luong_Ton         = Laptop.GetAttribute("So_luong_Ton");
            var Don_gia_Ban          = long.Parse(Laptop.GetAttribute("Don_gia_Ban"));
            var Chuoi_Chuc_nang_Chon = "<form method='post'>" +
                                       "<input name='Th_Ma_so_Chuc_nang' type='hidden' value='GHI_NHAP_HANG_MOI' />" +
                                       $"<input name='Th_Ma_so_Laptop' type='hidden' value='{Ma_so}' />" +
                                       $"<input name='Th_So_luong' required='required' autocomplete='off' " +
                                       $"style='border:none;border-bottom:solid 1px blue'" +
                                       $"type='number' min='1'  max='100' value='10' />  " +
                                       "</form>";
            var Chuoi_Hinh = $"<div class='KHUNG_HINH mx-auto'>" +
                             $"<img src='{Dia_chi_Media}/{Ma_so}.png' class='img-thumbnail HINH'/>" +
                             "</div>";
            var Chuoi_Thong_tin = $"<div>" +
                                  $"<strong>{Ten}</strong>" +
                                  $"<br/>Số lượng tồn: {So_luong_Ton}" +
                                  $"<br />Đơn giá: { Don_gia_Ban.ToString("c0", Dinh_dang_VN) }" +
                                  $"</div>";
            var Chuoi_HTML = $"<div class='KHUNG col-6 col-sm-4 col-md-3 col-lg-2'>" +
                             $"<div class='THONG_TIN'>" +
                             $"{Chuoi_Hinh}" +
                             $"{Chuoi_Thong_tin}" +
                             $"{Chuoi_Chuc_nang_Chon}" +
                             $"</div>" +
                             "</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        }

        Chuoi_HTML_Danh_sach += "</div>";
        return(Chuoi_HTML_Danh_sach);
    }
Beispiel #7
0
    public static XmlElement  Tra_cuu_Laptop(string Chuoi_Tra_cuu, XmlElement Danh_sach_Laptop)
    {
        Chuoi_Tra_cuu = Chuoi_Tra_cuu.ToUpper();
        var Chuoi_Danh_sach_Kq = "<Danh_sach_Laptop />";
        var Tai_lieu           = new XmlDocument();

        Tai_lieu.LoadXml(Chuoi_Danh_sach_Kq);
        var Danh_sach_Kq = Tai_lieu.DocumentElement;

        foreach (XmlElement Laptop in Danh_sach_Laptop.GetElementsByTagName("Laptop"))
        {
            var Ten = Laptop.GetAttribute("Ten");

            if (Ten.ToUpper().Contains(Chuoi_Tra_cuu))
            {
                var Laptop_Kq = Tai_lieu.ImportNode(Laptop, true);
                Danh_sach_Kq.AppendChild(Laptop_Kq);
            }
        }


        return(Danh_sach_Kq);
    }
Beispiel #8
0
    public static XmlElement Tim_Laptop(string Ma_so, List <XmlElement> Danh_sach)
    {
        var Kq = Danh_sach.FirstOrDefault(Laptop => Laptop.GetAttribute("Ma_so") == Ma_so);

        return(Kq);
    }