private void attachments_btn_Click(object sender, EventArgs e) { if (Datums == null) { New_Attachment NewAtt = new New_Attachment(); NewAtt.ShowDialog(); Datums = NewAtt.Datums; } else { New_Attachment NewAtt = new New_Attachment(Datums); NewAtt.ShowDialog(); Datums = NewAtt.Datums; } }
public void OpenFile() { try { int rowid = attachment_list.CurrentCellAddress.Y; string _data = attachment_list["filedata", rowid].Value.ToString(); string temp = Environment.GetEnvironmentVariable("temp"); File.WriteAllBytes(temp + "\\" + attachment_list["filedisplay", rowid].Value.ToString(), _filedata(_data)); System.Diagnostics.Process.Start(temp + "\\" + attachment_list["filedisplay", rowid].Value.ToString()); } catch { List<Attachments> ListAtt = new List<Attachments>(); for (int i = 0; i < attachment_list.Rows.Count; i++) { Attachments Att = new Attachments(); Att.Data = attachment_list["filedata", i].Value.ToString(); Att.FileName = attachment_list["filename", i].Value.ToString(); Att.FileExtension = attachment_list["fileext", i].Value.ToString(); Att.Directory = "(in database)"; Att.rowid = int.Parse(attachment_list["rowid", i].Value.ToString()); ListAtt.Add(Att); } New_Attachment NewAtt = new New_Attachment(ListAtt, projectnum_txt.Text); NewAtt.ShowDialog(); eSRAttachmentsTableAdapter.FillByESR(engDataDataSet.ESRAttachments, projectnum_txt.Text); } }
private void addNewToolStripMenuItem_Click(object sender, EventArgs e) { List<Attachments> ListAtt = new List<Attachments>(); for (int i = 0; i < attachment_list.Rows.Count; i++) { Attachments Att = new Attachments(); Att.Data = attachment_list["filedata", i].Value.ToString(); Att.FileName = attachment_list["filename", i].Value.ToString(); Att.FileExtension = attachment_list["fileext", i].Value.ToString(); Att.Directory = "(in database)"; Att.rowid = int.Parse(attachment_list["rowid", i].Value.ToString()); ListAtt.Add(Att); } New_Attachment NewAtt = new New_Attachment(ListAtt, projectnum_txt.Text); NewAtt.ShowDialog(); eSRAttachmentsTableAdapter.FillByESR(engDataDataSet.ESRAttachments, projectnum_txt.Text); }