예제 #1
0
        public ReturnValue <BaZiMod> TimeToBaZi()
        {
            BaZiMod input = new BaZiMod();

            //int nReadCount = 0;
            //MemoryStream ms = new MemoryStream();
            //byte[] buffer = new byte[1024];
            //while ((nReadCount = openPageData.Read(buffer, 0, 1024)) > 0)
            //{
            //    ms.Write(buffer, 0, nReadCount);
            //}
            //byte[] byteJson = ms.ToArray();
            //string textJson = System.Text.Encoding.Default.GetString(byteJson);

            //input = (BaZiMod)XMS.Core.Json.JsonSerializer.Deserialize(textJson, typeof(BaZiMod));

            //if (input == null)
            //{
            input.BirthTime = new PPLive.DateEntity(DateTime.Now);
            input.Gender    = AppEnum.Gender.male;
            input.RealTime  = false;
            //}

            BaZiBiz.GetInstance().TimeToBaZi(ref input);
            return(ReturnValue <BaZiMod> .Get200OK(input));
        }
예제 #2
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(), "", "show(0);", 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(), "", "show(0);", true);
                return;
            }

            List <RSH_BaziConditionMod> m_condition = new List <RSH_BaziConditionMod>();


            for (int i = 0; i < 50; i++)
            {
                if (Repeater1.Items[i].FindControl("drpItem").Visible)
                {
                    RSH_BaziConditionMod m_tmp = new RSH_BaziConditionMod();

                    m_tmp.Item      = int.Parse(((DropDownList)Repeater1.Items[i].FindControl("drpItem")).SelectedValue);
                    m_tmp.Type      = int.Parse(((DropDownList)Repeater1.Items[i].FindControl("drpType")).SelectedValue);
                    m_tmp.Condition = int.Parse(((DropDownList)Repeater1.Items[i].FindControl("drpCondition")).SelectedValue);
                    m_tmp.Target    = int.Parse(((DropDownList)Repeater1.Items[i].FindControl("drpTarget")).SelectedValue);
                    m_condition.Add(m_tmp);
                }
            }

            for (int i = 0; m_date.Date < m_date1.Date; i++)
            {
                m_date = new DateEntity(m_date.Date.AddHours(2));
                BaZiMod tmpzw = new BaZiMod();
                tmpzw.BirthTime = m_date;
                tmpzw.Gender    = AppEnum.Gender.male;
                BaZiBiz.GetInstance().TimeToBaZi(ref tmpzw);
                bool flag = true;
                for (int j = 0; j < 50; j++)
                {
                    //逻辑筛选
                }
                if (flag)
                {
                    ltrResult.Text += m_date.Date.ToString("yyyy-MM-dd HH:00:00 ") + "<br />";
                }
            }
            //this.ClientScript.RegisterStartupScript(this.GetType(), "", "show(0);", true);
        }
예제 #3
0
 //和盘排盘
 protected void SetHePan()
 {
     BaZiBiz.GetInstance().TimeToBaZi(ref _m_bazi);
     Literal2.Text = BaZiBiz.GetInstance().BaziToHTML(m_bazi, total);
     if (!IsPostBack)
     {
         ViewState["OriginalChart1"] = m_bazi;
         ViewState["NowChart1"]      = m_bazi;
     }
 }
예제 #4
0
        public ReturnValue <BaZiMod> TimeToBaZi(Stream openPageData)
        {
            BaZiMod      input      = new BaZiMod();
            int          nReadCount = 0;
            MemoryStream ms         = new MemoryStream();

            byte[] buffer = new byte[1024];
            while ((nReadCount = openPageData.Read(buffer, 0, 1024)) > 0)
            {
                ms.Write(buffer, 0, nReadCount);
            }
            byte[] byteJson = ms.ToArray();
            string textJson = System.Text.Encoding.Default.GetString(byteJson);

            input = (BaZiMod)XMS.Core.Json.JsonSerializer.Deserialize(textJson, typeof(BaZiMod));



            if (input == null)
            {
                input           = new BaZiMod();
                input.BirthTime = new PPLive.DateEntity(DateTime.Now);
                input.Gender    = AppEnum.Gender.male;
                input.RealTime  = false;
            }
            else
            {
                if (input.IsDayLight)
                {
                    input.BirthTime = new DateEntity(input.BirthTime.Date.AddHours(-1));
                }
                if (input.RealTime)
                {
                    input.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(input.BirthTime.Date, new LatLng("30.00", input.Longitude, input.AreaName)));
                }
                else
                {
                    input.BirthTime = new PPLive.DateEntity(input.BirthTime.Date);
                }
            }

            BaZiBiz.GetInstance().TimeToBaZi(ref input);
            return(ReturnValue <BaZiMod> .Get200OK(input));
        }
