Beispiel #1
0
    //============= Xử lý Chức năng ========
    public XL_NGUOI_DUNG_DANG_NHAP Dang_nhap(string Ten_Dang_nhap, string Mat_khau)
    {
        var Nguoi_dung_Dang_nhap = (XL_NGUOI_DUNG_DANG_NHAP)null;
        var Nguoi_dung           = Danh_sach_Nguoi_dung.FirstOrDefault(
            x => x.GetAttribute("Ten_Dang_nhap") == Ten_Dang_nhap && x.GetAttribute("Mat_khau") == Mat_khau);

        if (Nguoi_dung != null)
        {
            var DS_Nhom_San_pham = (XmlElement)Nguoi_dung.GetElementsByTagName("Danh_sach_Nhom_San_pham")[0];
            var Danh_sach_Nhom_San_pham_cua_Nguoi_dung = XL_NGHIEP_VU.Tao_Danh_sach(DS_Nhom_San_pham, "Nhom_San_pham");
            var Danh_sach_San_pham_cua_Nguoi_dung      = Danh_sach_San_pham.FindAll(
                x => Danh_sach_Nhom_San_pham_cua_Nguoi_dung.Any(Nhom => Nhom.GetAttribute("Ma_so") == x.SelectSingleNode("Nhom_San_pham/@Ma_so").Value));
            var Doanh_thu = Danh_sach_Nhom_San_pham_cua_Nguoi_dung.Sum(x => long.Parse(x.GetAttribute("Doanh_thu")));

            // Thống tin Online
            Nguoi_dung_Dang_nhap                         = new XL_NGUOI_DUNG_DANG_NHAP();
            Nguoi_dung_Dang_nhap.Ho_ten                  = Nguoi_dung.GetAttribute("Ho_ten");
            Nguoi_dung_Dang_nhap.Ma_so                   = Nguoi_dung.GetAttribute("Ma_so");
            Nguoi_dung_Dang_nhap.Doanh_thu               = Doanh_thu;
            Nguoi_dung_Dang_nhap.Cua_hang                = Cua_hang;
            Nguoi_dung_Dang_nhap.Danh_sach_San_pham      = Danh_sach_San_pham_cua_Nguoi_dung;
            Nguoi_dung_Dang_nhap.Danh_sach_Nhom_San_pham = Danh_sach_Nhom_San_pham_cua_Nguoi_dung;
            Nguoi_dung_Dang_nhap.Danh_sach_San_pham_Xem  = Nguoi_dung_Dang_nhap.Danh_sach_San_pham;

            HttpContext.Current.Session["Nguoi_dung_Dang_nhap"] = Nguoi_dung_Dang_nhap;
        }

        return(Nguoi_dung_Dang_nhap);
    }
Beispiel #2
0
    //============= Xử lý Chức năng ========
    public XL_NGUOI_DUNG_DANG_NHAP Dang_nhap(string Ten_Dang_nhap, string Mat_khau)
    {
        var Nguoi_dung_Dang_nhap = (XL_NGUOI_DUNG_DANG_NHAP)null;

        var Nguoi_dung = Danh_sach_Nguoi_dung.FirstOrDefault(
            x => x.GetAttribute("Ten_Dang_nhap") == Ten_Dang_nhap && x.GetAttribute("Mat_khau") == Mat_khau);

        if (Nguoi_dung != null)
        {
            var DS_Nhom_Lap_top = (XmlElement)Nguoi_dung.GetElementsByTagName("Danh_sach_Nhom_Lap_top")[0];
            var Danh_sach_Nhom_Lap_top_cua_Nguoi_dung = XL_NGHIEP_VU.Tao_Danh_sach(DS_Nhom_Lap_top, "Nhom_Lap_top");
            var Danh_sach_Lap_top_cua_Nguoi_dung      = Danh_sach_Lap_top.FindAll(
                x => Danh_sach_Nhom_Lap_top_cua_Nguoi_dung.Any(Nhom => Nhom.GetAttribute("Ma_so") == x.SelectSingleNode("Nhom_Lap_top/@Ma_so").Value));
            var Doanh_thu = Danh_sach_Nhom_Lap_top_cua_Nguoi_dung.Sum(Nhom_Lap_top => long.Parse(Nhom_Lap_top.GetAttribute("Doanh_thu")));
            // Thống tin Online
            Nguoi_dung_Dang_nhap                                = new XL_NGUOI_DUNG_DANG_NHAP();
            Nguoi_dung_Dang_nhap.Doanh_thu                      = Doanh_thu;
            Nguoi_dung_Dang_nhap.Thong_bao                      = $"Doanhthu: { Nguoi_dung_Dang_nhap.Doanh_thu}" + "$<br />";
            Nguoi_dung_Dang_nhap.Danh_sach_Lap_top              = Danh_sach_Lap_top_cua_Nguoi_dung;
            Nguoi_dung_Dang_nhap.Danh_sach_Nhom_Lap_top         = Danh_sach_Nhom_Lap_top_cua_Nguoi_dung;
            Nguoi_dung_Dang_nhap.Danh_sach_Lap_top_Xem          = Nguoi_dung_Dang_nhap.Danh_sach_Lap_top;
            HttpContext.Current.Session["Nguoi_dung_Dang_nhap"] = Nguoi_dung_Dang_nhap;
        }

        return(Nguoi_dung_Dang_nhap);
    }