コード例 #1
0
        public void TestCanGioAm()
        {
            DateTime duongLich = new DateTime(2018, 8, 30);
            AmLich   amLich    = duongLich.ToAmLich();

            ThienCan canGioTi = amLich.GetCanGioTi();

            ThienCan can = amLich.GetCanCuaGio(Ti);

            Assert.AreEqual(canGioTi, can);

            can = amLich.GetCanCuaGio(Suu);
            Assert.AreEqual(can, At);

            can = amLich.GetCanCuaGio(Ngo);
            Assert.AreEqual(can, Canh);

            can = amLich.GetCanCuaGio(Dau);
            Assert.AreEqual(can, Quy);

            can = amLich.GetCanCuaGio(Hoi);
            Assert.AreEqual(can, At);
        }
コード例 #2
0
        private void SetUIControls(AmLich amLich)
        {
            CanChi ngayAm  = amLich.NgayAm;
            CanChi thangAm = amLich.ThangAm;
            CanChi namAm   = amLich.NamAm;

            cbxNgayCan.SelectedIndex  = ngayAm.Can.Id - 1;
            cbxNgayChi.SelectedIndex  = ngayAm.Chi.Id - 1;
            cbxThangCan.SelectedIndex = thangAm.Can.Id - 1;
            cbxThangChi.SelectedIndex = thangAm.Chi.Id - 1;
            cbxNamCan.SelectedIndex   = namAm.Can.Id - 1;
            cbxNamChi.SelectedIndex   = namAm.Chi.Id - 1;

            DiaChi   gioChi = DiaChi.All[cbxGioChi.SelectedIndex];
            ThienCan gioCan = amLich.GetCanCuaGio(gioChi);

            cbxGioCan.SelectedIndex = gioCan.Id - 1;

            labelNgayDuongLich.Text = $"Ngày dương lịch: {amLich.SolarDate.Year}-{amLich.SolarDate.Month}-{amLich.SolarDate.Day}";
            labelNgayAmLich.Text    = $"Ngày âm lịch: {amLich.LunarYear}-{amLich.LunarMonth}-{amLich.LunarDay}";
        }