private void frmMainTest_Load(object sender, EventArgs e) { this.TempPath = this.AddBS(Environment.GetEnvironmentVariable("Temp")); this.cmbBaziTypeS.SelectedIndex = 0; DateTime nowDT = DateTime.Now; this.curTZ = TimeZone.CurrentTimeZone.GetUtcOffset(nowDT).Negate().TotalHours; // 中国: 东 8 区 this.curJD = LunarHelper.NowUTCmsSince19700101(nowDT) / 86400000d - 10957.5 - this.curTZ / 24d; //J2000起算的儒略日数(当前本地时间) JD.setFromJD(this.curJD + LunarHelper.J2000); this.Caly_y.Text = JD.Y.ToString(); this.Cml_y.Text = JD.Y.ToString(); this.Cml_m.Text = JD.M.ToString(); this.Cml_d.Text = JD.D.ToString(); this.Cml_his.Text = JD.h + ":" + JD.m + ":" + JD.s.ToString("F0").PadLeft(2, '0'); this.Cal_y.Text = JD.Y.ToString(); this.Cal_m.Text = JD.M.ToString(); this.curJD = LunarHelper.int2(this.curJD + 0.5); this.InitComboBoxes(); this.ML_calc(BaZiType.ZtyBaZi); this.getlunar(); this.timerTick.Enabled = true; this.showClockAndSunMoonInfo(); }
public void Dispose() { foreach (JsonDocument JD in JDs) { JD.Dispose(); } foreach (ManagementСonsole MC in MCs) { MC.Dispose(); } }
private string RTS1(double jd, double vJ, double vW, double tz) { SZJ.calcRTS(jd, 1, vJ, vW, tz); //升降计算,使用北时时间,tz=-8指东8区,jd+tz应在当地正午左右(误差数小时不要紧) string s; LunarInfoListT <double> ob = SZJ.rts[0]; JD.setFromJD(jd + LunarHelper.J2000); s = "日出 " + ob.s + " 日落 " + ob.j + " 中天 " + ob.z + "\r\n" + "月出 " + ob.Ms + " 月落 " + ob.Mj + " 月中 " + ob.Mz + "\r\n" + "晨起天亮 " + ob.c + " 晚上天黑 " + ob.h + "\r\n" + "日照时间 " + ob.sj + " 白天时间 " + ob.ch + "\r\n"; return(s); }
// GET: TL public ActionResult DeleteConfirmed(int id) { if (Session["type"] != null) { string type = Session["type"].ToString(); if (type == "1") { JD jD = db.JDs.Find(id); db.JDs.Remove(jD); db.SaveChanges(); return(RedirectToAction("Index")); } } return(Redirect(Url.Content("~/"))); }
public ActionResult SetQualificationJD(JD P) { //int x = 2; Project_ManagementEntities6 db = new Project_ManagementEntities6(); if (ModelState.IsValid) { P.user_id = Convert.ToInt32(Session["id"]); db.JDs.Add(P); db.SaveChanges(); return(RedirectToAction("../Home/newHomePage")); } return(View(P)); }
private void showClockAndSunMoonInfo() { if (this.Cal_pause.Checked) { return; } //this.timerTick.Enabled = false; // C#: Debug //this.Cal_pause.Checked = true; // C#: Debug DateTime nowDT = DateTime.Now; // 显示太阳月亮坐标 double jd = LunarHelper.NowUTCmsSince19700101(nowDT) / 86400000d - 10957.5; //J2000起算的儒略日数 //jd = 3391.31877640; // C#: Debug jd += JD.deltatT2(jd); this.smc.calc(jd, JWdata.J, JWdata.W, 0); //传入力学时间(J2000.0起算) this.Cal_zb.Text = smc.toText(1); // 显示实时时间 this.lblLocalClock.Text = nowDT.ToLocalTime().ToString(); string rg = ""; double h = JWdata.SQTimeDifference; string v = JWdata.DaylightInfo; jd = LunarHelper.NowUTCmsSince19700101(nowDT) / 86400000d - 10957.5 + h / 24; if (v.Length > 0) { double y1 = JD.Y, y2 = y1; //该时所在年份 double m1 = double.Parse(v.Substring(0, 2)), m2 = double.Parse(v.Substring(5, 2)); if (m2 < m1) { y2++; } //nnweek(y,m,n,w)求y年m月第n个星期w的jd double J1 = JD.nnweek(y1, m1, double.Parse(v.Substring(2, 1)), double.Parse(v.Substring(3, 1))) - 0.5 - LunarHelper.J2000 + (v[4] - 97) / 24d; double J2 = JD.nnweek(y2, m2, double.Parse(v.Substring(7, 1)), double.Parse(v.Substring(8, 1))) - 0.5 - LunarHelper.J2000 + (v[9] - 97) / 24d; if (jd >= J1 && jd < J2) { jd += 1 / 24d; rg = "¤"; } //夏令时 } JD.setFromJD(jd + LunarHelper.J2000); this.lblSQClock.Text = JD.D + "日 " + JD.h + ":" + JD.m + ":" + LunarHelper.int2(JD.s) + rg; //与了与clock1同步,秒数取整而不四舍五入 }
private static void Main(string[] args) { Program p = new Program(); Lunar lun = new Lunar(); double curJD, curTZ; sun_moon smc = new sun_moon(); DateTime nowDT = DateTime.Now; curTZ = -8; //TimeZone.CurrentTimeZone.GetUtcOffset(nowDT).Negate().TotalHours; // 中国: 东 8 区 curJD = LunarHelper.NowUTCmsSince19700101(nowDT) / 86400000d - 10957.5 - curTZ / 24d; //J2000起算的儒略日数(当前本地时间) JD.setFromJD(curJD + LunarHelper.J2000); string Cal_y = JD.Y.ToString(); string Cal_m = JD.M.ToString(); curJD = LunarHelper.int2(curJD + 0.5); // double By = LunarHelper.year2Ayear<string>(this.Cal_y.Text); //// C#: 注: 使用上句也可以, 如果在调用泛型方法时, 不指定类型, C# 编译器将自动推断其类型 double By = LunarHelper.year2Ayear(Cal_y); // 自动推断类型为: string double Bm = int.Parse(Cal_m); lun.yueLiHTML((int)By, (int)Bm, curJD, nowDT.Day);//html月历生成,结果返回在lun中,curJD为当前日期(用于设置今日标识) //显示n指定的日期信息 OB ob = lun.lun[nowDT.Day - 1]; // double vJ = JWdata.J, vW = JWdata.W; double vJ = -1.9768762660922441, vW = 0.40346194541935582; //广州 string thisDaySunMoonInfo = p.RTS1(ob.d0, vJ, vW, curTZ); // p.RTS1(ob.d0, vJ, vW, curTZ); // 计算并显示指定日期的日月升降信息 StringBuilder sb = new StringBuilder(); sb.AppendLine(LunarHelper.Ayear2year(ob.y) + "年" + ob.m + "月" + ob.d + "日"); //公历日期 sb.AppendLine(ob.Lyear3 + "年 星期" + JD.Weeks[(int)(ob.week)] + " " + ob.XiZ); // 丁酉年 星期日 狮子座 sb.AppendLine(ob.Lyear4 + "年 " + ob.Lleap + ob.Lmc + "月" + (ob.Ldn > 29 ? "大 " : "小 ") + ob.Ldc + "日"); // 4715年 润六月大 初八日 sb.AppendLine(ob.Lyear2 + "年 " + ob.Lmonth2 + "月 " + ob.Lday2 + "日"); // 丁酉年 丁未月 戊午日 sb.AppendLine("回历[" + ob.Hyear + "年" + ob.Hmonth + "月" + ob.Hday + "日]"); //回历[1438年11月6日] Console.WriteLine(thisDaySunMoonInfo); Console.WriteLine(sb.ToString()); Console.ReadLine(); }
private void getlun(DateTime dt) { Lunar lun = new Lunar(); double curJD, curTZ; sun_moon smc = new sun_moon(); //DateTime nowDT = DateTime.Now; curTZ = -8; //TimeZone.CurrentTimeZone.GetUtcOffset(nowDT).Negate().TotalHours; // 中国: 东 8 区 curJD = LunarHelper.NowUTCmsSince19700101(dt) / 86400000d - 10957.5 - curTZ / 24d; //J2000起算的儒略日数(当前本地时间) JD.setFromJD(curJD + LunarHelper.J2000); string Cal_y = JD.Y.ToString(); string Cal_m = JD.M.ToString(); curJD = LunarHelper.int2(curJD + 0.5); // double By = LunarHelper.year2Ayear<string>(this.Cal_y.Text); //// C#: 注: 使用上句也可以, 如果在调用泛型方法时, 不指定类型, C# 编译器将自动推断其类型 double By = LunarHelper.year2Ayear(Cal_y); // 自动推断类型为: string double Bm = int.Parse(Cal_m); lun.yueLiHTML((int)By, (int)Bm, curJD, dt.Day); //html月历生成,结果返回在lun中,curJD为当前日期(用于设置今日标识) //显示n指定的日期信息 ob = lun.lun[dt.Day - 1]; }
/// <summary> /// Job status. /// </summary> public override void EvaluateStatus(string idToken, object optInfo, string DeployDir, out bool isRunning, out bool isTerminated, out int ExitCode) { using (var tr = new FuncTrace()) { int id = int.Parse(idToken); ISchedulerJob JD; //if (optInfo != null && optInfo is ISchedulerJob _JD) { // JD = _JD; //} else { using (new BlockTrace("Scheduler.OpenJob", tr)) { JD = Scheduler.OpenJob(id); } //} /* * the following seems really slow: * * * List<SchedulerJob> allFoundJobs = new List<SchedulerJob>(); * ISchedulerCollection allJobs; * using (new BlockTrace("Scheduler.GetJobList", tr)) { * allJobs = Scheduler.Get * } * int cc = allJobs.Count; * Console.WriteLine("MsHpcClient: " + cc + " jobs."); * tr.Logger.Info("list of " + cc + " jobs."); * using (new BlockTrace("ID_FILTERING", tr)) { * foreach (SchedulerJob sJob in allJobs) { * if (sJob.Id != id) * continue; * allFoundJobs.Add(sJob); * } * * if (allFoundJobs.Count <= 0) { * // some weird state * isRunning = false; * isTerminated = false; * ExitCode = int.MinValue; * return; * } * } * * SchedulerJob JD; * using (new BlockTrace("SORTING", tr)) { * JD = allFoundJobs.ElementAtMax(MsHpcJob => MsHpcJob.SubmitTime); * } */ using (new BlockTrace("TASK_FILTERING", tr)) { ISchedulerCollection tasks = JD.GetTaskList(null, null, false); ExitCode = int.MinValue; foreach (ISchedulerTask t in tasks) { DeployDir = t.WorkDirectory; ExitCode = t.ExitCode; } } using (new BlockTrace("STATE_EVAL", tr)) { switch (JD.State) { case JobState.Configuring: case JobState.Submitted: case JobState.Validating: case JobState.ExternalValidation: case JobState.Queued: isRunning = false; isTerminated = false; break; case JobState.Running: case JobState.Finishing: isRunning = true; isTerminated = false; break; case JobState.Finished: isRunning = false; isTerminated = true; break; case JobState.Failed: case JobState.Canceled: case JobState.Canceling: isRunning = false; isTerminated = true; break; default: throw new NotImplementedException("Unknown job state: " + JD.State); } } } }