Exemple #1
0
		public void Execute(DocumentViewModel document)
		{
			var editScreen = IoC.Get<EditDocumentViewModel>();
			editScreen.Initialize(document.JsonDocument);

			events.Publish(new DatabaseScreenRequested(() => editScreen));
		}
 public MetadataPaneViewModel(ADOTabularConnection connection, IEventAggregator eventAggregator, DocumentViewModel document)
     : base(connection,eventAggregator)
 {
     _activeDocument = document;
     _activeDocument.PropertyChanged += ActiveDocumentPropertyChanged;
     NotifyOfPropertyChange(() => ActiveDocument);
 }
 public FindAllReferences(DocumentViewModel vm, FilePath path, CppCodeBrowser.IProjectIndex index)
     : base(vm)
 {
     ViewModel.CaretOffsetChanged += ViewModelCaretOffsetChanged;
     _path = path;
     _index = index;            
 }
Exemple #4
0
 public InspectCursorCommand(DocumentViewModel vm, FilePath path, CppCodeBrowser.IProjectIndex index)
     : base(vm)
 {
     ViewModel.CaretOffsetChanged += ViewModelCaretOffsetChanged;
     _path = path;
     _index = index;
     RaiseCanExecuteChangedEvent();
 }
Exemple #5
0
 // todo - implement operations queue
 //private Queue<TraceOperation> operationQueue;
 //private readonly Dictionary<TraceEventClass, TraceEvent> _traceEvents;
 public QueryTrace(ADOTabularConnection connection, DocumentViewModel document)
 {
     _server = new Server();
     _server.Connect(connection.ConnectionString);
     _connection = connection;
     Status = QueryTraceStatus.Stopped;
     // new Dictionary<TraceEventClass, TraceEvent>();
     _currentDocumentReference = new WeakReference(document);
 }
        public ActionResult DocumentsUpdate([DataSourceRequest]DataSourceRequest request, DocumentViewModel document)
        {
            if (this.ModelState.IsValid)
            {
                var entity = this.Mapper.Map<Document>(document);
                this.documents.Update(entity);
            }

            return this.Json(new[] { document }.ToDataSourceResult(request, this.ModelState));
        }
