/// <summary> /// Loops through the gviewFileTypes grid and adds any checked fileTypes to the fileType list /// </summary> private void addFileTypesToPosition(Position p) { if (p.FileTypes == null) { p.FileTypes = new List <FileType>(); } else { p.FileTypes.Clear(); } foreach (GridViewRow row in gviewFileTypes.Rows) { if (row.RowType == DataControlRowType.DataRow) { //If this datarow is checked, add it to the position's fileTypes CheckBox cbox = (CheckBox)row.FindControl("chkFileType"); if (cbox.Checked) { int fileTypeID = (int)gviewFileTypes.DataKeys[row.RowIndex]["id"]; p.FileTypes.Add(FileTypeBLL.GetByID(fileTypeID)); } } } }
private void UploadFiles() { FileType selectedFileType = FileTypeBLL.GetByID(int.Parse(dlistFileTypes.SelectedValue)); //For all fileTypes except for Publications we should remove existing files if (selectedFileType.FileTypeName != STR_Publication && selectedFileType.FileTypeName != STR_LetterOfRec) { RemoveAllFilesOfType(selectedFileType.FileTypeName); } File file = FileBLL.SavePDF(fileUpload, selectedFileType); using (var ts = new TransactionScope()) { if (file != null) { Application application = selectedApplication; application.Files.Add(file); ApplicationBLL.EnsurePersistent(application); lblStatus.Text = "File Uploaded Successfully"; } else { lblStatus.Text = "File Upload Did Not Succeed: Ensure That File Is A PDF File"; } ts.CommitTransaction(); } }