Esempio n. 1
0
File: Xe.cs Progetto: vu2872001/OOP
 public Xe(Xe lamboghini)
 {
     this.bienSoXe         = lamboghini.bienSoXe;
     this.hd               = lamboghini.hd;
     this.mauXe            = lamboghini.mauXe;
     this.loaiXe           = lamboghini.loaiXe;
     this.ngayGui          = lamboghini.ngayGui;
     this.soGioDuocPhepGui = lamboghini.soGioDuocPhepGui;
     this.tienguixe        = lamboghini.tienguixe;
 }
Esempio n. 2
0
 public bool kiemTraDuLieu(Xe a)
 {
     foreach (Xe item in this.dsxe1)
     {
         if (this.dsxe1.Contains(a))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 3
0
 public void chupAnh(Xe lamboghini)
 {
     xe                  = new Xe();
     xe.bienSoXe         = lamboghini.bienSoXe;
     xe.hd               = lamboghini.hd;
     xe.mauXe            = lamboghini.mauXe;
     xe.loaiXe           = lamboghini.loaiXe;
     xe.ngayGui          = lamboghini.ngayGui;
     xe.soGioDuocPhepGui = lamboghini.soGioDuocPhepGui;
     xe.tienguixe        = lamboghini.tienguixe;
 }
Esempio n. 4
0
 public static void BangHienThiLog(Xe a, MyEventArgs e)
 {
     if (e.content1 == "The xe khong hop le giu xe " || e.content1 == "Khach khong dua du tien nen giu xe ")
     {
         Console.WriteLine($"Bang hien thi: {e.content1}{a.bienSoXe}");
     }
     else
     {
         Console.WriteLine($"Bang hien thi: {e.content1}{a.bienSoXe} {e.xeStatus.ToString()}");
     }
 }
Esempio n. 5
0
 public static void NhanVienLog(Xe a, MyEventArgs e)
 {
     if (e.xeStatus == XeStatus.vao)
     {
         Console.WriteLine($"Nhan vien: Kiem tra cho trong cho xe {a.bienSoXe}");
     }
     else
     {
         Console.WriteLine($"Nhan vien: Kiem tra the cua xe {a.bienSoXe}");
     }
 }
Esempio n. 6
0
 private static object Staff_EVTinhtienth(Server a, Xe b)
 {
     if (a.tienphaitra(b) < b.tienguixe)
     {
         return($"Nhan Vien: Tra lai khach:{b.tienguixe - a.tienphaitra(b)}\n");
     }
     else
     {
         return("");
     }
 }
Esempio n. 7
0
 public int tienphaitra(Xe a)
 {
     if (a.loaiXe == PhanLoaiXe.XeDap)
     {
         return(2000);
     }
     else if (a.loaiXe == PhanLoaiXe.XeMay)
     {
         return(4000);
     }
     else
     {
         return(10000);
     }
 }
Esempio n. 8
0
 public void check(Xe a, MyEventArgs e)
 {
     //Check xem bai còn chổ ko --->kiểm tra sl xe trong đó
     if (e.xeStatus == XeStatus.vao)//tới GH hay chưa
     {
         if (this.checkChoTrong())
         {
             //chup hinh --->event{
             this.cameras.chupAnh(a);
             //Luu xuong server
             dsxe1.Add(a);
             this.soxeht++;
             a.ngayGui  = DateTime.Now;
             e.content1 = "Van con cho, moi xe ";
             e.data     = barrierStatus.OpenBarrier;
         }
         else
         {
             e.content1 = "Da het cho, moi xe ";
             e.xeStatus = XeStatus.ra;
             e.data     = barrierStatus.CloseBarrier;
         }
     }
     else
     {
         // kiem tra the xe co luu trong sever hay ko
         if (this.kiemTraDuLieu(a))
         {
             if (this.tienphaitra(a) <= a.tienguixe)
             {
                 this.soxeht--;
                 e.data = barrierStatus.OpenBarrier;
             }
             else
             {
                 e.content1 = "Khach khong dua du tien nen giu xe ";
                 e.data     = barrierStatus.CloseBarrier;
             }
         }
         else
         {
             e.content1 = "The xe khong hop le giu xe ";
             e.data     = barrierStatus.CloseBarrier;
         }
     }
 }
Esempio n. 9
0
 public void BarrierAct(Xe a, MyEventArgs e)
 {
     this.status = e.data;
 }
Esempio n. 10
0
 public object thucThiEVTinhTienth(Server a, Xe b)
 {
     return(EVTinhtienth?.Invoke(a, b));
 }
Esempio n. 11
0
 public string Giuxelai(Xe a)
 {
     return("Giu xe " + a.bienSoXe + "\n");
 }
Esempio n. 12
0
 public void Xera(Xe a)
 {
     EVInOutHandler?.Invoke(a, new MyEventArgs(barrierStatus.CloseBarrier, "Moi xe ", XeStatus.ra));
 }
Esempio n. 13
0
 private static object EV_Out(Xe a)
 {
     return($"Xe co bien so {a.bienSoXe} ra");
 }
Esempio n. 14
0
File: Xe.cs Progetto: vu2872001/OOP
 public object thongBaoXeVao(Xe a)
 {
     return(In?.Invoke(a));
 }
Esempio n. 15
0
 public static void BarrierLog(Xe a, MyEventArgs e)
 {
     Console.WriteLine($"Barrier: {e.data}");
 }
Esempio n. 16
0
 private static object EV_In(Xe a)
 {
     return($"Xe co bien so {a.bienSoXe} vao");
 }
Esempio n. 17
0
File: Xe.cs Progetto: vu2872001/OOP
 public object thongBaoXeRa(Xe a)
 {
     return(Out?.Invoke(a));
 }
Esempio n. 18
0
        static void Main(string[] args)
        {
            Xe a = new Xe("345", "small", 20000, PhanLoaiXe.XeOto);
            Xe b = new Xe("34325", "small", 2000, PhanLoaiXe.XeMay);

            /* Xe b = new Xe();
             * b.bienSoXe = Console.ReadLine();
             * b.hd = Console.ReadLine();
             * b.tienguixe = int.Parse(Console.ReadLine());
             * string temp = Console.ReadLine();
             * if (temp == "0") b.loaiXe = PhanLoaiXe.XeDap;
             * else if (temp == "1") b.loaiXe = PhanLoaiXe.XeMay;
             * else b.loaiXe = PhanLoaiXe.XeOto; */

            //Thanh phan cua bai xe
            Server      sv        = new Server(500);
            NhanVien    staff     = new NhanVien();
            Barrier     frontGate = new Barrier();
            BangHienThi bang1     = new BangHienThi();
            BaiDoXe     baidx1    = new BaiDoXe("SPKT", 10, sv, bang1, frontGate, staff);

            //event Xe check in & out
            baidx1.EVInOutHandler += NhanVienLog;
            baidx1.EVInOutHandler += baidx1.server.check;
            baidx1.EVInOutHandler += BangHienThiLog;
            baidx1.EVInOutHandler += baidx1.barrier1.BarrierAct;
            baidx1.EVInOutHandler += BarrierLog;

            baidx1.OPEN += EV_OPEN;
            Console.WriteLine(baidx1.moBai()); //event mo bai do xe
            //baidx1.Xevao(a);
            b.In += EV_In;
            Console.WriteLine(b.thongBaoXeVao(b)); //event thong bao xe vao
            baidx1.Xevao(b);
            //baidx1.Xera(a);
            b.Out += EV_Out;
            Console.WriteLine(b.thongBaoXeRa(b)); //event thong bao xe ra
            baidx1.Xera(b);
            //event cai dat 1 camera moi vao bai giu xe
            Camera i = new Camera();

            i.viTriCamera       = "Khu a";
            staff.EVInstallCam += I_EVInstallCam;
            Console.WriteLine(staff.thucThiEVInstallCam(i));

            //event bao tri camera
            staff.evMaintainCam += _evMaintainCam;
            Console.WriteLine(staff.thucThiEVMainTainCam(i));

            //event nhan vien tinh tien thoi va tra cho khach
            staff.EVTinhtienth += Staff_EVTinhtienth;
            Console.WriteLine(staff.thucThiEVTinhTienth(sv, b));
            staff.maNhanVien       = "hxp";
            staff.NgayDiemdanh     = "20";
            staff.songaydadiemdanh = 29;
            staff.NVDiemdanhNgaylamviec(sv);
            foreach (KeyValuePair <string, string> item in sv.DSdiemdanhh)
            {
                Console.WriteLine(item.Key + " " + item.Value);
            }
            //event phat luong
            sv.EVphatLuong += Sv_EVphatLuong;
            sv.thucthiEVphatLuong(staff);

            //event check so ngay diem danh sau khi phat luong
            sv.EVChPhatLuong += Sv_EVChPhatLuong;
            sv.thucthiEVChPhatLuong(staff);

            baidx1.CLOSE += EV_CLOSE;
            Console.WriteLine(baidx1.dongBai()); //event dong bai do xe

            staff.EVMaintainSV += _EVMaintainSV;
            Console.WriteLine(staff.thucThiEVMaintainSV(sv));
        }