Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NhanVien   nv1 = new NhanVien();
            NhanVienVp nv2 = new NhanVienVp("NV02", "NVB", new DateTime(1985, 2, 20), new DateTime(2015, 1, 25), Phai.Nam, 1.5, 2);

            double tienThuong = nv2.TinhThuong();
            double tienluong  = nv2.TinhLuong();
        }
Exemplo n.º 2
0
        protected void btnXuatThongTin_Click(object sender, EventArgs e)
        {
            string   maso       = txtMaso.Text;
            string   hoten      = txtHoTen.Text;
            DateTime ngaysinh   = DateTime.Parse(txtNgaySinh.Text);
            DateTime ngayvaolam = DateTime.Parse(txtNgayVaoLam.Text);
            double   hsl        = double.Parse(txtHeSoLuong.Text);
            Phai     gioitinh   = chkGioiTinh.Checked ? Phai.Nam : Phai.Nữ;
            int      songayvang = int.Parse(txtSoNgayVang.Text);
            //cách 1:
            //if(rdbNVVP.Checked)
            //{
            //    NhanVienVp nv = new NhanVienVp(maso,hoten,ngaysinh,ngayvaolam,gioitinh,hsl,songayvang);
            //    lblThongTin.Text = nv.XuatThongTin();


            //}
            //else
            //{
            //    int sosanpham = int.Parse(txtSoSanPham.Text);
            //    NhanViensx nv = new NhanViensx(maso, hoten, ngaysinh, ngayvaolam, gioitinh,songayvang, sosanpham);
            //    lblThongTin.Text = nv.XuatThongTin();


            //}
            // cach2: ứng dụng lateBinding


            NhanVien nv;

            if (rdbNVVP.Checked)
            {
                nv = new NhanVienVp(maso, hoten, ngaysinh, ngayvaolam, gioitinh, hsl, songayvang);
            }
            else
            {
                int sosanpham = int.Parse(txtSoSanPham.Text);
                nv = new NhanViensx(maso, hoten, ngaysinh, ngayvaolam, gioitinh, songayvang, sosanpham);
            }
            lblThongTin.Text = nv.XuatThongTin();
            //lệnh chuyển sang view 2
            MultiView1.ActiveViewIndex = 1;
        }