public XmlElement Tao_Du_lieu_cua_Ung_dung_Quan_ly_Ban_hang() { var Chuoi_XML = Du_lieu_Dich_vu.OuterXml; var Tai_lieu = new XmlDocument(); Tai_lieu.LoadXml(Chuoi_XML); var Du_lieu = Tai_lieu.DocumentElement; var Cua_hang = (XmlElement)Du_lieu.GetElementsByTagName("Cong_ty")[0]; var Danh_sach_Nguoi_dung = (XmlElement)Cua_hang.GetElementsByTagName("Danh_sach_Nguoi_dung")[0]; var DS_Nguoi_dung = XL_NGHIEP_VU.Tao_Danh_sach(Danh_sach_Nguoi_dung, "Nguoi_dung"); foreach (XmlElement Nguoi_dung in DS_Nguoi_dung) { if (Nguoi_dung.SelectSingleNode("Nhom_Nguoi_dung/@Ma_so").Value != "QUAN_LY_BAN_HANG" && Nguoi_dung.SelectSingleNode("Nhom_Nguoi_dung/@Ma_so").Value != "BAN_HANG") { Danh_sach_Nguoi_dung.RemoveChild(Nguoi_dung);// Xóa Các Người dùng không thuộc Nhóm tương ứng } } foreach (XmlElement Lap_top in Du_lieu.GetElementsByTagName("Laptop")) { var Danh_sach_Ban_hang = (XmlElement)Lap_top.GetElementsByTagName("Danh_sach_Ban_hang")[0]; Lap_top.RemoveChild(Danh_sach_Ban_hang); var Danh_sach_Nhap_hang = (XmlElement)Lap_top.GetElementsByTagName("Danh_sach_Dat_hang")[0]; Lap_top.RemoveChild(Danh_sach_Nhap_hang); }// Xóa Tất các Nhập hàng, Bán hàng return(Du_lieu); }
public XmlElement Tao_Du_lieu_cua_Ung_dung_Nhan_vien_Ban_hang() { var Chuoi_XML = Du_lieu_Dich_vu.OuterXml; var Tai_lieu = new XmlDocument(); Tai_lieu.LoadXml(Chuoi_XML); var Du_lieu = Tai_lieu.DocumentElement; var Cua_hang = (XmlElement)Du_lieu.GetElementsByTagName("Cua_hang")[0]; var Danh_sach_Nguoi_dung = (XmlElement)Cua_hang.GetElementsByTagName("Danh_sach_Nguoi_dung")[0]; var DS_Nguoi_dung = XL_NGHIEP_VU.Tao_Danh_sach(Danh_sach_Nguoi_dung, "Nguoi_dung"); foreach (XmlElement Nguoi_dung in DS_Nguoi_dung) { if (Nguoi_dung.SelectSingleNode("Nhom_Nguoi_dung/@Ma_so").Value != "BAN_HANG") { Danh_sach_Nguoi_dung.RemoveChild(Nguoi_dung);// Xóa Các Người dùng không thuộc Nhóm tương ứng } } foreach (XmlElement San_pham in Du_lieu.GetElementsByTagName("San_pham")) { if (San_pham.GetElementsByTagName("Danh_sach_Nhap_hang").Count > 0) { var Danh_sach_Ban_hang = (XmlElement)San_pham.GetElementsByTagName("Danh_sach_Ban_hang")[0]; San_pham.RemoveChild(Danh_sach_Ban_hang); var Danh_sach_Nhap_hang = (XmlElement)San_pham.GetElementsByTagName("Danh_sach_Nhap_hang")[0]; San_pham.RemoveChild(Danh_sach_Nhap_hang); } }// Xóa Tất các Nhập hàng, Bán hàng return(Du_lieu); }
public static string Tao_Chuoi_HTML_Danh_sach_Nguoi_dung_Xem(List <XmlElement> Danh_sach_Nguoi_dung) { var Nguoi_dung_Dang_nhap = (XL_NGUOI_DUNG_DANG_NHAP)HttpContext.Current.Session["Nguoi_dung_Dang_nhap"]; var Chuoi_HTML_Danh_sach = "<h3 style='color:red'> Danh sách nhân sự:</h3><div class='row'></br>"; Danh_sach_Nguoi_dung.ForEach(Nguoi_dung => { var Chuoi_Hinh = $"<img src='{Dia_chi_Media}/{Nguoi_dung.GetAttribute("Ma_so")}.png' " + "style='width:90px;height:90px;' />"; var Chuoi_Thong_tin = $"<div class='btn' style='text-align:left'> " + $"{Nguoi_dung.GetAttribute("Ho_ten")}" + $"<br />{ Nguoi_dung.SelectSingleNode("Nhom_Nguoi_dung/@Ten").Value}" + $"</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); }
public static List <XmlElement> Tao_Danh_sach_Nhan_vien( List <XmlElement> Danh_sach_Nguoi_dung, string Doi_tuong) { var Danh_sach = new List <XmlElement>(); Danh_sach = Danh_sach_Nguoi_dung.FindAll( Nguoi_dung => Nguoi_dung.SelectSingleNode("Nhom_Nguoi_dung/@Ma_so").Value == Doi_tuong); return(Danh_sach); }
void Khoi_dong_Du_lieu_cua_Dich_vu() { var Du_lieu_Luu_tru = XL_LUU_TRU.Doc_Du_lieu(); var Chuoi_XML = Du_lieu_Luu_tru.OuterXml; var Tai_lieu = new XmlDocument(); Tai_lieu.LoadXml(Chuoi_XML); Du_lieu_Dich_vu = Tai_lieu.DocumentElement; var Danh_sach_San_pham = (XmlElement)Du_lieu_Dich_vu.GetElementsByTagName("Danh_sach_San_pham")[0]; var Cua_hang = (XmlElement)Du_lieu_Dich_vu.GetElementsByTagName("Cua_hang")[0]; var Danh_sach_Nhom_San_pham = (XmlElement)Cua_hang.GetElementsByTagName("Danh_sach_Nhom_San_pham")[0]; var Danh_sach_Nguoi_dung = (XmlElement)Cua_hang.GetElementsByTagName("Danh_sach_Nguoi_dung")[0]; var Danh_sach_Phieu_dat = (XmlElement)Du_lieu_Dich_vu.GetElementsByTagName("Danh_sach_Phieu_dat")[0]; var Tong_Doanh_thu_Ngay_hien_hanh = 0.0; var Tong_Doanh_thu_Thang_hien_hanh = 0.0; var Tong_Doanh_thu_Nam_hien_hanh = 0.0; var Tong_So_luong_ton = 0.0; // ===================== Bổ sung thông tin =============================== foreach (XmlElement San_pham in Danh_sach_San_pham.GetElementsByTagName("San_pham")) { var So_luong_Ton = XL_NGHIEP_VU.Tinh_So_luong_Ton_San_pham(San_pham); San_pham.SetAttribute("So_luong_Ton", So_luong_Ton.ToString()); var Doanh_thu = XL_NGHIEP_VU.Tinh_Doanh_thu_San_pham(San_pham, DateTime.Today); San_pham.SetAttribute("Doanh_thu", Doanh_thu.ToString()); var Doanh_thu_Thang_hien_hanh = XL_NGHIEP_VU.Tinh_Doanh_thu_San_pham_Thang_hien_hanh(San_pham, DateTime.Today); var Doanh_thu_Nam_hien_hanh = XL_NGHIEP_VU.Tinh_Doanh_thu_San_pham_Thang_hien_hanh(San_pham, DateTime.Today); Tong_So_luong_ton += So_luong_Ton; Tong_Doanh_thu_Ngay_hien_hanh += Doanh_thu; Tong_Doanh_thu_Thang_hien_hanh += Doanh_thu_Thang_hien_hanh; Tong_Doanh_thu_Nam_hien_hanh += Doanh_thu_Nam_hien_hanh; } foreach (XmlElement Nhom_San_pham in Danh_sach_Nhom_San_pham.GetElementsByTagName("Nhom_San_pham")) { var Danh_sach_San_pham_cua_Nhom_San_pham = XL_NGHIEP_VU.Tao_Danh_sach_San_pham_cua_Nhom_San_pham(Nhom_San_pham, Danh_sach_San_pham); var So_luong_Ton = XL_NGHIEP_VU.Tinh_So_luong_Ton_Danh_sach_San_pham(Danh_sach_San_pham_cua_Nhom_San_pham); Nhom_San_pham.SetAttribute("So_luong_Ton", So_luong_Ton.ToString()); var Doanh_thu = XL_NGHIEP_VU.Tinh_Doanh_thu_Danh_sach_San_pham(Danh_sach_San_pham_cua_Nhom_San_pham, DateTime.Today); Nhom_San_pham.SetAttribute("Doanh_thu", Doanh_thu.ToString()); } foreach (XmlElement Nguoi_dung in Danh_sach_Nguoi_dung.GetElementsByTagName("Nguoi_dung")) { foreach (XmlElement Nhom_San_pham in Nguoi_dung.SelectNodes("Danh_sach_Nhom_San_pham/Nhom_San_pham")) { var Danh_sach_San_pham_cua_Nhom_San_pham = XL_NGHIEP_VU.Tao_Danh_sach_San_pham_cua_Nhom_San_pham(Nhom_San_pham, Danh_sach_San_pham); var So_luong_Ton = XL_NGHIEP_VU.Tinh_So_luong_Ton_Danh_sach_San_pham(Danh_sach_San_pham_cua_Nhom_San_pham); Nhom_San_pham.SetAttribute("So_luong_Ton", So_luong_Ton.ToString()); var Doanh_thu = XL_NGHIEP_VU.Tinh_Doanh_thu_Danh_sach_San_pham(Danh_sach_San_pham_cua_Nhom_San_pham, DateTime.Today); Nhom_San_pham.SetAttribute("Doanh_thu", Doanh_thu.ToString()); } } Cua_hang.SetAttribute("Tong_So_luong_ton", Tong_So_luong_ton.ToString()); Cua_hang.SetAttribute("Tong_Doanh_thu_Ngay_hien_hanh", Tong_Doanh_thu_Ngay_hien_hanh.ToString()); Cua_hang.SetAttribute("Tong_Doanh_thu_Thang_hien_hanh", Tong_Doanh_thu_Thang_hien_hanh.ToString()); Cua_hang.SetAttribute("Tong_Doanh_thu_Nam_hien_hanh", Tong_Doanh_thu_Nam_hien_hanh.ToString()); }
public XmlElement Tao_Du_lieu_cua_Ung_dung_Quan_ly_Giao_hang() { var Chuoi_XML = Du_lieu_Dich_vu.OuterXml; var Tai_lieu = new XmlDocument(); Tai_lieu.LoadXml(Chuoi_XML); var Du_lieu = Tai_lieu.DocumentElement; var Cua_hang = (XmlElement)Du_lieu.GetElementsByTagName("Cua_hang")[0]; var Danh_sach_Nguoi_dung = (XmlElement)Cua_hang.GetElementsByTagName("Danh_sach_Nguoi_dung")[0]; var DS_Nguoi_dung = XL_NGHIEP_VU.Tao_Danh_sach(Danh_sach_Nguoi_dung, "Nguoi_dung"); foreach (XmlElement Nguoi_dung in DS_Nguoi_dung) { if (Nguoi_dung.SelectSingleNode("Nhom_Nguoi_dung/@Ma_so").Value != "QUAN_LY_GIAO_HANG" && Nguoi_dung.SelectSingleNode("Nhom_Nguoi_dung/@Ma_so").Value != "GIAO_HANG") { Danh_sach_Nguoi_dung.RemoveChild(Nguoi_dung);// Xóa Các Người dùng không thuộc Nhóm tương ứng } } foreach (XmlElement San_pham in Du_lieu.GetElementsByTagName("San_pham")) { if (San_pham.GetElementsByTagName("Danh_sach_Nhap_hang").Count > 0) { var Danh_sach_Ban_hang = (XmlElement)San_pham.GetElementsByTagName("Danh_sach_Ban_hang")[0]; San_pham.RemoveChild(Danh_sach_Ban_hang); var Danh_sach_Nhap_hang = (XmlElement)San_pham.GetElementsByTagName("Danh_sach_Nhap_hang")[0]; San_pham.RemoveChild(Danh_sach_Nhap_hang); } }// Xóa Tất các Nhập hàng, Bán hàng var Danh_sach_Phieu_dat = (XmlElement)Du_lieu.GetElementsByTagName("Danh_sach_Phieu_dat")[0]; var DS_Phieu_dat = XL_NGHIEP_VU.Tao_Danh_sach(Danh_sach_Phieu_dat, "PHIEU_DAT"); foreach (XmlElement Phieu_dat in DS_Phieu_dat) { if (Phieu_dat.SelectSingleNode("@Trang_thai").Value == "DA_GIAO_HANG") { Danh_sach_Phieu_dat.RemoveChild(Phieu_dat); } } return(Du_lieu); }
void Khoi_dong_Du_lieu_cua_Dich_vu() { var Du_lieu_Luu_tru = XL_LUU_TRU.Doc_Du_lieu(); var Chuoi_XML = Du_lieu_Luu_tru.OuterXml; var Tai_lieu = new XmlDocument(); Tai_lieu.LoadXml(Chuoi_XML); Du_lieu_Dich_vu = Tai_lieu.DocumentElement; var Danh_sach_Lap_top = (XmlElement)Du_lieu_Dich_vu.GetElementsByTagName("Danh_sach_Lap_top")[0]; var Cua_hang = (XmlElement)Du_lieu_Dich_vu.GetElementsByTagName("Cong_ty")[0]; var Danh_sach_Nhom_Lap_top = (XmlElement)Cua_hang.GetElementsByTagName("Danh_sach_Nhom_Lap_top")[0]; var Danh_sach_Nguoi_dung = (XmlElement)Cua_hang.GetElementsByTagName("Danh_sach_Nguoi_dung")[0]; // ===================== Bổ sung thông tin =============================== foreach (XmlElement Lap_top in Danh_sach_Lap_top.GetElementsByTagName("Laptop")) { var So_luong_Ton = XL_NGHIEP_VU.Tinh_So_luong_Ton_Lap_top(Lap_top); Lap_top.SetAttribute("So_luong_Ton", So_luong_Ton.ToString()); var Doanh_thu = XL_NGHIEP_VU.Tinh_Doanh_thu_Lap_top(Lap_top, DateTime.Today); Lap_top.SetAttribute("Doanh_thu", Doanh_thu.ToString()); } foreach (XmlElement Nhom_Lap_top in Danh_sach_Nhom_Lap_top.GetElementsByTagName("Nhom_Lap_top")) { var Danh_sach_Lap_top_cua_Nhom_Lap_top = XL_NGHIEP_VU.Tao_Danh_sach_Lap_top_cua_Nhom_Lap_top(Nhom_Lap_top, Danh_sach_Lap_top); var So_luong_Ton = XL_NGHIEP_VU.Tinh_So_luong_Ton_Danh_sach_Lap_top(Danh_sach_Lap_top_cua_Nhom_Lap_top); Nhom_Lap_top.SetAttribute("So_luong_Ton", So_luong_Ton.ToString()); var Doanh_thu = XL_NGHIEP_VU.Tinh_Doanh_thu_Danh_sach_Lap_top(Danh_sach_Lap_top_cua_Nhom_Lap_top, DateTime.Today); Nhom_Lap_top.SetAttribute("Doanh_thu", Doanh_thu.ToString()); } foreach (XmlElement Nguoi_dung in Danh_sach_Nguoi_dung.GetElementsByTagName("Nguoi_dung")) { foreach (XmlElement Nhom_Lap_top in Nguoi_dung.SelectNodes("Danh_sach_Nhom_Lap_top/Nhom_Lap_top")) { var Danh_sach_Lap_top_cua_Nhom_Lap_top = XL_NGHIEP_VU.Tao_Danh_sach_Lap_top_cua_Nhom_Lap_top(Nhom_Lap_top, Danh_sach_Lap_top); var So_luong_Ton = XL_NGHIEP_VU.Tinh_So_luong_Ton_Danh_sach_Lap_top(Danh_sach_Lap_top_cua_Nhom_Lap_top); Nhom_Lap_top.SetAttribute("So_luong_Ton", So_luong_Ton.ToString()); var Doanh_thu = XL_NGHIEP_VU.Tinh_Doanh_thu_Danh_sach_Lap_top(Danh_sach_Lap_top_cua_Nhom_Lap_top, DateTime.Today); Nhom_Lap_top.SetAttribute("Doanh_thu", Doanh_thu.ToString()); } } }
public string Ghi_Phan_cong_Moi(string Ma_so_Phieu_dat, string Ma_so_Nhan_vien) { var Phieu_dat = Danh_sach_Phieu_dat.FirstOrDefault(x => x.Ma_so == Ma_so_Phieu_dat); var Nhan_vien = Danh_sach_Nguoi_dung.FirstOrDefault(Nguoi_dung => Nguoi_dung.GetAttribute("Ma_so") == Ma_so_Nhan_vien); var Hop_le = Phieu_dat != null && Nhan_vien != null; var Chuoi_Kq_Ghi = "OK"; if (Hop_le) { Phieu_dat.Ngay_Phan_cong = DateTime.Now; Phieu_dat.Tinh_trang = "CHO_GIAO_HANG"; var Chuoi_XML = "<Nhan_vien />"; var Tai_lieu = new XmlDocument(); Tai_lieu.LoadXml(Chuoi_XML); XmlElement nv; if (Phieu_dat.Nhan_vien != null) { nv = Phieu_dat.Nhan_vien; } else { nv = Tai_lieu.DocumentElement; Phieu_dat.Nhan_vien = nv; } nv.SetAttribute("Ma_so", Ma_so_Nhan_vien); nv.SetAttribute("Ho_ten", Nhan_vien.GetAttribute("Ho_ten")); } else { Chuoi_Kq_Ghi = "Lỗi Hệ thống - Xin Thực hiện lại "; } var Chuoi_Xml_Kq = $"<DU_LIEU Kq='{Chuoi_Kq_Ghi}' />"; return(Chuoi_Xml_Kq); }