private void ShowStep(int step) { for (int i = 0; i <= _stepCount; i++) { ((Panel)steps[i]).Visible = false; } ((Panel)steps[step - 1]).Visible = true; if (step == _stepCount) { lblToDoEntryTitle.Text = tbTitle.Text; if (DateTime.MinValue.AddDays(1) >= dtcStartDate.SelectedDate) { s5StartDateRow.Visible = false; } else if (DateTime.MinValue.AddDays(1) >= dtcEndDate.SelectedDate) { s5EndDateRow.Visible = false; } else { s5EndDateRow.Visible = true; s5StartDateRow.Visible = true; lblStartDate.Text = dtcStartDate.SelectedDate.ToString("g"); lblEndDate.Text = dtcEndDate.SelectedDate.ToString("g"); } switch (sUnit) { case "ToDo": btnAddGroup.Visible = false; s5RowForEntry1.Visible = false; s5RowForEntry2.Visible = false; s5RowForToDo1.Visible = true; s5RowForToDo2.Visible = chbToDoMustBeConfirmed.Checked; lblCompletionType.Text = ddToDoCompletionType.SelectedItem.Text; if (ddlManager.Enabled) { lblManagerName.Text = ddlManager.SelectedItem.Text; } else { lblManagerName.Text = lblManager.Text; } break; case "Entry": btnAddGroup.Visible = true; s5RowForEntry1.Visible = true; s5RowForEntry2.Visible = true; s5RowForToDo1.Visible = false; s5RowForToDo2.Visible = false; lblEntryType.Text = ddEntryType.SelectedItem.Text; trManager.Visible = false; lblLocation.Text = tbLocation.Text; break; } lblPriority.Text = ddPriority.SelectedItem.Text; lblDescription.Text = tbDescription.Text; lblProjectTitle.Text = ddProject.SelectedItem.Text; s5OnlyRow.Visible = s4OnlyForMe.Checked; s5TeamRow.Visible = s4AssignTeam.Checked; if (s5TeamRow.Visible) { DataTable dt = (DataTable)ViewState["Team"]; dlTeam.DataSource = dt.DefaultView; dlTeam.DataBind(); } } if (step == _stepCount + 1) { DataTable dt = (DataTable)ViewState["Team"]; if (s4OnlyForMe.Checked) { dt.Clear(); DataRow dr = dt.NewRow(); dr["UserId"] = Security.CurrentUser.UserID; dr["MustBeConfirmed"] = false; dt.Rows.Add(dr); } int iManagerId; if (ddlManager.Enabled) { iManagerId = int.Parse(ddlManager.SelectedItem.Value); } else { iManagerId = int.Parse(txtManagerId.Value); } int iProjectId = int.Parse(ddProject.SelectedItem.Value); int iPriorityId = int.Parse(ddPriority.SelectedItem.Value); switch (sUnit) { case "ToDo": int iCompletionType = int.Parse(ddToDoCompletionType.SelectedItem.Value); ViewState["UnitID"] = ToDo.CreateFromWizard(iProjectId, iManagerId, tbTitle.Text, tbDescription.Text, dtcStartDate.SelectedDate, dtcEndDate.SelectedDate, iPriorityId, (int)ActivationTypes.AutoWithCheck, iCompletionType, chbToDoMustBeConfirmed.Checked, -1, dt, PrimaryKeyId.Empty, PrimaryKeyId.Empty); Response.Redirect("../Wizards/CommonWizard.aspx?ObjectType=6&ObjectID=" + ViewState["UnitID"].ToString()); break; case "Entry": int iEntryTypeId = int.Parse(ddEntryType.SelectedItem.Value); ViewState["UnitID"] = CalendarEntry.CreateFromWizard(tbTitle.Text, tbDescription.Text, tbLocation.Text, iProjectId, iPriorityId, iEntryTypeId, dtcStartDate.SelectedDate, dtcEndDate.SelectedDate, dt, PrimaryKeyId.Empty, PrimaryKeyId.Empty); Response.Redirect("../Wizards/CommonWizard.aspx?ObjectType=4&ObjectID=" + ViewState["UnitID"].ToString()); break; } } }