Exemplo n.º 1
0
    public static string Tao_Chuoi_HTML_Danh_sach_San_pham_Xem(XmlElement Danh_sach_San_pham)
    {
        var Chuoi_HTML_Danh_sach = "<div class='row'>";

        foreach (XmlElement San_pham in Danh_sach_San_pham.GetElementsByTagName("San_pham"))
        {
            var Ten                  = San_pham.GetAttribute("Ten");
            var Ma_so                = San_pham.GetAttribute("Ma_so");
            var Don_gia_Nhap         = long.Parse(San_pham.GetAttribute("Don_gia_Nhap"));
            var So_luong_Ton         = int.Parse(San_pham.GetAttribute("So_luong_Ton"));
            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}.jpg' " +
                             "style='width:160px;height:180px;' />";
            var Chuoi_Thong_tin = $"<div class='btn' style='text-align:left'> " +
                                  $"{ Ten}" +
                                  $"<br />Đơn giá Nhập {  Don_gia_Nhap.ToString("n0", Dinh_dang_VN) }" +
                                  $"<br />Số lượng Tồn {  So_luong_Ton.ToString("n0", Dinh_dang_VN) }" +
                                  $"</div>";
            var Chuoi_HTML = $"<div class='col-md-5' style='margin-bottom:10px;{Dinh_dang_Trang_thai}' >" +
                             $"{Chuoi_Hinh}" + $"{Chuoi_Thong_tin}" +
                             "</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        }

        Chuoi_HTML_Danh_sach += "</div>";
        return(Chuoi_HTML_Danh_sach);
    }
