Esempio n. 1
0
        public static DA.Course CreateCourse(DA.Semester Semester_Parameter, DA.Teacher Teacher_Parameter, string Number_Parameter, string Name_Parameter, DO.CourseStatus Status_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Course            obj     = CreateCourse(context, Semester_Parameter, Teacher_Parameter, Number_Parameter, Name_Parameter, Status_Parameter);

            context.SubmitChanges();
            DA.Course.OnCacheNeedsRefresh();

            return(obj);
        }
Esempio n. 2
0
        public static void DeleteCourse(DA.SampleDataContext context, int id)
        {
            DA.Course obj = GetByID(context, id);

            PerformPreDeleteLogic(context, obj);

            context.Courses.DeleteOnSubmit(obj);

            PerformPostDeleteLogic(context, obj);
        }
Esempio n. 3
0
        public static DA.Enrollment CreateEnrollment(DA.Student Student_Parameter, DA.Course Course_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Enrollment        obj     = CreateEnrollment(context, Student_Parameter, Course_Parameter);

            context.SubmitChanges();
            DA.Enrollment.OnCacheNeedsRefresh();

            return(obj);
        }
 public void DataBind(Course obj)
 {
     if (obj != null)
     {
         this.ObjectID = obj.ID;
         this.SemesterField.SelectedValue = obj.SemesterID.ToString();
         this.TeacherField.SelectedValue = obj.TeacherID.ToString();
         this.NumberField.Text = obj.Number;
         this.NameField.Text = obj.Name;
         this.CourseStatusField.SelectedValue = obj.Status.ToString();
     }
 }
Esempio n. 5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

                string idString = this.Request.QueryString["ID"];
                int id;

                if (int.TryParse(idString, out id))
                {
                    this.Course = CourseLogic.GetByID(this.DataContext, id);

                    if (!this.IsPostBack)
                        this.EditControl.DataBind(this.Course);
                }
        }
        public static Course CreateCourse(SampleObjectContext context, Semester Semester_Parameter, Teacher Teacher_Parameter, string Number_Parameter, string Name_Parameter, CourseStatus Status_Parameter)
        {
            Course obj = new Course();

            obj.Semester = Semester_Parameter;
            obj.Teacher = Teacher_Parameter;
            obj.Number = Number_Parameter;
            obj.Name = Name_Parameter;
            obj.Status = Status_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Courses.AddObject(obj);

            PerformPostCreateLogic(context, obj);

            return obj;
        }
        public static DA.Course CreateCourse(DA.SampleDataContext context, DA.Semester Semester_Parameter, DA.Teacher Teacher_Parameter, string Number_Parameter, string Name_Parameter, DO.CourseStatus Status_Parameter)
        {
            DA.Course obj = new DA.Course();

            obj.Semester = Semester_Parameter;
            obj.Teacher = Teacher_Parameter;
            obj.Number = Number_Parameter;
            obj.Name = Name_Parameter;
            obj.Status = Status_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Courses.InsertOnSubmit(obj);

            PerformPostCreateLogic(context, obj);

            return obj;
        }
Esempio n. 8
0
        public static DA.Course CreateCourse(DA.SampleDataContext context, DA.Semester Semester_Parameter, DA.Teacher Teacher_Parameter, string Number_Parameter, string Name_Parameter, DO.CourseStatus Status_Parameter)
        {
            DA.Course obj = new DA.Course();

            obj.Semester = Semester_Parameter;
            obj.Teacher  = Teacher_Parameter;
            obj.Number   = Number_Parameter;
            obj.Name     = Name_Parameter;
            obj.Status   = Status_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Courses.InsertOnSubmit(obj);

            PerformPostCreateLogic(context, obj);

            return(obj);
        }
Esempio n. 9
0
 /// <summary>When implemented, validates that the object conforms to standard business rules using the supplied data context.</summary>
 static partial void Validate(DA.SampleDataContext context, DA.Course obj);
Esempio n. 10
0
 protected void EditControl_Saved(object sender, Course obj)
 {
     this.Response.Redirect("Default.aspx");
 }
Esempio n. 11
0
 public static DA.Course LoadCourseFromDataContext(this DA.Course obj, DA.SampleDataContext dataContext)
 {
     return(DA.Course.GetByID(dataContext, obj.ID));
 }
Esempio n. 12
0
partial         static void PerformPreDeleteLogic(SampleDataContext context, Course obj)
        {
            if (obj.Enrollments != null)
                foreach (DataAccess.Enrollment enrollment in obj.Enrollments)
                    EnrollmentLogic.DeleteEnrollment(context, enrollment.ID);
        }
 private void OnSaved(Course obj)
 {
     if (this.Saved != null)
         this.Saved(this, obj);
 }
        /// <summary>When implemented, allows logic to be performed after the object is created using the supplied data context.</summary>
partial         static void PerformPostCreateLogic(SampleObjectContext context, Course obj);
 protected void ListControl_Edit(object sender, Course obj)
 {
     Response.Redirect(string.Format("Edit.aspx?ID={0}", obj.ID));
 }
 private void OnEdit(Course obj)
 {
     if (this.Edit != null)
         this.Edit(this, obj);
 }
        /// <summary>When implemented, allows logic to be performed before the object is deleted using the supplied data context.</summary>
partial         static void PerformPreDeleteLogic(SampleObjectContext context, Course obj);
Esempio n. 18
0
 /// <summary>When implemented, allows logic to be performed before the object is created using the supplied data context.</summary>
 static partial void PerformPreCreateLogic(DA.SampleDataContext context, DA.Course obj);
        public static Enrollment CreateEnrollment(SampleObjectContext context, Student Student_Parameter, Course Course_Parameter)
        {
            Enrollment obj = new Enrollment();

            obj.Student = Student_Parameter;
            obj.Course = Course_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Enrollments.AddObject(obj);

            PerformPostCreateLogic(context, obj);

            return obj;
        }
        public static Enrollment CreateEnrollment(Student Student_Parameter, Course Course_Parameter)
        {
            SampleObjectContext context = new SampleObjectContext();
            Enrollment obj = CreateEnrollment(context, Student_Parameter, Course_Parameter);

            context.AcceptAllChanges();
            Enrollment.OnCacheNeedsRefresh();

            return obj;
        }
        /// <summary>When implemented, validates that the object conforms to standard business rules using the supplied data context.</summary>
partial         static void Validate(SampleObjectContext context, Course obj);
Esempio n. 22
0
 /// <summary>When implemented, allows logic to be performed after the object is deleted using the supplied data context.</summary>
 static partial void PerformPostDeleteLogic(DA.SampleDataContext context, DA.Course obj);
 private void OnDelete(Course obj)
 {
     if (this.Delete != null)
         this.Delete(this, obj);
 }
Esempio n. 24
0
        public static DA.Enrollment CreateEnrollment(DA.SampleDataContext context, DA.Student Student_Parameter, DA.Course Course_Parameter)
        {
            DA.Enrollment obj = new DA.Enrollment();

            obj.Student = Student_Parameter;
            obj.Course  = Course_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Enrollments.InsertOnSubmit(obj);

            PerformPostCreateLogic(context, obj);

            return(obj);
        }
 protected void ListControl_Delete(object sender, Course obj)
 {
     CourseLogic.DeleteCourse(this.DataContext, obj.ID);
     this.DataContext.SubmitChanges();
     BindList();
 }