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; }
public CanChi GetCanChiGio() { if (_gioAm == null) { DiaChi chi = GetChiCuaGio(SolarDate); ThienCan can = GetCanCuaGio(chi); _gioAm = new CanChi { Can = can, Chi = chi }; } return(_gioAm); }
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); }
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); }
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(); }
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); }
public NgayLayQue(CanChi nhatThan, CanChi nguyetKien) { NgayAm = nhatThan; ThangAm = nguyetKien; }
public bool IsCanChiInThisTuan(CanChi canChi) { return(All.Exists(c => c.Can == canChi.Can && c.Chi == canChi.Chi)); }
public Tuan(CanChi canChiBatDau) { Add10CanChi(canChiBatDau); }