예제 #5
0
        public string BaziToHTML(BaZiMod mod)
        {
            string ret = "";

            ret += mod.BirthTime.Date.ToString("yyyy-MM-dd HH:mm") + "  (" + AppEnum.GetGender(mod.Gender) + ")<br />";
            ret += PublicValue.GetTianGan(mod.YearTG) + PublicValue.GetDiZhi(mod.YearDZ) + " " +
                   PublicValue.GetTianGan(mod.MonthTG) + PublicValue.GetDiZhi(mod.MonthDZ) + " " +
                   PublicValue.GetTianGan(mod.DayTG) + PublicValue.GetDiZhi(mod.DayDZ) + " " +
                   PublicValue.GetTianGan(mod.HourTG) + PublicValue.GetDiZhi(mod.HourDZ) + " " +
                   PublicValue.GetTianGan(BaZiBiz.GetInstance().MinuteTG(mod.HourTG, mod.BirthTime.Date.Minute + (mod.BirthTime.Date.Hour + 1) % 2 * 60)) +
                   PublicValue.GetDiZhi(BaZiBiz.GetInstance().MinuteDZ(mod.BirthTime.Date.Minute + (mod.BirthTime.Date.Hour + 1) % 2 * 60)) + " " +
                   "(" + PublicValue.GetDiZhi(mod.XunKong0) + PublicValue.GetDiZhi(mod.XunKong1) + "空)<br /><br />";
            ret += "大运:";
            for (int i = 0; i < dayun; i++)
            {
                ret += PublicValue.GetTianGan(mod.Dayun[i].YearTG) + PublicValue.GetDiZhi(mod.Dayun[i].YearDZ) + " " +
                       PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(mod.Dayun[i].YearTG, mod.YearTG)).ShiShen) + "|";
            }
            ret += "<br />";
            ret += "始于:";
            for (int i = 0; i < dayun; i++)
            {
                ret += mod.Dayun[i].Begin.ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|";
            }
            ret += "<br />";
            ret += "流年:";
            for (int i = 0; i < 10; i++)
            {
                if (i != 0)
                {
                    ret += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                }
                for (int j = 0; j < dayun; j++)
                {
                    ret += PublicValue.GetTianGan(BaZiBiz.GetInstance().YearTG(mod.Dayun[j].Begin + i)) + PublicValue.GetDiZhi(BaZiBiz.GetInstance().YearDZ(mod.Dayun[j].Begin + i)) + " " +
                           PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(BaZiBiz.GetInstance().YearTG(mod.Dayun[j].Begin + i), mod.DayTG)).ShiShen) + "|";
                }
                ret += "<br />";
            }
            return(ret);
        }
예제 #6
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);
        }
예제 #7
0
        public ReturnValue <QA_QuestionShow <BaZiMod> > GetQuestionForBaZi(int sysno)
        {
            QA_QuestionMod            tmp = QA_QuestionBll.GetInstance().GetModel(sysno);
            QA_QuestionShow <BaZiMod> ret = new QA_QuestionShow <BaZiMod>();

            tmp.MemberwiseCopy(ret);

            USR_CustomerShow tmpu = new USR_CustomerShow();

            USR_CustomerBll.GetInstance().GetModel(ret.CustomerSysNo).MemberwiseCopy(tmpu);
            ret.Customer = tmpu;
            #region 设置命盘
            FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(ret.SysNo);
            if (m_chart != null)
            {
                BaZiMod  m_bazi    = new BaZiMod();
                string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' });
                m_bazi.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.FirstBirth.ToString()),
                                                                                    new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName)));
                m_bazi.AreaName  = m_chart.FirstPoiName.ToString();
                m_bazi.Longitude = tmplatlng[0];
                m_bazi.Gender    = (AppEnum.Gender)m_chart.FirstGender;
                BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi);
                ret.Chart.Add(m_bazi);
                if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString())
                {
                    BaZiMod m_bazi1 = new BaZiMod();
                    tmplatlng         = m_chart.SecondPoi.ToString().Split(new char[] { '|' });
                    m_bazi1.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.SecondBirth.ToString()),
                                                                                         new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName)));
                    m_bazi1.AreaName  = m_chart.SecondPoiName.ToString();
                    m_bazi1.Longitude = tmplatlng[0];
                    m_bazi1.Gender    = (AppEnum.Gender)m_chart.SecondGender;
                    BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi1);
                    ret.Chart.Add(m_bazi1);
                }
            }
            #endregion
            return(ReturnValue <QA_QuestionShow <BaZiMod> > .Get200OK(ret));
        }
