Ejemplo n.º 1
0
    public static XmlElement Tim_Lap_top(
        string Ma_so, XmlElement Du_lieu)
    {
        var Danh_sach_Lap_top = (XmlElement)Du_lieu.GetElementsByTagName("Danh_sach_Lap_top")[0];
        var Kq = (XmlElement)null;

        foreach (XmlElement Lap_top in Danh_sach_Lap_top.GetElementsByTagName("Laptop"))
        {
            if (Ma_so == Lap_top.GetAttribute("Ma_so"))
            {
                Kq = Lap_top;
            }
        }
        return(Kq);
    }
Ejemplo n.º 2
0
    public static string Tao_Chuoi_HTML_Danh_sach_Lap_top_Chon(List <XmlElement> Danh_sach)
    {
        var Chuoi_HTML_Danh_sach     = "<div class='row'>";
        var Chuoi_Chuc_nang_Dat_hang = $"<div style='margin-left:10px' ><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>";

        if (Danh_sach.Count > 0)
        {
            Chuoi_HTML_Danh_sach += Chuoi_Chuc_nang_Dat_hang;
        }

        Danh_sach.ForEach(Lap_top =>
        {
            var Ten                           = Lap_top.GetAttribute("Ten");
            var Ma_so                         = Lap_top.GetAttribute("Ma_so");
            var Don_gia_Ban                   = long.Parse(Lap_top.GetAttribute("Don_gia_Ban"));
            var So_luong_Ton                  = int.Parse(Lap_top.GetAttribute("So_luong_Ton"));
            var So_luong                      = int.Parse(Lap_top.GetAttribute("So_luong"));
            var Dinh_dang_Trang_thai          = ""; var Chuoi_Trang_thai = "";
            var Chuoi_Chuc_nang_Giam_So_luong = $"<form method='post'>" +
                                                "<input name='Th_Ma_so_Chuc_nang' type='hidden' value='GIAM_SO_LUONG_LAP_TOP' />" +
                                                $"<input name='Th_Ma_so_Lap_top' type='hidden' value='{Ma_so}' />" +
                                                $"<button type='submit' class='btn btn-danger' >-</button>" +
                                                "</form>";


            var Chuoi_Hinh = $"<img src='{Dia_chi_Media}/{ Ma_so}.png' " +
                             "style='width:90px;height:90px;' />";

            var Chuoi_Thong_tin = $"<div class='btn' style='text-align:left'> " +
                                  $"{ Ten}" +
                                  $"<br />Đơn giá Bán {  Don_gia_Ban.ToString("n0", Dinh_dang_VN) }" +
                                  $"<br />Số lượng Đặt {  So_luong.ToString("n0", Dinh_dang_VN) }" +
                                  $"<br />{ Chuoi_Trang_thai }" +
                                  $"</div>";
            var Chuoi_HTML = $"<div class='col-md-4' style='margin-bottom:10px;{Dinh_dang_Trang_thai}' >" +
                             $"{Chuoi_Hinh}" + $"{Chuoi_Thong_tin}" +
                             $"{Chuoi_Chuc_nang_Giam_So_luong}" +
                             "</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        });

        Chuoi_HTML_Danh_sach += "</div>";
        return(Chuoi_HTML_Danh_sach);
    }
Ejemplo n.º 3
0
    public static string Tao_Chuoi_HTML_Danh_sach_Lap_top_Xem(List <XmlElement> Danh_sach)
    {
        var Chuoi_HTML_Danh_sach = "<div class='row'>";

        Danh_sach.ForEach(Lap_top =>
        {
            var Ten          = Lap_top.GetAttribute("Ten");
            var Ma_so        = Lap_top.GetAttribute("Ma_so");
            var Don_gia_Ban  = long.Parse(Lap_top.GetAttribute("Don_gia_Ban"));
            var So_luong_Ton = int.Parse(Lap_top.GetAttribute("So_luong_Ton"));

            var Dinh_dang_Trang_thai = ""; var Chuoi_Trang_thai = "";
            var Chuoi_Chuc_nang_Chon = $"<form method='post'>" +
                                       "<input name='Th_Ma_so_Chuc_nang' type='hidden' value='CHON_LAP_TOP' />" +
                                       $"<input name='Th_Ma_so_Lap_top' type='hidden' value='{Ma_so}' />" +
                                       $"<button type='submit' class='btn btn-danger' >Chọn</button>" +
                                       "</form>";
            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_Chon = "";
            }

            var Chuoi_Hinh = $"<img src='{Dia_chi_Media}/{ Ma_so}.png' " +
                             "style='width:90px;height:90px;' />";

            var Chuoi_Thong_tin = $"<div class='btn' style='text-align:left'> " +
                                  $"<div style='width:300px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;'>{ Ten}" +
                                  $"</div>" +
                                  $"Đơn giá Bán {  Don_gia_Ban.ToString("n0", Dinh_dang_VN) }" +
                                  $"<br />{ Chuoi_Trang_thai }" +
                                  $"</div>";
            var Chuoi_HTML = $"<div class='col-md-4' style='margin-bottom:10px;{Dinh_dang_Trang_thai}' >" +
                             $"{Chuoi_Hinh}" + $"{Chuoi_Thong_tin}" +
                             $"{Chuoi_Chuc_nang_Chon}" +
                             "</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        });

        Chuoi_HTML_Danh_sach += "</div>";
        return(Chuoi_HTML_Danh_sach);
    }
Ejemplo n.º 4
0
    public static string Tao_Chuoi_HTML_Danh_sach_Lap_top_Xem(List <XmlElement> Danh_sach)
    {
        var Chuoi_HTML_Danh_sach = "<div class='row'>";

        Danh_sach.ForEach(Lap_top =>
        {
            var Ten                  = Lap_top.GetAttribute("Ten");
            var Ma_so                = Lap_top.GetAttribute("Ma_so");
            var Don_gia_Ban          = long.Parse(Lap_top.GetAttribute("Don_gia_Ban"));
            var So_luong_Ton         = int.Parse(Lap_top.GetAttribute("So_luong_Ton"));
            var Doanh_thu            = long.Parse(Lap_top.GetAttribute("Doanh_thu"));
            var Dinh_dang_Trang_thai = "";
            if (So_luong_Ton == 0)
            {
                Dinh_dang_Trang_thai = ";opacity:0.7";;
            }

            var Chuoi_Hinh = $"<img src='{Dia_chi_Media}/{ Ma_so}.png' " +
                             "style='width:90px;height:90px;' />";
            var Chuoi_Thong_tin = $"<div class='btn' style='text-align:left'> " +
                                  $"<div style='width:300px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;'>{ Ten}" +
                                  $"</div>" +
                                  $"Đơn giá Bán {  Don_gia_Ban.ToString("n0", Dinh_dang_VN) }" +
                                  $"<br />Số lượng Tồn { So_luong_Ton.ToString("n0", Dinh_dang_VN) }" +
                                  $"<br />Doanh thu {  Doanh_thu.ToString("n0", Dinh_dang_VN) }" +
                                  $"</div>";
            var Chuoi_Chuc_nang_Ban_hang = $"<form method='post'>   " +
                                           $"<input name='Th_Ma_so_Chuc_nang' type='hidden' value='GHI_BAN_HANG_MOI' />  " +
                                           $"<input name='Th_Ma_so_Lap_top' 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_HTML = $"<div class='col-md-4' style='margin-bottom:10px;{Dinh_dang_Trang_thai}' >" +
                             $"{Chuoi_Hinh}" + $"{Chuoi_Thong_tin}" +
                             $"{Chuoi_Chuc_nang_Ban_hang}" +
                             "</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        });

        Chuoi_HTML_Danh_sach += "</div>";
        return(Chuoi_HTML_Danh_sach);
    }
Ejemplo n.º 5
0
    //============= Xử lý Chức năng ========
    public string Ghi_Phieu_Dat_hang_Moi(string Ho_ten, string Dia_chi, string Dien_thoai, XL_KHACH_THAM_QUAN Khach)
    {
        var Chuoi_XML = "<PHIEU_DAT />";
        var Tai_lieu  = new XmlDocument();

        Tai_lieu.LoadXml(Chuoi_XML);
        var Phieu_dat = Tai_lieu.DocumentElement;

        Phieu_dat.SetAttribute("Ma_so", "");
        Phieu_dat.SetAttribute("Ngay", DateTime.Now.ToString());
        Phieu_dat.SetAttribute("Trang_thai", "CHUA_GIAO_HANG");
        var Khach_hang = (Tai_lieu.CreateElement("Khach_hang"));

        Khach_hang.SetAttribute("Ho_ten", Ho_ten);
        Khach_hang.SetAttribute("Dien_thoai", Dien_thoai);
        Khach_hang.SetAttribute("Dia_chi", Dia_chi);
        Phieu_dat.AppendChild(Khach_hang);
        var Ds = Tai_lieu.CreateElement("Danh_sach_Lap_top");

        Phieu_dat.AppendChild(Ds);
        Khach.Danh_sach_Lap_top_Chon.ForEach(Lap_top =>
        {
            var QA = Tai_lieu.CreateElement("Laptop");
            QA.SetAttribute("Ma_so", Lap_top.GetAttribute("Ma_so"));
            QA.SetAttribute("Ten", Lap_top.GetAttribute("Ten"));
            var Nhom_Lap_top = Tai_lieu.CreateElement("Nhom_Lap_top");
            Nhom_Lap_top.SetAttribute("Nhom_Lap_top", Lap_top.SelectSingleNode("Nhom_Lap_top/@Ma_so").Value);
            QA.AppendChild(Nhom_Lap_top);
            var Don_Gia  = long.Parse(Lap_top.GetAttribute("Don_gia_Ban"));
            var So_luong = long.Parse(Lap_top.GetAttribute("So_luong"));
            var Tien     = Don_Gia * So_luong;
            QA.SetAttribute("Don_gia", Lap_top.GetAttribute("Don_gia_Ban"));
            QA.SetAttribute("So_luong", Lap_top.GetAttribute("So_luong"));
            QA.SetAttribute("Tien", Tien.ToString());
            Ds.AppendChild(QA);

            /*var tailieu = new XmlDocument();
             * tailieu.LoadXml(Lap_top.OuterXml);
             * tailieu.remoa
             * var Lap_top1 = tailieu.DocumentElement;
             * var Lap_top2 = Tai_lieu.ImportNode(Lap_top1, true);
             * Ds.AppendChild(Lap_top2);*/
        });
        Phieu_dat.AppendChild(Ds);
        var Kq_Ghi = XL_LUU_TRU.Ghi_Phieu_Dat_hang_moi(Phieu_dat);

        Khach.Thong_bao = "";
        if (Kq_Ghi == "OK")
        {
            Khach.Thong_bao = "Đặt phiếu Thành công";
            Khach.Danh_sach_Lap_top_Chon = new List <XmlElement>();
        }
        else
        {
            Khach.Thong_bao = "Lỗi Hệ thống - Xin Thực hiện lại  ";
        }


        var Chuoi_HTML = XL_THE_HIEN.Tao_chuoi_HTML_Thong_bao(Khach.Thong_bao);

        return(Chuoi_HTML);
    }