private void btnAddAttachment_Click(object sender, EventArgs e) { // not allowed many attachments for Bugzilla 3.0 // get the version of this connection MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.GetInstance(); string version = _appSettings.GetConnectionById(this.connectionId).Version; int versionINT = int.Parse(version.Substring(0, version.IndexOf("."))); if (versionINT >= 3 && addedBug.Attachments.Count == 1) { MessageBox.Show(this, string.Format(Messages.MsgAttNotAllowed, Environment.NewLine), Messages.Info, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { FormAttachment frm = new FormAttachment(this.connectionId, -1, false); frm.ShowDialog(); Attachment newAtt = frm.NewAttachment; if (newAtt != null) { addedBug.Attachments.Add(newAtt); PopulateAttachmentList(); } } }
private void btnAddAttachment_Click(object sender, EventArgs e) { try { FormAttachment frm = new FormAttachment(this.connectionId, this.bugId, true); frm.ShowDialog(); Attachment newAtt = frm.NewAttachment; if (newAtt != null) { bugToUpdate.Attachments.Add(newAtt); GetBugDetailsAndSetControls(this.bugId, false); } } catch (Exception ex) { MyLogger.Write(ex, "btnAddAttachment_Click", LoggingCategory.Exception); MessageBox.Show(this, ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }