예제 #1
0
        public void testLiuYue()
        {
            Solar     solar = new Solar(1983, 2, 15, 20, 0, 0);
            Lunar     lunar = solar.getLunar();
            EightChar bazi  = lunar.getEightChar();
            Yun       yun   = bazi.getYun(0);

            DaYun[] daYun = yun.getDaYun();

            String[]  ganZhi  = { "甲寅", "乙卯", "丙辰", "丁巳", "戊午", "己未", "庚申", "辛酉", "壬戌", "癸亥", "甲子", "乙丑" };
            LiuNian[] liuNian = daYun[0].getLiuNian();
            LiuYue[]  l       = liuNian[0].getLiuYue();
            for (int i = 0, j = l.Length; i < j; i++)
            {
                LiuYue liuYue = l[i];
                Assert.AreEqual(ganZhi[i], liuYue.getGanZhi());
            }

            ganZhi  = new String[] { "庚寅", "辛卯", "壬辰", "癸巳", "甲午", "乙未", "丙申", "丁酉", "戊戌", "己亥", "庚子", "辛丑" };
            liuNian = daYun[4].getLiuNian();
            l       = liuNian[2].getLiuYue();
            for (int i = 0, j = l.Length; i < j; i++)
            {
                LiuYue liuYue = l[i];
                Assert.AreEqual(ganZhi[i], liuYue.getGanZhi());
            }
        }
예제 #2
0
        public void testXiaoYun()
        {
            Solar     solar = new Solar(1983, 2, 15, 20, 0, 0);
            Lunar     lunar = solar.getLunar();
            EightChar bazi  = lunar.getEightChar();
            Yun       yun   = bazi.getYun(0);

            DaYun[] daYun = yun.getDaYun();

            int[]     years  = { 1983, 1984, 1985, 1986, 1987, 1988 };
            int[]     ages   = { 1, 2, 3, 4, 5, 6 };
            String[]  ganZhi = { "乙亥", "丙子", "丁丑", "戊寅", "己卯", "庚辰" };
            XiaoYun[] l      = daYun[0].getXiaoYun();
            for (int i = 0, j = l.Length; i < j; i++)
            {
                XiaoYun xiaoYun = l[i];
                Assert.AreEqual(years[i], xiaoYun.getYear());
                Assert.AreEqual(ages[i], xiaoYun.getAge());
                Assert.AreEqual(ganZhi[i], xiaoYun.getGanZhi());
            }

            years  = new int[] { 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038 };
            ages   = new int[] { 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 };
            ganZhi = new String[] { "辛酉", "壬戌", "癸亥", "甲子", "乙丑", "丙寅", "丁卯", "戊辰", "己巳", "庚午" };
            l      = daYun[5].getXiaoYun();
            for (int i = 0, j = l.Length; i < j; i++)
            {
                XiaoYun xiaoYun = l[i];
                Assert.AreEqual(years[i], xiaoYun.getYear());
                Assert.AreEqual(ages[i], xiaoYun.getAge());
                Assert.AreEqual(ganZhi[i], xiaoYun.getGanZhi(), years[i] + "年");
            }
        }
예제 #3
0
        public void testQiYun()
        {
            Solar     solar = new Solar(1983, 2, 15, 20, 0, 0);
            Lunar     lunar = solar.getLunar();
            EightChar bazi  = lunar.getEightChar();
            Yun       yun   = bazi.getYun(0);

            Assert.AreEqual(6, yun.getStartYear());
            Assert.AreEqual(2, yun.getStartMonth());
            Assert.AreEqual(20, yun.getStartDay());
            Assert.AreEqual("1989-05-05", yun.getStartSolar().toYmd());

            solar = new Solar(2013, 7, 13, 16, 17, 0);
            lunar = solar.getLunar();
            bazi  = lunar.getEightChar();
            yun   = bazi.getYun(0);
            Assert.AreEqual(8, yun.getStartYear());
            Assert.AreEqual(4, yun.getStartMonth());
            Assert.AreEqual(0, yun.getStartDay());
            Assert.AreEqual("2021-11-13", yun.getStartSolar().toYmd());

            solar = new Solar(2020, 8, 18, 10, 0, 0);
            lunar = solar.getLunar();
            bazi  = lunar.getEightChar();
            yun   = bazi.getYun(0);
            Assert.AreEqual(3, yun.getStartYear());
            Assert.AreEqual(8, yun.getStartMonth());
            Assert.AreEqual(0, yun.getStartDay());
            Assert.AreEqual("2024-04-18", yun.getStartSolar().toYmd());

            solar = new Solar(1972, 6, 15, 0, 0, 0);
            lunar = solar.getLunar();
            bazi  = lunar.getEightChar();
            yun   = bazi.getYun(1);
            Assert.AreEqual(7, yun.getStartYear());
            Assert.AreEqual(5, yun.getStartMonth());
            Assert.AreEqual(10, yun.getStartDay());
            Assert.AreEqual("1979-11-25", yun.getStartSolar().toYmd());

            solar = new Solar(1968, 11, 22, 0, 0, 0);
            lunar = solar.getLunar();
            bazi  = lunar.getEightChar();
            yun   = bazi.getYun(1);
            Assert.AreEqual(5, yun.getStartYear());
            Assert.AreEqual(1, yun.getStartMonth());
            Assert.AreEqual(20, yun.getStartDay());
            Assert.AreEqual("1974-01-11", yun.getStartSolar().toYmd());

            solar = new Solar(1968, 11, 23, 0, 0, 0);
            lunar = solar.getLunar();
            bazi  = lunar.getEightChar();
            yun   = bazi.getYun(1);
            Assert.AreEqual(4, yun.getStartYear());
            Assert.AreEqual(9, yun.getStartMonth());
            Assert.AreEqual(20, yun.getStartDay());
            Assert.AreEqual("1973-09-12", yun.getStartSolar().toYmd());
        }