Exemple #7
0
        //private CppCodeBrowser.IProjectFile _indexItem;

        public SourceFileJumpToCommand(DocumentViewModel vm, FilePath path, CppCodeBrowser.IProjectIndex index)
            : base(vm)
        {
            ViewModel.CaretOffsetChanged += ViewModelCaretOffsetChanged;

            _path = path;
            _index = index;
            _jumpToBrowser = new CppCodeBrowser.JumpToBrowser(_index);
           // _indexItem = _index.FindProjectItem(_path);
            RaiseCanExecuteChangedEvent();
        }
        public ActionResult Create(DocumentViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                var studentId = this.User.Identity.GetUserId();
                this.documents.CreateForStudent(studentId, model.Name, model.Content);

                return this.RedirectToAction(nameof(this.All));
            }

            return this.View(model);
        }
        public ConnectionDialogViewModel(string connectionString, IDaxStudioHost host, IEventAggregator eventAggregator, bool hasPowerPivotModel, DocumentViewModel document )
        {
            try
            {
                _eventAggregator = eventAggregator;
                _connectionString = connectionString;
                _activeDocument = document;
                _ppvtRegex = new Regex(@"http://localhost:\d{4}/xmla", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                PowerPivotEnabled = true;
                Host = host;
                ServerModeSelected = true;

                PowerBIHelper.Refresh();
                if (PowerBIHelper.Instances.Count > 0)
                {
                    PowerBIDesignerDetected = true;
                    SelectedPowerBIInstance = PowerBIHelper.Instances[0];
                    NotifyOfPropertyChange(() => PowerBIDesignerDetected);
                    NotifyOfPropertyChange(() => PowerBIDesignerInstances);
                    NotifyOfPropertyChange(() => SelectedPowerBIInstance);
                }

                ParseConnectionString(); // load up dialog with values from ConnStr

                if (Host.IsExcel)
                {
                    //using (new StatusBarMessage("Checking for PowerPivot model 2..."))
                    //{
                    //bool hasPpvt = false;
                    //HasPowerPivotModelAsync().ContinueWith(t => hasPpvt = t.Result).Wait(); 

                    if (hasPowerPivotModel)
                    {
                        ServerModeSelected = false;
                        PowerPivotModeSelected = true;
                    }

                    //}
                }

                WorkbookName = host.Proxy.WorkbookName;
                DisplayName = "Connect To";
                //MdxCompatibility = "3 - (Default) Placeholder members are not exposed";
            }
            catch (Exception ex)
            {
                Log.Error("{class} {method} {message} {stacktrace}", "ConnectionDialogViewModel", "ctor", ex.Message, ex.StackTrace);
            }
        }
        public void TestRouteStudentDocumentsDetails()
        {
            const string Url = "/Student/Documents/Details/5";

            var model = new DocumentViewModel()
            {
                Content = "dasdas",
                Name = "dasdas",
                UniversityId = 5
            };
            var jsonBody = JsonConvert.SerializeObject(model);

            this.RouteCollection
                .ShouldMap(Url)
                .To<DocumentsController>(c => c.Details(5));
        }
        public ActionResult Delete(DocumentViewModel DVM)
        {
            if (!Request.IsAuthenticated)
            {
                return(RedirectToAction("Login", "Account"));
            }
            //redirect to nowhere if not admin
            if (!(User.IsInRole("Team Leader")))
            {
                return(RedirectToAction("Nowhere", "Account"));
            }
            Document D = new Document();

            D.DocumentId   = DVM.DocumentId;
            D.DocumentName = DVM.DocumentName;


            DS.Delete(D);
            DS.Commit();
            return(RedirectToAction("Index"));
        }
        public IActionResult Type(string documentName, string className)
        {
            DocumentViewModel model = BuildDocumentViewModel(documentName, className, out Document selected);

            if (model == null)
            {
                return(RedirectToAction(nameof(Index)));
            }

            if (model.Breadcrumbs.Count > 0)
            {
                BreadcrumbItem lastItem   = model.Breadcrumbs[model.Breadcrumbs.Count - 1];
                BreadcrumbItem breadcrumb = new BreadcrumbItem(selected.Title, lastItem.Route, lastItem.HasParameters);
                model.Breadcrumbs.Remove(lastItem);
                model.Breadcrumbs.Add(breadcrumb);
            }

            model.ShowShortDescription = true;

            return(View(model));
        }
Exemple #13
0
        /// <summary>
        /// Opens up the chosen document in the code editor
        /// </summary>
        /// <param name="projectID"></param>
        /// <param name="documentID"></param>
        /// <returns>Index view with the documents in the prj</returns>
        public ActionResult Index(int?projectID, int?documentID)
        {
            if (projectID.HasValue && documentID.HasValue)
            {
                ViewBag.DocumentID = documentID ?? default(int);
                int projectByID  = projectID ?? default(int);
                int documentByID = documentID ?? default(int);

                if (!checkAuthorization(projectByID))
                {
                    return(RedirectToAction("Error", "Home"));
                }
                DocumentViewModel model = new DocumentViewModel();
                model.CurrProjectID = projectByID;
                model.Documents     = _service.GetDocumentsByProjectID(projectByID);
                model.Doc           = _service.GetDocumentByID(documentByID);
                return(View(model));
            }

            return(HttpNotFound());
        }
Exemple #14
0
        private void OpenNewBlankDocument(DocumentViewModel sourceDocument)
        {
            var newDoc = _documentFactory(_windowManager, _eventAggregator);

            Items.Add(newDoc);
            ActivateItem(newDoc);
            ActiveDocument     = newDoc;
            newDoc.DisplayName = string.Format("Query{0}.dax", _documentCount);
            _documentCount++;

            new System.Action(CleanActiveDocument).BeginOnUIThread();

            if (sourceDocument == null)
            {
                new System.Action(ChangeConnection).BeginOnUIThread();
            }
            else
            {
                _eventAggregator.PublishOnUIThread(new CopyConnectionEvent(sourceDocument));
            }
        }
Exemple #15
0
        public ActionResult Document(int id, int type)
        {
            var files = _systemService.GetDocumentList(id, type);

            var fileList = files.Select(s => new FileViewModel
            {
                FileId      = s.Id,
                FileGuid    = s.DocumentURL,
                FileName    = s.DocumentName,
                ActionDate  = s.ActionDate.ToString("MM/dd/yyyy"),
                Description = s.DocumentTitle
            });
            var document = new DocumentViewModel
            {
                FileList           = fileList.ToList(),
                KeyId              = id,
                DocumentCategoryId = type
            };

            return(PartialView(type == (int)DocumentType.StockPicture ? "Partials/UploadPicture" : "Partials/UploadDocument", document));
        }
Exemple #16
0
        public override async Task NewDocument(DocumentViewModel <StorageFile, IRandomAccessStream> documentViewModel)
        {
            var canceled = false;

            if (documentViewModel.Document.IsDirty)
            {
                var saved = await AskSaveDocument(documentViewModel, false);

                canceled = saved == SaveState.Canceled;
            }

            if (!canceled)
            {
                documentViewModel.Initialize = viewModel => viewModel.InitNewDocument();

                documentViewModel.Initialize(documentViewModel);

                Settings.Status("New document initialized.", TimeSpan.FromSeconds(10),
                                Verbosity.Debug);
            }
        }
        public async Task <IActionResult> RemoveDocument(int documentId, int entityId)
        {
            var document = await _documentService.GetDocumentByIdAsync(documentId);

            if (document == null)
            {
                return(NotFound());
            }

            string adjustedPath = Path.GetDirectoryName(document.Path) + document.Name;

            var viewModel = new DocumentViewModel
            {
                EntityId   = entityId,
                DocumentId = document.Id,
                ModelPath  = adjustedPath,
                UploadDate = document.UploadTime
            };

            return(View(viewModel));
        }
        /// <summary>
        /// Ánh xạ từ đối tượng DocumentViewModel sang đối tượng Document
        /// </summary>
        /// <param name="documentViewModel"></param>
        /// <returns>Document</returns>
        /// Tạo bởi: NBDUONG(20/6/2019)
        public Document MapDocumentViewModelToDocument(DocumentViewModel documentVM)
        {
            var document = new Document();

            document.DocumentCode    = documentVM.DocumentCode;
            document.DocumentDate    = documentVM.DocumentDate;
            document.TotalMoney      = documentVM.TotalMoney;
            document.Reason          = documentVM.Reason;
            document.ReceiverName    = documentVM.ReceiverName;
            document.MoneyHasToPay   = documentVM.MoneyHasToPay;
            document.MoneyHasNotPaid = documentVM.MoneyHasNotPaid;
            document.AmountPaid      = documentVM.AmountPaid;
            document.DocumentAddress = documentVM.DocumentAddress;
            document.IsPaid          = documentVM.IsPaid;
            document.CheckType       = documentVM.CheckType;
            document.DocumentTypeID  = documentVM.DocumentTypeID;
            document.PersonID        = documentVM.PersonID;
            document.EmployeeID      = documentVM.EmployeeID;

            return(document);
        }
Exemple #19
0
        public void AddDocumentView(DocumentViewModel vm, bool setActive)
        {
            if (vm == null)
            {
                throw new ArgumentNullException(nameof(vm));
            }

            UIDispatcher.Execute(() =>
            {
                WeakEventManager <DocumentViewModel, EventArgs>
                .AddHandler(vm, "Closed", TabVm_Closed);
                _viewModels.Add(vm.UniqueId, vm);
                DocumentViews.Add(vm.View as IDocumentView);
                if (setActive)
                {
                    SetActiveDocumentView(vm.View as IDocumentView);
                }

                OnCountChanged();
            });
        }
Exemple #20
0
        /// <summary>
        /// Load avalondock layout, desearlize it and apply it
        /// </summary>
        private void LoadAvalonDockLayout()
        {
            if (MainWindow.GetInstance() == null)
            {
                return;
            }

            XmlLayoutSerializer serializer = new XmlLayoutSerializer(MainWindow.GetInstance().GetDockingManager());

            serializer.LayoutSerializationCallback += (s, args) => { args.Content = args.Content; };

            string layout = Properties.Settings.Default.AvalonLayout;

            if (String.IsNullOrEmpty(layout.Trim()))
            {
                return;
            }

            StringReader stringReader = new StringReader(layout);
            XmlReader    xmlReader    = XmlReader.Create(stringReader);

            serializer.Deserialize(xmlReader);

            xmlReader.Close();
            stringReader.Close();

            FileDeclaration d = MacroUI.GetInstance().GetDeclarationFromFullname(Properties.Settings.Default.ActiveDocument);

            if (d == null)
            {
                return;
            }

            DocumentViewModel dvm = DockManager.GetDocument(d);

            if (d != null)
            {
                ChangeActiveDocument(dvm);
            }
        }
Exemple #21
0
        public IActionResult UploadDocument(DocumentViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Create", "Home", model));
            }

            try
            {
                foreach (var file in Request.Form.Files)
                {
                    if (file.Length > 0)
                    {
                        var document = new NetCore.Core.Entities.Document()
                        {
                            Id          = Guid.NewGuid(),
                            Description = model.FileName,
                            FileName    = file.FileName
                        };

                        MemoryStream ms = new MemoryStream();
                        file.CopyTo(ms);
                        document.FileData = ms.ToArray();

                        ms.Close();
                        ms.Dispose();

                        _documentInteractor.UploadDocument(document);

                        ViewBag.Message = "Image(s) stored in database!";
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = "An error has occurred. <br /> " + ex.Message.ToString();
            }

            return(RedirectToAction("Index", model));
        }
        public async Task Create_ReturnsViewResult_When_InValidModelIsGiven()
        {
            // Arrange
            Mock <IFormFile> mockResumeFormFile = new Mock <IFormFile>();

            mockResumeFormFile.Setup(file => file.Length)
            .Returns(0);


            DocumentViewModel tempDocumentVM = new DocumentViewModel
            {
                DocumentName = "new DocumentViewModel",
                Resume       = mockResumeFormFile.Object
            };


            ApplicationUser user = new ApplicationUser
            {
                Id = "ids"
            };
            Mock <IUserRepository> mockUserRepo = new Mock <IUserRepository>();
            HttpContext            temp         = null;

            mockUserRepo.Setup(repo => repo.getUserFromHttpContextAsync(temp))
            .ReturnsAsync(user);

            Mock <IDocumentRepository> mockDocumentRepo = new Mock <IDocumentRepository>();

            mockDocumentRepo.Setup(repo => repo.SaveDocumentToUser(tempDocumentVM, user))
            .ReturnsAsync(false);

            DocumentsController controller = new DocumentsController(mockUserRepo.Object,
                                                                     mockDocumentRepo.Object);

            // Act
            IActionResult result = await controller.Create(tempDocumentVM);

            // Assert
            ViewResult viewResult = Assert.IsType <ViewResult>(result);
        }
Exemple #23
0
        //[Authorize(Roles = "Admin")]
        public async Task <IActionResult> Upload(DocumentViewModel document)
        {
            if (ModelState.IsValid)
            {
                if (document.MyDocument == null || document.MyDocument.Length == 0)
                {
                    return(Content("file not selected"));
                }

                var path = Path.Combine(PATH, document.MyDocument.FileName);

                var keywords = document.Keywords.Split(" ").ToList();

                var doc = new Document()
                {
                    Id   = Guid.NewGuid(),
                    Name = document.MyDocument.FileName
                };

                keywords.ForEach(x => {
                    var key = new Keyword {
                        Name = x, Id = Guid.NewGuid()
                    };
                    doc.Keywords.Add(key);
                });

                doc.Keywords = doc.Keywords.Distinct().ToList();

                _context.Documents.Add(doc);
                _context.SaveChanges();

                using (var stream = new FileStream(path, FileMode.Create))
                {
                    await document.MyDocument.CopyToAsync(stream);
                }

                return(RedirectToAction("Index"));
            }
            return(Content("Error uploading document"));
        }
Exemple #24
0
        public ActionResult Create(DocumentViewModel DVM, System.Web.HttpPostedFileBase file)
        {
            Document D = new Document();

            D.DocumentId   = DVM.DocumentId;
            D.DocumentName = DVM.DocumentName;
            D.Size         = DVM.Size;

            D.categorie = (Domain.Entities.Categorie)DVM.categorie;
            try
            {
                if (file.ContentLength > 0)
                {
                    var fileName = Path.GetFileName(file.FileName);
                    var path     = Path.Combine(Server.MapPath("~/Content/Documents/"), fileName);

                    file.SaveAs(path);
                    D.Path          = "~/Content/Documents/" + fileName;
                    ViewBag.Message = "File Uploaded Successfully!!";
                }
            }
            catch
            {
                ViewBag.Message = "File upload failed!!";
                return(View());
            }
            D.DateCreation = DateTime.Now;

            DS.Add(D);
            DS.Commit();
            if (DVM.categorie == Web.Models.Categorie.Image)
            {
                return(View("Index"));
            }

            else
            {
                return(View("IndexDocument"));
            }
        }
Exemple #25
0
        public void SaveUpdateRecord(DocumentViewModel document)
        {
            tblDocumentMaster tblDocument = new tblDocumentMaster();

            if (document.ID <= 0)
            {
                _context.tblDocumentMasters.Add(tblDocument);
            }
            else
            {
                tblDocument = _context.tblDocumentMasters.Where(x => x.DocumentID == document.ID).FirstOrDefault();
            }
            tblDocument.DocumentName         = document.DocumentName;
            tblDocument.DocumentType         = document.DocumentType;
            tblDocument.ExpiryDateApplicable = false;
            if (document.ExpiryApplicableStr == "Yes")
            {
                tblDocument.ExpiryDateApplicable = true;
            }
            tblDocument.Status = document.DocumentStatus;
            _context.SaveChanges();
        }
Exemple #26
0
        // GET: Documents
        public ActionResult Index()
        {
            var documentItems = new List <DocumentItem>
            {
                new DocumentItem {
                    Id = 0, Title = "Testi", Information = "jojojojojojojojökjadfalöfhjasökfjasf a faökfja sökfjas fksjfsöafjsakfjsaöfksjafök ahjsöfjasöfksajföaskfojooooo", ExampleRequest = "dfsafsegjöskgj aöäfgjkaöfjaökfjaöfjaöskfjsalf\n öajföakfjsaöklfja aöfjasökfjasökfj"
                },
                new DocumentItem {
                    Id = 1, Title = "Toinen testi", Information = "käytetään testauksessa", ExampleRequest = "Banaani perkele paska jumalauta zxxxxxxxxxxxxxxx"
                },
                new DocumentItem {
                    Id = 2, Title = "Kolmas testi", Information = "Joojoo", ExampleRequest = ""
                }
            };

            var viewModel = new DocumentViewModel
            {
                DocumentItems = documentItems
            };

            return(View(viewModel));
        }
Exemple #27
0
        /// <summary>
        /// Convert Document Object into Document Entity
        /// </summary>
        ///<param name="model">Document</param>
        ///<param name="DocumentEntity">DataAccess.Document</param>
        ///<returns>DataAccess.Document</returns>
        public static Document ToEntity(this DocumentViewModel model, Document entity
                                        )
        {
            if (entity.Id == 0)
            {
                entity.CreatedUserId = model.SessionUserId;
            }
            else
            {
                entity.IsActive         = model.IsActive;
                entity.UpdatedUserId    = model.SessionUserId;
                entity.UpdatedTimestamp = DateTime.Now;
            }

            entity.DocumentTypeId   = model.DocumentTypeId;
            entity.Name             = model.Name;
            entity.DocumentData     = model.DocumentData;
            entity.DocumentNameGuid = model.DocumentNameGuid;
            entity.Comments         = model.Comments;

            return(entity);
        }
Exemple #28
0
        /// <summary>
        /// Hàm get dữ liệu chứng từ
        /// </summary>
        /// <param name="storeName"></param>
        /// <param name="tableName"></param>
        /// <param name="pageNumber"></param>
        /// <param name="pageSize"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        /// Tạo bởi: NBDUONG(27/6/2019)
        public AjaxResult GetDataPaginationBase(string storeName, string tableName, int pageNumber, int pageSize, string where)
        {
            var ajaxResult = new AjaxResult();
            var entities   = new List <DocumentViewModel>();

            using (DataAccess dataAccess = new DataAccess())
            {
                // Khởi tạo đối tượng SqlDataReader hứng dữ liệu trả về:
                var sqlCommand = dataAccess.SqlCommand;
                sqlCommand.CommandText = storeName;
                sqlCommand.Parameters.AddWithValue("@TableName", tableName);
                sqlCommand.Parameters.AddWithValue("@PageNumber", pageNumber);
                sqlCommand.Parameters.AddWithValue("@PageSize", pageSize);
                sqlCommand.Parameters.AddWithValue("@Where", where);
                SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
                while (sqlDataReader.Read())
                {
                    var entity = new DocumentViewModel();
                    for (int i = 0; i < sqlDataReader.FieldCount; i++)
                    {
                        // Lấy ra tên propertyName dựa vào tên cột của field hiện tại:
                        var propertyName = sqlDataReader.GetName(i);
                        // Lấy ra giá trị của field hiện tại:
                        var propertyValue = sqlDataReader.GetValue(i);
                        // Gán Value cho Property tương ứng:
                        var propertyInfo = entity.GetType().GetProperty(propertyName);
                        if (propertyInfo != null && propertyValue != DBNull.Value)
                        {
                            propertyInfo.SetValue(entity, propertyValue);
                        }
                    }
                    ajaxResult.TotalCount = (int)sqlDataReader.GetValue(20);
                    entities.Add(entity);
                }
            }

            ajaxResult.Data = entities;
            return(ajaxResult);
        }
Exemple #29
0
        public static List <DocumentViewModel> GetDocuments(DocumentViewModel viewmodel)
        {
            var documents = new List <DocumentViewModel>();

            try
            {
                var files = Directory.EnumerateFiles(viewmodel.DocumentPath).ToList();

                foreach (var file in files)
                {
                    var document = new DocumentViewModel();
                    document.DocumentName = Path.GetFileName(file);
                    documents.Add(document);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(documents);
        }
        public void CreateDocument(DocumentViewModel documentViewModel)
        {
            var  organisationId = UserOrganisationId;
            bool isSuperAdmin   = User.IsInAnyRoles("SuperAdmin");
            var  fixAssetData   = NidanBusinessService.RetrieveFixAssets(organisationId, e => isSuperAdmin && e.FixAssetId.ToString() == documentViewModel.StudentCode).Items.FirstOrDefault();

            if (fixAssetData != null)
            {
                try
                {
                    _documentService.Create(organisationId, fixAssetData.CentreId,
                                            documentViewModel.DocumentTypeId, documentViewModel.StudentCode,
                                            fixAssetData.FixAssetId.ToString(), "Fix Asset Document", documentViewModel.Attachment.FileName,
                                            documentViewModel.Attachment.InputStream.ToBytes());
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }
        }
 public DocumentView(SolutionModel solution, FileModel file)
 {
     // Inicializa los componentes
     InitializeComponent();
     // Inicializa la vista de datos
     grdData.DataContext = ViewModel = new DocumentViewModel(solution, file);
     udtEditor.ViewModel = ViewModel;
     udtEditor.Text      = ViewModel.Content;
     // Asigna la clase del documento
     FormView = new BaseFormView(ViewModel);
     // Cambia el modo de resalte a Nhtml
     //#if DEBUG // ... cuando queramos hacer pruebas con un archivo de definición
     //	try
     //		{ udtEditor.LoadHighLight(@"C:\Users\jbautistam\Downloads\NhtmlSyntaxHighLight.xml");
     //		}
     //	catch (Exception exception)
     //		{ DocWriterPlugin.MainInstance.HostController.ControllerWindow.ShowMessage("Error al cambiar el modo de resalte. " + exception.Message);
     //		}
     //#else
     try
     {
         using (System.IO.Stream stm = System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/DocWriter.Plugin;Resources/NhtmlSyntaxHighLight.xml")).Stream)
         {
             udtEditor.LoadHighLight(stm);
         }
     }
     catch (Exception exception)
     {
         System.Diagnostics.Debug.WriteLine("Error al cambiar el modo de resalte. " + exception.Message);
     }
     //#endif
     // Inicializa las plantillas
     udtTemplates.Project = file.Project;
     udtImage.Project     = file.Project;
     udtImage.FileType    = FileModel.DocumentType.File;
     // Asigna el manejador de eventos
     ViewModel.EndFileCopy      += new EventHandler <Libraries.LibDocWriter.ViewModel.Solutions.EventArguments.EndFileCopyEventArgs>(ViewModel_EndFileCopy);
     ViewModel.InsertTextEditor += (sender, evntArgs) => udtEditor.InsertText(evntArgs.Text, evntArgs.Offset);
 }
Exemple #32
0
        public ActionResult GetDocumentById(int ID)
        {
            string operation = Session["Operation"].ToString();

            ButtonVisiblity(operation);
            Mst_DocumentMaster tblDocument = dd._context.Mst_DocumentMaster.Where(x => x.Doc_Id == ID).FirstOrDefault();
            DocumentViewModel  document    = new DocumentViewModel();

            document.ID                   = tblDocument.Doc_Id;
            document.DocumentName         = tblDocument.Doc_DocumentName;
            document.DocumentType         = (short)tblDocument.Doc_DocumentType;
            document.ExpiryDateApplicable = (bool)tblDocument.Doc_ExpiryDateApplicable;
            document.ExpiryApplicableStr  = "No";
            if (document.ExpiryDateApplicable == true)
            {
                document.ExpiryApplicableStr = "Yes";
            }
            document.DocumentStatus  = (short)tblDocument.Doc_Status;
            document.operation       = operation;
            ViewBag.DocumentTypeList = new SelectList(dd._context.Mst_DocumentType.ToList(), "Id", "Name");
            return(View("Document", document));
        }
Exemple #33
0
        public ActionResult Document(string fileName)
        {
            var name      = HttpContext.User.Identity.Name;
            var documents = _documentService.GetAllByUserName(name).Select(d => d.ToModel()).ToList();
            var document  = documents.Find(d => d.Name == fileName);

            if (document == null)
            {
                document = new DocumentViewModel()
                {
                    Code        = "",
                    Description = ""
                };
            }
            var model = new UserCodeViewModel()
            {
                Documents       = documents,
                CurrentDocument = document
            };

            return(View("UserCodes", model));
        }
Exemple #34
0
        public ActionResult GetDocumentTable(string Operation)
        {
            Session["Operation"] = Operation;
            //ButtonVisiblity(Operation);
            List <DocumentViewModel> list = new List <DocumentViewModel>();
            var  model            = new DocumentViewModel();
            var  tablelist        = dd._context.Mst_DocumentMaster.ToList();
            int  status           = 1;
            bool expiryapplicable = true;

            foreach (var item in tablelist)
            {
                model                     = new DocumentViewModel();
                model.ID                  = item.Doc_Id;
                model.DocumentName        = item.Doc_DocumentName;
                model.DocumentTypeStr     = dd._context.Mst_DocumentType.Where(x => x.Id == item.Doc_DocumentType).Select(x => x.Name).FirstOrDefault();
                model.ExpiryApplicableStr = item.Doc_ExpiryDateApplicable == expiryapplicable ? "Yes" : "No";
                model.DocumentStatusStr   = item.Doc_Status == status ? "Active" : "Inactive";
                list.Add(model);
            }
            return(PartialView("_DocumentList", list));
        }
Exemple #35
0
        public void UploadDocument(DocumentViewModel model)
        {
            try
            {
                using (var padr = new ProfileApplicationDocumentsRepository())
                {
                    ProfileApplicationDocuments PADoc = padr.Find(x => x.IDNumber == model.IDNumber && x.fullname == model.fullname && x.documentName == model.documentName).SingleOrDefault();

                    PADoc.documentID      = PADoc.documentID;
                    PADoc.PolicyHolderIDN = model.IDNumber;
                    PADoc.IDNumber        = model.IDNumber;
                    PADoc.fullname        = model.fullname;
                    PADoc.documentName    = model.documentName;
                    PADoc.document        = model.document;

                    padr.Update(PADoc);
                }
            }
            catch (Exception ex)
            {
            }
        }
        public async Task <IActionResult> Create(DocumentViewModel document)
        {
            if (!ModelState.IsValid)
            {
                return(View(document));
            }

            DocumentInfo info = _mapper.Map <DocumentInfo>(document);

            info.Employee = await GetCurrentUserAsync();

            info.CreatedAt = DateTime.Now;

            _dataAccess.Document.Create(info);
            _dataAccess.Save();

            _logger.LogInformation($"Создан {info}");

            _storage[info.Id].AddFormFiles(document.Files);

            return(RedirectToAction(nameof(List)));
        }
        public async Task <IActionResult> Create([Bind("File,Description,Feedback,CourseId,ModuleId,ActivityId")] DocumentViewModel model)
        {
            var user = await _userManager.GetUserAsync(User);

            model.Name = model.File.FileName;

            var document = new Document()
            {
                Name              = model.File.FileName,
                Description       = model.Description,
                Feedback          = model.Feedback,
                UploadDateTime    = DateTime.Now,
                Deadline          = model.Deadline,
                ApplicationUserId = user.Id,
                CourseId          = model.CourseId,
                ModuleId          = model.ModuleId,
                ActivityId        = model.ActivityId
            };

            if (ModelState.IsValid)
            {
                if (model.File == null || model.File.Length == 0)
                {
                    return(Content("ingen fil vald!"));
                }
                var path = Path.Combine(
                    Directory.GetCurrentDirectory(), "LMSDocuments",
                    model.File.FileName);
                using (var stream = new FileStream(path, FileMode.Create))
                {
                    await model.File.CopyToAsync(stream);
                }
                _context.Add(document);
                await _context.SaveChangesAsync();

                return(RedirectToAction("MainIndex", "Courses"));
            }
            return(View(model));
        }
Exemple #38
0
        //
        // GET: /Document/ListAll/
        public ActionResult ListAll()
        {
            var docList = new List <Documents>();

            if (TempData["FoundDocs"] != null)
            {
                var t = (List <int>)TempData["FoundDocs"];
                if (t.Count == 0)
                {
                    ViewBag.message = "Suche nach <span style='color: red;'>" + TempData["SearchTerm"] + "</span> hat keine Resultate";
                }
                else
                {
                    ViewBag.message = "<span style='color: red;'>" + TempData["SearchTerm"] + "</span> kommt in folgenden Dokumenten vor:";
                }

                docList = db.Documents.ToList().Where(x => t.Contains(x.DocId)).ToList();
            }
            else // get all documents, unordered
            {
                if (Request.QueryString["getAll"] == "true")
                {
                    docList         = db.Documents.OrderBy(e => e.CreateDate).ToList();
                    ViewBag.message = "Alle Dokumente";
                }
                else
                {
                    ViewBag.message = "Dokumente ab 2016";
                    docList         = db.Documents.Where(e => e.CreateDate.Year > 2015).ToList();
                }
            }

            var viewModel = new DocumentViewModel
            {
                Docs = docList
            };

            return(View(viewModel));
        }
Exemple #39
0
        public ActionResult ViewDocuments()
        {
            string      userId            = User.Identity.GetUserId();
            DB_Entities db                = new DB_Entities();
            var         docs              = db.Documents.Where(x => x.UserId == userId).OrderBy(x => x.Date).ToList <Document>();
            List <DocumentViewModel> docx = new List <DocumentViewModel>();

            foreach (var i in docs as List <Document> )
            {
                DocumentViewModel document = new DocumentViewModel()
                {
                    InstituteName = GetInstituteName(i.InstituteId),
                    Title         = i.Title,
                    Photo         = i.Image,
                    Date          = Convert.ToDateTime(i.Date),
                    Id            = i.Id
                };
                docx.Add(document);
            }
            ViewData["docs"] = docx;
            return(View());
        }
Exemple #40
0
            private static async Task NewDocument(DocumentViewModel documentViewModel)
            {
                var canceled = false;

                if (documentViewModel.IsDirty)
                {
                    var saved = await AskSaveDocument(documentViewModel, false);

                    canceled = saved == SaveState.Canceled;
                }

                if (!canceled)
                {
                    documentViewModel.Initialize = async viewModel =>
                    { await viewModel.InitNewDocument(); };

                    documentViewModel.Initialize(documentViewModel);

                    Settings.Status("New document initialized.", TimeSpan.FromSeconds(10),
                                    Verbosity.Debug);
                }
            }
 public void Dispose()
 {
     _document.SetStatusBarMessage("Ready");
     _document = null;
 }
 public StatusBarMessage(DocumentViewModel document, string message)
 {
     _document = document;
     _document.SetStatusBarMessage(message);
 }
 public ActivateDocumentEvent(DocumentViewModel document)
 {
     Document = document;
 }
Exemple #44
0
 public EditorCommand(DocumentViewModel vm)
 {
     _docVm = vm;   
 }
		public MathRegionViewModel (DocumentViewModel document)
		{
			Document = document;

			x = BuildProperty<double> ("X");
			y = BuildProperty<double> ("Y");
			root = BuildProperty<HBoxToken> ("Root");
			selection = BuildProperty<Selection> ("Selection");

			insertCharacterCommand = BuildProperty<ICommand> ("InsertCharacterCommand");
			insertCharacterCommand.Value = new DelegateCommand<Key> (o => new InsertCharacterAction (o, this).Do ());

			plusCommand = BuildProperty<ICommand> ("PlusCommand");
			plusCommand.Value = new DelegateCommand<object> (o => new PlusAction (this).Do ());

			minusCommand = BuildProperty<ICommand> ("MinusCommand");
			minusCommand.Value = new DelegateCommand<object> (o => new MinusAction (this).Do ());

			multiplicationCommand = BuildProperty<ICommand> ("MultiplicationCommand");
			multiplicationCommand.Value = new DelegateCommand<object> (o => new MultiplicationAction (this).Do ());
			
			divideCommand = BuildProperty<ICommand> ("DivideCommand");
			divideCommand.Value = new DelegateCommand<object> (o => new DivideAction (this).Do ());

			assignmentCommand = BuildProperty<ICommand> ("AssignmentCommand");
			assignmentCommand.Value = new DelegateCommand<object> (o => new AssignmentAction (this).Do ());

			resultCommand = BuildProperty<ICommand> ("ResultCommand");
			resultCommand.Value = new DelegateCommand<object> (o => new ResultAction (this).Do ());

			leftCommand = BuildProperty<ICommand> ("LeftCommand");
			leftCommand.Value = new DelegateCommand<object> (o => new LeftAction (this).Do ());

			rightCommand = BuildProperty<ICommand> ("RightCommand");
			rightCommand.Value = new DelegateCommand<object> (o => new RightAction (this).Do ());

			evaluateCommand = BuildProperty<ICommand> ("EvaluateCommand");
			evaluateCommand.Value = new DelegateCommand<object> (o => new EvaluateAction (this).Do ());

			openBracketCommand = BuildProperty<ICommand> ("OpenBracketCommand");
			openBracketCommand.Value = new DelegateCommand<object> (o => new OpenBracketAction (this).Do ());

			closeBracketCommand = BuildProperty<ICommand> ("CloseBracketCommand");
			closeBracketCommand.Value = new DelegateCommand<object> (o => new CloseBracketAction (this).Do ());

			commaCommand = BuildProperty<ICommand> ("CommaCommand");
			commaCommand.Value = new DelegateCommand<object> (o => new CommaAction (this).Do ());

			exponentiationCommand = BuildProperty<ICommand> ("ExponentiationCommand");
			exponentiationCommand.Value = new DelegateCommand<object> (o => new ExponentiationAction (this).Do ());

			squareRootCommand = BuildProperty<ICommand> ("SquareRootCommand");
			squareRootCommand.Value = new DelegateCommand<object> (o => new SquareRootAction (this).Do ());

			absoluteCommand = BuildProperty<ICommand> ("AbsoluteCommand");
			absoluteCommand.Value = new DelegateCommand<object> (o => new AbsoluteAction (this).Do ());

			needToEvaluate = BuildProperty<bool> ("NeedToEvaluate");
			needToEvaluate.DependencyPropertyValueChanged += HandleNeedToEvaluateChanged;

			Root = new HBoxToken ();
			Selection = new Selection ();

			var token = new TextToken ();
			Root.Add (token);

			Selection.SelectedToken = token; 

			hasError = BuildProperty<bool> ("HasError");
		}
        public ActionResult Edit(DocumentViewModel model)
        {
            var original = this.documents.GetById(model.Id);
            var studentId = this.User.Identity.GetUserId();

            if (original.AuthorId != studentId)
            {
                this.ModelState.AddModelError("Oh snap!", "You are not authorized to edit this document!");
            }

            if (this.ModelState.IsValid)
            {
                var document = this.Mapper.Map<Document>(model);
                this.documents.Update(document);

                return this.RedirectToAction(nameof(this.All));
            }

            return this.View(model);
        }
 public EditorPreviewKeyDownEvent(DocumentViewModel viewModel, TextEditor editor, KeyEventArgs args)
 {
     ViewModel = viewModel;
     Editor = editor;
     Args = args;
 }
 /// <summary>
 /// Command to edit document
 /// </summary>
 /// <param name="item">Document item parameter</param>
 private void EditDocument(Document item)
 {
     if (DocumentEditionRequested != null)
     {
         DocumentViewModel model = new DocumentViewModel(item);
         model.SavedItem += OnDocumentSaved;
         DocumentEditionRequested(this, new ContextEditionEventArgs<DocumentViewModel>(model));
     }
 }
        public ActionResult DocumentsDestroy([DataSourceRequest]DataSourceRequest request, DocumentViewModel document)
        {
            this.documents.Delete(document.Id);

            return this.Json(new[] { document }.ToDataSourceResult(request, this.ModelState));
        }
 public EditorTextEnteringEvent(DocumentViewModel viewModel, TextEditor editor, TextCompositionEventArgs args)
 {
     ViewModel = viewModel;
     Editor = editor;
     Args = args;
 }
 public DaxIntellisenseProvider(DocumentViewModel activeDocument, DAXEditor.DAXEditor editor)
 {
     Document = activeDocument;
     _editor = editor;
 }