Example #1
0
        //#endregion

        public void Initial()
        {
            MyCalendar m_c = new MyCalendar();
            DateEntity tmp = new DateEntity();

            tmp._date = this._date;
            m_c.SetDateEntity(ref tmp);
            this._BeginMonth     = tmp._BeginMonth;
            this._BeginZodiac    = tmp._BeginZodiac;
            this.nonglimonth     = tmp.nonglimonth;
            this.nongliday       = tmp.nongliday;
            this.nonglihour      = tmp.nonglihour;
            this.nongliyearflag  = tmp.nongliyearflag;
            this.NongliMonthDays = tmp.NongliMonthDays;
            if (nongliyearflag)
            {
                BaZi.BaZiBiz m_bz = PPLive.BaZi.BaZiBiz.GetInstance();
                this.nongliTG = m_bz.YearTG(_date.Year - 1);
                this.nongliDZ = m_bz.YearDZ(_date.Year - 1);
            }
            else
            {
                BaZi.BaZiBiz m_bz = PPLive.BaZi.BaZiBiz.GetInstance();
                this.nongliTG = m_bz.YearTG(_date.Year);
                this.nongliDZ = m_bz.YearDZ(_date.Year);
            }
        }
Example #2
0
        double[] preceB = { 0, 50287.92262, 111.24406, 0.07699, -0.23479, -0.00178, 0.00018, 0.00001 }; //Date黄道上的岁差p

        #endregion Fields

        #region Methods

        public void SetDateEntity(ref DateEntity date)
        {
            double y = (double)date.Date.Year;

            //从冬至开始,连续计算14个中气时刻
            double t1 = 365.2422 * (y - 2000) - 50;//农历年首始于前一年的冬至,为了节气中气一起算,取前年大雪之前
            double[] zq = new double[14];
            double[] jq = new double[14];
            double[] hs = new double[14];
            for (int i = 0; i < 14; i++)//计算节气(从冬至开始),注意:返回的是力学时
            {
                zq[i] = AngleCal(t1 + i * 30.4, i * 30 - 90, false); //中气计算,冬至的太阳黄经是270度(或-90度)
                jq[i] = AngleCal(t1 + i * 30.4, i * 30 - 105, false); //顺便计算节气,它不是农历定朔计算所必需的
            }
            //在大雪过后,连续计算14个日月合朔时刻
            double dongZhiJia1 = jq[0] + 1 - LocalDayModify(zq[0], 8, false);//大雪过后的第一天0点的儒略日数
            hs[0] = AngleCal(dongZhiJia1, 0, true); //首月结束的日月合朔时刻
            for (int i = 1; i < 14; i++)
            {
                hs[i] = AngleCal(hs[i - 1] + 25, 0, true);
            }
            //算出中气及合朔时刻的日数(不含小数的日数计数,以便计算日期之间的差值)
            double[] A = new double[14];
            double[] B = new double[14];
            double[] C = new double[14];
            for (int i = 0; i < 14; i++)
            { //取当地UTC日数的整数部分
                A[i] = LocalDayModify(zq[i], 8, true);
                B[i] = LocalDayModify(jq[i], 8, true);
                C[i] = LocalDayModify(hs[i], 8, true);
            }
            //闰月及大小月分析
            int total = 13, nun = -1;
            int[] yn = {12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0}; //月编号
            int k = 0;
            if (C[0] <= A[0])
            {
                k = 1;
                for (int i = 0; i < yn.Length; i++)
                {
                    yn[i]--;
                    if (yn[i] <= 0)
                    { yn[i] = 12; }
                }
                total = 14;
            }
            if (C[12+k] <= A[12])//闰月分析
            {
                yn[13] = 12; total = 14;  //编号为12的月是本年的有效月份,本年总月数13个
                int p = 1;
                for (p = 1; p < 13; p++)
                {
                    if (C[p+k] <= A[p])
                        break;
                }
                for (nun = p - 1; p < 14; p++)
                {
                    yn[p - 1]--; //注意yn中不含农历首月(所以取i-1),在公历中农历首月总是去年的所以不多做计算
                }
            }

            for (int i = 0; i < total; i++)//设置农历
            {
                //yn[i] = (yn[i] + 10) % 12;
                DateTime MonthBegin = JDayToDay(hs[i] + J2000 + (double)8 /(double) 24, true);
                DateTime MonthEnd = date.Date.AddYears(1);
                if (i < total - 1)
                {
                    MonthEnd = JDayToDay(hs[i + 1] + J2000 + (double)8 / (double)24, true);
                }
                MonthBegin = new DateTime(MonthBegin.Year,MonthBegin.Month,MonthBegin.Day);
                MonthEnd = new DateTime(MonthEnd.Year,MonthEnd.Month,MonthEnd.Day);

                DateTime tmpdate = date.Date;
                if (tmpdate.Hour == 23)
                {
                    tmpdate = tmpdate.AddDays(1);
                }
                if (tmpdate > MonthBegin && tmpdate < MonthEnd)
                {
                    if (i == nun)
                    {
                        date.NongliMonth = (PublicValue.NongliMonth)Enum.Parse(typeof(PublicValue.NongliMonth), (yn[i] + 100).ToString());
                    }
                    else
                    {
                        date.NongliMonth = (PublicValue.NongliMonth)Enum.Parse(typeof(PublicValue.NongliMonth), (yn[i]).ToString());
                    }
                    TimeSpan ts = new TimeSpan();
                    ts = new DateTime(tmpdate.Year, tmpdate.Month, tmpdate.Day) - new DateTime(MonthBegin.Year, MonthBegin.Month, MonthBegin.Day);
                    date.NongliDay = (PublicValue.NongliDay)Enum.Parse(typeof(PublicValue.NongliDay), (ts.Days+1).ToString());
                    if (((int)date.NongliMonth)%100>=11 && date.Date< new DateTime(date.Date.Year,6,1))
                    {
                        date.NongliYearFlag = true;
                    }
                    date.NongliMonthDays = (MonthEnd - MonthBegin).Days;
                }
                int tmphour = (date.Date.Hour + 1) / 2;
                if (tmphour == 12)
                {
                    tmphour = 0;
                }
                date.NongliHour = (PublicValue.DiZhi)Enum.Parse(typeof(PublicValue.DiZhi), tmphour.ToString());
            }

            for (int i = 1; i < 13; i++) //设置节气
            {
                date.BeginMonth[i-1] = JDayToDay(jq[i] + J2000 + (double)8 /(double) 24, true);
                date.BeginZodiac[i-1] = JDayToDay(zq[i] + J2000 + (double)8 /(double) 24, true);
            }
        }
