Пример #1
0
 public FCapNhatThongTinVe(List<LichTrinhTuyenDuongModelcs> listLichTrinh, GheModel ghe, string nhanVienId) 
 {
     InitializeComponent();
     Ghe = ghe;
     ListLichTrinh = listLichTrinh;
     TaoMoi = ghe.GiaoDichId == 0;
     NhanVienId = nhanVienId;
 }
Пример #2
0
        private void CapNhatDanhSachGhe()
        {
            if (SelectedListTuyenDuong == null || SelectedListTuyenDuong.Count < 1)
            {
                gridControl.DataSource = new List<GheModel>();
                return;
            }

            var ghes = new List<GheModel>();

            var dsLoaiGhe = DoanTauGheDal.LayTatCa(null);

            if (cbLoaiGhe.SelectedIndex != 0)
            {
                dsLoaiGhe = DoanTauGheDal.LayTatCa(cbLoaiGhe.SelectedValue as int? ?? 0);
            }

            foreach (var loaiGhe in dsLoaiGhe)
            {
                for (var i = 0; i < loaiGhe.SoLuong; i++)
                {
                    var lg = LoaiGheDal.LayLoaiGhe(loaiGhe.LoaiGheId);

                    var ghe = new GheModel
                    {
                        Anh = imageListLoaiGhe.Images[imageListLoaiGhe.Images.IndexOfKey(loaiGhe.LoaiGheId.ToString())],
                        LoaiGheId = loaiGhe.LoaiGheId,
                        GhiChu = string.Empty,
                        Ten = lg.Ten,
                        DaDuocDat = false,
                        CoTheDat = true,
                        HeSo = lg.HeSo,
                        SoShe = i,
                        HuyGhe = false,
                        MaGhe = "LT" + cbLichTrinh.SelectedValue + "-" + loaiGhe.LoaiGheId + (i + 1),
                        KhachHangId = "NaN"

                    };
                    ghe.MaGhe = "LT" + cbLichTrinh.SelectedValue + "-" + loaiGhe.LoaiGheId + (i+1);
                    ghe.SoTien = SelectedListTuyenDuong.Sum(t => t.GiaVe)*ghe.HeSo;
                    ghe.TenKhachHang = "Ghế trống";
                  
                    var listGiaoDich = GiaoDichDal.LayGiaoDichTrenTuyenDuong(false,loaiGhe.LoaiGheId, i,
                        SelectedListTuyenDuong.Select(td=>td.Id).ToList());

                    if (listGiaoDich.Count > 0)
                    {
                        var khs = KhachHangDal.Lay(listGiaoDich.Select(gd=>gd.KhachHangId).ToList());
                        ghe.TenKhachHang = string.Join(",", khs.Select(kh => kh.Id).ToList());
                        ghe.CoTheDat = false;
                        ghe.SoTien = listGiaoDich.Sum(gd=>gd.SoTien);
                    }
                    ghes.Add(ghe);
                }
            }
            gridControl.DataSource = ghes;
        }
Пример #3
0
        private void CapNhatLichTrinh()
        {
            var ghes = new List<GheModel>();
            var dsGiaoDich = GiaoDichDal.LayGiaoDichKhachHang(gridLockUpSearch.EditValue.ToString());
            foreach (var giaoDich in dsGiaoDich)
            {
                if(giaoDich.ChiTietGiaoDiches.Count<1)
                    continue;

                var ctgd = giaoDich.ChiTietGiaoDiches.First();

                var ngay = LichTrinhDal.LayTheoId(giaoDich.LichTrinhId);

                var lg = LoaiGheDal.LayLoaiGhe(giaoDich.ChiTietGiaoDiches.First().LoaiGheId);

                var ghe = new GheModel
                {
                    Anh = imageListLoaiGhe.Images[imageListLoaiGhe.Images.IndexOfKey(lg.Id.ToString())],
                    LoaiGheId = lg.Id,
                    GhiChu = string.Empty,
                    Ten = lg.Ten,
                    DaDuocDat = ctgd.Huy != null && !ctgd.Huy.Value, //chấp nhận cho huỷ ko sát nghĩa lắm enable
                    HeSo = lg.HeSo,
                    SoShe = ctgd.SoGhe,
                    HuyGhe = ctgd.Huy != null && ctgd.Huy.Value, //mặc định
                    CoTheDat = false, //check khi right click select
                    MaGhe = "LT" + giaoDich.LichTrinhId + "-" + lg.Id + (ctgd.SoGhe + 1),
                    TenKhachHang = gridLockUpSearch.SelectedText,
                    GiaoDichId = giaoDich.Id,
                    LichTrinhId = giaoDich.LichTrinhId,
                    KhachHangId = giaoDich.KhachHangId,
                    NgayKhoiHanh = ngay.GioChay.ToShortDateString(),
                    GioKhoiHanh = ngay.GioChay.ToShortTimeString(),
                    SoTien = giaoDich.SoTien
                };
                var lichTrinhTuyenDuongs = LichTrinhTuyenDuongDal.LayLichTrinhGiaoDich(giaoDich.Id);
                
                ghe.TenLichTrinh = LayTuyenDuong(lichTrinhTuyenDuongs);

                var length = ghe.TenLichTrinh.Length;

                if (length > 12)
                {
                    ghe.TenLichTrinh = ghe.TenLichTrinh.Substring(0, 12) + "..." +
                                              ghe.TenLichTrinh.Substring(ghe.TenLichTrinh.Length - 12, 12);
                }

                
                ghes.Add(ghe);
            }
         
            gridControl.DataSource = ghes;
        }