private void btnBillNo_Click(object sender, EventArgs e) { DataTable dt = bll.FillDataTable("WMS.SelectBillMaster", new DataParameter[] { new DataParameter("{0}", string.Format("TaskType='11' and AreaCode='{0}'",AreaCode)) }); SelectDialog selectDialog = new SelectDialog(dt, BillFields, false); if (selectDialog.ShowDialog() == DialogResult.OK) { this.txtBillNo.Text = selectDialog["BillID"]; } }
private void btnShowProject_Click(object sender, EventArgs e) { var dx = (DataExportChildProvider)Activator.CoreChildProvider; var projects = dx.Projects.Where(p => p.ProjectNumber == _extractableCohort.ExternalProjectNumber).ToArray(); if (!projects.Any()) { MessageBox.Show("No Projects exist with ProjectNumber " + _extractableCohort.ExternalProjectNumber); } else if (projects.Length == 1) { Activator.RequestItemEmphasis(this, new EmphasiseRequest(projects.Single(), 1)); } else { var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, projects, false, false); if (dialog.ShowDialog() == DialogResult.OK) { Activator.RequestItemEmphasis(this, new EmphasiseRequest(dialog.Selected, 1)); } } }
private void AddExtractableDatasetToPackage(object sender, EventArgs e) { var packageManager = _activator.RepositoryLocator.DataExportRepository.PackageManager; var notInPackage = _childProvider.ExtractableDataSets.Except(packageManager.GetAllDataSets(_package, _childProvider.ExtractableDataSets)); var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(_activator, notInPackage, false, false); dialog.AllowMultiSelect = true; if (dialog.ShowDialog() == DialogResult.OK) { foreach (ExtractableDataSet ds in dialog.MultiSelected.Cast <ExtractableDataSet>()) { packageManager.AddDataSetToPackage(_package, ds); } //package contents changed if (dialog.MultiSelected.Any()) { Publish(_package); } } }
void ReadMasterBill(string billType) { listBill = waveData.ScanNewBill("ScanNewBill", billType); switch (listBill.Count) { case 0: billNo = ""; break; case 1: billNo = listBill[0]; break; default: SelectDialog selectDialog = new SelectDialog(listBill); if (selectDialog.ShowDialog() == DialogResult.OK) { billNo = selectDialog.SelectedBillID; } break; } RefreshData(); }
private void btnOut_Click(object sender, EventArgs e) { //this.ReadMasterBill("5", "STOCKMOVE");//下架 listBill = wave.ScanNewBill("ScanNewBill", "5"); switch (listBill.Count) { case 0: billNo = ""; break; case 1: billNo = listBill[0]; break; default: SelectDialog selectDialog = new SelectDialog(listBill); if (selectDialog.ShowDialog() == DialogResult.OK) { billNo = selectDialog.SelectedBillID; } break; } }
private void btnAddCatalogue_Click(object sender, EventArgs e) { var alreadyMappedCatalogues = olvCatalogues.Objects.Cast <Catalogue>(); var allCatalogues = Activator.RepositoryLocator.CatalogueRepository.GetAllObjects <Catalogue>(); var availableToSelect = allCatalogues.Where(c => !alreadyMappedCatalogues.Contains(c)).ToArray(); var selector = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, availableToSelect, false, false); selector.AllowMultiSelect = true; if (selector.ShowDialog() == DialogResult.OK) { try { AddCatalogues(selector.MultiSelected.Cast <Catalogue>().ToArray()); } catch (Exception ex) { ExceptionViewer.Show("Could not add relationship to Catalogue:" + selector.Selected, ex); } } }
private void btnTaskID_Click(object sender, EventArgs e) { DataTable dt = bll.FillDataTable("WCS.SelectTask", new DataParameter[] { new DataParameter("{0}", string.Format("WCS_TASK.TaskType='11' and WCS_TASK.CellCode='{0}'",CellCode)) }); SelectDialog selectDialog = new SelectDialog(dt, TaskFields, false); if (selectDialog.ShowDialog() == DialogResult.OK) { this.txtTaskNo.Text = selectDialog["TaskNo"]; } }
private void btnProductCode_Click(object sender, EventArgs e) { if (this.txtBillNo.Text.Trim().Length <= 0) { MessageBox.Show("请先选择入库单据号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtBillNo.Focus(); return; } DataTable dt = bll.FillDataTable("CMD.SelectProduct", new DataParameter[] { new DataParameter("{0}", string.Format("AreaCode='{0}'",AreaCode))}); SelectDialog selectDialog = new SelectDialog(dt, ProductFields, false); if (selectDialog.ShowDialog() == DialogResult.OK) { this.txtProductCode.Text = selectDialog["ProductCode"]; } }
/// <summary> /// Display dialog to allow user to select a category item from specified category. /// </summary> /// <param name="sheet"></param> /// <param name="categoryName"></param> /// <param name="instructions"></param> /// <param name="defaultSelectedIndex"></param> /// <param name="useCategorySelectedItemIndex"></param> /// <returns></returns> public static CategoryItem SelectCategoryItem(Sheet sheet, String categoryName, String instructions, Int32 defaultSelectedIndex, Boolean useCategorySelectedItemIndex) { CategoryItem returnValue = default(CategoryItem); Category category = default(Category); String categoryItemName = default(String); try { //User must select a Category Item. // Display the form as a modal dialog box. SelectDialog dialog = new SelectDialog(); //set dialog icon dialog.Icon = MultiDimensionalSpreadsheetLibrary.Properties.Resources.MultiDimensionalSpreadsheet; //set dialog title dialog.Text = "Select a Category Item"; //set instructions dialog.lblInstructions.Text = instructions; //set category name category = sheet.Categories.Find(c => c.Name == categoryName); dialog.lblCategoryName.Text = category.Name; // Add category items to the listbox dialog.ddlCategoryItems.DataSource = category.Items; dialog.ddlCategoryItems.DisplayMember = "Name"; dialog.ddlCategoryItems.ValueMember = "Name"; //pre-set selection if (useCategorySelectedItemIndex) { dialog.ddlCategoryItems.SelectedIndex = category.SelectedItemIndex; } else if (defaultSelectedIndex != -1) { dialog.ddlCategoryItems.SelectedIndex = defaultSelectedIndex; } //show dialog; dialog.ShowDialog(); // Determine if the OK button was clicked on the dialog box. if (dialog.DialogResult == DialogResult.OK) { categoryItemName = ((CategoryItem)dialog.ddlCategoryItems.SelectedItem).Name; dialog.Dispose(); returnValue = category.Items.Find(ci => ci.Name == categoryItemName); } else { dialog.Dispose(); } } catch (Exception ex) { Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error); throw; } return(returnValue); }
void tlvTableInfoMigrations_CellEditStarting(object sender, BrightIdeasSoftware.CellEditEventArgs e) { if (e.RowObject is TableInfo) { e.Cancel = true; } if (e.Column == olvDestinationType) { e.Cancel = true; } var col = e.RowObject as ColumnInfo; if (e.Column == olvMigrationPlan) { e.Control.Bounds = e.CellBounds; } if (col != null) { var plan = _planManager.GetPlanForColumnInfo(col); if (e.Column == olvPickedANOTable) { if (plan.Plan != Plan.ANO) { e.Cancel = true; return; } var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, Activator.CoreChildProvider.AllANOTables, true, false); try { if (dialog.ShowDialog() == DialogResult.OK) { plan.ANOTable = dialog.Selected as ANOTable; } Check(); } catch (Exception exception) { ExceptionViewer.Show(exception); } e.Cancel = true; } if (e.Column == olvDilution) { if (plan.Plan != Plan.Dilute) { e.Cancel = true; return; } var cbx = new ComboBox(); cbx.DropDownStyle = ComboBoxStyle.DropDownList; cbx.Bounds = e.CellBounds; cbx.Items.AddRange(_planManager.DilutionOperations.ToArray()); e.Control = cbx; } if (e.Column == olvDestinationExtractionCategory) { //if the plan is to drop if (plan.Plan == Plan.Drop) { //don't let them edit it e.Cancel = true; return; } var cbx = new ComboBox(); cbx.DropDownStyle = ComboBoxStyle.DropDownList; cbx.Bounds = e.CellBounds; var list = Enum.GetValues(typeof(ExtractionCategory)).Cast <object>().Select(s => s.ToString()).ToList(); list.Add("Clear"); cbx.Items.AddRange(list.ToArray()); e.Control = cbx; if (plan.ExtractionCategoryIfAny.HasValue) { cbx.SelectedItem = plan.ExtractionCategoryIfAny.Value.ToString(); } } } }
private void CreateMissingClassMenuItem_Click(object sender, EventArgs e) { if (this.SystemImplementation == null) return; List<Definitions.Description.Global> globals = new List<Definitions.Description.Global>(); foreach (var prot in this.SystemImplementation.SmalltalkSystem.SystemDescription.Protocols) globals.AddRange(prot.StandardGlobals.Where(g => (g.Definition == null) || (g.Definition is Definitions.Description.GlobalClass))); SelectDialog<Definitions.Description.Global> dlg = new SelectDialog<Definitions.Description.Global>(); dlg.CheckBoxes = true; dlg.Items = globals.Where(g => !this.SystemImplementation.GlobalItems.Any(x => x.Name == g.Name)).OrderBy(g => g.Name); dlg.Columns = new SelectDialogColumn<Definitions.Description.Global>[] { new SelectDialogColumn<Definitions.Description.Global>("Global", 200, (g => g.Name)), new SelectDialogColumn<Definitions.Description.Global>("Protocol", 200, (g => g.Protocol.Name)) }; if (dlg.ShowDialog(this.TopLevelControl) != DialogResult.OK) return; foreach(var g in dlg.SelectedItems) { Class cls = new Class(this.SystemImplementation); cls.Name = g.Name; cls.SuperclassName = "Object"; cls.Description = g.Description; cls.ImplementedClassProtocols.Add(g.Protocol.Name); cls.Initializer.Source = g.Initializer; cls.InstanceState = InstanceStateEnum.NamedObjectVariables; cls.DefiningProtocol = g.Protocol.Name; if (!this.SystemImplementation.GlobalItems.Contains(cls)) this.SystemImplementation.GlobalItems.Add(cls); } this.SystemImplementation.GlobalItems.TriggerChanged(); }
void olvJoin_ButtonClick(object sender, CellClickEventArgs e) { var node = (AvailableForceJoinNode)e.Model; if (e.Column == olvJoinColumn) { //if it has Join Infos if (node.JoinInfos.Any()) { //Find all the joins columns var cols = node.JoinInfos.Select(j => j.PrimaryKey).ToArray(); ColumnInfo toEmphasise = null; //if there's only one column involved in the join if (cols.Length == 1) { toEmphasise = cols[0]; //emphasise it to the user } else { //otherwise show all the columns and let them pick which one they want to navigate to (emphasise) var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, cols, false, false); if (dialog.ShowDialog() == DialogResult.OK) { toEmphasise = (ColumnInfo)dialog.Selected; } } if (toEmphasise != null) { Activator.RequestItemEmphasis(this, new EmphasiseRequest(toEmphasise, 1)); } return; } var otherTables = olvJoin.Objects.OfType <AvailableForceJoinNode>().Where(n => !Equals(n, node)).Select(n => n.TableInfo).ToArray(); if (otherTables.Length == 0) { MessageBox.Show("There are no other tables so no join is required"); return; } TableInfo otherTable = null; if (otherTables.Length == 1) { otherTable = otherTables[0]; } else { var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, otherTables, false, false); if (dialog.ShowDialog() == DialogResult.OK) { otherTable = (TableInfo)dialog.Selected; } } if (otherTable != null) { var cmd = new ExecuteCommandAddJoinInfo(Activator, node.TableInfo); cmd.SetInitialJoinToTableInfo(otherTable); cmd.Execute(); } } }
private void btnState_Click(object sender, EventArgs e) { DataTable dt = bll.FillDataTable("CMD.SelectProductState"); SelectDialog selectDialog = new SelectDialog(dt, StateFields, false); if (selectDialog.ShowDialog() == DialogResult.OK) { this.txtStateNo.Text = selectDialog["StateNo"]; } }
private void CreateMissingGlobalMenuItem_Click(object sender, EventArgs e) { if (this.SystemImplementation == null) return; List<Definitions.Description.Global> globals = new List<Definitions.Description.Global>(); foreach (var prot in this.SystemImplementation.SmalltalkSystem.SystemDescription.Protocols) globals.AddRange(prot.StandardGlobals.Where(g => (g.Definition == null) || (g.Definition is Definitions.Description.GlobalVariable) || (g.Definition is Definitions.Description.GlobalConstant))); SelectDialog<Definitions.Description.Global> dlg = new SelectDialog<Definitions.Description.Global>(); dlg.CheckBoxes = true; dlg.Items = globals.Where(g => !this.SystemImplementation.GlobalItems.Any(x => x.Name == g.Name)).OrderBy(g => g.Name); dlg.Columns = new SelectDialogColumn<Definitions.Description.Global>[] { new SelectDialogColumn<Definitions.Description.Global>("Global", 200, (g => g.Name)), new SelectDialogColumn<Definitions.Description.Global>("Protocol", 200, (g => g.Protocol.Name)) }; if (dlg.ShowDialog(this.TopLevelControl) != DialogResult.OK) return; foreach (var g in dlg.SelectedItems) { Global global = new Global(this.SystemImplementation); global.Name = g.Name; global.GlobalType = (g.Definition is Definitions.Description.GlobalConstant) ? GlobalTypeEnum.Constant : GlobalTypeEnum.Variable; global.Description = g.Description; global.ImplementedProtocols.Add(g.Protocol.Name); global.Initializer.Source = g.Initializer; global.DefiningProtocol = g.Protocol.Name; global.Description = g.Description; if (!this.SystemImplementation.GlobalItems.Contains(global)) this.SystemImplementation.GlobalItems.Add(global); } this.SystemImplementation.GlobalItems.TriggerChanged(); }