public void Initialize(ViewRequest viewRequest) { var request = viewRequest as IssueViewRequest; scope = request.Scope; var issueId = request?.IssueId; if (issueId == 0) { issueId = null; } Observable.FromAsync(() => scope.LoadOrCreateAsync(issueId)) .ObserveOnDispatcher() .Subscribe(issue => mapper.Map(issue, this)); Observable.FromAsync(() => scope.GetRows()) .ObserveOnDispatcher() .Subscribe(rows => { AwailableRows.Clear(); AwailableRows.AddRange(rows); }); Observable.FromAsync(() => scope.GetColumns()) .ObserveOnDispatcher() .Subscribe(columns => AwailableColumns.PublishCollection(columns)); Title = $"Редактирование задачи {Head}"; }
public void Initialize(ViewRequest viewRequest) { var request = viewRequest as CardViewRequest; if (request == null) { return; } box = request.Box; card = request.Card; AvailableBoards = box.Boards.Items.ToList(); SelectedBoard = AvailableBoards.First(); var str = request.Card.Header; var maxLen = str.Length >= 22 ? 22 : str.Length; CardHeader = "Select destination board and cell to make move \"" + request.Card.Header.Substring(0, maxLen) + (str.Length > 22 ? "..." : "") + "\""; Title = $"Move card {card.Header} to"; IsOpened = true; }
//9. View approved list of request //8. View delivering list of request public static List <ViewRequest> ViewPendingRequest(int id) { using (StationeryStoreEntities context = new StationeryStoreEntities()) { List <Request> r = context.Request.Where(x => x.EmployeeID == id && x.Status == "Pending").ToList(); //RequestID is null when request is not submitted List <ViewRequest> req = new List <ViewRequest>(); for (int i = 0; i < r.Count; i++) { decimal?[] amt = new decimal?[r.Count]; amt[i] = 0; HashSet <RequestDetail> l = (HashSet <RequestDetail>)r[i].RequestDetails; foreach (RequestDetail rd in l) { amt[i] += rd.CatalogueInventory.UnitCost * rd.Qty; } ViewRequest rc = new ViewRequest(r[i].RequestID, null, String.Format("{0:ddd, MMM d, yyyy}", r[i].SubmissionDate), null, amt[i], null, null); req.Add(rc); } return(req); } }
//7. View rejected list of request public static List <ViewRequest> ViewRejectedRequest(int id) { using (StationeryStoreEntities context = new StationeryStoreEntities()) { List <Request> r = context.Request.Where(x => x.EmployeeID == id && x.Status == "Rejected").ToList(); //RequestID is null when request is not submitted List <ViewRequest> req = new List <ViewRequest>(); HashSet <RequestDetail> l = new HashSet <RequestDetail>(); for (int i = 0; i < r.Count; i++) { decimal?[] qty = new decimal?[r.Count]; qty[i] = 0; string[] desc = new string[r.Count]; desc[i] = null; l = (HashSet <RequestDetail>)r[i].RequestDetails; foreach (RequestDetail rd in l) { desc[i] = rd.CatalogueInventory.Item_Description; qty[i] = rd.Qty; } ViewRequest rc = new ViewRequest(r[i].RequestID, desc[i], String.Format("{0:ddd, MMM d, yyyy}", r[i].SubmissionDate), null, qty[i], null, r[i].Remarks); req.Add(rc); } return(req); } }
public ActionResult AddMessage(ViewRequest viewRequest, HttpPostedFileBase file) { RequestMessage requestMessage = new RequestMessage(); requestMessage = viewRequest.AddMessage; requestMessage.DateTime = DateTime.Now; requestMessage.Request = new Request { Id = viewRequest.Request.Id }; requestMessage.Reciever = new User { Id = viewRequest.Request.Student.Id }; requestMessage.Sender = new User { Id = Convert.ToInt32(Request.Cookies["user"]["Id"]) }; if (file != null) { using (MemoryStream ms = new MemoryStream()) { file.InputStream.CopyTo(ms); byte[] array = ms.GetBuffer(); requestMessage.Attachment = array; } } new LearningHandler().AddMessage(requestMessage); Session["UpdateRequestId"] = viewRequest.Request.Id; return(RedirectToAction("RequestPage")); }
public void Initialize(ViewRequest viewRequest) { var request = viewRequest as WizardViewRequest; IsNewFile = request.Uri == null; if (IsNewFile) { FolderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); FileName = "MyBoard.kam"; BoardName = "MyBoard"; } else { FolderName = Path.GetDirectoryName(request.Uri); FileName = Path.GetFileName(request.Uri); BoardName = "MyBoard"; } SelectedTemplate = Templates.First(); FillFromTemplateCommand .Execute() .Subscribe(); }
private void Launch(AppStoreModule appStoreModule) { if (appStoreModule == null || string.IsNullOrEmpty(appStoreModule.ModuleName)) { return; } try { var moduleViewRequest = new ViewRequestInfo { Title = appStoreModule.ProductName }; ViewName = appStoreModule.ModuleName; ViewIconSource = appStoreModule.WindowIconSource; ViewWidth = appStoreModule.WindowWidth; ViewHeight = appStoreModule.WindowHeight; ViewRequest?.Raise(moduleViewRequest); } catch (Exception e) { LogProvider.Log.Error(this, $"Could not launch module '{appStoreModule.ModuleName}'", e); } }
public List <ViewRequest> ViewPendingRequest(int id) { using (StationeryStoreEntities context = new StationeryStoreEntities()) { List <Request> r = context.Requests.Where(x => x.Employee.DepartmentID == id && x.Status == "Pending").ToList(); //RequestID is null when request is not submitted List <ViewRequest> req = new List <ViewRequest>(); for (int i = 0; i < r.Count; i++) { decimal?[] amt = new decimal?[r.Count]; amt[i] = 0; int rid = r[i].RequestID; List <RequestDetail> l = context.RequestDetails.Where(x => x.RequestID == rid).ToList(); for (int j = 0; j < l.Count; j++) { amt[i] += l[j].CatalogueInventory.UnitCost * l[j].Qty; } // foreach (RequestDetail rd in l) //{ // amt[i] += rd.CatalogueInventory.UnitCost * rd.Qty; //} //decimal? d = (decimal)20.00; ViewRequest rc = new ViewRequest(r[i].RequestID, r[i].Employee.Name, r[i].SubmissionDate, r[i].Status, r[i].Remarks, amt[i]); req.Add(rc); } return(req); } }
public async void Initialize(ViewRequest viewRequest) { model.GetConfiguration((viewRequest as KanbanViewRequest)?.ConfigurtaionName); var filtersData = await Task .Run(() => model.LoadFiltersData()) .ConfigureAwait(true); Projects.Clear(); foreach (var project in filtersData.Projects) { Projects.Add(project); } Priorities.Clear(); foreach (var priority in filtersData.Priorities) { Priorities.Add(priority); } if (model.Configuration != null && model.Configuration.ProjectId.HasValue) { CurrentProject = Projects.FirstOrDefault(x => x.Id == model.Configuration.ProjectId); } await DoRefresh(); }
public void Initialize(ViewRequest viewRequest) { HeaderPropertyViewRequest request = viewRequest as HeaderPropertyViewRequest; if (request == null) { return; } Header = request.Header; Box = request.Box; board = request.Board; if (Header == null) { return; } OldLimitSet = Header.LimitSet; OldMaxNumberOfCards = HeaderMaxNumber; OldName = Header.Name; TitleText = Header is ColumnViewModel ? "Column Properties" : "Row Properties"; this.RaisePropertyChanged("TitleText"); this.RaisePropertyChanged("HeaderName"); this.RaisePropertyChanged("HeaderLimitSet"); this.RaisePropertyChanged("HeaderMaxNumber"); IsOpened = true; }
public void Initialize(ViewRequest viewRequest) { if (viewRequest is RecepientEditorRequest request) { mapper.Map(request.Group, this); } }
public void Initialize(ViewRequest viewRequest) { if (viewRequest is TextBoxViewRequest tbRequest) { Text = tbRequest.Text; } }
public void Initialize(ViewRequest viewRequest) { if (initialized) { return; } shell.AddGlobalCommand("File", "Create", nameof(NewFileCommand), this) .SetHotKey(ModifierKeys.Control, Key.N); shell.AddGlobalCommand("File", "Open", nameof(OpenFileCommand), this) .SetHotKey(ModifierKeys.Control, Key.O); shell.AddGlobalCommand("File", "Import", nameof(ImportCommand), this) .SetHotKey(ModifierKeys.Control, Key.I); shell.AddGlobalCommand("File", "Export", nameof(ExportCommand), this) .SetHotKey(ModifierKeys.Control, Key.U); shell.AddGlobalCommand("File", "Print", nameof(PrintCommand), this) .SetHotKey(ModifierKeys.Control, Key.P); shell.AddGlobalCommand("File", "Show Startup", nameof(ShowStartupCommand), this, true); shell.AddGlobalCommand("File", "Exit", nameof(ExitCommand), this); initialized = true; Observable.FromAsync(_ => appConfig.LoadOnlineContentAsync()) .Subscribe(_ => { PublicBoards = appConfig.PublicBoards; }); }
public void Initialize(ViewRequest viewRequest) { var request = viewRequest as BoardViewRequest; Box = request.Box; Columns = Box.Columns.Items .Where(x => x.BoardId == request.Board.Id) .OrderBy(x => x.Order) .ToArray(); Rows = Box.Rows.Items .Where(x => x.BoardId == request.Board.Id) .OrderBy(x => x.Order) .ToArray(); Cards = Box.Cards.Items .Where(x => x.BoardId == request.Board.Id) .OfType <ICard>() .ToArray(); ShowCardIds = request.ShowCardIds; SwimLaneView = request.SwimLaneView; EnableMatrix = true; }
public void DefaultVPath_ProcessLocationForControllerDefaultName_OutputsCorrectPaths() { var req = new ViewRequest() {ViewFolder = "home", DefaultName = "index"}; serviceNoVPath.ProcessLocations(req, new StubHttpContext()); req.ViewLocations.Count().Should().Be(2); req.ViewLocations.ElementAt(0).Should().Be("/Views/home/index"); req.ViewLocations.ElementAt(1).Should().Be("/Views/Shared/index"); }
private void DequeueNextViewRequest() { if (m_requests.Count > 0) { m_currentRequest = m_requests.Dequeue(); m_currentRequest.ProcessRequest(); } }
public void CreateFormHelper() { _viewBag = new Dictionary<string, object>(); var viewReq = new ViewRequest(); _ctx = new ViewContext(null, _viewBag, new object(), viewReq); _formHlpr = new FormHelper(_ctx); _url = new StubTargetUrl(); }
public void Initialize(ViewRequest viewRequest) { if (!(viewRequest is ImportSchemeViewRequest importSchemeViewRequest)) { throw new ArgumentException($"Cannot initialize with request of type {viewRequest.GetType().Name}"); } _repository = importSchemeViewRequest.Repository; }
public void ComplexVPath_ProcessLocationForControllerDefaultName_OutputsCorrectPaths() { var req = new ViewRequest() { ViewFolder = "home", DefaultName = "index" }; serviceWithComplexVPath.ProcessLocations(req, new StubHttpContext()); req.ViewLocations.Count().Should().Be(4); req.ViewLocations.ElementAt(0).Should().Be("/0.0.0/Service/bundles/BundleName/Views/home/index"); req.ViewLocations.ElementAt(1).Should().Be("/0.0.0/Service/Views/home/index"); req.ViewLocations.ElementAt(2).Should().Be("/0.0.0/Service/bundles/BundleName/Views/Shared/index"); req.ViewLocations.ElementAt(3).Should().Be("/0.0.0/Service/Views/Shared/index"); }
public void Initialize(ViewRequest viewRequest) { if (Shell.Role == ServiceUserRole.Editor) { Shell.AddVMCommand("Edit", "Change recepient group", "EditGroupCommand", this); } RecepientGroups = cachedService.RecepientGroups.SpawnCollection(); }
public void Init(ViewRequest viewReq) { _viewBag = new Dictionary <string, object>(); _httpCtx = new StubHttpContext(); _ctx = new ViewContext(_httpCtx, _viewBag, new object(), viewReq); _serviceRegistry = CreateStubServiceRegistry(); _modelProvider = CreateMetadataProvider(); _serviceRegistry._modelMetadataProvider = _modelProvider; _helperContext = new HelperContext(_ctx, _serviceRegistry); }
public async Task <IActionResult> ThemMoi([FromForm] ViewRequest viewrequest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var test = await _viewservice.Them(viewrequest); //validator = new LoaiPhongRequestValidator(); return(Ok(test)); }
public void ComplexVPath_ProcessLocationForControllerDefaultName_OutputsCorrectPaths() { var req = new ViewRequest() { ViewFolder = "home", DefaultName = "index" }; serviceWithComplexVPath.ProcessLocations(req, new StubHttpContext()); req.ViewLocations.Count().Should().Be(2); req.ViewLocations.ElementAt(0).Should().Be("/0.0.0/Service/Views/home/index"); req.ViewLocations.ElementAt(1).Should().Be("/0.0.0/Service/Views/Shared/index"); }
public void RequestView(UIView view) { if (m_currentRequest == null) { m_currentRequest = new ViewRequest(view); m_currentRequest.ProcessRequest(); } else { m_requests.Enqueue(new ViewRequest(view)); } }
public new virtual async Task <ActionResult> View(ViewRequest request) { Trace.TraceInformation("[NuGet.View] Package: " + request.PackageID + " Source: " + request.Source); if (string.IsNullOrEmpty(request.PackageID)) { throw new UserActionException("Package Name is required during search", "CON.NUGET.VP1", new ArgumentNullException("PackageID")); } NuGetPackageViewResponse model = await _cache.ViewPackageInfo(request.PackageID, request.Source); return(View(model)); }
public void Initialize(ViewRequest viewRequest) { if (viewRequest is OperTemplatesListRequest req) { taskEditor = req.TaskEditor; } OperTemplates = new ObservableCollectionExtended <ApiOperTemplate>(); cachedService.OperTemplates.Connect() .Bind(OperTemplates).Subscribe(); }
public void Initialize(ViewRequest viewRequest) { var issueId = (viewRequest as IssueViewRequest)?.IssueId; Observable.FromAsync(() => Model.LoadOrCreateAsync(issueId)) .ObserveOnDispatcher() .Subscribe((issue) => { Mapper.Map(issue, this); Title = issue.ToString(); }); }
public void DefaultVPath_ProcessLocationForControllerDefaultName_OutputsCorrectPaths() { var req = new ViewRequest() { ViewFolder = "home", DefaultName = "index" }; serviceNoVPath.ProcessLocations(req, new StubHttpContext()); req.ViewLocations.Count().Should().Be(4); req.ViewLocations.ElementAt(0).Should().Be("/bundles/BundleName/Views/home/index"); req.ViewLocations.ElementAt(1).Should().Be("/Views/home/index"); req.ViewLocations.ElementAt(2).Should().Be("/bundles/BundleName/Views/Shared/index"); req.ViewLocations.ElementAt(3).Should().Be("/Views/Shared/index"); }
public void Initialize(ViewRequest viewRequest) { if (Shell.Role == ServiceUserRole.Editor) { Shell.AddVMCommand("File", "Save", "SaveChangesCommand", this) .SetHotKey(ModifierKeys.Control, Key.S); } void Changed(object sender, PropertyChangedEventArgs e) { if (IsDirty || Shell.Role == ServiceUserRole.Viewer) { return; } IsDirty = true; Title += '*'; } PropertyChanged += Changed; DataImporters = cachedService.DataImporters; DataExporters = cachedService.DataExporters; if (viewRequest is OperEditorRequest request) { FullTitle = request.ViewId; if (request.Oper.Id == 0) { Mode = OperMode.Importer; Name = "New operation"; } else { Mode = DataExporters.ContainsKey(request.Oper.ImplementationType) ? OperMode.Exporter : OperMode.Importer; mapper.Map(request.Oper, this); var type = Mode == OperMode.Exporter ? DataExporters[ImplementationType] : DataImporters[ImplementationType]; Configuration = JsonConvert.DeserializeObject(request.Oper.ConfigTemplate, type); } } }
private void Update() { if (m_currentRequest != null && m_currentRequest.IsFinished) { if (m_currentRequest.IsFinished) { m_currentRequest = null; DequeueNextViewRequest(); } } else { DequeueNextViewRequest(); } }
public int UpdateRequest(ViewRequest req) { using (StationeryStoreEntities context = new StationeryStoreEntities()) { var q = context.Requests.Where(x => x.RequestID == req.RequestID).First(); if (q != null) { q.Status = req.Status; q.ApprovalDate = System.DateTime.Now; context.SaveChanges(); return(1); } return(0); }; }
public void Initialize(ViewRequest viewRequest) { if (Shell.Role == ServiceUserRole.Editor) { Shell.AddVMCommand("Edit", "Change schedule", "EditScheduleCommand", this); Shell.AddVMCommand("Edit", "Delete sched", "DeleteCommand", this) .SetHotKey(ModifierKeys.None, Key.Delete); } Schedules = cachedService.Schedules.SpawnCollection(); Schedules.Select(sched => ExpressionDescriptor.GetDescription(sched.Schedule)) .ToList(); //some kind of magic for schedule description vizualisation }
public async Task <int> Them(ViewRequest model) { View view = new View(); view.Delete = model.Delete; view.CreateBy = model.CreateBy; view.ID_NgonNgu = model.ID_NgonNgu; view.ModifyBy = model.ModifyBy; view.NoiDungHienThi = model.NoiDungHienThi; view.CreateDate = DateTime.Now; _context.Views.Add(view); await _context.SaveChangesAsync(); return(view.ID_View); }
public void Handling_view_requests_should_work() { /* Arrange */ var mocks = new TestAssistant().MockAll(); var main = A.Dummy<MainViewModel>(); A.CallTo(() => mocks.ViewModelFactory.Get(typeof(DummyViewModel))).Returns(new DummyViewModel()); var optionsReq = new ViewRequest(typeof(DummyViewModel)); var vm = new ShellViewModel(main, mocks.Messenger, mocks.ViewModelFactory); var handler = vm as IHandle<ViewRequest>; /* Act */ (vm as IActivate).Activate(); handler.Handle(optionsReq); /* Assert */ A.CallTo(() => mocks.ViewModelFactory.Get(typeof(DummyViewModel))).MustHaveHappened(Repeated.Exactly.Once); vm.ActiveItem.Should().BeOfType<DummyViewModel>(); }
public void Handling_view_request_to_other_than_main_if_main_is_not_active_should_ignore_and_log() { /* Arrange */ var mocks = new TestAssistant().MockAll(); var main = A.Dummy<MainViewModel>(); var active = new object(); var optionsReq = new ViewRequest(typeof(DummyViewModel)); var vm = new ShellViewModel(main, mocks.Messenger, mocks.ViewModelFactory); var handler = vm as IHandle<ViewRequest>; /* Act */ vm.ActiveItem = active; handler.Handle(optionsReq); /* Assert */ A.CallTo(() => mocks.Logger.Warn(A<string>.Ignored, A<object[]>.Ignored)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => mocks.ViewModelFactory.Get(typeof(DummyViewModel))).MustNotHaveHappened(); vm.ActiveItem.Should().BeSameAs(active); }
public ViewAnswer(ViewRequest request) : base(PacketCmdS2C.PKT_S2C_ViewAns) { buffer.Write(request.netId); }