예제 #4
0
        public void testDaYun()
        {
            int[]     startYears = { 1983, 1989, 1999, 2009, 2019, 2029, 2039, 2049, 2059, 2069 };
            int[]     endYears   = { 1988, 1998, 2008, 2018, 2028, 2038, 2048, 2058, 2068, 2078 };
            int[]     startAges  = { 1, 7, 17, 27, 37, 47, 57, 67, 77, 87 };
            int[]     endAges    = { 6, 16, 26, 36, 46, 56, 66, 76, 86, 96 };
            String[]  yearGanZhi = { "", "乙卯", "丙辰", "丁巳", "戊午", "己未", "庚申", "辛酉", "壬戌", "癸亥" };
            Solar     solar      = new Solar(1983, 2, 15, 20, 0, 0);
            Lunar     lunar      = solar.getLunar();
            EightChar bazi       = lunar.getEightChar();
            Yun       yun        = bazi.getYun(0);

            DaYun[] l = yun.getDaYun();
            for (int i = 0, j = l.Length; i < j; i++)
            {
                DaYun daYun = l[i];
                Assert.AreEqual(startYears[i], daYun.getStartYear());
                Assert.AreEqual(endYears[i], daYun.getEndYear());
                Assert.AreEqual(startAges[i], daYun.getStartAge());
                Assert.AreEqual(endAges[i], daYun.getEndAge());
                Assert.AreEqual(yearGanZhi[i], daYun.getGanZhi());
            }
        }
예제 #5
0
 public ActionResult Secret(Yun.User.UserDetail model, string province, string city, string area)
 {
     DateTime? birthday = null;
     if(string.IsNullOrWhiteSpace(model.Email) || string.IsNullOrWhiteSpace(model.Mobile))
     {
         ViewBag.ErrMsg = "用户手机或者邮箱为空";
         return View(model);
     }
      var req = YunShop.Core.YunClient.Instance.Execute(new Yun.User.Request.ModifyUserInfoRequest
      {
          Avatar = model.Avatar,
          // Birthday = model.Birthday,
          Email = model.Email,
          IsMale = model.Sex == "男" ? 1 : 0,
          Mobile = model.Mobile,
          Nick = model.Nick,
          RealName = model.RealName,
          Address = model.Address,
          Province = province,
          City = city,
          Area = !string.IsNullOrWhiteSpace(area) ? area : "",
          Birthday = string.IsNullOrWhiteSpace(model.Birthday) ? Convert.ToDateTime(model.Birthday) : birthday,
          Remark = model.Remark,
          Phone = model.Mobile,
      }, Member.Token);
      if (!req.IsError)
      {
          YunShop.Core.Cache.CacheManage.TokenUserCache.Remove(Member.Token.Hash());
          ViewBag.ErrMsg = "2";
      }
      else
      {
          ViewBag.ErrMsg = req.ErrMsg;
      }
      return View(model);
 }
