Exemple #1
0
        // Them phong moi vao vi tri thich hop, theo thu tu maphong
        public void ThemPhongVoiViTriThichHop(string ma, LoaiPhong loaiphong, int succhua)
        {
            Phong phong = TaoPhong(ma, loaiphong, succhua);

            if (phong != null)
            {
                listPhong.ThemThichHop(phong);
            }
        }
Exemple #2
0
        // Them phong moi vao cuoi danh sach
        public void ThemPhong(string ma, LoaiPhong loaiphong, int succhua)
        {
            Phong phong = TaoPhong(ma, loaiphong, succhua);

            if (phong != null)
            {
                listPhong.Add(phong);
            }
        }
Exemple #3
0
        // cai dat cho IComparable
        public int CompareTo(object o)
        {
            Phong p = o as Phong;

            if (p != null)
            {
                return(this.MaPhong.CompareTo(p.MaPhong));
            }
            throw new ArgumentException("Khong phai doi tuong kieu Phong");
        }
Exemple #4
0
 // Ham cau tu
 public DonMuonPhong(string ma, string tenNguoiMuon, string dvCongTac, Phong phongMuon,
                     NgayThang ngayMuon, int tietBDMuon, int tietKTMuon, bool cothaydoi = true)
 {
     this.ma           = ma;
     this.TenNguoiMuon = tenNguoiMuon;
     this.DVCongTac    = dvCongTac;
     this.PhongMuon    = phongMuon;
     this.NgayMuon     = ngayMuon;
     this.TietBDMuon   = tietBDMuon;
     this.TietKTMuon   = tietKTMuon;
     this.CoThayDoi    = cothaydoi;
 }
Exemple #5
0
        // Tao mot phong moi tu tham so dau vao
        // tuy theo loai phong ma tao doi tuong cho thich hop
        private Phong TaoPhong(string ma, LoaiPhong loaiphong, int succhua)
        {
            Phong phong = null;

            switch (loaiphong)
            {
            case LoaiPhong.PhongHoc:
                phong = new PhongHoc(ma, succhua);
                break;

            case LoaiPhong.ThucHanh:
                phong = new ThucHanh(ma, succhua);
                break;
            }
            return(phong);
        }
Exemple #6
0
        // Ham thuc hien sua thong tin mot phong
        public void SuaTTMotPhong(string maphong, LoaiPhong loaiphong, int succhua)
        {
            Phong pMoi  = null;
            Phong pCu   = listPhong[maphong];     // lay doi tuong phong cu
            int   index = listPhong.IndexOf(pCu); // lay vi tri cua phong cu trong danh sach

            // tao phong moi
            if (loaiphong == LoaiPhong.PhongHoc && pCu is ThucHanh)
            {
                pMoi = new PhongHoc(maphong, succhua);
            }
            else if (loaiphong == LoaiPhong.ThucHanh && pCu is PhongHoc)
            {
                pMoi = new ThucHanh(maphong, succhua);
            }
            else
            {                              // truong hop chi sua succhua
                pCu.SucChua = succhua;     // khong tao phong moi
                return;                    // thoat khoi ham
            }
            listPhong.RemoveAt(index);     // xoa phong cu
            listPhong.Insert(index, pMoi); // chen phong moi
        }