예제 #1
0
    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());
    }
예제 #2
0
    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());
            }
        }
    }