Beispiel #1
0
    protected void submitNewCategoryTime(object sender, EventArgs e)
    {
        int      catID;
        DateTime startDateTimeObject;
        DateTime endDateTimeObject;

        if (dropdownCategoryTypes.SelectedIndex == 0)
        {
            catMessageText.InnerHtml = "Please select a category";
        }
        else if (catStartTime.Text == "")
        {
            catMessageText.InnerHtml = "Please enter a start time";
        }
        else if (catEndTime.Text == "")
        {
            catMessageText.InnerHtml = "Please enter an end time";
        }
        if ((catID = dropdownCategoryTypes.SelectedIndex) != -1)
        {
            catID = dropdownCategoryTypes.SelectedIndex;

            string startDate = catStartDate.Text + ' ' + catStartTime.Text;
            startDateTimeObject = Convert.ToDateTime(startDate);

            string endDate = catEndDate.Text + ' ' + catEndTime.Text;
            endDateTimeObject = Convert.ToDateTime(endDate);

            clsDataLayer dataLayer = new clsDataLayer();

            dataLayer.InsertCategoryInstance(username, catID, startDateTimeObject, endDateTimeObject);
        }

        Response.Redirect("frmDashBoard.aspx");
    }