public void SaveFiles() { string[] descriptions = hfDescriptions.Value.Split('|'); int i = 0; foreach (UploadedFile file in raUpload.UploadedFiles) { string description = (i < descriptions.Count()) ? descriptions[i] : ""; decimal displayType = (file.FileName.ToLower().Contains(".jpeg") || file.FileName.ToLower().Contains(".jpg") || file.FileName.ToLower().Contains(".gif") || file.FileName.ToLower().Contains(".png")) || file.FileName.ToLower().Contains(".bmp") ? 1 : 0; SQMDocumentMgr.AddAttachment( file.FileName, description, displayType, "", SessionManager.DocumentContext.RecordType, SessionManager.DocumentContext.RecordID, SessionManager.DocumentContext.RecordStep, Session.SessionID, file.InputStream ); i++; } // Update "display" status of existing files foreach (GridDataItem item in rgFiles.Items) { decimal attachmentId = Convert.ToDecimal(item.GetDataKeyValue("AttachmentId")); CheckBox cb = (CheckBox)item["DisplayTypeColumn"].FindControl("checkBox"); decimal displayType = (cb.Checked) ? 1 : 0; SQMDocumentMgr.UpdateAttachmentDisplayType(attachmentId, displayType); } }
public void SaveFiles(int recordType, decimal recordId) { string[] descriptions = hfDescriptions.Value.Split('|'); int i = 0; foreach (UploadedFile file in raVideoUpload.UploadedFiles) { string description = (i < descriptions.Count()) ? descriptions[i] : ""; decimal displayType = (file.FileName.ToLower().Contains(".jpeg") || file.FileName.ToLower().Contains(".jpg") || file.FileName.ToLower().Contains(".gif") || file.FileName.ToLower().Contains(".png")) || file.FileName.ToLower().Contains(".bmp") ? 1 : 0; switch (recordType) { case (int)MediaAttachmentType.ReleaseForm: SQMDocumentMgr.AddVideoAttachment( file.FileName, description, "", displayType, recordType, recordId, Session.SessionID, file.InputStream ); break; default: // text entries SQMDocumentMgr.AddVideoAttachment( file.FileName, description, "", displayType, recordType, recordId, Session.SessionID, file.InputStream ); break; } i++; } // Update "display" status of existing files foreach (GridDataItem item in rgVideoFiles.Items) { decimal attachmentId = Convert.ToDecimal(item.GetDataKeyValue("VideoAttachId")); CheckBox cb = (CheckBox)item["DisplayTypeColumn"].FindControl("checkBox"); decimal displayType = (cb.Checked) ? 1 : 0; SQMDocumentMgr.UpdateAttachmentDisplayType(attachmentId, displayType); } }