Beispiel #1
0
    // 以數字取得生肖
    protected void bn_GetLunarZodiac_Click(object sender, EventArgs e)
    {
        Calendar_Func dfc = new Calendar_Func();

        int ckint = 1;

        int.TryParse(tb_GetLunarZodiac_int.Text, out ckint);

        lb_GetLunarZodiac.Text = dfc.GetLunarZodiac(ckint);
    }
Beispiel #2
0
    // 以數字取得地支
    protected void bn_GetEarthlyBranch_Click(object sender, EventArgs e)
    {
        Calendar_Func dfc = new Calendar_Func();

        int ckint = 1;

        int.TryParse(tb_GetEarthlyBranch_int.Text, out ckint);

        lb_GetEarthlyBranch.Text = dfc.GetEarthlyBranch(ckint);
    }
Beispiel #3
0
    // 以數字取得天干
    protected void bn_GetHeavenlyStem_Click(object sender, EventArgs e)
    {
        Calendar_Func dfc = new Calendar_Func();

        int ckint = 1;

        int.TryParse(tb_GetHeavenlyStem_int.Text, out ckint);

        lb_GetHeavenlyStem.Text = dfc.GetHeavenlyStem(ckint);
    }
Beispiel #4
0
    // 以小時對映農曆時辰
    protected void bn_GetChHour_Click(object sender, EventArgs e)
    {
        Calendar_Func dfc = new Calendar_Func();

        int ckint = 1;

        int.TryParse(tb_GetChHour_int.Text, out ckint);

        lb_GetChHour.Text = dfc.GetChHour(ckint);
    }
Beispiel #5
0
    // 以西元日期時間換算農曆日期時間
    protected void bn_GetLunarDate_Click(object sender, EventArgs e)
    {
        Calendar_Func dfc = new Calendar_Func();

        DateTime cktime = DateTime.Now;

        if (! DateTime.TryParse(tb_GetLunarDate_datetime.Text, out cktime))
        {
            cktime = DateTime.Now;
            tb_GetLunarDate_datetime.Text = cktime.ToString("yyyy/MM/dd HH:mm:ss");
        }

        lb_GetLunarDate.Text = dfc.GetLunarDate(cktime, tb_GetLunarDate_format.Text);
    }
Beispiel #6
0
    // 以西元日期取得農曆生肖
    protected void bn_GetDateLunarZodiac_Click(object sender, EventArgs e)
    {
        Calendar_Func dfc = new Calendar_Func();

        DateTime cktime = DateTime.Now;

        if (!DateTime.TryParse(tb_GetDateLunarZodiac.Text, out cktime))
        {
            cktime = DateTime.Now;
            tb_GetDateLunarZodiac.Text = cktime.ToString("yyyy/MM/dd HH:mm:ss");
        }

        lb_GetDateLunarZodiac.Text = dfc.GetDateLunarZodiac(cktime);
    }
Beispiel #7
0
    // 設定右側行事曆內容
    private void Set_List(DateTime fDay)
    {
        Calendar_Func dfc = new Calendar_Func();
        int iCnt = 0;
        string SqlString = "";

        using (SqlConnection Sql_Conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["AppSysConnectionString"].ConnectionString))
        {
            Sql_Conn.Open();

            using (SqlCommand Sql_Command = new SqlCommand())
            {
                SqlDataReader Sql_Reader;

                SqlString = "Select c.ca_btime, c.ca_sid, c.ca_class, g.cg_name, c.ca_subject, c.is_attach, c.init_time";
                SqlString += " From Ca_Calendar c Inner Join Ca_Group g On c.cg_sid = g.cg_sid";
                SqlString += " Where c.mg_sid = @mg_sid And Convert(NChar(10), c.ca_btime, 111) = @ca_btime";
                SqlString += " Order by c.ca_btime";

                Sql_Command.Connection = Sql_Conn;
                Sql_Command.CommandText = SqlString;

                for (iCnt = 0; iCnt < 7; iCnt++)
                {
                    Label lb_wk = (Label)Page.FindControl("lb_wk" + iCnt.ToString());
                    Literal lt_wk = (Literal)Page.FindControl("lt_wk" + iCnt.ToString());
                    DateTime nday = fDay.AddDays(iCnt);

                    lb_wk.Text = nday.ToString("yyyy/MM/dd") + "<br>" + nday.ToString("dddd") + "<br><br>" + dfc.GetLunarDate(nday, "Md");

                    Sql_Command.Parameters.Clear();
                    Sql_Command.Parameters.AddWithValue("mg_sid", Session["mg_sid"].ToString());
                    Sql_Command.Parameters.AddWithValue("ca_btime", nday.ToString("yyyy/MM/dd"));

                    Sql_Reader = Sql_Command.ExecuteReader();

                    if (Sql_Reader.Read())
                    {
                        lt_wk.Text = "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";

                        do
                        {
                            lt_wk.Text += "<tr valign=\"top\" onclick=\"show_win('50021.aspx?sid=" + Sql_Reader["ca_sid"].ToString();
                            lt_wk.Text += "&dtm=" + nday.ToString("yyyy/MM/dd") + "', 450, 600)\" onMouseOver=\"this.bgColor='#00CCFF'\" onMouseOut=\"this.bgColor='#FAFAD2'\"><td align=left style=\"width:36px\">";

                            switch (Sql_Reader["ca_class"].ToString())
                            {
                                case "1":
                                    lt_wk.Text += "<img src=\"../images/ico/important.gif\" alt=\"重要\" title=\"重要\" border=0>";
                                    break;

                                case "2":
                                    lt_wk.Text += "<img src=\"../images/ico/minus.gif\" alt=\"不重要\" title=\"不重要\" border=0>";
                                    break;

                                default:
                                    lt_wk.Text += "<img src=\"../images/ico/normal.gif\" alt=\"普通\" title=\"普通\" border=0>";
                                    break;
                            }

                            if (Sql_Reader["is_attach"].ToString() == "1")
                                lt_wk.Text += "<img src=\"../images/ico/clip.gif\" alt=\"附加檔案\" title=\"附加檔案\" border=0>";
                            else
                                lt_wk.Text += "<img src=\"../images/ico/normal.gif\" alt=\"無附加檔案\" title=\"無附加檔案\" border=0>";

                            lt_wk.Text += "</td>";

                            lt_wk.Text += "<td align=\"left\" style=\"width:60px\">" + DateTime.Parse(Sql_Reader["ca_btime"].ToString()).ToString("HH:mm") + "</td>";
                            lt_wk.Text += "<td align=\"left\">" + Sql_Reader["ca_subject"].ToString().Trim() + "&nbsp;</td>";
                            lt_wk.Text += "<td align=\"center\" style=\"width:60px\">" + DateTime.Parse(Sql_Reader["init_time"].ToString()).ToString("yyyy/MM/dd") + "</td>";
                            lt_wk.Text += "<td align=\"center\" style=\"width:60px\">" + Sql_Reader["cg_name"].ToString().Trim() + "</td>";

                            lt_wk.Text += "</tr>";
                        } while (Sql_Reader.Read());

                        lt_wk.Text += "</table>";
                    }
                    else
                        lt_wk.Text = "&nbsp;";

                    Sql_Reader.Close();
                    Sql_Reader.Dispose();

                    Sql_Command.Dispose();
                }
            }
        }
    }