Exemplo n.º 1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            lblError.Visible = false;
            if (infoIsValid())
            {
                if (timeTableDT == null)
                {
                    timeTableDT = new ProviderEDSC.ActivityScheduleGridDTDataTable();
                }

                ScheduleDT = getTimetable(false);

                ProviderEDSC.ActivityScheduleGridDTRow dr = timeTableDT.NewActivityScheduleGridDTRow();
                if (txtEndDate.Text == "")
                {
                    lblError.Text = "* Required";
                    txtEndDate.Focus();
                }
                else
                {
                    var aSched = getTimetableInput();
                    ScheduleDT.AddActivityScheduleDTRow(aSched);
                    SetScheduleDataSource();
                    //SetTimetableDataSource();
                    SetTimetablePreview();
                    btnAdd.Text = "Add another timetable";
                }
            }
            else
            {
                lblError.Visible = true;
            }
        }
Exemplo n.º 2
0
        public ProviderEDSC.ActivityScheduleDTDataTable getTimetable(bool checkDelete)
        {
            ScheduleDT = new ProviderEDSC.ActivityScheduleDTDataTable();
            foreach (GridViewRow row in gridviewTimetable.Rows)
            {
                CheckBox    chkboxSelected0   = row.FindControl("chkboxSelected0") as CheckBox;
                HiddenField hdnStartDateTime  = row.FindControl("hdnStartDateTime") as HiddenField;
                HiddenField hdnEndDateTime    = row.FindControl("hdnEndDateTime") as HiddenField;
                HiddenField hdnExpiryDateTime = row.FindControl("hdnExpiryDateTime") as HiddenField;
                HiddenField hdnRecurrenceType = row.FindControl("hdnRecurrenceType") as HiddenField;
                HiddenField hdnRecurEvery     = row.FindControl("hdnRecurEvery") as HiddenField;
                HiddenField hdnOnMonday       = row.FindControl("hdnOnMonday") as HiddenField;
                HiddenField hdnOnTuesday      = row.FindControl("hdnOnTuesday") as HiddenField;
                HiddenField hdnOnWednesday    = row.FindControl("hdnOnWednesday") as HiddenField;
                HiddenField hdnOnThursday     = row.FindControl("hdnOnThursday") as HiddenField;
                HiddenField hdnOnFriday       = row.FindControl("hdnOnFriday") as HiddenField;
                HiddenField hdnOnSaturday     = row.FindControl("hdnOnSaturday") as HiddenField;
                HiddenField hdnOnSunday       = row.FindControl("hdnOnSunday") as HiddenField;
                if (checkDelete)
                {
                    if (!chkboxSelected0.Checked)
                    {
                        var dr = ScheduleDT.NewActivityScheduleDTRow();

                        dr.ActivityID            = ActivityID;
                        dr.ActivityStartDatetime = Convert.ToDateTime(hdnStartDateTime.Value);
                        dr.ActivityEndDatetime   = Convert.ToDateTime(hdnEndDateTime.Value);
                        dr.ActivityExpiryDate    = Convert.ToDateTime(hdnExpiryDateTime.Value);
                        dr.RecurrenceType        = Convert.ToInt32(hdnRecurrenceType.Value);
                        dr.RecurEvery            = Convert.ToInt32(hdnRecurEvery.Value);
                        dr.OnMonday    = Convert.ToBoolean(hdnOnMonday.Value);
                        dr.OnTuesday   = Convert.ToBoolean(hdnOnTuesday.Value);
                        dr.OnWednesday = Convert.ToBoolean(hdnOnWednesday.Value);
                        dr.OnThursday  = Convert.ToBoolean(hdnOnThursday.Value);
                        dr.OnFriday    = Convert.ToBoolean(hdnOnFriday.Value);
                        dr.OnSaturday  = Convert.ToBoolean(hdnOnSaturday.Value);
                        dr.OnSunday    = Convert.ToBoolean(hdnOnSunday.Value);

                        ScheduleDT.AddActivityScheduleDTRow(dr);
                    }
                }
                else
                {
                    var dr = ScheduleDT.NewActivityScheduleDTRow();

                    dr.ActivityID            = ActivityID;
                    dr.ActivityStartDatetime = Convert.ToDateTime(hdnStartDateTime.Value);
                    dr.ActivityEndDatetime   = Convert.ToDateTime(hdnEndDateTime.Value);
                    dr.ActivityExpiryDate    = Convert.ToDateTime(hdnExpiryDateTime.Value);
                    dr.RecurrenceType        = Convert.ToInt32(hdnRecurrenceType.Value);
                    dr.RecurEvery            = Convert.ToInt32(hdnRecurEvery.Value);
                    dr.OnMonday    = Convert.ToBoolean(hdnOnMonday.Value);
                    dr.OnTuesday   = Convert.ToBoolean(hdnOnTuesday.Value);
                    dr.OnWednesday = Convert.ToBoolean(hdnOnWednesday.Value);
                    dr.OnThursday  = Convert.ToBoolean(hdnOnThursday.Value);
                    dr.OnFriday    = Convert.ToBoolean(hdnOnFriday.Value);
                    dr.OnSaturday  = Convert.ToBoolean(hdnOnSaturday.Value);
                    dr.OnSunday    = Convert.ToBoolean(hdnOnSunday.Value);

                    ScheduleDT.AddActivityScheduleDTRow(dr);
                }
            }
            return(ScheduleDT);
        }