Exemplo n.º 2
0
    public static string Tao_Chuoi_HTML_Gio_hang(List <XmlElement> Danh_sach)
    {
        var Chuoi_HTML_Gio_hang  = "<div style='background-color:pink; width:500px; border: 2px solid blue;'>";
        var Chuoi_HTML_Danh_sach = "<h2 style='color:red; text-align:center' >GIỎ HÀNG</h2>";
        var Tong_tien            = 0.0;

        Danh_sach.ForEach(San_pham =>
        {
            var Ten         = San_pham.GetAttribute("Ten");
            var Ma_so       = San_pham.GetAttribute("Ma_so");
            var Don_gia_Ban = long.Parse(San_pham.GetAttribute("Don_gia_Ban"));
            var So_luong    = int.Parse(San_pham.GetAttribute("So_luong"));
            Tong_tien      += Don_gia_Ban * So_luong;
            var Chuoi_Hinh  = $"<img src='{Dia_chi_Media}/{ Ma_so}.jpg' " +
                              "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) }" +
                                  $"</div>";
            var Chuoi_HTML = $"<div>" +
                             $"{Chuoi_Hinh}" + $"{Chuoi_Thong_tin}" +
                             "</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        });
        Chuoi_HTML_Danh_sach += $"<div><h4 style='color:red; text-align:center'>Tổng tiền: {Tong_tien}<h4>";
        Chuoi_HTML_Gio_hang  += Chuoi_HTML_Danh_sach + "</div></div>";
        return(Chuoi_HTML_Gio_hang);
    }
Exemplo n.º 3
0
    public static string Tao_Chuoi_HTML_Danh_sach_Phieu_dat_Xem(List <XmlElement> Danh_sach_Phieu_dat)
    {
        var Chuoi_HTML_Danh_sach = "<div class='row'>";

        Danh_sach_Phieu_dat.ForEach(Phieu_dat =>
        {
            var Ma_Phieu           = Phieu_dat.GetAttribute("Ma_so");
            var Ngay               = Phieu_dat.GetAttribute("Ngay");
            var Trang_thai         = Phieu_dat.GetAttribute("Trang_thai");
            var Dia_chi            = Phieu_dat.SelectSingleNode("Khach_hang/@Dia_chi").Value;
            var NV_Giao_hang       = "";
            var Chuoi_Thong_tin_sp = "";
            var Tong_tien          = 0L;
            foreach (XmlElement San_pham in Phieu_dat.GetElementsByTagName("San_pham"))
            {
                var Ma_San_pham    = San_pham.GetAttribute("Ma_so");
                var Ten_San_pham   = San_pham.GetAttribute("Ten");
                var Don_gia        = San_pham.GetAttribute("Don_gia");
                var So_luong       = San_pham.GetAttribute("So_luong");
                var Thanh_tien     = San_pham.GetAttribute("Tien");
                Tong_tien         += long.Parse(Thanh_tien);
                Chuoi_Thong_tin_sp = Chuoi_Thong_tin_sp +
                                     $"<br />Mã Sản phẩm giao: {  Ma_San_pham}" +
                                     $"<br />Tên Sản phẩm: {  Ten_San_pham}" +
                                     $"<br />Đơn giá bán: {  Don_gia}" +
                                     $"<br />Số lượng: {  So_luong}" +
                                     $"<br /><i>Thành tiền: { Thanh_tien}</i>";
            }
            var Chuoi_Thong_tin = $"<div class='btn' style='text-align:left; border:1px' > " +
                                  $"<br /><b>Mã phiếu: {  Ma_Phieu}</b>" +
                                  $"<br />Ngày: {  Ngay}" +
                                  $"<br />Trạng thái: {  Trang_thai}" +
                                  $"<br />Địa chỉ Khách hàng: {  Dia_chi}";
            var Chuoi_Phan_cong = $"<form method='post'>" +
                                  $"<b>Tổng tiền: { Tong_tien}</b> </br>" +
                                  $"<input name='Th_Ma_so_Chuc_nang' type='hidden' value='PHAN_CONG' />  " +
                                  $"<input name='Th_Ma_so_Phieu_dat' type='hidden' value='{Ma_Phieu}' />  " +
                                  $"<input type='text' name='Th_Ma_so_Nhan_vien' value='' />  " +
                                  $"<button type='submit' class ='btn btn-primary'>Phân công</button>" +
                                  $"</form>" +
                                  $"</div>";
            if (Trang_thai == "CHO_PHAN_CONG")
            {
                Chuoi_HTML_Danh_sach += Chuoi_Thong_tin + Chuoi_Thong_tin_sp + Chuoi_Phan_cong;
            }
            else
            {
                NV_Giao_hang          = Phieu_dat.SelectSingleNode("Nhan_vien_Giao_hang/@Ma_so").Value;
                Chuoi_HTML_Danh_sach += Chuoi_Thong_tin + Chuoi_Thong_tin_sp + $"<br />Nhân viên Giao hàng: {NV_Giao_hang}" + "</div>";
            }
        });
        Chuoi_HTML_Danh_sach += "</div>";
        return(Chuoi_HTML_Danh_sach);
    }
Exemplo n.º 4
0
    public static XmlElement Tim_San_pham(
        string Ma_so, XmlElement Du_lieu)
    {
        var Danh_sach_San_pham = (XmlElement)Du_lieu.GetElementsByTagName("Danh_sach_San_pham")[0];
        var Kq = (XmlElement)null;

        foreach (XmlElement San_pham in Danh_sach_San_pham.GetElementsByTagName("San_pham"))
        {
            if (Ma_so == San_pham.GetAttribute("Ma_so"))
            {
                Kq = San_pham;
            }
        }
        return(Kq);
    }
Exemplo n.º 5
0
    public static string Tao_Chuoi_HTML_Danh_sach_San_pham_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(San_pham =>
        {
            var Ten                           = San_pham.GetAttribute("Ten");
            var Ma_so                         = San_pham.GetAttribute("Ma_so");
            var Don_gia_Ban                   = long.Parse(San_pham.GetAttribute("Don_gia_Ban"));
            var So_luong_Ton                  = int.Parse(San_pham.GetAttribute("So_luong_Ton"));
            var So_luong                      = int.Parse(San_pham.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_SAN_PHAM' />" +
                                                $"<input name='Th_Ma_so_San_pham' type='hidden' value='{Ma_so}' />" +
                                                $"<button type='submit' class='btn btn-danger' >-</button>" +
                                                "</form>";


            var Chuoi_Hinh = $"<img src='{Dia_chi_Media}/{ Ma_so}.jpg' " +
                             "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);
    }
Exemplo n.º 6
0
    public static string Tao_Chuoi_HTML_Danh_sach_San_pham_Xem(List <XmlElement> Danh_sach_San_pham)
    {
        var Chuoi_HTML_Danh_sach = "<div class='row'>";

        Danh_sach_San_pham.ForEach(San_pham =>
        {
            var Ten                  = San_pham.GetAttribute("Ten");
            var Ma_so                = San_pham.GetAttribute("Ma_so");
            var Don_gia_Ban          = long.Parse(San_pham.GetAttribute("Don_gia_Ban"));
            var So_luong_Ton         = int.Parse(San_pham.GetAttribute("So_luong_Ton"));
            var Doanh_thu            = long.Parse(San_pham.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}.jpg' " +
                             "class='float-left' style='width:25%;height:80%;' />";
            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_San_pham' 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='{So_luong_Ton}' value='1' />  " +
                                           $"</form>";
            var Chuoi_Thong_tin = $"<div class='text-left float-left' style='width:65%;height:100%;margin-left:10px;'> " +
                                  $"{ Ten}" +
                                  $"<br />Đơ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)}" +
                                  $"<br/>{Chuoi_Chuc_nang_Ban_hang}" +
                                  $"</div>";


            var Chuoi_HTML = $"<div class='float-left' style='width:550px;height:150px;margin-bottom:10px;margin-left:10px;{Dinh_dang_Trang_thai}' >" +
                             $"{Chuoi_Hinh}" + $"{Chuoi_Thong_tin}" +

                             "</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        });

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

        Danh_sach.ForEach(San_pham =>
        {
            var Ten          = San_pham.GetAttribute("Ten");
            var Ma_so        = San_pham.GetAttribute("Ma_so");
            var Don_gia_Ban  = long.Parse(San_pham.GetAttribute("Don_gia_Ban"));
            var So_luong_Ton = int.Parse(San_pham.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_SAN_PHAM' />" +
                                       $"<input name='Th_Ma_so_San_pham' 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}.jpg' " +
                             "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 />{ 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);
    }
Exemplo n.º 8
0
    public static string Tao_Chuoi_HTML_Danh_sach_Phieu_dat_Da_Phan_cong(List <XmlElement> Danh_sach_Phieu_dat)
    {
        var Chuoi_HTML_Danh_sach = "<div class='row'>";

        Danh_sach_Phieu_dat.ForEach(Phieu_dat =>
        {
            var Ma_Phieu           = Phieu_dat.GetAttribute("Ma_so");
            var Ngay               = Phieu_dat.GetAttribute("Ngay");
            var Trang_thai         = Phieu_dat.GetAttribute("Trang_thai");
            var Dia_chi            = Phieu_dat.SelectSingleNode("Khach_hang/@Dia_chi").Value;
            var Ma_NV_Giao_hang    = Phieu_dat.SelectSingleNode("Nhan_vien_Giao_hang/@Ma_so").Value;
            var Chuoi_Thong_tin_sp = "";
            var Tong_tien          = 0L;
            foreach (XmlElement San_pham in Phieu_dat.GetElementsByTagName("San_pham"))
            {
                var Ma_San_pham    = San_pham.GetAttribute("Ma_so");
                var Ten_San_pham   = San_pham.GetAttribute("Ten");
                var Don_gia        = San_pham.GetAttribute("Don_gia");
                var So_luong       = San_pham.GetAttribute("So_luong");
                var Thanh_tien     = San_pham.GetAttribute("Tien");
                Tong_tien         += long.Parse(Thanh_tien);
                Chuoi_Thong_tin_sp = Chuoi_Thong_tin_sp +
                                     $"<br />Mã Sản phẩm giao: {  Ma_San_pham}" +
                                     $"<br />Tên Sản phẩm: {  Ten_San_pham}" +
                                     $"<br />Đơn giá bán: {  Don_gia}" +
                                     $"<br />Số lượng: {  So_luong}" +
                                     $"<br /><i>Thành tiền: { Thanh_tien}</i>";
            }
            var Chuoi_Thong_tin = $"<div class='btn' style='text-align:left; border:1px' > " +
                                  $"<br /><b>Mã phiếu: {  Ma_Phieu}</b>" +
                                  $"<br />Ngày: {  Ngay}" +
                                  $"<br />Trạng thái: {  Trang_thai}" +
                                  $"<br />Địa chỉ Khách hàng: {  Dia_chi}";
            var Chuoi_Tong_tien = $"</br><b>Tổng tiền: { Tong_tien}</b>" +
                                  $"</div >";

            Chuoi_HTML_Danh_sach += Chuoi_Thong_tin + Chuoi_Thong_tin_sp + Chuoi_Tong_tien;
        });
        Chuoi_HTML_Danh_sach += "</div>";
        return(Chuoi_HTML_Danh_sach);
    }
Exemplo n.º 9
0
    public static XmlElement Tra_cuu_San_pham(
        string Chuoi_Tra_cuu, XmlElement Danh_sach_San_pham)
    {
        Chuoi_Tra_cuu = Chuoi_Tra_cuu.ToUpper();
        var Chuoi_Danh_sach_Kq = "<Danh_sach_San_pham />";
        var Tai_lieu           = new XmlDocument();

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

        foreach (XmlElement San_pham in Danh_sach_San_pham.GetElementsByTagName("San_pham"))
        {
            var Ten = San_pham.GetAttribute("Ten");
            var Ma_so_Nhom_San_pham = San_pham.SelectSingleNode("Nhom_San_pham/@Ma_so").Value.ToUpper();
            if (Ten.ToUpper().Contains(Chuoi_Tra_cuu) || Ma_so_Nhom_San_pham == Chuoi_Tra_cuu)
            {
                var San_pham_Kq = Tai_lieu.ImportNode(San_pham, true);
                Danh_sach_Kq.AppendChild(San_pham_Kq);
            }
        }


        return(Danh_sach_Kq);
    }
Exemplo n.º 10
0
    public static string Tao_Chuoi_HTML_Danh_sach_San_pham_Xem(List <XmlElement> Danh_sach_San_pham)
    {
        var Chuoi_HTML_Danh_sach = "<h3 style='color:red'>   Danh sách sản phẩm:</h3><div class='row'><div>";

        Danh_sach_San_pham.ForEach(San_pham =>
        {
            var Ten                  = San_pham.GetAttribute("Ten");
            var Ma_so                = San_pham.GetAttribute("Ma_so");
            var Don_gia_Nhap         = long.Parse(San_pham.GetAttribute("Don_gia_Nhap"));
            var Don_gia_Ban          = long.Parse(San_pham.GetAttribute("Don_gia_Ban"));
            var So_luong_Ton         = int.Parse(San_pham.GetAttribute("So_luong_Ton"));
            var Doanh_thu            = long.Parse(San_pham.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}.jpg' " +
                             "class='float-left' style='width:25%;height:80%;' />";
            var Chuoi_Thong_tin = $"<div class='text-left float-left' style='width:65%;height:100%;margin-left:10px;'> " +
                                  $"{ Ten}" +
                                  $"<br />Đơn giá Nhập {  Don_gia_Nhap.ToString("n0", Dinh_dang_VN) }" +
                                  $"<br />Đơ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_HTML = $"<div class='float-left' style='width:550px;height:150px;margin-bottom:10px;margin-left:10px;{Dinh_dang_Trang_thai}' >" +
                             $"{Chuoi_Hinh}" + $"{Chuoi_Thong_tin}" +

                             "</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        });
        Chuoi_HTML_Danh_sach += "</div></div>";
        return(Chuoi_HTML_Danh_sach);
    }
Exemplo n.º 11
0
    //2222222 Chức năng Ghi 222222222222222
    public string Ghi_Phieu_Dat_moi(List <XmlElement> Danh_sach, string Ho_ten, string Dien_thoai, string Dia_chi)
    {
        var Khach_Tham_quan           = (XL_KHACH_THAM_QUAN)HttpContext.Current.Session["Khach_Tham_quan"];
        var Danh_sach_Ma_so_Phieu_dat = new List <string>();

        Danh_sanh_Phieu_dat.ForEach(Phieu_dat =>
                                    Danh_sach_Ma_so_Phieu_dat.Add(Phieu_dat.GetAttribute("Ma_so")));
        var Ma_so_Phieu_dat_moi = "";

        for (var i = 0; i <= Danh_sach_Ma_so_Phieu_dat.Count(); i++)
        {
            var Chuoi_Ma_so_dat_moi = "P_" + i;
            if (!Danh_sach_Ma_so_Phieu_dat.Contains(Chuoi_Ma_so_dat_moi))
            {
                Ma_so_Phieu_dat_moi = Chuoi_Ma_so_dat_moi;
                break;
            }
        }
        var Chuoi_XML = "<PHIEU_DAT/>";
        var Tai_lieu  = new XmlDocument();

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

        Phieu_dat_moi.SetAttribute("Ma_so", Ma_so_Phieu_dat_moi.ToString());
        Phieu_dat_moi.SetAttribute("Ngay", DateTime.Now.ToString());
        Phieu_dat_moi.SetAttribute("Trang_thai", "CHO_PHAN_CONG");
        Chuoi_XML = "<Khach_hang/>";
        Tai_lieu.LoadXml(Chuoi_XML);
        var Khach_hang = Tai_lieu.DocumentElement;

        Khach_hang.SetAttribute("Ho_ten", Ho_ten);
        Khach_hang.SetAttribute("Dien_thoai", Dien_thoai);
        Khach_hang.SetAttribute("Dia_chi", Dia_chi);
        Phieu_dat_moi.AppendChild(Khach_hang);

        Chuoi_XML = "<Danh_sach_San_pham/>";
        Tai_lieu.LoadXml(Chuoi_XML);
        var Danh_sach_San_pham = Tai_lieu.DocumentElement;

        Phieu_dat_moi.AppendChild(Danh_sach_San_pham);
        Danh_sach.ForEach(San_pham =>
        {
            Chuoi_XML = "<San_pham/>";
            Tai_lieu.LoadXml(Chuoi_XML);
            var San_pham_chon = Tai_lieu.DocumentElement;
            San_pham_chon.SetAttribute("Ma_so", San_pham.GetAttribute("Ma_so"));
            San_pham_chon.SetAttribute("Ten", San_pham.GetAttribute("Ten"));
            San_pham_chon.SetAttribute("Don_gia", San_pham.GetAttribute("Don_gia_Ban"));
            San_pham_chon.SetAttribute("So_luong", San_pham.GetAttribute("So_luong"));
            var Tien = (long.Parse(San_pham.GetAttribute("Don_gia_Ban"))) * (int.Parse(San_pham.GetAttribute("So_luong")));
            San_pham_chon.SetAttribute("Tien", Tien.ToString());
            Danh_sach_San_pham.AppendChild(San_pham_chon);
        }
                          );
        Chuoi_XML = "<Nhan_vien_Giao_hang/>";
        Tai_lieu.LoadXml(Chuoi_XML);
        var Nhan_vien_Giao_hang = Tai_lieu.DocumentElement;

        Phieu_dat_moi.AppendChild(Nhan_vien_Giao_hang);
        Nhan_vien_Giao_hang.SetAttribute("Ma_so", "");

        var Hop_le = Phieu_dat_moi != null;

        if (Hop_le)
        {
            var Kq_Ghi = XL_LUU_TRU.Ghi_Phieu_Dat_moi(Phieu_dat_moi);
            if (Kq_Ghi == "OK")
            {
                Khach_Tham_quan.Thong_bao = "Đã ghi nhận phiếu đặt hàng";
            }
            else
            {
                Khach_Tham_quan.Thong_bao = "Lỗi Hệ thống - Xin Thực hiện lại  ";
            }
        }
        else
        {
            Khach_Tham_quan.Thong_bao = "Lỗi Hệ thống - Xin Thực hiện lại ";
        }
        var Chuoi_HTML = Tao_Chuoi_HTML_Ket_qua();

        return(Chuoi_HTML);
    }
Exemplo n.º 12
0
    public static string Tao_Chuoi_HTML_Danh_sach_Phieu_dat(List <XmlElement> Danh_sach_Phieu_dat)
    {
        var Chuoi_HTML_Danh_sach = "<div class=''>";

        Danh_sach_Phieu_dat.ForEach(Phieu_dat =>
        {
            var Tong_tien = 0L;
            var Danh_sach_San_pham_cua_Phieu_dat = (XmlElement)Phieu_dat.GetElementsByTagName("Danh_sach_San_pham")[0];
            var Chuoi_Thong_tin_San_pham         = $"<div class=''>";
            foreach (XmlElement San_pham in Danh_sach_San_pham_cua_Phieu_dat)
            {
                var Ma_so_San_pham = San_pham.GetAttribute("Ma_so");
                var Ten            = San_pham.GetAttribute("Ten");
                var Don_gia        = 0L;
                long.TryParse(San_pham.GetAttribute("Don_gia"), out Don_gia);
                var So_luong = 0;
                int.TryParse(San_pham.GetAttribute("So_luong"), out So_luong);
                var Tien = 0L;
                long.TryParse(San_pham.GetAttribute("Tien"), out Tien);
                Tong_tien     += Tien;
                var Chuoi_Hinh = $"<img src='{Dia_chi_Media}/{ Ma_so_San_pham}.jpg' " +
                                 "class='float-left' style='width:25%;height:80%;' />";
                var Chuoi_Thong_tin = $"<div class='text-left float-left' style='width:65%;height:100%;margin-left:10px;'> " +
                                      $"{ Ten}" +
                                      $"<br />Đơn giá Bán: {Don_gia.ToString("n0", Dinh_dang_VN)}" +
                                      $"<br />Số lượng: {So_luong.ToString("n0", Dinh_dang_VN)}" +
                                      $"<br />Tiền: {Tien.ToString("n0", Dinh_dang_VN)}" +
                                      $"</div>";
                var Chuoi_San_pham = $"<div class='float-left ' style='width:320px;height:150px;margin-bottom:10px;margin-left:10px;' >" +
                                     $"{Chuoi_Hinh}" + $"{Chuoi_Thong_tin}" +
                                     "</div>";
                Chuoi_Thong_tin_San_pham += Chuoi_San_pham;
            }
            Chuoi_Thong_tin_San_pham += $"</div>";

            var Ma_so_Phieu_dat = Phieu_dat.GetAttribute("Ma_so");
            var Ngay_dat        = Phieu_dat.GetAttribute("Ngay");
            var Trang_thai      = Phieu_dat.GetAttribute("Trang_thai");
            var Ho_ten          = Phieu_dat.SelectSingleNode("Khach_hang/@Ho_ten").Value;
            var Dien_thoai      = Phieu_dat.SelectSingleNode("Khach_hang/@Dien_thoai").Value;
            var Dia_chi         = Phieu_dat.SelectSingleNode("Khach_hang/@Dia_chi").Value;

            var Chuoi_Thong_tin_Khach_hang = $"<div class='row' style='clear: both;'>" +
                                             $"<div class='btn text-left' >" +
                                             $"Mã Phiếu đặt: {Ma_so_Phieu_dat}" +
                                             $"<br/>Họ tên khách hàng: {Ho_ten}" +
                                             $"<br/>Điện thoai: {Dien_thoai}" +
                                             $"<br/>Địa chỉ: {Dia_chi}" +
                                             $"<br/>Ngày đặt: {Ngay_dat}" +
                                             $"<br/>Tổng tiền: {Tong_tien.ToString("n0", Dinh_dang_VN)}" +
                                             $"<br/>Danh sách Sản phẩm: <br/>" +
                                             $"</div>" +
                                             $"</div>";

            var Chuoi_HTML = $"<div class='' style='margin-bottom:10px;'>" +
                             $"{Chuoi_Thong_tin_Khach_hang}" + $"{Chuoi_Thong_tin_San_pham}" +
                             $"</div>";
            Chuoi_HTML_Danh_sach += Chuoi_HTML;
        });

        Chuoi_HTML_Danh_sach += "</div>";
        return(Chuoi_HTML_Danh_sach);
    }