Ejemplo n.º 1
0
        private void ProcessExcel(AdminDataImport dataImport, string fileExtension)
        {
            var postedFile = Request.Files[0];
            var filePath   = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, System.IO.Path.GetFileName(postedFile.FileName));

            if (System.IO.File.Exists(filePath))
            {
                System.IO.File.Delete(filePath);
            }
            postedFile.SaveAs(filePath);

            if (dataImport.Schema == FileUploadSchema.Grade.ToString())
            {
                ExcelImport.UploadGrades(filePath
                                         , fileExtension
                                         , dataImport.CourseId
                                         , dataImport.Deliverable
                                         , CurrentUser.Id);
            }
            else
            {
                ExcelImport.UploadSurveys(filePath
                                          , fileExtension
                                          , dataImport.CourseId
                                          , CurrentUser.Id);
            }
        }