Example #3
0
 //#endregion
 public void Initial()
 {
     MyCalendar m_c = new MyCalendar();
     DateEntity tmp = new DateEntity();
     tmp._date = this._date;
     m_c.SetDateEntity(ref tmp);
     this._BeginMonth = tmp._BeginMonth;
     this._BeginZodiac = tmp._BeginZodiac;
     this.nonglimonth = tmp.nonglimonth;
     this.nongliday = tmp.nongliday;
     this.nonglihour = tmp.nonglihour;
     this.nongliyearflag = tmp.nongliyearflag;
     this.NongliMonthDays = tmp.NongliMonthDays;
     if (nongliyearflag)
     {
         BaZi.BaZiBiz m_bz = PPLive.BaZi.BaZiBiz.GetInstance();
         this.nongliTG = m_bz.YearTG(_date.Year - 1);
         this.nongliDZ = m_bz.YearDZ(_date.Year - 1);
     }
     else
     {
         BaZi.BaZiBiz m_bz = PPLive.BaZi.BaZiBiz.GetInstance();
         this.nongliTG = m_bz.YearTG(_date.Year);
         this.nongliDZ = m_bz.YearDZ(_date.Year);
     }
 }
Example #4
0
        private void SetQiYun(ref BaZiMod bazi)
        {
            DateTime[] jieqi = new DateTime[2];
            PublicValue.JieQi[] jieqiname = new PublicValue.JieQi[2];
            if (bazi.BirthTime.Date < bazi.BirthTime.BeginMonth[0])
            {
                DateEntity tmpdate = new DateEntity(bazi.BirthTime.Date.AddMonths(-3));
                jieqi[0] = tmpdate.BeginMonth[11];
                jieqi[1] = bazi.BirthTime.BeginMonth[0];
                jieqiname[0] = (PublicValue.JieQi)(11);
                jieqiname[1] = (PublicValue.JieQi)(0);
            }
            else if (bazi.BirthTime.Date > bazi.BirthTime.BeginMonth[11])
            {
                DateEntity tmpdate = new DateEntity(bazi.BirthTime.Date.AddMonths(+3));
                jieqi[1] = tmpdate.BeginMonth[0];
                jieqi[0] = bazi.BirthTime.BeginMonth[11];
                jieqiname[0] = (PublicValue.JieQi)(11);
                jieqiname[1] = (PublicValue.JieQi)(0);
            }
            else
            {
                for (int i = 0; i <= 10; i++)
                {
                    if (bazi.BirthTime.Date >= bazi.BirthTime.BeginMonth[i] && bazi.BirthTime.Date <= bazi.BirthTime.BeginMonth[i + 1])
                    {
                        jieqi[0] = bazi.BirthTime.BeginMonth[i];
                        jieqi[1] = bazi.BirthTime.BeginMonth[i + 1];
                        jieqiname[0] = (PublicValue.JieQi)(i);
                        jieqiname[1] = (PublicValue.JieQi)(i + 1);
                        break;
                    }
                }
            }
            //DateTime[] zhongqi = new DateTime[2];
            //PublicValue.ZhongQi[] zhongqiname = new PublicValue.ZhongQi[2];
            //if (bazi.BirthTime.Date < bazi.BirthTime.BeginZodiac[0])
            //{
            //    DateEntity tmpdate = new DateEntity(bazi.BirthTime.Date.AddMonths(-3));
            //    zhongqi[0] = tmpdate.BeginZodiac[11];
            //    zhongqi[1] = bazi.BirthTime.BeginZodiac[0];
            //    zhongqiname[0] = (PublicValue.ZhongQi)(11);
            //    zhongqiname[1] = (PublicValue.ZhongQi)(0);
            //}
            //else if (bazi.BirthTime.Date > bazi.BirthTime.BeginZodiac[11])
            //{
            //    DateEntity tmpdate = new DateEntity(bazi.BirthTime.Date.AddMonths(+3));
            //    zhongqi[1] = tmpdate.BeginZodiac[0];
            //    zhongqi[0] = bazi.BirthTime.BeginZodiac[11];
            //    zhongqiname[0] = (PublicValue.ZhongQi)(11);
            //    zhongqiname[1] = (PublicValue.ZhongQi)(0);
            //}
            //else
            //{
            //    for (int i = 0; i < 10; i++)
            //    {
            //        if (bazi.BirthTime.Date >= bazi.BirthTime.BeginZodiac[i] && bazi.BirthTime.Date <= bazi.BirthTime.BeginZodiac[i + 1])
            //        {
            //            zhongqi[0] = bazi.BirthTime.BeginZodiac[i];
            //            zhongqi[1] = bazi.BirthTime.BeginZodiac[i + 1];
            //            zhongqiname[0] = (PublicValue.ZhongQi)(i);
            //            zhongqiname[1] = (PublicValue.ZhongQi)(i + 1);
            //            break;
            //        }
            //    }
            //}

            bazi.JieQi[0] = jieqi[0];
            bazi.JieQiName[0] = (PublicValue.AllJieQi)((int)jieqiname[0] * 2);
            bazi.JieQi[1] = jieqi[1];
            bazi.JieQiName[1] = (PublicValue.AllJieQi)((int)jieqiname[1] * 2);

            //if (jieqi[0] > zhongqi[0])
            //{
            //    bazi.JieQi[0] = jieqi[0];
            //    bazi.JieQiName[0] = (PublicValue.AllJieQi)((int)jieqiname[0] * 2);
            //}
            //else
            //{
            //    bazi.JieQi[0] = zhongqi[0];
            //    bazi.JieQiName[0] = (PublicValue.AllJieQi)((int)zhongqiname[0] * 2+1);
            //}
            //if (jieqi[1] < zhongqi[1])
            //{
            //    bazi.JieQi[1] = jieqi[1];
            //    bazi.JieQiName[1] = (PublicValue.AllJieQi)((int)jieqiname[1] * 2);
            //}
            //else
            //{
            //    bazi.JieQi[1] = zhongqi[1];
            //    bazi.JieQiName[1] = (PublicValue.AllJieQi)((int)zhongqiname[1] * 2 + 1);
            //}

            //TimeSpan tmp = bazi.JieQi[1] - bazi.JieQi[0];//两节气差

            if ((bazi.YinYang == PublicValue.ShuXing.yang && bazi.Gender == AppCmn.AppEnum.Gender.male) ||
                (bazi.YinYang == PublicValue.ShuXing.yin && bazi.Gender == AppCmn.AppEnum.Gender.female))
            {
                TimeSpan tmp1 = new TimeSpan();
                tmp1 = bazi.JieQi[1] - bazi.BirthTime.Date;
                bazi.QiYun = new TimeSpan(Convert.ToInt64(tmp1.Ticks / 3 * 365.25636));
            }
            else
            {
                TimeSpan tmp1 = new TimeSpan();
                tmp1 = bazi.BirthTime.Date - bazi.JieQi[0];
                bazi.QiYun = new TimeSpan(Convert.ToInt64(tmp1.Ticks / 3 * 365.25636));
            }
            bazi.JiaoYun = bazi.BirthTime.Date.Add(bazi.QiYun);
        }