예제 #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;
            }
            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;
                }
            }
        }
예제 #9
0
        public QA_QuestionShowMini <BaZiMod> MapQA_QuestionShowMiniForBaZi(DataRow input)
        {
            QA_QuestionShowMini <BaZiMod> ret = new QA_QuestionShowMini <BaZiMod>();

            if (input["Award"].ToString() != "")
            {
                ret.Award = int.Parse(input["Award"].ToString());
            }
            if (input["CateSysNo"].ToString() != "")
            {
                ret.CateSysNo = int.Parse(input["CateSysNo"].ToString());
            }
            #region 设置命盘
            FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(int.Parse(input["SysNo"].ToString()));
            if (m_chart != null)
            {
                BaZiMod  m_bazi    = new BaZiMod();
                string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' });
                m_bazi.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.FirstBirth.ToString()),
                                                                                    new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName)));
                m_bazi.AreaName  = m_chart.FirstPoiName.ToString();
                m_bazi.Longitude = tmplatlng[0];
                m_bazi.Gender    = (AppEnum.Gender)m_chart.FirstGender;
                BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi);
                ret.Chart.Add(m_bazi);
                if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString())
                {
                    BaZiMod m_bazi1 = new BaZiMod();
                    tmplatlng         = m_chart.SecondPoi.ToString().Split(new char[] { '|' });
                    m_bazi1.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.SecondBirth.ToString()),
                                                                                         new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName)));
                    m_bazi1.AreaName  = m_chart.SecondPoiName.ToString();
                    m_bazi1.Longitude = tmplatlng[0];
                    m_bazi1.Gender    = (AppEnum.Gender)m_chart.SecondGender;
                    BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi1);
                    ret.Chart.Add(m_bazi1);
                }
            }
            #endregion
            ret.Context = input["Context"].ToString();
            if (input["NickName"] == null)
            {
                USR_CustomerMod m_customer = USR_CustomerBll.GetInstance().GetModel(int.Parse(input["CustomerSysNo"].ToString()));

                ret.CustomerNickName = m_customer.NickName;
                ret.CustomerPhoto    = m_customer.Photo;
            }
            else
            {
                ret.CustomerNickName = input["NickName"].ToString();
                ret.CustomerPhoto    = input["Photo"].ToString();
            }
            if (input["CustomerSysNo"].ToString() != "")
            {
                ret.CustomerSysNo = int.Parse(input["CustomerSysNo"].ToString());
            }
            ret.DR = int.Parse(input["DR"].ToString());
            if (input["EndTime"].ToString() != "")
            {
                ret.EndTime = DateTime.Parse(input["EndTime"].ToString());
            }
            if (input["IsSecret"].ToString() != "")
            {
                ret.IsSecret = int.Parse(input["IsSecret"].ToString());
            }
            if (input["LastReplyTime"].ToString() != "")
            {
                ret.LastReplyTime = DateTime.Parse(input["LastReplyTime"].ToString());
            }
            if (input["LastReplyUser"].ToString() != "")
            {
                ret.LastReplyUser = int.Parse(input["LastReplyUser"].ToString());
            }
            if (input["ReadCount"].ToString() != "")
            {
                ret.ReadCount = int.Parse(input["ReadCount"].ToString());
            }
            if (input["ReplyCount"].ToString() != "")
            {
                ret.ReplyCount = int.Parse(input["ReplyCount"].ToString());
            }
            if (input["SysNo"].ToString() != "")
            {
                ret.SysNo = int.Parse(input["SysNo"].ToString());
            }
            ret.Title = input["Title"].ToString();
            if (input["TS"].ToString() != "")
            {
                ret.TS = DateTime.Parse(input["TS"].ToString());
            }

            return(ret);
        }