public void UploadDocumentFile(string projectName, string projectDocumentName, HttpPostedFileBase file /*,string fileName*/, string username)
        {
            if (file != null)
            {
                EfProjectDocumentService efProjectDocumentService = new EfProjectDocumentService(_uow);
                EfProjectService         efProjectService         = new EfProjectService(_uow);
                EfIdentityUserService    efIdentityUserService    = new EfIdentityUserService();

                int projectDocumentId =
                    efProjectDocumentService.Find(r => r.DocumentName.Replace("  ", string.Empty) == projectDocumentName).Id;
                int projectId = efProjectService.Find(r => r.Name == projectName).Id;

                ProjectDocumentFile projectDocumentFile = new ProjectDocumentFile();
                projectDocumentFile.UploadDateTime    = DateTime.Now;
                projectDocumentFile.CreatedBy         = efIdentityUserService.FindUserIdByName(username);
                projectDocumentFile.ProjectDocumentId = projectDocumentId;
                projectDocumentFile.ProjectId         = projectId;
                projectDocumentFile.FileName          = file.FileName;

                byte[] uploadFile = new byte[file.InputStream.Length];
                file.InputStream.Read(uploadFile, 0, uploadFile.Length);
                projectDocumentFile.File = uploadFile;

                _pDbSet.Add(projectDocumentFile);
            }
        }
Exemplo n.º 2
0
        public void AddValue(string projectName, string projectDocumentName, string newProjectDocumentValue, string userName)
        {
            EfProjectDocumentService efProjectDocumentService = new EfProjectDocumentService(_uow);
            EfProjectService         efProjectService         = new EfProjectService(_uow);
            EfIdentityUserService    efIdentityUserService    = new EfIdentityUserService();

            int projectDocumentId =
                efProjectDocumentService.Find(r => r.DocumentName.Replace("  ", string.Empty) == projectDocumentName).Id;
            int projectId = efProjectService.Find(r => r.Name == projectName).Id;

            ProjectDocumentValue projectDocumentValue = new ProjectDocumentValue();

            projectDocumentValue.DateTime          = DateTime.Now;
            projectDocumentValue.CreatedBy         = efIdentityUserService.FindUserIdByName(userName);
            projectDocumentValue.Value             = newProjectDocumentValue;
            projectDocumentValue.ProjectDocumentId = projectDocumentId;
            projectDocumentValue.ProjectId         = projectId;
            _pDbSet.Add(projectDocumentValue);
        }