Example #1
0
    public static string Ghi_Ban_ve_Moi(XL_PHIM Phim, XL_BAN_VE Ban_ve)
    {
        var Kq    = "";
        var Xu_ly = new WebClient();

        Xu_ly.Encoding = System.Text.Encoding.UTF8;
        var Tham_so       = $"Ma_so_Xu_ly=GHI_BAN_VE_MOI&Ma_so_Phim={Phim.Ma_so}";
        var Dia_chi_Xu_ly = $"{Dia_chi_Dich_vu_Quan_ly_Rap_Phim}?{Tham_so}";
        var Chuoi_JSON    = Json.Encode(Ban_ve);

        try
        {
            Kq = Xu_ly.UploadString(Dia_chi_Xu_ly, Chuoi_JSON).Trim();
        }
        catch (Exception Loi)
        {
            Kq = Loi.Message;
        }
        if (Kq == "OK")
        {
            var Suat_chieu = Phim.Danh_sach_Suat_chieu.FirstOrDefault(x => x.Ma_so == Ban_ve.Suat_chieu.Ma_so);
            Suat_chieu.Danh_sach_Ghe_trong.RemoveAll(Ghe_trong => Ban_ve.Danh_sach_Ghe_ban.Any(Ghe_ban => Ghe_ban.Ma_so == Ghe_trong.Ma_so));
        }
        return(Kq);
    }
Example #2
0
    public string Ghi_Ban_ve_Moi(string Ma_so_Phim, XL_BAN_VE Ban_ve)
    {
        var Chuoi_Kq_Ghi        = "";
        var Phim                = Danh_sach_Phim.FirstOrDefault(x => x.Ma_so == Ma_so_Phim);
        var Suat_chieu          = Phim.Danh_sach_Suat_chieu.FirstOrDefault(x => x.Ma_so == Ban_ve.Suat_chieu.Ma_so);
        var Ghe_khong_con_Trong = new List <XL_GHE>();

        foreach (XL_GHE Ghe_dat in Ban_ve.Danh_sach_Ghe_ban)
        {
            if (Suat_chieu.Danh_sach_Ghe_trong.All(Ghe_trong => Ghe_trong.Ma_so != Ghe_dat.Ma_so))
            {
                Ghe_khong_con_Trong.Add(Ghe_dat);
                break;
            }
        }
        if (Ghe_khong_con_Trong.Count == 0)
        {
            Suat_chieu.Danh_sach_Ghe_trong.RemoveAll(Ghe_trong => Ban_ve.Danh_sach_Ghe_ban.Any(Ghe_dat => Ghe_dat.Ma_so == Ghe_trong.Ma_so));
            var So_luot_Ban_ve = Phim.Danh_sach_Ban_ve.Count;
            So_luot_Ban_ve++;
            Ban_ve.Ma_so = Phim.Ma_so + "_BV_" + So_luot_Ban_ve.ToString();
            Phim.Danh_sach_Ban_ve.Add(Ban_ve);
            Chuoi_Kq_Ghi = XL_DU_LIEU.Ghi_Ban_ve_Moi(Phim, Ban_ve, Suat_chieu);
        }
        else
        {
            Chuoi_Kq_Ghi = "Ghế";
            Ghe_khong_con_Trong.ForEach(Ghe => {
                Chuoi_Kq_Ghi += $" {Ghe.Ma_so}";
            });
            Chuoi_Kq_Ghi += "đã được đặt hoặc bán";
        }

        return(Chuoi_Kq_Ghi);
    }
Example #3
0
    public static string Ghi_Ban_ve_Moi(XL_PHIM Phim, XL_BAN_VE Ban_ve, XL_SUAT_CHIEU Suat_chieu)
    {
        var Kq = "";

        Kq = Ghi_Phim(Phim);
        if (Kq != "OK")
        {
            Phim.Danh_sach_Ban_ve.Remove(Ban_ve);
            Ban_ve.Danh_sach_Ghe_ban.ForEach(Ghe_ban => Suat_chieu.Danh_sach_Ghe_trong.Add(Ghe_ban));
        }

        return(Kq);
    }
Example #4
0
    public static string Ghi_Thay_doi_Danh_sach_Ghe_trong_Phan_he_Khach_tham_quan(XL_PHIM Phim, XL_BAN_VE Ban_ve)
    {
        var Kq    = "";
        var Xu_ly = new WebClient();

        Xu_ly.Encoding = System.Text.Encoding.UTF8;
        var Tham_so       = $"Ma_so_Xu_ly=GHI_THAY_DOI_DANH_SACH_GHE_TRONG&Ma_so_Phim={Phim.Ma_so}&Ma_so_Suat_chieu={Ban_ve.Suat_chieu.Ma_so}";
        var Dia_chi_Xu_ly = $"{Dia_chi_Phan_he_Khach_tham_quan}?{Tham_so}";
        var Chuoi_JSON    = Json.Encode(Ban_ve.Danh_sach_Ghe_ban);

        try
        {
            Kq = Xu_ly.UploadString(Dia_chi_Xu_ly, Chuoi_JSON).Trim();
        }
        catch (Exception Loi)
        {
            Kq = Loi.Message;
        }
        return(Kq);
    }