Пример #1
0
        private QueIndex GetQueIndex(CachLayQue cachLayQue, AmLich amLich)
        {
            var queIndex = new QueIndex();

            switch (cachLayQue)
            {
            case CachLayQue.None:
                break;

            case CachLayQue.MaiHoaTienThien1:
                queIndex = _layQueService.GetQueIndexByTime(amLich, txtSoHoacChu.Text);
                break;

            case CachLayQue.MaiHoaTienThien2:
                queIndex = _layQueService.GetQueIndexBySoAndTime(amLich, txtQueNgoai1.Text);
                break;

            case CachLayQue.MaiHoaTienThien3:
                queIndex = _layQueService.GetQueIndexBySoAndSo(txtQueNgoai2.Text, txtQueNoi2.Text, amLich, chkCongChiGio.Checked);
                break;

            default:
                break;
            }

            return(queIndex);
        }
Пример #2
0
        private void radioNgoaiSoNoiSo_CheckedChanged(object sender, EventArgs e)
        {
            CachLayQue = CachLayQue.MaiHoaTienThien3;

            txtSoHoacChu.Enabled  = false;
            txtQueNgoai1.Enabled  = false;
            txtQueNgoai2.Enabled  = true;
            txtQueNoi2.Enabled    = true;
            chkCongChiGio.Enabled = true;

            txtQueNgoai2.Focus();

            GetQue();
        }
Пример #3
0
        protected string GetNgayThang(NgayLayQue ngayLayQue, CachLayQue cachLayQue)
        {
            var nhatThan   = ngayLayQue.NgayAm;
            var nguyetKien = ngayLayQue.ThangAm;
            var result     = "";

            switch (cachLayQue)
            {
            case CachLayQue.None:
                break;

            case CachLayQue.Manual:
                result = $"   Tháng: {nguyetKien.Name} - Ngày: {nhatThan.Name} ({nhatThan.Khong1.Name} {nhatThan.Khong2.Name} lâm không)";
                break;

            case CachLayQue.TungXu:
            case CachLayQue.MaiHoaTienThien1:
            case CachLayQue.MaiHoaTienThien2:
            case CachLayQue.MaiHoaTienThien3:
                var sb        = new StringBuilder();
                var columnLen = 17;
                sb.Append($"   Năm {ngayLayQue.LunarYear}".PadRight(columnLen + 2));
                sb.Append($"Tháng {ngayLayQue.LunarMonth}".PadRight(columnLen));
                sb.Append($"Ngày {ngayLayQue.LunarDay}".PadRight(columnLen));
                sb.Append($"Giờ {ngayLayQue.GioAm.Chi.Name} (dương lịch: {ngayLayQue.SolarDate.ToString("yyyy-MM-dd")})");
                sb.AppendLine();

                sb.Append($"   {ngayLayQue.NamAm.Name}".PadRight(columnLen + 2));
                sb.Append($"{ngayLayQue.ThangAm.Name}".PadRight(columnLen));
                sb.Append($"{ngayLayQue.NgayAm.Name}".PadRight(columnLen));
                sb.Append($"{ngayLayQue.GioAm.Name} ({nhatThan.Khong1.Name} {nhatThan.Khong2.Name} lâm không)");

                result = sb.ToString();

                break;

            default:
                break;
            }

            return(result);
        }
