Ejemplo n.º 1
0
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            ResetPanels();

            TopicService service = new TopicService(Ioc.GetInstance<ITopicRepository>());

            bool success = false;
            DateTime startDate;
            DateTime endDate;
            Guid? showType = null;
            Guid? tourType = null;
            TopicType t = TopicType.None;

            if (Validated(out startDate, out endDate))
            {
                if (ddlShowType.SelectedValue != "-1" && ddlTourType.SelectedValue == "-1")
                {
                    Guid g = new Guid(ddlShowType.SelectedValue);
                    showType = g;
                    t = TopicType.Show;
                }
                else if (ddlShowType.SelectedValue == "-1" && ddlTourType.SelectedValue != "-1")
                {
                    Guid g = new Guid(ddlTourType.SelectedValue);
                    tourType = g;
                    t = TopicType.Tour;
                }

                Topic topic = new Topic()
                {
                    TopicName = txtTopicName.Text.Trim(),
                    TopicId = Guid.NewGuid(),
                    StartDate = startDate,
                    EndDate = endDate,
                    Notes = txtNotes.Text.Trim(),
                    ShowId = showType,
                    TourId = tourType,
                    Type = (short)t
                };

                service.SaveCommit(topic, out success);
            }
        }