Example #5
0
        public ZiWeiMod TransitToZiWei(DateEntity DateEntity,DateEntity Transit, AppCmn.AppEnum.Gender gender, int[] flags)
        {
            ZiWeiMod ret = new ZiWeiMod();
            ret.BirthTime = DateEntity;
            ret.TransitTime = Transit;
            ret.Gender = gender;
            ret.Type = 1;
            ret.YueMa = flags[0];
            ret.MingShenZhu = flags[1];
            ret.ShiShang = flags[2];
            ret.HuanYun = flags[3];

            setrunyue(ref ret);
            gongwei(ref ret);
            getgonggz(ref ret);
            getmingju(ref ret);
            getyingyang(ref ret);
            gettransit(ref ret);
            getzwstar(ref ret);
            setmainstar(ref ret);
            setassiststar(ref ret);
            setluma(ref ret, ret.YueMa);
            setbadstar(ref ret);
            setsihua(ref ret);
            setbadstar(ref ret);
            setguanfo(ref ret);
            setsihua(ref ret);
            setkong(ref ret);
            settaohua(ref ret);
            setfangchan(ref ret);
            setcaishou(ref ret);
            setguxing(ref ret);
            setwenguan(ref ret);
            setmonthstars(ref ret);
            setdaystars(ref ret, ret.ShiShang);
            setyearstars(ref ret);
            setmingshenzhu(ref ret, ret.MingShenZhu);
            changsheng(ref ret);
            taisui(ref ret);
            jiangqian(ref ret);
            boshi(ref ret);
            SetMiaoWang(ref ret);
            SetZiDou(ref ret);
            SetXiaoXian(ref ret);
            SetXingGong(ref ret);
            SetLiuSiHua(ref ret);
            SetLiuGong(ref ret);
            SetLiuChangQu(ref ret);
            SetLiuKuiYue(ref ret);
            SetLiuYangTuoLu(ref ret);
            return ret;
        }