Пример #4
0
        /// <summary>
        /// Get que desc.
        /// </summary>
        /// <param name="queChu"></param>
        /// <param name="nhatThan"></param>
        /// <param name="nguyetKien"></param>
        /// <param name="isHao6Dong"></param>
        /// <param name="isHao5Dong"></param>
        /// <param name="isHao4Dong"></param>
        /// <param name="isHao3Dong"></param>
        /// <param name="isHao2Dong"></param>
        /// <param name="isHao1Dong"></param>
        /// <returns></returns>
        private string GetQueChuQueHoQueBienDesc(Que queChu, Que queBien, Que queHo, NgayLayQue ngayLayQue, CachLayQue cachLayQue,
                                                 bool isHao6Dong = false, bool isHao5Dong = false, bool isHao4Dong = false,
                                                 bool isHao3Dong = false, bool isHao2Dong = false, bool isHao1Dong = false)
        {
            var nhatThan   = ngayLayQue.NgayAm;
            var nguyetKien = ngayLayQue.ThangAm;

            var padRight = 50;
            var sb       = new StringBuilder();

            sb.AppendLine(GetNgayThang(ngayLayQue, cachLayQue));
            sb.AppendLine();

            sb.Append("   QUẺ CHỦ".PadRight(padRight));
            sb.Append("   QUẺ HỖ".PadRight(padRight));
            sb.Append(queBien != null ? "   QUẺ BIẾN" : "");
            sb.AppendLine();
            AddLongHR(padRight, sb);

            sb.Append(GetTenQueMaiHoa(queChu).PadRight(padRight));
            sb.Append(GetTenQueMaiHoa(queHo).PadRight(padRight));
            sb.Append(GetTenQueMaiHoa(queBien));
            sb.AppendLine();
            sb.Append(GetCachCuaQue(queChu).PadRight(padRight));
            sb.Append(GetCachCuaQue(queHo).PadRight(padRight));
            sb.Append(GetCachCuaQue(queBien));
            sb.AppendLine();
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu, queChu.Hao6, isHao6Dong).PadRight(padRight));
            sb.Append(GetHaoDesc(queHo, queHo.Hao6, false).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoDesc(queBien, queBien.Hao6, isHao6Dong) : "");
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu, queChu.Hao5, isHao5Dong).PadRight(padRight));
            sb.Append(GetHaoDesc(queHo, queHo.Hao5, false).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoDesc(queBien, queBien.Hao5, isHao5Dong) : "");
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu, queChu.Hao4, isHao4Dong).PadRight(padRight));
            sb.Append(GetHaoDesc(queHo, queHo.Hao4, false).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoDesc(queBien, queBien.Hao4, isHao4Dong) : "");
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu, queChu.Hao3, isHao3Dong).PadRight(padRight));
            sb.Append(GetHaoDesc(queHo, queHo.Hao3, false).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoDesc(queBien, queBien.Hao3, isHao3Dong) : "");
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu, queChu.Hao2, isHao2Dong).PadRight(padRight));
            sb.Append(GetHaoDesc(queHo, queHo.Hao2, false).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoDesc(queBien, queBien.Hao2, isHao2Dong) : "");
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu, queChu.Hao1, isHao1Dong).PadRight(padRight));
            sb.Append(GetHaoDesc(queHo, queHo.Hao1, false).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoDesc(queBien, queBien.Hao1, isHao1Dong) : "");
            sb.AppendLine();
            sb.AppendLine();

            AddLongHR(padRight, sb);
            AddTuongQue(sb, queChu, queHo, queBien);

            return(sb.ToString());
        }
        /// <summary>
        /// Get que desc.
        /// </summary>
        /// <param name="queChu"></param>
        /// <param name="nhatThan"></param>
        /// <param name="nguyetKien"></param>
        /// <param name="isHao6Dong"></param>
        /// <param name="isHao5Dong"></param>
        /// <param name="isHao4Dong"></param>
        /// <param name="isHao3Dong"></param>
        /// <param name="isHao2Dong"></param>
        /// <param name="isHao1Dong"></param>
        /// <returns></returns>
        private string GetQueChuQueHoQueBienDesc(Que queChu, Que queBien, Que queHo, NgayLayQue ngayLayQue, CachLayQue cachLayQue,
                                                 bool isHao6Dong = false, bool isHao5Dong = false, bool isHao4Dong = false,
                                                 bool isHao3Dong = false, bool isHao2Dong = false, bool isHao1Dong = false)
        {
            var nhatThan   = ngayLayQue.NgayAm;
            var nguyetKien = ngayLayQue.ThangAm;
            var lucThan    = LucThan.GetLucThan(nhatThan.Can);

            var padRight = 50;
            var sb       = new StringBuilder();

            sb.AppendLine(GetNgayThang(ngayLayQue, cachLayQue));
            sb.AppendLine();

            sb.Append("   QUẺ CHỦ".PadRight(padRight));
            sb.Append("   QUẺ HỖ".PadRight(padRight));
            sb.Append(queBien != null ? "   QUẺ BIẾN" : "");
            sb.AppendLine();
            AddLongHR(padRight, sb);

            AddBodyDesc(queChu, queHo, queBien, isHao6Dong, isHao5Dong, isHao4Dong, isHao3Dong, isHao2Dong, isHao1Dong, sb, padRight, true, lucThan);
            sb.AppendLine();
            sb.AppendLine();
            AddLongHR(padRight, sb);

            AddBodyDesc(QueChuDoiDai, QueHoDoiDai, QueBienDoiDai, isHao1Dong, isHao2Dong, isHao3Dong, isHao4Dong, isHao5Dong, isHao6Dong, sb, padRight, false, null);
            sb.AppendLine();
            sb.AppendLine();
            AddLongHR(padRight, sb);

            AddTuongQue(sb, queChu, queHo, queBien);
            AddLongHR(padRight, sb);
            AddTuongQue(sb, QueChuDoiDai, QueHoDoiDai, QueBienDoiDai);

            return(sb.ToString());
        }
