コード例 #1
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            // validate input
            if (this.ValidateInput() == false)
                return;

            // connect to database
            DatabaseDataContext db = new DatabaseDataContext();

            // create new schedule
            Schedule schedule = new Schedule();

            // set schedule properties
            schedule.ID = Guid.NewGuid();
            schedule.AccountID = (Session["CurrentAccount"] as Common.Account).ID;
            schedule.Name = this.txtName.Text;
            schedule.Occurrence = CrontabSchedule.Parse(this.txtOccurrence.Text).ToString();
            schedule.NextOccurrence = CrontabSchedule.Parse(schedule.Occurrence).GetNextOccurrence(DateTime.UtcNow);
            schedule.Endpoint = this.txtEndpoint.Text;
            schedule.IsEnabled = true;
            schedule.CreatedDate = DateTime.UtcNow;

            // insert schedule to database
            db.Schedules.InsertOnSubmit(schedule);
            db.SubmitChanges();

            // close connection
            db.Dispose();

            // redirect to default page
            Response.Redirect("~/default.aspx");
        }
コード例 #2
0
 partial void DeleteSchedule(Schedule instance);
コード例 #3
0
 partial void UpdateSchedule(Schedule instance);
コード例 #4
0
 partial void InsertSchedule(Schedule instance);
コード例 #5
0
		private void detach_Schedules(Schedule entity)
		{
			this.SendPropertyChanging();
			entity.Account = null;
		}
コード例 #6
0
		private void attach_Schedules(Schedule entity)
		{
			this.SendPropertyChanging();
			entity.Account = this;
		}