private void btnAdd_Click(object sender, RoutedEventArgs e) { try { Project p = new Project(); p.ProjectName = txtProjectName.Text; p.Description = txtProjectName.Text; p.Client = txtClient.Text; p.StartDate = DateTime.Parse(dpStartDate.Text); p.EndDate = DateTime.Parse(dpEndDate.Text); bll.Add(p); lsSearch.ItemsSource = bll.GetAll(); lsSearch.DisplayMemberPath = "ProjectID"; txtProjectId.Text = bll.GetProjectId().ToString(); dgRecords.ItemsSource = bll.GetAll(); ClearWindow(); MessageBox.Show("Project Added Sucessfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected void btnInsert_Click(object sender, EventArgs e) { try { Project project = new Project(); project.ProjectName = txtProjName.Text; project.StartDate = DateTime.Parse(txtStartDate.Text); project.EndDate = DateTime.Parse(txtEndDate.Text); project.Client = txtClient.Text; project.Description = txtDescription.Text; bll.Add(project); Response.Write("<script type='text/javascript'>alert('Details Inserted Successfully');</script>"); Response.Redirect("Projectsearch.aspx"); } catch (ProjectException ex) { Response.Write("<script type='text/javascript'>alert('" + ex.Message + "');</script>"); } catch (SystemException ex) { Response.Write("<script type='text/javascript'>alert('" + ex.Message + "');</script>"); } }