Пример #6
0
        /// <summary>
        /// Get que desc.
        /// </summary>
        /// <param name="queChu"></param>
        /// <param name="nhatThan"></param>
        /// <param name="nguyetKien"></param>
        /// <param name="isHao6Dong"></param>
        /// <param name="isHao5Dong"></param>
        /// <param name="isHao4Dong"></param>
        /// <param name="isHao3Dong"></param>
        /// <param name="isHao2Dong"></param>
        /// <param name="isHao1Dong"></param>
        /// <returns></returns>
        private string GetQueChuVaQueBienDesc(Que queChu, Que queBien, NgayLayQue ngayLayQue, CachLayQue cachLayQue,
                                              bool isHao6Dong = false, bool isHao5Dong = false, bool isHao4Dong = false,
                                              bool isHao3Dong = false, bool isHao2Dong = false, bool isHao1Dong = false)
        {
            var nhatThan   = ngayLayQue.NgayAm;
            var nguyetKien = ngayLayQue.ThangAm;
            var lucThan    = LucThan.GetLucThan(nhatThan.Can);

            var padRight = 94;
            var sb       = new StringBuilder();

            sb.AppendLine(GetNgayThang(ngayLayQue, cachLayQue));
            sb.AppendLine();

            sb.Append("   QUẺ CHỦ".PadRight(padRight));
            sb.Append(queBien != null ? "   QUẺ BIẾN" : "");
            sb.AppendLine();

            sb.Append(GetTenQueLucHao(queChu).PadRight(padRight));
            sb.Append(GetTenQueLucHao(queBien));
            sb.AppendLine();

            sb.Append(GetCachCuaQue(queChu).PadRight(padRight));
            sb.Append(GetCachCuaQue(queBien));
            sb.AppendLine();
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu.Hao6, isHao6Dong, nhatThan, nguyetKien, lucThan).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoBienDesc(queBien.Hao6, queChu.Hao6, isHao6Dong, nhatThan, nguyetKien) : "");
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu.Hao5, isHao5Dong, nhatThan, nguyetKien, lucThan).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoBienDesc(queBien.Hao5, queChu.Hao5, isHao5Dong, nhatThan, nguyetKien) : "");
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu.Hao4, isHao4Dong, nhatThan, nguyetKien, lucThan).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoBienDesc(queBien.Hao4, queChu.Hao4, isHao4Dong, nhatThan, nguyetKien) : "");
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu.Hao3, isHao3Dong, nhatThan, nguyetKien, lucThan).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoBienDesc(queBien.Hao3, queChu.Hao3, isHao3Dong, nhatThan, nguyetKien) : "");
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu.Hao2, isHao2Dong, nhatThan, nguyetKien, lucThan).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoBienDesc(queBien.Hao2, queChu.Hao2, isHao2Dong, nhatThan, nguyetKien) : "");
            sb.AppendLine();

            sb.Append(GetHaoDesc(queChu.Hao1, isHao1Dong, nhatThan, nguyetKien, lucThan).PadRight(padRight));
            sb.Append(queBien != null ? GetHaoBienDesc(queBien.Hao1, queChu.Hao1, isHao1Dong, nhatThan, nguyetKien) : "");
            sb.AppendLine();

            sb.AppendLine();
            sb.AppendLine(GetHaoPhucDesc(queChu));
            sb.AppendLine();
            sb.AppendLine(GetTamHopCuc(queChu));
            sb.AppendLine();

            AddTuongQue(sb, queChu, null, queBien);

            return(sb.ToString());
        }