예제 #6
0
        static void Main(string[] args)
        {
            // 阳历
            Solar solar = new Solar(2020, 5, 26, 23, 42, 0);

            Console.WriteLine(solar);
            Console.WriteLine(solar.toFullString());

            // 阴历
            Lunar lunar = solar.getLunar();

            Console.WriteLine(lunar);
            Console.WriteLine(lunar.toFullString());

            // 八字
            EightChar baZi = lunar.getEightChar();

            Console.WriteLine(baZi.getYear() + " " + baZi.getMonth() + " " + baZi.getDay() + " " + baZi.getTime());

            // 八字纳音
            Console.WriteLine(baZi.getYearNaYin() + " " + baZi.getMonthNaYin() + " " + baZi.getDayNaYin() + " " + baZi.getTimeNaYin());

            // 八字五行
            Console.WriteLine(baZi.getYearWuXing() + " " + baZi.getMonthWuXing() + " " + baZi.getDayWuXing() + " " + baZi.getTimeWuXing());

            // 八字天干十神
            Console.WriteLine(baZi.getYearShiShenGan() + " " + baZi.getMonthShiShenGan() + " " + baZi.getDayShiShenGan() + " " + baZi.getTimeShiShenGan());

            // 八字地支十神
            Console.WriteLine(baZi.getYearShiShenZhi()[0] + " " + baZi.getMonthShiShenZhi()[0] + " " + baZi.getDayShiShenZhi()[0] + " " + baZi.getTimeShiShenZhi()[0]);

            // 八字年支十神
            foreach (string s in baZi.getYearShiShenZhi())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            // 八字月支十神
            foreach (string s in baZi.getMonthShiShenZhi())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            // 八字日支十神
            foreach (string s in baZi.getDayShiShenZhi())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            // 八字时支十神
            foreach (string s in baZi.getTimeShiShenZhi())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            // 八字胎元
            Console.WriteLine(baZi.getTaiYuan());

            // 八字命宫
            Console.WriteLine(baZi.getMingGong());

            // 八字身宫
            Console.WriteLine(baZi.getShenGong());

            Console.WriteLine();
            solar = new Solar(1988, 3, 20, 18, 0, 0);
            lunar = solar.getLunar();
            EightChar bazi = lunar.getEightChar();

            // 男运
            Yun yun = bazi.getYun(1);

            Console.WriteLine("阳历" + solar.toYmdHms() + "出生");
            Console.WriteLine("出生" + yun.getStartYear() + "年" + yun.getStartMonth() + "个月" + yun.getStartDay() + "天后起运");
            Console.WriteLine("阳历" + yun.getStartSolar().toYmd() + "后起运");
            Console.WriteLine();

            // 节假日
            List <Holiday> holidays = HolidayUtil.getHolidays(2012);

            foreach (Holiday holiday in holidays)
            {
                Console.WriteLine(holiday);
            }
            Console.WriteLine();

            // 八字转阳历
            List <Solar> solars = Solar.fromBaZi("庚子", "戊子", "己卯", "庚午");

            foreach (Solar d in solars)
            {
                Console.WriteLine(d.toFullString());
            }
            Console.WriteLine();

            Console.ReadLine();
        }
        private List<ExportTradeFormat> ConvertTradeToExportTrade(Yun.Trade.SnapshotTrade m)
        {
            if (m != null)
            {
                var result = new List<ExportTradeFormat>();

                for (var i = 0; i < m.Orders.Count; i++)
                {
                    var order = m.Orders[i];

                    result.Add(new ExportTradeFormat
                    {
                        Address = m.Address,
                        Mobile = m.Mobile,
                        RealName = m.RealName,
                        CreateTime = m.CreateTime,
                        PayTime = m.PayTime,
                        OrderId = m.Id.ToString(),
                        Money = order.Money.ToString(),
                        TotalMoney = HandleShoppingCartData(i, m.TotalFunds.ToString()),
                        Remark = HandleShoppingCartData(i, m.Remark),
                        TradeStatus = TranslationTradeState(m.TradeStatus),
                        ItemTitle = order.ItemTitle,
                        Price = order.Price,
                        Quantity = order.Quantity,
                        Sku = GetSku(order),
                        SellerMemo = m.SellerMemo == null ? "" : m.SellerMemo.Remark,
                        ItemCode = order.Code,
                        ItemId = order.ItemId,
                        UserName = m.Nick,
                        WeixinMoney =
                            HandleShoppingCartData(i,
                                IsPaid(m) && m.PaymentInfo.OnlinePayResult != null &&
                                m.PaymentInfo.OnlinePayResult.PayCode.Equals("weixin",
                                    StringComparison.CurrentCultureIgnoreCase)
                                    ? m.PaymentInfo.OnlinePayResult.Online.ToString()
                                    : ""),
                        AlipayMoney =
                            HandleShoppingCartData(i,
                                IsPaid(m) && m.PaymentInfo.OnlinePayResult != null &&
                                m.PaymentInfo.OnlinePayResult.PayCode.Equals("alipay",
                                    StringComparison.CurrentCultureIgnoreCase)
                                    ? m.PaymentInfo.OnlinePayResult.Online.ToString()
                                    : ""),
                        PrepaidcardMoney =
                            HandleShoppingCartData(i, IsPaid(m) ? m.PaymentInfo.PrepaidCard.ToString() : ""),
                        ShopName = HandleShoppingCartData(i, m.ShopName),
                        Cash = HandleShoppingCartData(i, IsPaid(m) ? m.PaymentInfo.Cash.ToString() : "")
                    });
                }

                return result;
            }

            return null;
        }