#pragma warning disable CA1707 // Identifiers should not contain underscores protected void Page_Load(object sender, EventArgs e) #pragma warning restore CA1707 // Identifiers should not contain underscores { SetupViewState(); GlstuSearch = (StuGLSearch)ViewState["_gstuSearch"]; if (GlstuSearch.LottoType == TargetTable.None || GlstuSearch.LngTotalSN == 0) { Response.Write("<script language='javascript'>window.close();</script>"); } else { if (!IsPostBack) { if (ViewState["title"] == null) { ViewState.Add("title", string.Format(InvariantCulture, "{0}:{1}", "活性總表圖", new CglDBData().SetTitleString(GlstuSearch))); } if (ViewState["CurrentNums"] == null) { ViewState["CurrentNums"] = new CglData().GetDataNumsDici(GlstuSearch); } if (ViewState["CurrentData"] == null) { ViewState["CurrentData"] = new CglFunc().CDicTOTable(new CglData().GetCurrentDataDics(GlstuSearch)); } if (ViewState["FreqActive"] == null) { StuGLSearch stuGLSearchTemp = GlstuSearch; stuGLSearchTemp.ShowProcess = ShowProcess.Visible; stuGLSearchTemp.InDisplayPeriod = (stuGLSearchTemp.InDisplayPeriod < stuGLSearchTemp.InSearchLimit) ? stuGLSearchTemp.InSearchLimit : stuGLSearchTemp.InDisplayPeriod; ViewState.Add("FreqActive", new CglFreq().GetFreqActiveDic(stuGLSearchTemp)); } } //_dicCurrentNums = (Dictionary<string, int>)ViewState["CurrentNums"]; _dicNumcssclass = new GalaxyApp().GetNumcssclass(GlstuSearch); dtCurrentData = (DataTable)ViewState["CurrentData"]; _dicFreqActive = (Dictionary <string, DataTable>)ViewState["FreqActive"]; Page.Title = ViewState["title"].ToString(); SetddlNums(); ShowResult(GlstuSearch); } CurrentSearchOrderID = string.Empty; }
#pragma warning disable CA1707 // Identifiers should not contain underscores protected void Page_Load(object sender, EventArgs e) #pragma warning restore CA1707 // Identifiers should not contain underscores { SetupViewState(); if (_gstuSearch.LottoType == TargetTable.None || _gstuSearch.LngTotalSN == 0) { Response.Write("<script language='javascript'>window.close();</script>"); } else { _gstuSearch = (StuGLSearch)ViewState["_gstuSearch"]; DicCurrentNums = new CglData().GetDataNumsDici(_gstuSearch); if (ViewState["title"] == null) { ViewState.Add("title", string.Format(InvariantCulture, "{0}:{1}", "百分比預測表", new CglDBData().SetTitleString(_gstuSearch))); } Page.Title = ViewState["title"].ToString(); ShowResult(_gstuSearch); } ResetSearchOrder(TablePercentID); //Search.CurrentSearchOrderID = string.Empty; }
protected void Calendar01_SelectionChanged(object sender, EventArgs e) { using DataTable dtDate = new CglData().GetDateData(Calendar01.SelectedDate.Date); DataRow drDAte = dtDate.NewRow(); // 找農曆 TaiwanLunisolarCalendar tlc = new TaiwanLunisolarCalendar(); int leapMouth = tlc.GetLeapMonth(tlc.GetYear(Calendar01.SelectedDate.Date)); int LuniMouth = tlc.GetMonth(Calendar01.SelectedDate.Date); if (leapMouth > 0) { if (LuniMouth == leapMouth) { LuniMouth = leapMouth - 1; } else if (LuniMouth > leapMouth) { LuniMouth -= 1; } } drDAte["lngDateSN"] = string.Format(InvariantCulture, "{0}{1:d2}{2:d2}", Calendar01.SelectedDate.Year, Calendar01.SelectedDate.Month, Calendar01.SelectedDate.Day); drDAte["lngCDateSN"] = string.Format(InvariantCulture, "{0}{1:d2}{2:d2}", tlc.GetYear(Calendar01.SelectedDate.Date), LuniMouth, tlc.GetDayOfMonth(Calendar01.SelectedDate.Date)); //找紫微 StuPurple stuTemp = new StuPurple { StrWYear = Calendar01.SelectedDate.Year.ToString(InvariantCulture), StrWMonth = Calendar01.SelectedDate.Month.ToString("d2", InvariantCulture), StrWDay = Calendar01.SelectedDate.Day.ToString("d2", InvariantCulture), StrWHour = "YY11", IntGender = CglPurple.Gender.MalePlus }; stuTemp.Init(); foreach (KeyValuePair <string, string> KeyPair in stuTemp.DicUpdateData) { if (KeyPair.Key != "lngDateSN") { if (KeyPair.Value.Length >= 4) { drDAte[KeyPair.Key] = KeyPair.Value.Substring(0, 4); } else { drDAte[KeyPair.Key] = KeyPair.Value; } } } // dtDate.Rows.Add(drDAte); GridView gvDate = new GalaxyApp().CreatGridView("gvDate", " gltabel ", dtDate, true, true); gvDate.DataBind(); pnlCalendar.Controls.Add(gvDate); // 一些使用的範例程式 //StringBuilder stringBuilder = new StringBuilder(0,8000); //for (int i = 2007; i <= 2050; i++) //{ // CNDate cd1 = new CNDate(new DateTime(i, Calendar01.SelectedDate.Date.Month, Calendar01.SelectedDate.Date.Day)); // stringBuilder.AppendLine("計算 " + i + "年隔年農曆過年的國曆日期:" + cd1.GetNextLunarNewYearDate().ToLongDateString() + "<br/>"); //} //CNDate cd = new CNDate(Calendar01.SelectedDate); //stringBuilder.AppendLine("今年農曆天數:" + cd.LunarYearDays(2007).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 01 月農曆天數:" + cd.LunarMonthDays(2007, 1).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 02 月農曆天數:" + cd.LunarMonthDays(2007, 2).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 03 月農曆天數:" + cd.LunarMonthDays(2007, 3).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 04 月農曆天數:" + cd.LunarMonthDays(2007, 4).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 05 月農曆天數:" + cd.LunarMonthDays(2007, 5).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 06 月農曆天數:" + cd.LunarMonthDays(2007, 6).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 07 月農曆天數:" + cd.LunarMonthDays(2007, 7).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 08 月農曆天數:" + cd.LunarMonthDays(2007, 8).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 09 月農曆天數:" + cd.LunarMonthDays(2007, 9).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 10 月農曆天數:" + cd.LunarMonthDays(2007, 10).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 11 月農曆天數:" + cd.LunarMonthDays(2007, 11).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今年 12 月農曆天數:" + cd.LunarMonthDays(2007, 12).ToString(InvariantCulture) + "<br/>"); //stringBuilder.AppendLine("今天的農曆日期:" + cd.GetLunarHolDay() + "<br/>"); //stringBuilder.AppendLine("今年的農曆潤月月份:" + cd.GetLeapMonth(2007) + "<br/>"); //stringBuilder.AppendLine("計算國曆當天對應的節氣:" + cd.LGetLunarHolDay() + "<br/>"); //stringBuilder.AppendLine("計算今年農曆過年的國曆日期:" + cd.GetLunarNewYearDate().ToLongDateString() + "<br/>"); //lblCC.Text = stringBuilder.ToString(); }