/// <summary> /// 根据配置文件描述动态创建报表窗体界面 /// </summary> /// <param name="_reportName"></param> public void LoadReport(string _reportName) { try { reportName = _reportName; flowLayoutPanel1.Controls.Clear(); sqlQuery = xmlWork.GetReportParam(reportName); Control ctl = null; foreach (ParamInfo param in sqlQuery.paramList) { switch (param.controltype.ToLower().Trim()) { case "mycomboboxdept": ctl = new MyComboBoxDept(); break; case "mydateedit": ctl = new MyDateEdit(); break; case "mydutydoctor": ctl = new MyDutyDoctor(); break; case "myqctype": ctl = new MyQCType(); break; case "mydia": ctl = new Mydia(); break; case "mydateeditbegin": ctl = new MyDateEditBegin(); break; //新增的输入年份控件 add by ywk 2013年8月1日 17:28:48 case "inputyear": ctl = new InputYear(); break; case "inputmonth": ctl = new InputMonth(); break; } ctl.Name = param.name; MyLabel lb = new MyLabel(); lb.AutoSize = false; lb.Text = param.controlcaption; flowLayoutPanel1.Controls.Add(lb); flowLayoutPanel1.Controls.Add(ctl); } BindControlData(); } catch (Exception ex) { throw ex; } }
static void Main(string[] args) { String InputMonth; int DaysInTheMonth; string FebAnswer; Console.WriteLine("Input the current month."); InputMonth = Console.ReadLine(); if (InputMonth.ToUpper() == "APRIL") { DaysInTheMonth = 30; } else if (InputMonth.ToUpper() == "JUNE") { DaysInTheMonth = 30; } else if (InputMonth.ToUpper() == "SEPTEMBER") { DaysInTheMonth = 30; } else if (InputMonth.ToUpper() == "NOVEMBER") { DaysInTheMonth = 30; } else if (InputMonth.ToUpper() == "FEBRUARY") { Console.WriteLine("Is it a leap year? Y or N"); FebAnswer = Console.ReadLine(); FebAnswer.ToUpper(); if (FebAnswer == "Y") { DaysInTheMonth = 29; } else { DaysInTheMonth = 28; } } else { DaysInTheMonth = 31; } Console.WriteLine("The number of days in " + InputMonth + " is " + DaysInTheMonth); Console.ReadKey(); }