protected void AddButton_Click(object obj, EventArgs args) { if (Page.IsValid == false) { return; } if (CurrentProject != null) { bool wasCategorySave = false; Category newCategory = new Category(Abbrev.Text, Convert.ToDecimal(CatDuration.Text), CategoryName.Text, CurrentProject.Id); wasCategorySave = newCategory.Save(); ListAllCategories.DataBind(); } }
protected void CopyButton_Click(object obj, EventArgs args) { if (CurrentProject != null) { int selectedProjectId = Convert.ToInt32(ProjectList.SelectedValue); List <Category> newCategories = Category.GetCategoriesByProjectId(selectedProjectId); foreach (Category cat in newCategories) { Category newCat = new Category(cat.Abbreviation, cat.EstimateDuration, cat.Name, CurrentProject.Id); newCat.Save(); } CategoryData.DataBind(); ListAllCategories.DataBind(); } }