示例#1
0
        public NgayLayQue(AmLich amLich)
        {
            SolarDate  = amLich.SolarDate;
            LunarYear  = amLich.LunarYear;
            LunarMonth = amLich.LunarMonth;
            LunarDay   = amLich.LunarDay;
            LunarLeap  = amLich.LunarLeap;

            NamAm   = amLich.NamAm;
            ThangAm = amLich.ThangAm;
            NgayAm  = amLich.NgayAm;
            GioAm   = amLich.GioAm;
        }
示例#2
0
        public CanChi GetCanChiGio()
        {
            if (_gioAm == null)
            {
                DiaChi   chi = GetChiCuaGio(SolarDate);
                ThienCan can = GetCanCuaGio(chi);

                _gioAm = new CanChi {
                    Can = can, Chi = chi
                };
            }

            return(_gioAm);
        }
示例#3
0
        private CanChi GetCanChiNgay()
        {
            if (_ngayAm == null)
            {
                long jd       = Calendar.jdFromDate(SolarDate);
                var  canIndex = (int)(jd + 9) % 10;
                var  chiIndex = (int)(jd + 1) % 12;

                _ngayAm = new CanChi {
                    Can = ThienCan.All[canIndex], Chi = DiaChi.All[chiIndex]
                };
            }

            return(_ngayAm);
        }
示例#4
0
        private CanChi GetCanChiThang()
        {
            if (_thangAm == null)
            {
                // 0=Giap, 1=At, ...
                var canIndex = (LunarYear * 12 + LunarMonth + 3) % 10;

                // 0=Ti, 1=Suu, ..., 11=Hoi.
                var chiIndex = (LunarMonth + 1) % 12;

                _thangAm = new CanChi {
                    Can = ThienCan.All[canIndex], Chi = DiaChi.All[chiIndex]
                };
            }

            return(_thangAm);
        }
示例#5
0
        private void Add10CanChi(CanChi canChiBatDau)
        {
            All.Add(canChiBatDau);

            CanChi canChiTruoc = canChiBatDau;
            CanChi canChi;

            // Add other 9 CanChi.
            for (int i = 0; i < SoNgay - 1; i++)
            {
                canChi = canChiTruoc.Next();

                All.Add(canChi);
                canChiTruoc = canChi;
            }

            Khong1 = canChiTruoc.Chi.Next();
            Khong2 = Khong1.Next();
        }
示例#6
0
        private CanChi GetCanChiNam()
        {
            if (_namAm == null)
            {
                // Mod 10 => 0=Canh, 1=Tân, 2=Nhâm, ..., 9=Kỷ
                // + 6 mod 10 => 0=Giap, ...
                var canIndex = (LunarYear + 6) % 10;

                // Mod 12 => 0=Thân, 1=Dậu, 2=Tuất, ..., 11=Mùi.
                // + 8 mod 12 => 0=Ti, ...
                var chiIndex = (LunarYear + 8) % 12;

                _namAm = new CanChi {
                    Can = ThienCan.All[canIndex], Chi = DiaChi.All[chiIndex]
                };
            }

            return(_namAm);
        }
示例#7
0
 public NgayLayQue(CanChi nhatThan, CanChi nguyetKien)
 {
     NgayAm  = nhatThan;
     ThangAm = nguyetKien;
 }
示例#8
0
 public bool IsCanChiInThisTuan(CanChi canChi)
 {
     return(All.Exists(c => c.Can == canChi.Can && c.Chi == canChi.Chi));
 }
示例#9
0
 public Tuan(CanChi canChiBatDau)
 {
     Add10CanChi(canChiBatDau);
 }