static int daysPerMonth(month Month, int Year)
        {
            switch (Month) {
            case month.january:
            case month.march:
            case month.may:
            case month.july:
            case month.august:
            case month.october:
            case month.december:
                return 31;

            case month.april:
            case month.june:
            case month.september:
            case month.november:
                return 30;

            case month.february:
                if (Year % 4 == 0) {
                    if (Year % 100 == 0) {
                        if (Year % 400 == 0)
                            return 29;
                        return 28;
                    }
                    return 29;
                } else
                    return 28;
            default:
                throw new Exception ("The program could not continue because the universe has imploded. Please try again later.");
            }
        }
Exemple #2
0
    public static void Main()
    {
        month mon = new month();

        Console.WriteLine("以下1表示是,0表示不是。");
        Console.WriteLine("你的生日的月份在这里面吗?");
        mon.show(0);
        int a1 = Console.Read() - '0';

        for (;;)
        {
            if (a1 == 1 || a1 == 0)
            {
                break;
            }
            Console.WriteLine();
            Console.WriteLine("请输入0或1");
            a1 = Console.Read() - '0';
        }
        Console.WriteLine();
        Console.WriteLine("你的生日的月份在这里面吗?");
        mon.show(1);
        int a2 = Console.Read() - '0';

        for (;;)
        {
            if (a2 == 1 || a2 == 0)
            {
                break;
            }
            Console.WriteLine();
            Console.WriteLine("请输入0或1");
            a2 = Console.Read() - '0';
        }
        Console.WriteLine();
        Console.WriteLine("你的生日的月份在这里面吗?");
        mon.show(2);
        int a3 = Console.Read() - '0';

        for (;;)
        {
            if (a3 == 1 || a3 == 0)
            {
                break;
            }
            Console.WriteLine();
            Console.WriteLine("请输入0或1");
            a3 = Console.Read() - '0';
        }
        Console.WriteLine();
        Console.WriteLine("你的生日的月份在这里面吗?");
        mon.show(3);
        int a4 = Console.Read() - '0';

        for (;;)
        {
            if (a4 == 1 || a4 == 0)
            {
                break;
            }
            Console.WriteLine();
            Console.WriteLine("请输入0或1");
            a4 = Console.Read() - '0';
        }
        Console.WriteLine();

        Day day = new Day();

        Console.WriteLine("你的生日的日期在里面吗?");
        day.show(0);
        int d1 = Console.Read() - '0';

        for (;;)
        {
            if (d1 == 1 || d1 == 0)
            {
                break;
            }
            Console.WriteLine();
            Console.WriteLine("请输入0或1");
            d1 = Console.Read() - '0';
        }
        Console.WriteLine();

        Console.WriteLine("你的生日的日期在里面吗?");
        day.show(1);
        int d2 = Console.Read() - '0';

        for (;;)
        {
            if (d2 == 1 || d2 == 0)
            {
                break;
            }
            Console.WriteLine();
            Console.WriteLine("请输入0或1");
            d2 = Console.Read() - '0';
        }
        Console.WriteLine();

        Console.WriteLine("你的生日的日期在里面吗?");
        day.show(2);
        int d3 = Console.Read() - '0';

        for (;;)
        {
            if (d3 == 1 || d3 == 0)
            {
                break;
            }
            Console.WriteLine();
            Console.WriteLine("请输入0或1");
            d3 = Console.Read() - '0';
        }
        Console.WriteLine();

        Console.WriteLine("你的生日的日期在里面吗?");
        day.show(3);
        int d4 = Console.Read() - '0';

        for (;;)
        {
            if (d4 == 1 || d4 == 0)
            {
                break;
            }
            Console.WriteLine();
            Console.WriteLine("请输入0或1");
            d4 = Console.Read() - '0';
        }
        Console.WriteLine();

        Console.WriteLine("你的生日的日期在里面吗?");
        day.show(4);
        int d5 = Console.Read() - '0';

        for (;;)
        {
            if (d5 == 1 || d5 == 0)
            {
                break;
            }
            Console.WriteLine();
            Console.WriteLine("请输入0或1");
            d5 = Console.Read() - '0';
        }
        Console.WriteLine();

        Console.Write("你的生日为:");
        int mon1 = a4 * 8 + a3 * 4 + a2 * 2 + a1;
        int day1 = d5 * 16 + d4 * 8 + d3 * 4 + d2 * 2 + d1;

        Console.WriteLine(mon1 + "月" + day1 + "日");
        Console.Read();
    }
 private void bind()
 {
     List<month> List = new List<month>();
     for (int i = 1; i < 13; i++)
     {
         month m = new month(i);
         List.Add(m);
     }
     rptETDetail.DataSource = List;
     rptETDetail.DataBind();
     Year = Request.QueryString["year"];
     entid = int.Parse(Request.QueryString["entid"]);
     ETName.InnerHtml = blldjent.GetDJS8id(entid.ToString())[0].Name;
 }
    private void bind()
    {
        List<month> List = new List<month>();
        for (int i = 1; i < 13; i++)
        {
            month m = new month(i);
            List.Add(m);
        }
        rptETDetail.DataSource = List;
        rptETDetail.DataBind();

        Year = Request.QueryString["year"];
        dptid = Request.QueryString["dptid"];
        ETName.InnerHtml = bllgovdepart.GetById(Guid.Parse(dptid)).Name;
    }