public async Task <IHttpActionResult> Post([FromBody] Model model) { string name = model.Data; try { UserGroupPoco poco = await _groupService.CreateUserGroupAsync(name); // check that it doesn't already exist if (poco == null) { return(Ok(new { status = 200, success = false, msg = MagicStrings.GroupNameExists })); } string msg = MagicStrings.GroupCreated.Replace("{name}", name); Log.Debug(msg); // return the id of the new group, to update the front-end route to display the edit view return(Ok(new { status = 200, success = true, msg, id = poco.GroupId })); } catch (Exception ex) { string error = $"Error creating user group '{name}' - group has likely been deleted. Group names cannot be reused."; Log.Error(error, ex); // if we are here, something isn't right... return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, error))); } }
public IHttpActionResult CancelWorkflowTask(TaskData model) { WorkflowInstancePoco instance = GetInstance(model.InstanceGuid); try { WorkflowProcess process = GetProcess(instance.Type); IUser currentUser = _utility.GetCurrentUser(); instance = process.CancelWorkflow( instance, currentUser.Id, model.Comment ); Log.Info($"{instance.TypeDescription} request for {instance.Node.Name} [{instance.NodeId}] was cancelled by {currentUser.Name}"); return(Json(new { status = 200, message = instance.TypeDescription + " workflow cancelled" }, ViewHelpers.CamelCase)); } catch (Exception ex) { string msg = $"An error occurred cancelling the workflow on {instance.Node.Name} [{instance.NodeId}]"; Log.Error(msg, ex); return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg))); } }
// private void EquipGear() // { // var inventory = Shipwreck.CurrentGame.Player.Inventory; // var itemToEquip = ViewHelpers.GetInventoryItem("Which item would you like to equip?"); // if (itemToEquip != null) // { // if (itemToEquip.GetType().IsSubclassOf(typeof(Weapon))) // { // inventory.ActiveWeapon = (Weapon)itemToEquip; // } // else if (itemToEquip.GetType() == typeof(Armor)) // { // inventory.ActiveArmor = (Armor)itemToEquip; // } // Console.WriteLine($"Your {itemToEquip.Name} has been equipped"); // } // else // { // Console.WriteLine($"That is not an item that exists in your inventory"); // } // } private void DropItem() { var inventory = Shipwreck.CurrentGame.Player.Inventory; var droppableItemRecords = inventory.Items.Where(itemRecord => itemRecord.InventoryItem.Droppable).ToList(); var promptItems = droppableItemRecords.Select(record => record.InventoryItem.Name).ToList(); promptItems.Add("Exit"); var itemToDropName = Prompt.Select("Which item would you like to drop?", promptItems); if (itemToDropName == "Exit") { return; } var itemRecordToDrop = droppableItemRecords.FirstOrDefault(record => record.InventoryItem.Name == itemToDropName); if (itemRecordToDrop == null) { return; // todo there's gotta be a better way to do this... } var quantity = ViewHelpers.GetQuantity($"You have {itemRecordToDrop.Quantity} {itemToDropName}(s). How Many would you like to drop?", itemRecordToDrop.Quantity); var numDropped = InventoryController.RemoveItems(inventory, itemRecordToDrop?.InventoryItem, quantity); Log.Success($"You dropped {numDropped} {itemToDropName}(s)"); }
public IHttpActionResult Get(int?id = null) { try { if (id.HasValue) { List <UserGroupPoco> result = Pr.PopulatedUserGroup(id.Value); if (result.Any(r => !r.Deleted)) { return(Json(result.First(), ViewHelpers.CamelCase)); } } else { List <UserGroupPoco> groups = Pr.UserGroups(); return(Json(groups.Where(g => !g.Deleted), ViewHelpers.CamelCase)); } throw new HttpResponseException(HttpStatusCode.NotFound); } catch (Exception e) { return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(e))); } }
public GroupControllerTest() { _filteredUrl = new Mock <IFilteredUrl>(); _logger = new Mock <ILogger <GroupsController> >(); var emailLogger = new Mock <ILogger <GroupEmailBuilder> >(); var eventEmailLogger = new Mock <ILogger <EventEmailBuilder> >(); var emailClient = new Mock <IHttpEmailClient>(); var emailConfig = new Mock <IApplicationConfiguration>(); emailConfig.Setup(a => a.GetEmailEmailFrom(It.IsAny <string>())) .Returns(AppSetting.GetAppSetting("GroupSubmissionEmail")); _groupEmailBuilder = new Mock <GroupEmailBuilder>(emailLogger.Object, emailClient.Object, emailConfig.Object, new BusinessId("BusinessId")); _eventEmailBuilder = new Mock <EventEmailBuilder>(eventEmailLogger.Object, emailClient.Object, emailConfig.Object, new BusinessId("BusinessId")); var mockTime = new Mock <ITimeProvider>(); var viewHelper = new ViewHelpers(mockTime.Object); datetimeCalculator = new DateCalculator(mockTime.Object); http = new Mock <IHttpContextAccessor>(); var cookies = new FakeCookie(true); http.Setup(_ => _.HttpContext.Request.Cookies).Returns(cookies); _groupController = new GroupsController(_processedRepository.Object, _repository.Object, _groupEmailBuilder.Object, _eventEmailBuilder.Object, _filteredUrl.Object, _logger.Object, _configuration.Object, _markdownWrapper.Object, viewHelper, datetimeCalculator, _loggedInHelper.Object, _groupsService.Object, _cookiesHelper.Object, new StockportWebapp.FeatureToggling.FeatureToggles()); // setup mocks _groupsService.Setup(o => o.GetGroupCategories()).ReturnsAsync(groupCategories); _groupsService.Setup(o => o.GetGroupHomepage()).ReturnsAsync(groupHomepage); _groupsService.Setup(o => o.GetAvailableGroupCategories()).ReturnsAsync(new List <string>()); _groupsService.Setup(o => o.GetErrorsFromModelState(It.IsAny <ModelStateDictionary>())).Returns(""); }
public static void findSpringOnSubmitMethods(List <String> lsSpringMvcClasses) { lsClassesToFindInBeanList_Bad = new List <String>(); lsClassesToFindInBeanList_Good = new List <String>(); foreach (String sClassSignature in lsSpringMvcClasses) { foreach (CirFunction cfCirFunction in fadCirData.dClasses_bySignature[sClassSignature].dFunctions.Values ) { if (cfCirFunction.FunctionSignature.IndexOf("onSubmit") > -1) { if (false == lsClassesToFindInBeanList_Bad.Contains(sClassSignature)) { lsClassesToFindInBeanList_Bad.Add(sClassSignature); DI.log.info("Bad: {0}", sClassSignature); } } if (cfCirFunction.FunctionSignature.IndexOf("initBinder") > -1) { foreach (String sCalledFunction in ViewHelpers.getCirFunctionStringList(cfCirFunction.FunctionsCalledUniqueList)) { if (sCalledFunction.IndexOf("setAllowedFields") > -1) { lsClassesToFindInBeanList_Good.Add(sClassSignature); DI.log.debug("init binder -> setAllowedFields: " + sCalledFunction); } } } } //if (false == lsClassesToFindInBeanList_Bad.Contains(sClassSignature)) // DI.log.info("Skipping: {0}", sClassSignature); } }
public IHttpActionResult SaveConfig(Dictionary <int, List <UserGroupPermissionsPoco> > model) { try { UmbracoDatabase db = DatabaseContext.Database; if (null != model && model.Any()) { KeyValuePair <int, List <UserGroupPermissionsPoco> > permission = model.First(); db.Execute("DELETE FROM WorkflowUserGroupPermissions WHERE NodeId = @0", permission.Key); if (permission.Value.Any()) { db.BulkInsertRecords(permission.Value, DatabaseContext.SqlSyntax); } } } catch (Exception ex) { string msg = $"Error saving config. {ex.Message}"; return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg))); } return(Ok()); }
public virtual async Task <IActionResult> Edit(int id, T entity) { if (id != entity.Id) { return(NotFound()); } RemoveNavigationPropertiesFromModelState <T>(); if (ModelState.IsValid) { ViewHelpers.RemoveAllNavigationProperties(entity); try { DbContext.Update(entity); await DbContext.SaveChangesAsync().ConfigureAwait(false); } catch (DbUpdateConcurrencyException) { if (!EntityExists(entity.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } AddEntityListsToViewBag(); return(View(entity)); }
protected override bool HandleInput(MenuItem menuItem) { var closeView = false; switch (menuItem.Type) { case MenuItemType.PurposeHelp: PurposeHelp(); ViewHelpers.Continue(); break; case MenuItemType.MapHelp: MapHelp(); ViewHelpers.Continue(); break; // case "R": // ResourceHelp(); // break; // case "C": // CombatHelp(); // break; } return(closeView); }
protected async override void OnRun() { var selectedItem = IdeApp.ProjectOperations.CurrentSelectedItem; string filePath = null; Project project = null; if (selectedItem is Project project1) { project = project1; filePath = project1.FileName.ParentDirectory; } else if (selectedItem is ProjectFolder projectItem) { project = projectItem.Project; filePath = projectItem.Path.FullPath; } else { return; } var figmaBundleWindow = new GenerateViewsWindow(filePath, project); figmaBundleWindow.Appearance = ViewHelpers.GetCurrentIdeAppearance(); await figmaBundleWindow.LoadAsync(); var currentIdeWindow = Components.Mac.GtkMacInterop.GetNSWindow(IdeApp.Workbench.RootWindow); currentIdeWindow.AddChildWindow(figmaBundleWindow, AppKit.NSWindowOrderingMode.Above); MessageService.PlaceDialog(figmaBundleWindow, MessageService.RootWindow); IdeServices.DesktopService.FocusWindow(figmaBundleWindow); }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); editText = ViewHelpers.GetView <Android.Widget.EditText> (nativeView); if (options.HasFlag(BindOptions.PreserveNativeProperties)) { text = editText.Text; placeholder = editText.Hint; enabled = editText.Enabled; } else { editText.Text = text; editText.Hint = placeholder; editText.Enabled = enabled; } editText.TextChanged += EditText_TextChanged; }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); textField = ViewHelpers.GetView <NSTextField> (nativeView); if (options.HasFlag(BindOptions.PreserveNativeProperties)) { text = textField.StringValue; placeholder = textField.PlaceholderString; enabled = textField.Enabled; } else { textField.StringValue = text; textField.PlaceholderString = placeholder; textField.Enabled = enabled; } textField.Changed += TextField_Changed; }
private void UpdateLogoImage(Team oldTeam, TeamViewModel newViewModel) { if (newViewModel.NewLogoImage == null) { return; } using (var stream = newViewModel.NewLogoImage.OpenReadStream()) { var extension = newViewModel.NewLogoImage.FileName.Split('.').Last(); var fileName = string.Format("logo-{0}.{1}", newViewModel.Id, extension); var oldFile = _dbContext.Teams.Include(t => t.LogoImage).Single(t => t.Id == newViewModel.Id).LogoImage; if (oldFile == null) { var category = ViewHelpers.GetFileCategoryForProperty <Team>(t => t.LogoImage); oldTeam.LogoImage = _storage.Value.Create( category, fileName, stream ); } else { oldTeam.LogoImage = _storage.Value.Replace( oldFile, fileName, stream ); } oldTeam.LogoImage.Name = string.Format("{0}.{1}", newViewModel.Name, extension); newViewModel.LogoImageUrl = oldTeam.LogoImage.Url; } }
public async Task <IActionResult> Create(AccountEditViewModel vm) { RemoveNavigationPropertiesFromModelState <AccountEditViewModel>(); if (ModelState.IsValid) { ViewHelpers.RemoveAllNavigationProperties(vm); if (string.IsNullOrEmpty(vm.Password)) { ModelState.AddModelError(nameof(AccountEditViewModel.Password), "A Password must be set"); return(View(vm)); } if (!await IsCurrentUserSuperAdminAsync().ConfigureAwait(false)) { vm.IsAdmin = false; vm.IsSuperAdmin = false; } var result = await _mapper.CreateAccountAsync(vm).ConfigureAwait(false); if (!result.Succeeded) { ModelState.AddModelError(string.Empty, result.Errors.First().Description); return(View(vm)); } return(RedirectToAction(nameof(Index))); } return(View(vm)); }
protected virtual void InitializeReadOnlyModeBinding() { List <Control> controlList = ViewHelpers.GetAllControls(this); foreach (Control control in controlList) { //if (control is TextBox) control.DataBindings.Add("Readonly", this, "ReadonlyMode"); if (control is TextBox) { control.DataBindings.Add("Enabled", this, "EditableMode"); } else if (control is ComboBox || control is DateTimePicker) { control.DataBindings.Add("Enabled", this, "EditableMode"); } else if (control is DataGridView) { control.DataBindings.Add("Readonly", this, "ReadonlyMode"); control.DataBindings.Add("AllowUserToAddRows", this, "EditableMode"); control.DataBindings.Add("AllowUserToDeleteRows", this, "EditableMode"); } } //this.FastObjectListView.DataBindings.Add("Enabled", this, "ReadonlyMode"); }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); switchControl = ViewHelpers.GetView <NSButton> (nativeView); switchControl.SetButtonType(NSButtonType.Switch); switchControl.AllowsMixedState = false; if (options.HasFlag(BindOptions.PreserveNativeProperties)) { isChecked = switchControl.State == NSCellStateValue.On; enabled = switchControl.Enabled; } else { switchControl.State = isChecked ? NSCellStateValue.On : NSCellStateValue.Off; switchControl.Enabled = enabled; } switchControl.Activated += SwitchControl_Activated; }
public async void AwaitMinimizedInBackground() { while (TotalWebViewsMovingIntoBackground > 0) { await Task.Delay(50); this.LoadUrl(JavascriptCommands._jsPlayVideo); } await Task.Delay(50); PlaystateManagement.WebViewPlayerNumberIsStreaming = this.Id; PlaystateManagement.WebViewPlayerIsStreaming = true; if (AppState.ForeNote == null) { MainPlaybackSticky.StartForeground(BitChute.ExtNotifications.BuildPlayControlNotification()); } ViewHelpers.DoActionOnUiThread(() => { this.LoadUrl(JavascriptCommands._jsPlayVideo); }); await Task.Delay(100); ViewHelpers.DoActionOnUiThread(() => { this.LoadUrl(JavascriptCommands._jsPlayVideo); }); }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); textField = ViewHelpers.GetView <UIKit.UITextField> (nativeView); if (textField == null) { throw new InvalidOperationException("Cannot convert " + nativeView + " to UITextField"); } if (options.HasFlag(BindOptions.PreserveNativeProperties)) { text = textField.Text; placeholder = textField.Placeholder; enabled = textField.Enabled; } else { textField.Text = text; textField.Placeholder = placeholder; textField.Enabled = enabled; } textField.ValueChanged += TextField_ValueChanged; }
public IHttpActionResult RejectWorkflowTask(TaskData model) { WorkflowInstancePoco instance = GetInstance(model.InstanceGuid); try { WorkflowProcess process = GetProcess(instance.Type); IUser currentUser = _utility.GetCurrentUser(); instance = process.ActionWorkflow( instance, WorkflowAction.Reject, currentUser.Id, model.Comment ); Log.Info($"{instance.TypeDescription} request for {instance.Node.Name} [{instance.NodeId}] was rejected by {currentUser.Name}"); _hubContext.Clients.All.TaskRejected( _tasksService.ConvertToWorkflowTaskList(instance.TaskInstances.ToList(), instance: instance)); return(Json(new { message = instance.TypeDescription + " request has been rejected.", status = 200 }, ViewHelpers.CamelCase)); } catch (Exception ex) { string msg = $"An error occurred rejecting the workflow on {instance.Node.Name} [{instance.NodeId}]"; Log.Error(msg, ex); return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg))); } }
protected override void OnRun() { //when window is closed we need to create all the stuff Project currentProject = null; if (IdeApp.ProjectOperations.CurrentSelectedItem is Project project) { currentProject = project; } else if (IdeApp.ProjectOperations.CurrentSelectedItem is ProjectFolder projectFolder && projectFolder.IsFigmaDirectory()) { currentProject = projectFolder.Project; } if (currentProject == null) { return; } var figmaBundleWindow = new FigmaPackageWindow(currentProject); figmaBundleWindow.Appearance = ViewHelpers.GetCurrentIdeAppearance(); var currentIdeWindow = Components.Mac.GtkMacInterop.GetNSWindow(IdeApp.Workbench.RootWindow); currentIdeWindow.AddChildWindow(figmaBundleWindow, AppKit.NSWindowOrderingMode.Above); MessageService.PlaceDialog(figmaBundleWindow, MessageService.RootWindow); IdeServices.DesktopService.FocusWindow(figmaBundleWindow); }
public IHttpActionResult SaveDocTypeConfig(Dictionary <int, List <UserGroupPermissionsPoco> > model) { try { if (null != model) { UmbracoDatabase db = DatabaseContext.Database; // set defaults for doctype - delete all previous if any model data exists db.Execute("DELETE FROM WorkflowUserGroupPermissions WHERE ContentTypeId != 0"); if (model.Any()) { foreach (KeyValuePair <int, List <UserGroupPermissionsPoco> > permission in model) { if (permission.Value.Any()) { db.BulkInsertRecords(permission.Value, DatabaseContext.SqlSyntax); } } } } } catch (Exception ex) { string msg = $"Error saving config. {ex.Message}"; return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg))); } return(Ok()); }
public IHttpActionResult GetNodePendingTasks(int id) { // id will be 0 when creating a new page - id is assigned after save if (id == 0) { return(Json(new { settings = false, noFlow = false }, ViewHelpers.CamelCase)); } try { WorkflowTaskInstancePoco currentTask = _tasksService.GetTasksByNodeId(id).FirstOrDefault(); return(Json(new { items = currentTask != null && currentTask.TaskStatus.In(TaskStatus.PendingApproval, TaskStatus.Rejected) ? _tasksService.ConvertToWorkflowTaskList(new List <WorkflowTaskInstancePoco> { currentTask }) : new List <WorkflowTask>() }, ViewHelpers.CamelCase)); } catch (Exception ex) { string msg = MagicStrings.ErrorGettingPendingTasksForNode.Replace("{id}", id.ToString()); Log.Error(msg, ex); return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg))); } }
public IHttpActionResult GetPendingTasks(int count, int page) { try { List <WorkflowTask> workflowItems = _tasksService.GetPendingTasks( new List <int> { (int)TaskStatus.PendingApproval, (int)TaskStatus.Rejected }, count, page); int taskCount = _tasksService.CountPendingTasks(); return(Json(new { items = workflowItems, total = taskCount, page, count }, ViewHelpers.CamelCase)); } catch (Exception ex) { const string msg = "Error getting pending tasks"; Log.Error(msg, ex); return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg))); } }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); switchControl = ViewHelpers.GetView <UISwitch> (nativeView); if (switchControl == null) { throw new InvalidOperationException("Cannot convert " + nativeView + " to UISwitch"); } if (options.HasFlag(BindOptions.PreserveNativeProperties)) { isChecked = switchControl.On; enabled = switchControl.Enabled; } else { switchControl.On = isChecked; switchControl.Enabled = enabled; } switchControl.ValueChanged += SwitchControl_ValueChanged; }
public IHttpActionResult GetDateList() { try { List <string> dates = new List <string>(); ILog log = LogManager.GetLogger("Workflow"); var logger = (Logger)log.Logger; var appender = (FileAppender)logger.GetAppender("WorkflowLogAppender"); string filePath = appender.File; string logDir = Path.GetDirectoryName(filePath); string fileName = Path.GetFileName(filePath); if (logDir == null) { return(Json(dates, ViewHelpers.CamelCase)); } string[] logFiles = Directory.GetFiles(logDir, $"{fileName}.*"); if (logFiles.Any()) { dates = logFiles.Select(l => l.Substring(l.LastIndexOf('.') + 1)).ToList(); } return(Json(dates, ViewHelpers.CamelCase)); } catch (Exception ex) { const string error = "Could not get log dates"; Log.Error(error, ex); return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, error))); } }
public virtual async Task <ClientSecretsDto> GetClientSecretAsync(int clientSecretId) { var clientSecret = await ClientRepository.GetClientSecretAsync(clientSecretId); if (clientSecret == null) { throw new UserFriendlyErrorPageException(string.Format(ClientServiceResources.ClientSecretDoesNotExist().Description, clientSecretId)); } var clientInfo = await ClientRepository.GetClientIdAsync(clientSecret.Client.Id); if (clientInfo.ClientId == null) { throw new UserFriendlyErrorPageException(string.Format(ClientServiceResources.ClientDoesNotExist().Description, clientSecret.Client.Id)); } var clientSecretsDto = clientSecret.ToModel(); clientSecretsDto.ClientId = clientSecret.Client.Id; clientSecretsDto.ClientName = ViewHelpers.GetClientName(clientInfo.ClientId, clientInfo.ClientName); // remove secret value for dto clientSecretsDto.Value = null; await AuditEventLogger.LogEventAsync(new ClientSecretRequestedEvent(clientSecretsDto.ClientId, clientSecretsDto.ClientSecretId, clientSecretsDto.Type, clientSecretsDto.Expiration)); return(clientSecretsDto); }
public IHttpActionResult ResubmitWorkflowTask(TaskData model) { WorkflowInstancePoco instance = GetInstance(model.InstanceGuid); try { WorkflowProcess process = GetProcess(instance.Type); IUser currentUser = _utility.GetCurrentUser(); instance = process.ResubmitWorkflow( instance, currentUser.Id, model.Comment ); Log.Info($"{instance.TypeDescription} request for {instance.Node.Name} [{instance.NodeId}] was resubmitted by {currentUser.Name}"); return(Json(new { message = $"Changes resubmitted successfully. Page will be {instance.TypeDescriptionPastTense.ToLower()} following workflow completion.", status = 200 }, ViewHelpers.CamelCase)); } catch (Exception ex) { string msg = $"An error occurred processing the approval on {instance.Node.Name} [{instance.NodeId}]"; Log.Error(msg, ex); return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg))); } }
public virtual async Task <ClientPropertiesDto> GetClientPropertyAsync(int clientPropertyId) { var clientProperty = await ClientRepository.GetClientPropertyAsync(clientPropertyId); if (clientProperty == null) { throw new UserFriendlyErrorPageException(string.Format(ClientServiceResources.ClientPropertyDoesNotExist().Description, clientPropertyId)); } var clientInfo = await ClientRepository.GetClientIdAsync(clientProperty.Client.Id); if (clientInfo.ClientId == null) { throw new UserFriendlyErrorPageException(string.Format(ClientServiceResources.ClientDoesNotExist().Description, clientProperty.Client.Id)); } var clientPropertiesDto = clientProperty.ToModel(); clientPropertiesDto.ClientId = clientProperty.Client.Id; clientPropertiesDto.ClientName = ViewHelpers.GetClientName(clientInfo.ClientId, clientInfo.ClientName); await AuditEventLogger.LogEventAsync(new ClientPropertyRequestedEvent(clientPropertiesDto)); return(clientPropertiesDto); }
/// <summary> /// GoodsIssueViewModel goodsIssueViewModel: CURRENT DETAILS OF GOODSISSUE /// List<IPendingPrimaryDetail> pendingPrimaryDetails: COLLECTION OF PENDING ITEMS REQUESTED FOR DELIVERY (HERE WE USE IPendingPrimaryDetail FOR TWO CASE: PendingDeliveryAdviceDetail AND PendingTransferOrderDetail WHICH ARE IMPLEMENTED interface IPendingPrimaryDetail /// IPendingPrimaryDetail pendingPrimaryDetail: CURRENT SELECTED PENDING ITEM (CURRENT SELECTED OF PendingDeliveryAdviceDetail OR PendingTransferOrderDetail). THIS PARAMETER IS REQUIRED BY TABLET MODE: MEANS: WHEN USING BY THE FORFLIFT DRIVER TO MANUAL SELECT BY BARCODE OR BIN LOCATION /// string fileName: WHEN IMPORTED FORM TEXT FILE /// </summary> /// <param name="goodsIssueViewModel"></param> /// <param name="pendingPrimaryDetails"></param> /// <param name="pendingPrimaryDetail"></param> /// <param name="fileName"></param> public WizardDetail(GoodsIssueViewModel goodsIssueViewModel, List <IPendingPrimaryDetail> pendingPrimaryDetails, IPendingPrimaryDetail pendingPrimaryDetail, string fileName) { InitializeComponent(); if (!this.UsingPack) { this.fastAvailablePacks.Dock = DockStyle.None; this.fastAvailablePacks.Visible = false; } this.toolstripChild = this.toolStripBottom; this.customTabBatch = new CustomTabControl(); this.customTabBatch.Font = this.fastAvailablePallets.Font; this.customTabBatch.DisplayStyle = TabStyle.VisualStudio; this.customTabBatch.DisplayStyleProvider.ImageAlign = ContentAlignment.MiddleLeft; this.customTabBatch.TabPages.Add("tabAvailablePallets", "Available pallets"); this.customTabBatch.TabPages.Add("tabAvailableCartons", "Available cartons"); if (this.UsingPack) { this.customTabBatch.TabPages.Add("tabAvailablePacks", "Available packs"); } this.customTabBatch.TabPages[0].Controls.Add(this.fastAvailablePallets); this.customTabBatch.TabPages[1].Controls.Add(this.fastAvailableCartons); if (this.UsingPack) { this.customTabBatch.TabPages[2].Controls.Add(this.fastAvailablePacks); } this.customTabBatch.Dock = DockStyle.Fill; this.fastAvailablePallets.Dock = DockStyle.Fill; this.fastAvailableCartons.Dock = DockStyle.Fill; if (this.UsingPack) { this.fastAvailablePacks.Dock = DockStyle.Fill; } this.panelMaster.Controls.Add(this.customTabBatch); if (GlobalVariables.ConfigID == (int)GlobalVariables.FillingLine.GoodsIssue) { ViewHelpers.SetFont(this, new Font("Calibri", 11), new Font("Calibri", 11), new Font("Calibri", 11)); } this.goodsIssueViewModel = goodsIssueViewModel; this.pendingPrimaryDetails = pendingPrimaryDetails; this.pendingPrimaryDetail = pendingPrimaryDetail; this.fileName = fileName; if (this.fileName != null) { this.toolStripBottom.Visible = true; this.fastMismatchedBarcodes.Visible = true; this.customTabBatch.TabPages.Add("tabMismatchedBarcodes", "Mismatched Barcodes"); this.customTabBatch.TabPages[this.customTabBatch.TabPages.Count - 1].Controls.Add(this.fastMismatchedBarcodes); this.fastMismatchedBarcodes.Dock = DockStyle.Fill; } }
public async Task <IHttpActionResult> Get(int?id = null) { try { if (id.HasValue) { UserGroupPoco result = await _groupService.GetUserGroupAsync(id.Value); if (result != null) { return(Json(result, ViewHelpers.CamelCase)); } } else { return(Json(await _groupService.GetUserGroupsAsync(), ViewHelpers.CamelCase)); } throw new HttpResponseException(HttpStatusCode.NotFound); } catch (Exception e) { string error = MagicStrings.ErrorGettingGroup.Replace("{id}", id.ToString()); Log.Error(error, e); // if we are here, something isn't right... return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(e, error))); } }