Beispiel #1
0
 void FolderAddDialogUc1_FolderSavedEvent(object sender, Academic.DbHelper.MessageEventArgs e)
 {
     FolderAddDialogUc1.CloseDialog();
     if (e.SaveSuccess)
     {
         //reload the list
         Response.Redirect(Request.Url.ToString());
         FileListingUc1.ResetView();
     }
 }
Beispiel #2
0
        void FilePickerDialog1_UploadClicked(object sender, Academic.ViewModel.FileResourceEventArgs e)
        {
            //save file information to database
            var user = Page.User as CustomPrincipal;

            if (user != null)
            {
                using (var helper = new DbHelper.WorkingWithFiles())
                {
                    var fileName = Path.GetFileName(e.FilePath);
                    var fi       = new Academic.DbEntities.UserFile()
                    {
                        Id        = e.Id,
                        CreatedBy = user.Id
                        ,
                        CreatedDate = DateTime.Now
                        ,
                        DisplayName = e.FileDisplayName                           //Path.GetFileName(imageFile.FileName)
                        ,
                        FileDirectory = DbHelper.StaticValues.PrivateFiesLocation //CourseFilesLocation //StaticValue.UserImageDirectory
                        ,
                        FileName = fileName
                                   //Guid.NewGuid().ToString() + GetExtension(imageFile.FileName, imageFile.ContentType)
                        ,
                        FileSizeInBytes = e.FileSizeInBytes //imageFile.ContentLength
                        ,
                        FileType = e.FileType               //imageFile.ContentType
                        ,
                        IconPath = e.IconPath
                        ,
                        IsFolder = false
                        ,
                        IsServerFile = IsServerFile
                        ,
                        SchoolId = user.SchoolId
                                   //SubjectId = SubjectId
                                   //,
                                   //Void = !f.Visible
                    };
                    var folderId = FolderId;
                    if (folderId > 0)
                    {
                        fi.FolderId = folderId;
                    }
                    var saved = helper.AddOrUpdateFile(fi);
                    if (saved != null)
                    {
                        //Response.Redirect("~/Views/Course/Section/Master/CourseSectionListing.aspx?SubId=" + SubjectId + "&edit=1#section_" + SectionId);
                        FilePickerDialog1.CloseDialog();
                        FileListingUc1.ResetView();
                    }
                }
            }
        }
Beispiel #3
0
 void FileDeleteDialogUc1_OkClick(object sender, Academic.ViewModel.IdAndNameEventArgs e)
 {
     FileDeleteDialogUc1.CloseDialog();
     FileListingUc1.ResetView();
 }