Example #6
0
 private int CheckYear(DateEntity DateEntity)
 {
     int year = DateEntity.Date.Year;
     if (DateEntity.Date < DateEntity.BeginMonth[1])
     {
         year--;
     }
     return year;
 }
Example #7
0
 private int CheckMon(DateEntity DateEntity)
 {
     int mon = DateEntity.Date.Month;
     if (DateEntity.Date < DateEntity.BeginMonth[mon - 1])
     {
         mon--;
     }
     if (mon == 0)
     {
         mon = 12;
     }
     return mon;
 }
Example #8
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            ltrResult.Text = "";
            if (txtDate.Text == "" || txtDate1.Text == "")
            {
                ltrNotice.Text = "请选择日期";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';closeforseconds();", true);
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "plus(1);", true);
                return;
            }
            DateEntity m_date = new DateEntity(new DateTime(int.Parse(txtDate.Text.Split(new char[] { '-' })[0]), int.Parse(txtDate.Text.Split(new char[] { '-' })[1]), int.Parse(txtDate.Text.Split(new char[] { '-' })[2]),
               0, 0, 0));
            DateEntity m_date1 = new DateEntity(new DateTime(int.Parse(txtDate1.Text.Split(new char[] { '-' })[0]), int.Parse(txtDate1.Text.Split(new char[] { '-' })[1]), int.Parse(txtDate1.Text.Split(new char[] { '-' })[2]),
               0, 0, 0));
            if (m_date.Date >= m_date1.Date)
            {
                ltrNotice.Text = "开始日期必须在结束日期前";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';closeforseconds();", true);
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "plus(1);", true);
                return;
            }
            DataTable m_dt1 = new DataTable();
            m_dt1.Columns.Add("star");
            m_dt1.Columns.Add("gong");
            m_dt1.Columns.Add("wei");
            m_dt1.Columns.Add("hua");

            DataTable m_dt2 = new DataTable();
            m_dt2.Columns.Add("star");
            m_dt2.Columns.Add("star1");
            m_dt2.Columns.Add("hua1");
            m_dt2.Columns.Add("hua");
            m_dt2.Columns.Add("rel");

            for (int i = 0; i < 10; i++)
            {
                DataRow m_dr1 = m_dt1.NewRow();
                m_dr1["star"] = ((DropDownList)Repeater1.Items[i].FindControl("drpStar")).SelectedValue;
                m_dr1["gong"] = ((DropDownList)Repeater1.Items[i].FindControl("drpGong")).SelectedItem.Text;
                m_dr1["wei"] = ((DropDownList)Repeater1.Items[i].FindControl("drpWei")).SelectedItem.Text;
                m_dr1["hua"] = ((DropDownList)Repeater1.Items[i].FindControl("drpHua")).SelectedItem.Text;
                m_dt1.Rows.Add(m_dr1);

                DataRow m_dr2 = m_dt2.NewRow();
                m_dr2["star"] = ((DropDownList)Repeater2.Items[i].FindControl("drpStar")).SelectedValue;
                m_dr2["star1"] = ((DropDownList)Repeater2.Items[i].FindControl("drpStar1")).SelectedValue;
                //m_dr2["hua1"] = ((DropDownList)Repeater2.Items[i].FindControl("drpHua1")).SelectedValue;
                //m_dr2["hua"] = ((DropDownList)Repeater2.Items[i].FindControl("drpHua")).SelectedValue;
                m_dr2["rel"] = ((DropDownList)Repeater2.Items[i].FindControl("drpRel")).SelectedValue;
                m_dt2.Rows.Add(m_dr2);
            }

            for (int i = 0; m_date.Date < m_date1.Date; i++)
            {
                m_date = new DateEntity(m_date.Date.AddHours(2));
                ZiWeiMod tmpzw = ZiWeiBiz.GetInstance().TimeToZiWei(m_date, AppEnum.Gender.male, new int[] { 1, 1, 0,1 });
                bool flag = true;
                for (int j = 0; j < 10; j++)
                {
                    if (m_dt1.Rows[j]["star"].ToString() != "-1")
                    {
                        if (m_dt1.Rows[j]["gong"].ToString() != "请选择")
                        {
                            if (PublicValue.GetZiWeiGong(tmpzw.Gong[tmpzw.Xing[int.Parse(m_dt1.Rows[j]["star"].ToString())].Gong].GongName) != m_dt1.Rows[j]["gong"].ToString())
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (m_dt1.Rows[j]["wei"].ToString() != "请选择")
                        {
                            if (PublicValue.GetDiZhi(tmpzw.Gong[tmpzw.Xing[int.Parse(m_dt1.Rows[j]["star"].ToString())].Gong].DZ) != m_dt1.Rows[j]["wei"].ToString())
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (m_dt1.Rows[j]["hua"].ToString() != " ")
                        {
                            if (PublicValue.GetZiWeiSihua(tmpzw.Xing[int.Parse(m_dt1.Rows[j]["star"].ToString())].Hua) != m_dt1.Rows[j]["hua"].ToString())
                            {
                                flag = false;
                                break;
                            }
                        }
                    }

                    if (m_dt2.Rows[j]["star"].ToString() != "-1" && m_dt2.Rows[j]["star1"].ToString() != "-1")
                    {
                        if (m_dt2.Rows[j]["rel"].ToString() == "0" && !(tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star"].ToString())].Gong == tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star1"].ToString())].Gong))
                        {
                            flag = false;
                            break;
                        }
                        else if (m_dt2.Rows[j]["rel"].ToString() == "1" && !(Math.Abs(tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star"].ToString())].Gong - tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star1"].ToString())].Gong) == 6))
                        {
                            flag = false;
                            break;
                        }
                        else if (m_dt2.Rows[j]["rel"].ToString() == "2" && !((Math.Abs(tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star"].ToString())].Gong - tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star1"].ToString())].Gong) == 4||
                            Math.Abs(tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star"].ToString())].Gong - tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star1"].ToString())].Gong) == 8)))
                        {
                            flag = false;
                            break;
                        }
                        else if (m_dt2.Rows[j]["rel"].ToString() == "3" && !((Math.Abs(tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star"].ToString())].Gong - tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star1"].ToString())].Gong) == 6 ||
                            Math.Abs(tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star"].ToString())].Gong - tmpzw.Xing[int.Parse(m_dt2.Rows[j]["star1"].ToString())].Gong) %4==0)))
                        {
                            flag = false;
                            break;
                        }
                    }
                }
                if (flag)
                {
                    ltrResult.Text += m_date.Date.ToString("yyyy-MM-dd HH:00:00 ")+"<a href='http://pp.ssqian.com/PPLive/AstroChart.aspx?ID=-qb_"+m_date.Date.ToString("MM dd yyyy HH;00;00")+" 0_-8_120E42_21N93_-c_0_-YAo_1_5_10_8_8_8_5_-R0_1_2_3_4_5_6_7_8_9_10 14 18_21_24_27_30' target='_blank'>查看星盘</a><br />";
                }
            }
            this.ClientScript.RegisterStartupScript(this.GetType(), "", "plus(1);", true);
        }
