protected void UpdateWaiter_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(WaiterID.Text)) { MessageUserControl1.ShowInfo("Please select a waiter to update"); } else { MessageUserControl1.TryRun(() => { Waiter item = new Waiter(); item.WaiterID = int.Parse(WaiterID.Text); item.FirstName = FirstName.Text; item.LastName = LastName.Text; item.Address = Address.Text; item.Phone = Phone.Text; item.HireDate = DateTime.Parse(DateHired.Text); if (string.IsNullOrEmpty(DateReleased.Text)) { item.ReleaseDate = null; } else { item.ReleaseDate = DateTime.Parse(DateReleased.Text); } AdminController sysmgr = new AdminController(); sysmgr.Waiter_Update(item); MessageUserControl1.ShowInfo("Waiter Updated"); RefreshwaiterList(WaiterID.Text); } ); } }
protected void Search_Click(object sender, EventArgs e) { AlbumID.Text = ""; AlbumTitle.Text = ""; AlbumReleaseYear.Text = ""; AlbumReleaseLabel.Text = ""; ArtistList.SelectedIndex = 0; if (string.IsNullOrEmpty(SearchArg.Text)) { MessageUserControl1.ShowInfo("Enter an album title or part of the title."); } else { MessageUserControl1.TryRun(() => { AlbumController sysmgr = new AlbumController(); List <Album> albumlist = sysmgr.Albums_GetbyTitle(SearchArg.Text); if (albumlist.Count == 0) { MessageUserControl1.ShowInfo("Search Result", "No data for album title or partial title " + SearchArg.Text); AlbumList.DataSource = null; AlbumList.DataBind(); } else { MessageUserControl1.ShowInfo("Search Result", "Select the desired album for maintanence"); AlbumList.DataSource = albumlist; AlbumList.DataBind(); } }); } }
protected void FetchWaiter_Click(object sender, EventArgs e) { if (WaiterList.SelectedIndex == 0) { MessageUserControl1.ShowInfo("Please select a waiter before clicking Fetch Waiter."); } else { //we will use a TryCatch() from the MessageUserControl. This will capture error messages when/if they happen, and properly display in the user control. MessageUserControl1.TryRun((ProcessRequest)GetWaiterInfo); }
protected void FetchWaiter_Click(object sender, EventArgs e) { if (WaiterList.SelectedIndex == 0) { MessageUserControl1.ShowInfo("Please select a waiter before clicking 'Fetch Waiter'."); } else { //we will use a TryRun() from the MessageUserControl //this will capture error messages when/if they happen and properly display in the user control //GetWaiterInfo is your mehtod for accessing BLL and query MessageUserControl1.TryRun((ProcessRequest)GetWaiterInfo); } }
protected void InsertWaiter_Click(object sender, EventArgs e) { //this example is using the TryRun inline MessageUserControl1.TryRun(() => { Waiter item = new Waiter(); item.FirstName = FirstName.Text; item.LastName = LastName.Text; item.Address = Address.Text; item.Phone = Phone.Text; item.HireDate = DateTime.Parse(DateHired.Text); item.ReleaseDate = null; AdminController sysmgr = new AdminController(); WaiterID.Text = sysmgr.Waiter_Add(item).ToString(); MessageUserControl1.ShowInfo("Waiter Added."); RefreshWaiterList(WaiterID.Text); }); }
protected void Search_Click(object sender, EventArgs e) { //clear out the old album information on the Maintain tab Clear_Click(sender, e); if (string.IsNullOrEmpty(SearchArg.Text)) { //(message string) MessageUserControl1.ShowInfo("Enter an album title or part of the title."); } else { //do a look of the data in the db via the controller //all actions that are external to the webpage should be done in a try/catch // for friendly error handling //we will use MessageUserControl to handle the error messages for this semester MessageUserControl1.TryRun(() => { //coding block I wish MessageUserControl to try and run checking for //any errors, catching the errors, and displaying said error(s) for me //in its error panel //what is leave for me to do: simply the logic for the event //standard lookup AlbumController sysmgr = new AlbumController(); List <Album> albumlist = sysmgr.Albums_GetbyTitle(SearchArg.Text); if (albumlist.Count == 0) { //(title string, message string) MessageUserControl1.ShowInfo("Search Result", "No data for album title or partial tile " + SearchArg.Text); AlbumList.DataSource = null; AlbumList.DataBind(); } else { MessageUserControl1.ShowInfo("Search Result", "Select the desired album for maintenance."); AlbumList.DataSource = albumlist; AlbumList.DataBind(); } }); } }
protected void Search_Click(object sender, EventArgs e) { //Clear out the old album information on the maintain tab. Clear_Click(sender, e); if (string.IsNullOrEmpty(SearchArg.Text)) { MessageUserControl1.ShowInfo("Please Enter an Album Title or part of the title"); } else { //Lookup of the data in the database.We are the controller all actions all the external to the //web page should be done through a try catch. From a friendly error handling. //We will use the mesageusercotrol to handle error messages for this semester. MessageUserControl1.TryRun(() => { //Coding block I wish message user control to try and run and check the checking for //any errors catching the errors and displaying set errors sfor me in its error panel. //What is left for me to do is simply the logicc for me to do the event. //This is a standard lookup AlbumController sysmgr = new AlbumController(); List <Album> albumlist = sysmgr.Albums_GetbyTitle(SearchArg.Text); if (albumlist.Count == 0) { //Title String,message string MessageUserControl.ShowInfo("Search Result", "No data for the album title or the partial title " + SearchArg.Text); AlbumList.DataSource = null; AlbumList.DataBind(); } else { MessageUserControl.ShowInfo("Using Instructions", "Select the desired album for the maintenece."); AlbumList.DataSource = albumlist; AlbumList.DataBind(); } } ); } }