private void SaveChanges() { MainForm mainForm = (MainForm)base.Owner; ComicIssue comicIssue = (ComicIssue)CC.Issues[CurrentIssue]; if (!comicIssue.Missing) { comicIssue.SeriesID = ComicSeries.GetID(cboSeries.Text, comicIssue.GroupID, comicIssue.PublisherID); ComicSeries comicSeries = new ComicSeries(comicIssue.SeriesID); comicIssue.GroupName = comicSeries.GroupName; comicIssue.PublisherName = comicSeries.PublisherName; comicIssue.SeriesName = cboSeries.Text; comicIssue.Name = txtPlot.Text; comicIssue.SeriesVolume = (int)udVol.Value; comicIssue.Number = (int)udNumber.Value; comicIssue.Type = cboType.SelectedIndex; comicIssue.Comments = txtComments.Text; if (chkPublished.Checked) { comicIssue.Published = datePublished.Value; } comicIssue.SaveChanges(); if (Settings.Default.OrganizeMethod != 0) { comicIssue.OrganizeFile(); } mainForm.IssueList.Refresh(); } }
private void OK_Button_Click(object sender, EventArgs e) { int num = -1; DateTime published = datePublished.Value; ComicIssue comicIssue = null; Cursor = Cursors.WaitCursor; for (int i = 0; i < MainForm.Root.IssueList.SelectedIndices.Count; i++) { comicIssue = (ComicIssue)CC.Issues[MainForm.Root.IssueList.SelectedIndices[i]]; //set the plot title of the issue if checked //(sorry for the three different naming conventions here) if (chkStory.Checked) { comicIssue.Name = txtPlot.Text; } //set series name of the issue if checked if (chkSeries.Checked) { //Find the ID of the selected Series if (num == -1) { num = ComicSeries.GetID(cboSeries.Text, comicIssue.GroupID, comicIssue.PublisherID); } comicIssue.SeriesID = num; comicIssue.SeriesName = cboSeries.Text; } //set comments if checked if (chkComments.Checked) { comicIssue.Comments = txtComments.Text; } //set volume if checked if (chkVol.Checked) { comicIssue.SeriesVolume = (int)udVol.Value; } //set published date if checked if (chkPublished.Checked) { comicIssue.Published = published; //If the Auto-Date feature is being used then we're assuming //that the selected issues were published a set amount of time apart, sequentially if (cboAutoDate.SelectedIndex != -1) { switch (cboAutoDate.Text) { case "Weekly": published = published.AddDays(7.0); break; case "Bi-Weekly": published = published.AddDays(14.0); break; case "Monthly": published = published.AddMonths(1); break; case "Bi-Monthly": published = published.AddMonths(2); break; case "Yearly": published = published.AddYears(1); break; } } } //set issue type if checked if (chkType.Checked) { comicIssue.Type = cboType.SelectedIndex; } //set issue number if checked if (chkNumber.Checked) { //we're assuming that the issues were published sequentially after the start value comicIssue.Number = (int)((decimal)i + udStart.Value); comicIssue.Type = 0; //Normal Issue } comicIssue.SaveChanges(); //Since we've made changes, the files may need to be renamed or moved in accordance with user prefs if (Settings.Default.OrganizeMethod != 0) { comicIssue.OrganizeFile(); } } Cursor = Cursors.Default; base.DialogResult = DialogResult.OK; Close(); }