Example #9
0
 protected void Unnamed1_Click(object sender, EventArgs e)
 {
     ltrResult.Text = "";
     if (txtDate.Text == "" || txtDate1.Text == "")
     {
         ltrNotice.Text = "请选择日期";
         this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';closeforseconds();", true);
         this.ClientScript.RegisterStartupScript(this.GetType(), "", "plus(1);", true);
         return;
     }
     DateEntity m_date = new DateEntity(new DateTime(int.Parse(txtDate.Text.Split(new char[] { '-' })[0]), int.Parse(txtDate.Text.Split(new char[] { '-' })[1]), int.Parse(txtDate.Text.Split(new char[] { '-' })[2]),
        0, 0, 0));
     DateEntity m_date1 = new DateEntity(new DateTime(int.Parse(txtDate1.Text.Split(new char[] { '-' })[0]), int.Parse(txtDate1.Text.Split(new char[] { '-' })[1]), int.Parse(txtDate1.Text.Split(new char[] { '-' })[2]),
        0, 0, 0));
     if (m_date.Date >= m_date1.Date)
     {
         ltrNotice.Text = "开始日期必须在结束日期前";
         this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';closeforseconds();", true);
         this.ClientScript.RegisterStartupScript(this.GetType(), "", "plus(1);", true);
         return;
     }
     while (m_date.Date < m_date1.Date)
     {
         BaZiMod male_bazi = new BaZiMod();
         male_bazi.BirthTime = m_date;
         male_bazi.Gender = AppEnum.Gender.male;
         BaZiBiz.GetInstance().TimeToBaZi(ref male_bazi);
         if ((((int)male_bazi.YearTG) * 100 + male_bazi.YearDZ).ToString() == drpYear.SelectedValue)
         {
             if ((((int)male_bazi.MonthTG) * 100 + male_bazi.MonthDZ).ToString() == drpMonth.SelectedValue)
             {
                 if ((((int)male_bazi.DayTG) * 100 + male_bazi.DayDZ).ToString() == drpDay.SelectedValue)
                 {
                     if ((((int)male_bazi.HourTG) * 100 + male_bazi.HourDZ).ToString() == drpHour.SelectedValue)
                     {
                         ltrResult.Text += m_date.Date.ToString("yyyy年MM月dd日HH时") + "<br />";
                         m_date = new DateEntity(m_date.Date.AddHours(2));
                         continue;
                     }
                     else
                     {
                         m_date = new DateEntity(new DateTime(m_date.Date.AddHours(2).Year, m_date.Date.AddHours(2).Month, m_date.Date.AddHours(2).Day, m_date.Date.AddHours(2).Hour,0,0));
                         continue;
                     }
                 }
                 else
                 {
                     m_date = new DateEntity(new DateTime(m_date.Date.AddDays(1).Year,m_date.Date.AddDays(1).Month,m_date.Date.AddDays(1).Day));
                     continue;
                 }
             }
             else
             {
                     m_date = new DateEntity(male_bazi.JieQi[1].AddSeconds(1));
                     continue;
             }
         }
         else
         {
             if (m_date.Date >= m_date.BeginMonth[1])
             {
                 m_date = new DateEntity(new DateEntity(m_date.Date.AddYears(1)).BeginMonth[1]);
             }
             else
             {
                 m_date = new DateEntity(m_date.BeginMonth[1]);
             }
             continue;
         }
     }
 }
