public static List <XmlElement> Tao_Danh_sach_Lap_top_cua_Nguoi_dung( XmlElement Nguoi_dung, XmlElement Danh_sach_Tat_ca_Lap_top) { var Danh_sach = new List <XmlElement>(); var DS_Tat_ca_Lap_top = Tao_Danh_sach(Danh_sach_Tat_ca_Lap_top, "Laptop"); Danh_sach = DS_Tat_ca_Lap_top.FindAll( Lap_top => Lap_top.SelectSingleNode("Nhom_Lap_top/@Ma_so").Value == Nguoi_dung.GetAttribute("Ma_so")); return(Danh_sach); }
//============= 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); }