private void btnSaveTask_Click(object sender) { if (ProjectTemplateDB.SaveChanges() > 0) { stpcode.IsEnabled = false; toolBar.msgSaved(ProjectTemplateDB.NumberOfRecords); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { try { IEnumerable <DbEntityValidationResult> validationresult = entity.GetValidationErrors(); if (validationresult.Count() == 0) { entity.SaveChanges(); //if (operationMode == Class.clsCommon.Mode.Add) //{ // project_template project_template = _projecttemplateViewSource.View.CurrentItem as project_template; // project_template_detail n_project_template = new project_template_detail(); // n_project_template.id_project_template = project_template.id_project_template; // // n_project_template.name = "task"; // entity.project_template_detail.Add(n_project_template); // entity.SaveChanges(); //} // projecttemplatedetailViewSource.View.Filter = null; filter_task(); // btnCancel_Click(sender, e); Grid parentGrid = (Grid)Parent; parentGrid.Children.Clear(); parentGrid.Visibility = Visibility.Hidden; projecttemplateViewSource.View.Refresh(); // projecttemplatedetailViewSource.View.Refresh(); } } catch (Exception ex) { throw ex; } }