public ActionResult OperationsEdit() { if (!string.IsNullOrEmpty(Session["username"] as string)) { if (Session["roleid"].ToString() == "1" || Session["roleid"].ToString() == "6") { try { OperationsData od = new OperationsData(); List <Operations> operations = od.GetOperations(); return(View(operations)); } catch (Exception ex) { return(View("Error", ex)); } } else { return(View("Accessdenied")); } } else { return(RedirectToAction("Index", "Login")); } }
public ActionResult OperationsEdit(FormCollection form) { if (!string.IsNullOrEmpty(Session["username"] as string)) { try { List <Operations> operations = new List <Operations>(); for (int i = 1; i <= 7; i++) { Operations operation = new Operations(); operation.Project = form["project" + i.ToString()]; operation.CompletionDate = form["Completion" + i.ToString()]; operation.ForecastCompletionDate = form["ForCompletion" + i.ToString()]; operation.Budget = form["Budget" + i.ToString()]; operation.CommitToDate = form["commit" + i.ToString()]; operation.ApprovedAmount = form["approved" + i.ToString()]; operation.Comments = form["Comments" + i.ToString()]; operation.IsRecoverable = (form["hide" + i.ToString()]) == "False" ? false : true; operations.Add(operation); } OperationsData od = new OperationsData(); od.UpdateOperations(operations); return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error", ex)); } } else { return(RedirectToAction("Index", "Login")); } }
public string Print() { OperationsData od = new OperationsData(); List <Operations> operations = od.GetOperations(); return(new PageOrientations().RenderRazorViewToString(this, "Print", operations)); }
internal static ICommonOperations CreateCommonOperations( ITextView textView, IVimLocalSettings localSettings, IOutliningManager outlining = null, IStatusUtil statusUtil = null, ISearchService searchService = null, IUndoRedoOperations undoRedoOperations = null, IVimData vimData = null, IVimHost vimHost = null, ITextStructureNavigator navigator = null, IClipboardDevice clipboardDevice = null, IFoldManager foldManager = null) { var editorOperations = EditorUtil.GetOperations(textView); var editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(textView); var jumpList = new JumpList(new TrackingLineColumnService()); var keyMap = new KeyMap(); foldManager = foldManager ?? new FoldManager(textView.TextBuffer); statusUtil = statusUtil ?? new StatusUtil(); searchService = searchService ?? CreateSearchService(localSettings.GlobalSettings); undoRedoOperations = undoRedoOperations ?? new UndoRedoOperations(statusUtil, FSharpOption <ITextUndoHistory> .None, editorOperations); vimData = vimData ?? new VimData(); vimHost = vimHost ?? new MockVimHost(); navigator = navigator ?? CreateTextStructureNavigator(textView.TextBuffer); clipboardDevice = clipboardDevice ?? new MockClipboardDevice(); var operationsData = new OperationsData( editorOperations, editorOptions, foldManager, jumpList, keyMap, localSettings, outlining != null ? FSharpOption.Create(outlining) : FSharpOption <IOutliningManager> .None, CreateRegisterMap(clipboardDevice), searchService, statusUtil, textView, undoRedoOperations, vimData, vimHost, navigator); return(new CommonOperations(operationsData)); }
internal static ICommonOperations CreateCommonOperations( ITextView textView, IVimLocalSettings localSettings, IOutliningManager outlining = null, IStatusUtil statusUtil = null, ISearchService searchService = null, IUndoRedoOperations undoRedoOperations = null, IVimData vimData = null, IVimHost vimHost = null, ITextStructureNavigator navigator = null, IClipboardDevice clipboardDevice = null, IFoldManager foldManager = null) { var editorOperations = EditorUtil.GetOperations(textView); var editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(textView); var jumpList = new JumpList(new TrackingLineColumnService()); var keyMap = new KeyMap(); foldManager = foldManager ?? new FoldManager(textView.TextBuffer); statusUtil = statusUtil ?? new StatusUtil(); searchService = searchService ?? CreateSearchService(localSettings.GlobalSettings); undoRedoOperations = undoRedoOperations ?? new UndoRedoOperations(statusUtil, FSharpOption<ITextUndoHistory>.None); vimData = vimData ?? new VimData(); vimHost = vimHost ?? new MockVimHost(); navigator = navigator ?? CreateTextStructureNavigator(textView.TextBuffer); clipboardDevice = clipboardDevice ?? new MockClipboardDevice(); var operationsData = new OperationsData( editorOperations, editorOptions, foldManager, jumpList, keyMap, localSettings, outlining != null ? FSharpOption.Create(outlining) : FSharpOption<IOutliningManager>.None, CreateRegisterMap(clipboardDevice), searchService, EditorUtil.FactoryService.SmartIndentationService, statusUtil, textView, undoRedoOperations, vimData, vimHost, navigator); return new CommonOperations(operationsData); }
// GET: Operations public ActionResult Index() { if (!string.IsNullOrEmpty(Session["username"] as string)) { try { OperationsData od = new OperationsData(); List <Operations> operations = od.GetOperations(); return(View(operations)); } catch (Exception ex) { return(View("Error", ex)); } } else { return(RedirectToAction("Index", "Login")); } }
private void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _factory = new MockRepository(MockBehavior.Strict); _editOpts = _factory.Create <IEditorOperations>(); _editOpts.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editOpts.Setup(x => x.AddBeforeTextBufferChangePrimitive()); _host = _factory.Create <IVimHost>(); _jumpList = _factory.Create <IJumpList>(); _registerMap = MockObjectFactory.CreateRegisterMap(factory: _factory); _globalSettings = _factory.Create <IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _settings = MockObjectFactory.CreateLocalSettings(global: _globalSettings.Object); _keyMap = _factory.Create <IKeyMap>(); _statusUtil = _factory.Create <IStatusUtil>(); _outlining = _factory.Create <IOutliningManager>(); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); _searchService = VimUtil.CreateSearchService(_globalSettings.Object); var data = new OperationsData( vimData: new VimData(), vimHost: _host.Object, textView: _textView, editorOperations: _editOpts.Object, outliningManager: FSharpOption.Create(_outlining.Object), statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, localSettings: _settings.Object, keyMap: _keyMap.Object, undoRedoOperations: _undoRedoOperations, editorOptions: null, navigator: null, foldManager: null, registerMap: _registerMap.Object, searchService: _searchService); _operationsRaw = new DefaultOperations(data); _operations = _operationsRaw; }
public void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _vimData = new VimData(); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _textBuffer = _textView.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); _registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOptions = _factory.Create<IEditorOptions>(); _editorOptions.Setup(x => x.GetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId)).Returns(true); _editorOperations = _factory.Create<IEditorOperations>(); _editorOperations.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editorOperations.Setup(x => x.AddBeforeTextBufferChangePrimitive()); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false); _globalSettings.SetupGet(x => x.UseEditorTabSettings).Returns(false); _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory); _settings.SetupGet(x => x.AutoIndent).Returns(false); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _settings.SetupGet(x => x.ExpandTab).Returns(true); _settings.SetupGet(x => x.TabStop).Returns(4); _outlining = _factory.Create<IOutliningManager>(); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _statusUtil = _factory.Create<IStatusUtil>(); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); _undoRedoOperations.Setup(x => x.CreateUndoTransaction(It.IsAny<string>())).Returns<string>(name => new UndoTransaction(FSharpOption.Create(EditorUtil.GetUndoHistory(_textView.TextBuffer).CreateTransaction(name)))); _smartIndent = _factory.Create<ISmartIndentationService>(); _searchService = new SearchService(EditorUtil.FactoryService.TextSearchService, _globalSettings.Object); var data = new OperationsData( vimData: _vimData, vimHost: _host.Object, editorOperations: _editorOperations.Object, textView: _textView, outliningManager: FSharpOption.Create(_outlining.Object), jumpList: _jumpList.Object, localSettings: _settings.Object, undoRedoOperations: _undoRedoOperations.Object, registerMap: _registerMap, editorOptions: _editorOptions.Object, keyMap: null, navigator: null, statusUtil: _statusUtil.Object, foldManager: null, searchService: _searchService, smartIndentationService: _smartIndent.Object); _operationsRaw = new CommonOperations(data); _operations = _operationsRaw; }
private void Create(params string[] lines) { _view = EditorUtil.CreateView(lines); _factory = new MockRepository(MockBehavior.Strict); _editOpts = _factory.Create<IEditorOperations>(); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _registerMap = MockObjectFactory.CreateRegisterMap(factory: _factory); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _settings = MockObjectFactory.CreateLocalSettings(global: _globalSettings.Object); _keyMap = _factory.Create<IKeyMap>(); _statusUtil = _factory.Create<IStatusUtil>(); _outlining = _factory.Create<IOutliningManager>(); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); var data = new OperationsData( vimHost: _host.Object, textView: _view, editorOperations: _editOpts.Object, outliningManager: _outlining.Object, statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, localSettings: _settings.Object, keyMap: _keyMap.Object, undoRedoOperations: _undoRedoOperations.Object, editorOptions: null, navigator: null, foldManager: null, registerMap: _registerMap.Object); _operationsRaw = new DefaultOperations(data); _operations = _operationsRaw; }
private void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _factory = new MockRepository(MockBehavior.Strict); _editOpts = _factory.Create<IEditorOperations>(); _editOpts.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editOpts.Setup(x => x.AddBeforeTextBufferChangePrimitive()); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _registerMap = MockObjectFactory.CreateRegisterMap(factory: _factory); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _settings = MockObjectFactory.CreateLocalSettings(global: _globalSettings.Object); _keyMap = _factory.Create<IKeyMap>(); _statusUtil = _factory.Create<IStatusUtil>(); _outlining = _factory.Create<IOutliningManager>(); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); _undoRedoOperations.Setup(x => x.CreateUndoTransaction(It.IsAny<string>())).Returns<string>(name => new UndoTransaction(FSharpOption.Create(EditorUtil.GetUndoHistory(_textView.TextBuffer).CreateTransaction(name)))); _searchService = new SearchService(EditorUtil.FactoryService.TextSearchService, _globalSettings.Object); var data = new OperationsData( vimData: new VimData(), vimHost: _host.Object, textView: _textView, editorOperations: _editOpts.Object, outliningManager: FSharpOption.Create(_outlining.Object), statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, localSettings: _settings.Object, keyMap: _keyMap.Object, undoRedoOperations: _undoRedoOperations.Object, editorOptions: null, navigator: null, foldManager: null, registerMap: _registerMap.Object, searchService: _searchService, smartIndentationService: EditorUtil.FactoryService.SmartIndentationService); _operationsRaw = new DefaultOperations(data); _operations = _operationsRaw; }
private void Create( IEditorOperations editorOpts = null, ITextStructureNavigator baseNav = null, params string[] lines) { _host = new Mock<IVimHost>(MockBehavior.Strict); if (editorOpts == null) { var tuple = EditorUtil.CreateViewAndOperations(lines); _view = tuple.Item1; editorOpts = tuple.Item2; } else { _view = EditorUtil.CreateView(lines); } var editorOptions = EditorUtil.FactoryService.editorOptionsFactory.GetOptions(_view); baseNav = baseNav ?? (new Mock<ITextStructureNavigator>(MockBehavior.Strict)).Object; var nav = TssUtil.CreateTextStructureNavigator(WordKind.NormalWord, baseNav); _bufferOptions = new Mock<IEditorOptions>(MockBehavior.Strict); _bufferOptions.Setup(x => x.GetOptionValue(DefaultOptions.TabSizeOptionId)).Returns(4); _globalSettings = MockObjectFactory.CreateGlobalSettings(ignoreCase: true); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object); _options = new Mock<IEditorOptions>(MockBehavior.Strict); _options.Setup(x => x.GetOptionValue<int>(It.IsAny<string>())).Throws(new ArgumentException()); _options.Setup(x => x.GetOptionValue<int>(It.IsAny<EditorOptionKey<int>>())).Throws(new ArgumentException()); _options.Setup(x => x.IsOptionDefined<int>(It.IsAny<EditorOptionKey<int>>(), false)).Returns(true); _jumpList = new Mock<IJumpList>(MockBehavior.Strict); _searchService = new SearchService(EditorUtil.FactoryService.textSearchService, _globalSettings.Object); _search = new Mock<IIncrementalSearch>(MockBehavior.Strict); _search.SetupGet(x => x.SearchService).Returns(_searchService); _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict); _outlining = new Mock<IOutliningManager>(MockBehavior.Strict); _undoRedoOperations = new Mock<IUndoRedoOperations>(MockBehavior.Strict); _undoRedoOperations.Setup(x => x.CreateUndoTransaction(It.IsAny<string>())).Returns<string>(name => new Vim.UndoTransaction(FSharpOption.Create(EditorUtil.GetUndoHistory(_view.TextBuffer).CreateTransaction(name)))); _registerMap = MockObjectFactory.CreateRegisterMap(); var data = new OperationsData( vimHost: _host.Object, textView: _view, editorOperations: editorOpts, outliningManager: _outlining.Object, statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, localSettings: _settings.Object, registerMap: _registerMap.Object, keyMap: null, undoRedoOperations: _undoRedoOperations.Object, editorOptions: _options.Object, navigator: null, foldManager: null); _operationsRaw = new DefaultOperations(data, _search.Object); _operations = _operationsRaw; }
private void Create(params string[] lines) { _textView = EditorUtil.CreateTextView(lines); _factory = new MockRepository(MockBehavior.Strict); _editOpts = _factory.Create<IEditorOperations>(); _editOpts.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editOpts.Setup(x => x.AddBeforeTextBufferChangePrimitive()); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _registerMap = MockObjectFactory.CreateRegisterMap(factory: _factory); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _localSettings = MockObjectFactory.CreateLocalSettings(global: _globalSettings.Object); _keyMap = _factory.Create<IKeyMap>(); _statusUtil = _factory.Create<IStatusUtil>(); _outlining = _factory.Create<IOutliningManager>(); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); _searchService = VimUtil.CreateSearchService(_globalSettings.Object); var vimData = new VimData(); var data = new OperationsData( vimData: vimData, vimHost: _host.Object, textView: _textView, editorOperations: _editOpts.Object, outliningManager: FSharpOption.Create(_outlining.Object), statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, localSettings: _localSettings.Object, keyMap: _keyMap.Object, undoRedoOperations: _undoRedoOperations, editorOptions: null, foldManager: null, registerMap: _registerMap.Object, searchService: _searchService, wordUtil: VimUtil.GetWordUtil(_textView)); _operationsRaw = new DefaultOperations( new CommonOperations(data), _textView, _editOpts.Object, _jumpList.Object, _localSettings.Object, _undoRedoOperations, _keyMap.Object, vimData, _host.Object, _statusUtil.Object); _operations = _operationsRaw; }
public void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _vimData = new VimData(); _editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(_textView); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _textBuffer = _textView.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); _registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOperations = _factory.Create<IEditorOperations>(); _editorOperations.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editorOperations.Setup(x => x.AddBeforeTextBufferChangePrimitive()); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false); _globalSettings.SetupGet(x => x.UseEditorTabSettings).Returns(false); _globalSettings.SetupGet(x => x.WrapScan).Returns(true); _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory); _settings.SetupGet(x => x.AutoIndent).Returns(false); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _settings.SetupGet(x => x.ExpandTab).Returns(true); _settings.SetupGet(x => x.TabStop).Returns(4); _outlining = _factory.Create<IOutliningManager>(); _outlining .Setup(x => x.ExpandAll(It.IsAny<SnapshotSpan>(), It.IsAny<Predicate<ICollapsed>>())) .Returns<IEnumerable<ICollapsible>>(null); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _statusUtil = _factory.Create<IStatusUtil>(); _searchService = VimUtil.CreateSearchService(_globalSettings.Object); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); var data = new OperationsData( vimData: _vimData, vimHost: _host.Object, editorOperations: _editorOperations.Object, textView: _textView, outliningManager: FSharpOption.Create(_outlining.Object), jumpList: _jumpList.Object, localSettings: _settings.Object, undoRedoOperations: _undoRedoOperations, registerMap: _registerMap, editorOptions: _editorOptions, keyMap: null, navigator: null, statusUtil: _statusUtil.Object, foldManager: null, searchService: _searchService); _operationsRaw = new CommonOperations(data); _operations = _operationsRaw; }
internal OperationsImpl(OperationsData data) : base(data) { }
public void Create(params string[] lines) { _view = EditorUtil.CreateView(lines); _view.Caret.MoveTo(new SnapshotPoint(_view.TextSnapshot, 0)); _buffer = _view.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOpts = _factory.Create<IEditorOperations>(); _settings = _factory.Create<IVimLocalSettings>(); _globalSettings = _factory.Create<IVimGlobalSettings>(); _outlining = _factory.Create<IOutliningManager>(); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); var data = new OperationsData( vimHost: _host.Object, editorOperations: _editorOpts.Object, textView: _view, outliningManager: _outlining.Object, jumpList: _jumpList.Object, localSettings: _settings.Object, undoRedoOperations: _undoRedoOperations.Object, editorOptions: null, keyMap: null, navigator: null, statusUtil: null, foldManager: null); _operationsRaw = new OperationsImpl(data); _operations = _operationsRaw; }