Example #10
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            if (txtDate.Text == "")
            {
                ltrNotice.Text = "请选择日期";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';closeforseconds();", true);
                return;
            }

            DateEntity m_date = new DateEntity(new DateTime(int.Parse(txtDate.Text.Split(new char[] { '-' })[0]), int.Parse(txtDate.Text.Split(new char[] { '-' })[1]), int.Parse(txtDate.Text.Split(new char[] { '-' })[2]),
                int.Parse(drpHour.SelectedValue), int.Parse(drpMinute.SelectedValue), 0));
            BaZiMod male_bazi = new BaZiMod();
            male_bazi.BirthTime = m_date;
            male_bazi.Gender = AppEnum.Gender.male;
            BaZiBiz.GetInstance().TimeToBaZi(ref male_bazi);
            BaZiMod female_baze = new BaZiMod();
            female_baze.BirthTime = m_date;
            female_baze.Gender = AppEnum.Gender.female;
            BaZiBiz.GetInstance().TimeToBaZi(ref female_baze);

            if (drpDaYun.SelectedValue == "1")
            {
                SetDayun(ref male_bazi, male_bazi.DayTG, male_bazi.DayDZ);
                SetDayun(ref female_baze, female_baze.DayTG, female_baze.DayDZ);
            }
            else if (drpDaYun.SelectedValue == "2")
            {
                SetDayun(ref male_bazi, male_bazi.HourTG, male_bazi.HourDZ);
                SetDayun(ref female_baze, female_baze.HourTG, female_baze.HourDZ);
            }
            else if (drpDaYun.SelectedValue == "3")
            {
                SetDayun(ref male_bazi, BaZiBiz.GetInstance().MinuteTG(male_bazi.HourTG, male_bazi.BirthTime.Date.Minute + (male_bazi.BirthTime.Date.Hour + 1) % 2 * 60), BaZiBiz.GetInstance().MinuteDZ(male_bazi.BirthTime.Date.Minute + (male_bazi.BirthTime.Date.Hour + 1) % 2 * 60));
                SetDayun(ref female_baze, BaZiBiz.GetInstance().MinuteTG(female_baze.HourTG, female_baze.BirthTime.Date.Minute + (female_baze.BirthTime.Date.Hour + 1) % 2 * 60), BaZiBiz.GetInstance().MinuteDZ(female_baze.BirthTime.Date.Minute + (female_baze.BirthTime.Date.Hour + 1) % 2 * 60));
            }
            ltrResult.Text = BaziToHTML(male_bazi);
            ltrResult.Text += "<br /><br />" + BaziToHTML(female_baze);
        }