protected void Grid_ItemCommand(object sender, DataGridCommandEventArgs e) { if ("Edit".Equals(e.CommandName)) { int primaryKey = (int)this.Grid.DataKeys[e.Item.ItemIndex]; this.OnEdit(MajorLogic.GetByID(this.DataContext, primaryKey)); } else if ("Delete".Equals(e.CommandName)) { int primaryKey = (int)this.Grid.DataKeys[e.Item.ItemIndex]; this.OnDelete(MajorLogic.GetByID(this.DataContext, primaryKey)); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); string idString = this.Request.QueryString["ID"]; int id; if (int.TryParse(idString, out id)) { this.Major = MajorLogic.GetByID(this.DataContext, id); if (!this.IsPostBack) { this.EditControl.DataBind(this.Major); } } }
protected void SaveButton_Click(object sender, EventArgs e) { if (this.ObjectID.HasValue) { Major obj = MajorLogic.GetByID(this.DataContext, this.ObjectID.Value); obj.Name = this.NameField.Text; this.DataContext.SubmitChanges(); OnSaved(obj); } else { Major obj = MajorLogic.CreateMajor(this.DataContext, this.NameField.Text); this.DataContext.SubmitChanges(); OnSaved(obj); } }
private void BindList() { ListControl.DataBind(MajorLogic.GetAll().ToList()); }
protected void ListControl_Delete(object sender, Major obj) { MajorLogic.DeleteMajor(this.DataContext, obj.ID); this.DataContext.SubmitChanges(); BindList(); }
/// <summary>Maps to the UX_Major foreign key in the database.</summary> public SO.Major GetMajorByName(string name) { return(SO.Major.FromDataAccessObject(MajorLogic.GetByName(name))); }
/// <summary>Gets the Major with the specified primary key.</summary> /// <param name="id">The primary key of the Major to return.</param> /// <returns>The matching Major, if one exists, or null.</returns> public SO.Major GetMajorByID(int id) { return(SO.Major.FromDataAccessObject(MajorLogic.GetByID(id))); }
/// <summary>Gets a list of all of the Majors in the database.</summary> /// <returns>An IEnumerable of Majors.</returns> public IEnumerable <SO.Major> GetMajors(int page) { return(ServiceUtil.GetPage(MajorLogic.GetAll(), page).Select(o => SO.Major.FromDataAccessObject(o))); }
protected override void OnLoad(EventArgs e) { this.MajorField.DataSource = MajorLogic.GetAll(); this.MajorField.DataBind(); }
/// <summary>Gets the Major with the specified primary key.</summary> /// <param name="id">The primary key of the Major to return.</param> /// <returns>The matching Major, if one exists, or null.</returns> public SO.Major GetMajorByID(string id) { return(SO.Major.FromDataAccessObject(MajorLogic.GetByID(ParseInt("id", id)))); }
/// <summary>Gets a list of all of the Majors in the database.</summary> /// <returns>An IEnumerable of Majors.</returns> public IEnumerable <SO.Major> GetMajors(string page) { return(GetPage(MajorLogic.GetAll(), page).Select(o => SO.Major.FromDataAccessObject(o))); }