예제 #1
0
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            TourService service = new TourService(Ioc.GetInstance <ITourRepository>());

            bool     success = false;
            DateTime?startDate, endDate;

            if (Validated(out startDate, out endDate))
            {
                Tour tour = new Tour()
                {
                    TourId    = Guid.NewGuid(),
                    TourName  = txtTourName.Text.Trim(),
                    StartDate = startDate,
                    EndDate   = endDate,
                    Official  = chkOfficial.Checked
                };

                service.SaveCommit(tour, out success);
            }

            if (success)
            {
                phSuccess.Visible = true;
                phError.Visible   = false;
            }
            else
            {
                phError.Visible   = true;
                phSuccess.Visible = false;
            }
        }