예제 #1
0
 private void AddButton_Click(object sender, EventArgs e)
 {
     Project project = new Project { Id = Guid.NewGuid(), Active = true };
     editDialog.DialogContext = new DialogContext<Project> { SessionContext = this.SessionContext, DataContext = this.dataContext, Item = project };
     if (editDialog.ShowDialog(this) == DialogResult.OK)
     {
         dataContext.Projects.InsertOnSubmit(project);
         dataContext.SubmitChanges();
         listView.BeginUpdate();
         AddListViewItem(project);
         listView.EndUpdate();
     }
 }
예제 #2
0
 partial void DeleteProject(Project instance);
예제 #3
0
 partial void UpdateProject(Project instance);
예제 #4
0
 partial void InsertProject(Project instance);
예제 #5
0
 private void AddListViewItem(Project project)
 {
     var item = new ListViewItem();
     SetListViewItem(item, project);
     listView.Items.Add(item);
 }
예제 #6
0
 private void SetListViewItem(ListViewItem item, Project project)
 {
     item.SubItems.Clear();
     item.Text = project.Name;
     item.SubItems.Add(project.Description);
     item.SubItems.Add(DatabaseUtilities.BoolToYesNoString(project.Active));
     item.SubItems.Add(project.ExternalCode);
     item.Tag = project;
 }