public static List <XmlElement> Tao_Danh_sach_San_pham_cua_Nguoi_dung(XmlElement Nguoi_dung, XmlElement Danh_sach_Tat_ca_San_pham) { var Danh_sach = new List <XmlElement>(); var DS_Tat_ca_San_pham = Tao_Danh_sach(Danh_sach_Tat_ca_San_pham, "San_pham"); Danh_sach = DS_Tat_ca_San_pham.FindAll( San_pham => San_pham.SelectSingleNode("Nhom_San_pham/@Ma_so").Value == Nguoi_dung.GetAttribute("Ma_so")); return(Danh_sach); }
public static List <XmlElement> Tao_Danh_sach_San_pham_cua_Nhan_vien_Ban_hang(XmlElement Nhan_vien, List <XmlElement> Danh_sach_Tat_ca_San_pham) { var Danh_sach = new List <XmlElement>(); var DS_Nhom_San_pham = (XmlElement)Nhan_vien.GetElementsByTagName("Danh_sach_Nhom_San_pham")[0]; var Danh_sach_Nhom_San_pham = XL_NGHIEP_VU.Tao_Danh_sach(DS_Nhom_San_pham, "Nhom_San_pham"); Danh_sach_Tat_ca_San_pham.ForEach(San_pham => { var Ma_so_Nhom_San_pham = San_pham.SelectSingleNode("Nhom_San_pham/@Ma_so").Value; if (Danh_sach_Nhom_San_pham.Any(Nhom_San_pham => Nhom_San_pham.GetAttribute("Ma_so") == Ma_so_Nhom_San_pham)) { Danh_sach.Add(San_pham); } }); return(Danh_sach); }
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); }