protected void Button11_Click(object sender, EventArgs e) { int year = System.Convert.ToInt32(SelectYears.SelectedValue); int month = System.Convert.ToInt32(SelectMonth.SelectedValue); int day = System.Convert.ToInt32(SelectDay.SelectedValue); DateTime dt = new DateTime(year, month, day); switch (myFunction) { case Age: //DOB not working value won't passed to service AgeCalculation.DOB d = new AgeCalculation.DOB(); AgeCalculation.Service1 ws = new AgeCalculation.Service1(); d.Day = dt.Day; d.Month = dt.Month; d.Year = dt.Year; //ws.Ages(d, out int agesResult, out bool AgesresualtSpecified, out int days, out bool daysSpecified, out string yourAge); ws.Ages(d, out int AgesResult, out bool AgesResultSpecified, out int days, out bool daysSpecified, out string yourAge); this.Label1.Text = "Your ages: "; this.TextBox1.Text = yourAge; this.Label1.Visible = true; this.TextBox1.Visible = true; this.SelectDay.Items.Clear(); this.SelectMonth.Items.Clear(); this.SelectYears.Items.Clear(); break; case AgeYMD: AgeCalculation.Service1 wsYMD = new AgeCalculation.Service1(); wsYMD.AgesYMD(year, true, month, true, day, true, out int AgesYMDResult, out bool agesYMDResultSpecified, out int Outdays, out bool dayspecified, out string OutyourAge); this.Label1.Text = "Your ages: "; this.TextBox1.Text = OutyourAge; this.Label1.Visible = true; this.TextBox1.Visible = true; break; } this.SelectYears.Visible = false; this.SelectDay.Visible = false; this.SelectMonth.Visible = false; this.Button11.Visible = false; }
protected void Calendar1_SelectionChanged(object sender, EventArgs e) { switch (myFunction) { case Age: //DOB not working value won't passed to service AgeCalculation.DOB d = new AgeCalculation.DOB(); AgeCalculation.Service1 ws = new AgeCalculation.Service1(); d.Day = this.Calendar1.SelectedDate.Day; d.Month = this.Calendar1.SelectedDate.Month; d.Year = this.Calendar1.SelectedDate.Year; //ws.Ages(d, out int agesResult, out bool AgesresualtSpecified, out int days, out bool daysSpecified, out string yourAge); int agesResult; bool AgesresualtSpecified; int days; bool daysSpecified; string yourAge; ws.Ages(d, out agesResult, out AgesresualtSpecified, out days, out daysSpecified, out yourAge); this.Label1.Text = "Your ages: "; this.TextBox1.Text = yourAge; this.Label1.Visible = true; this.TextBox1.Visible = true; break; case AgeYMD: AgeCalculation.Service1 wsYMD = new AgeCalculation.Service1(); int day = this.Calendar1.SelectedDate.Day; int month = this.Calendar1.SelectedDate.Month; int year = this.Calendar1.SelectedDate.Year; wsYMD.AgesYMD(year, true, month, true, day, true, out int AgesYMDResult, out bool agesYMDResultSpecified, out int Outdays, out bool dayspecified, out string OutyourAge); this.Label1.Text = "Your ages: "; this.TextBox1.Text = OutyourAge; this.Label1.Visible = true; this.TextBox1.Visible = true; break; } }
protected void Button9_Click(object sender, EventArgs e) { this.myFunction = AgeYMD; this.Label1.Visible = false; this.TextBox1.Visible = false; this.Button11.Visible = true; this.Calendar1.Visible = true; this.SelectYears.Items.Add("Select year"); for (int i = 1950; i <= DateTime.Today.Year; i++) { this.SelectYears.Items.Add(i.ToString()); } this.SelectYears.Visible = true; this.SelectMonth.Items.Add("Slect Month"); for (int i = 1; i <= 12; i++) { this.SelectMonth.Items.Add(i.ToString()); } this.SelectMonth.Visible = true; this.SelectDay.Items.Add("Select Day"); for (int i = 1; i <= 31; i++) { this.SelectDay.Items.Add(i.ToString()); } this.SelectDay.Visible = true; AgeCalculation.Service1 ws = new AgeCalculation.Service1(); // ws.CalculateDays(int day, out bool daySpecified, int Month, out bool MonthSpecified, int year, out bool yearSpecified, out int CalculateDaysResult, out bool CalateDaysResultSpecified); ws.CalculateDays(18, true, 10, true, 1960, true, out int CalculateDaysResult, out bool CalateDaysResultSpecified); this.TextBox1.Text = CalculateDaysResult.ToString(); this.Label1.Text = "Your days in the earth: "; this.TextBox1.Visible = true; this.Label1.Visible = true; }