public void Execute() { BindingList <Part> parts = new BindingList <Part>(); var query = session.CreateSQLQuery(PartQuery.BuildSqlForInspection(viewModel.SearchNumber)) .SetResultTransformer(PartQuery.Transformer); var qparts = query.List <Part>(); foreach (var item in qparts) { if (item.IsActive) { parts.Add(item); } } viewModel.Parts = parts; if (parts.Count > 0) { if (inspectionDialog == null) { inspectionDialog = new InspectionSelectPartDialog(parts, viewModel); } else { inspectionDialog.SetupForm(parts, viewModel); } inspectionDialog.ShowDialog(); } else if (ctx.HasAccess(global::Domain.Entity.Security.Privileges.PartsInspection)) { if (dialog == null) { dialog = new CreateSpoolComponentDialog(viewModel.SearchNumber); } else { dialog.SetupForm(viewModel.SearchNumber); } dialog.ShowDialog(); var parent = viewModel.CurrentForm.MdiParent as PrizmApplicationXtraForm; if (parent != null && dialog.DialogResult == DialogResult.Yes) { parent.OpenChildForm(typeof(SpoolsXtraForm), Guid.Empty, viewModel.SearchNumber); } else if (parent != null && dialog.DialogResult == DialogResult.No) { parent.OpenChildForm(typeof(ComponentNewEditXtraForm), Guid.Empty, viewModel.SearchNumber); } } RefreshVisualStateEvent(); }
public void Execute() { BindingList <Part> parts = new BindingList <Part>(); var query = session.CreateSQLQuery(PartQuery.BuildSqlForInspection(viewModel.SearchNumber)) .SetResultTransformer(PartQuery.Transformer); var qparts = query.List <Part>(); foreach (var item in qparts) { parts.Add(item); } viewModel.Parts = parts; if (parts.Count > 0) { if (inspectionDialog == null) { inspectionDialog = new InspectionSelectPartDialog(parts, viewModel); } else { inspectionDialog.SetupForm(parts, viewModel); } inspectionDialog.ShowDialog(); } else if (ctx.HasAccess(global::Domain.Entity.Security.Privileges.PartsInspection)) { if (dialog == null) { dialog = new CreateSpoolComponentDialog(viewModel.SearchNumber); } else { dialog.SetupForm(viewModel.SearchNumber); } dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.Yes) { FormManager.Instance.OpenChildForm(DocumentTypes.ConstructionSpool, viewModel.SearchNumber); } else if (dialog.DialogResult == DialogResult.No) { FormManager.Instance.OpenChildForm(DocumentTypes.ConstructionComponent, viewModel.SearchNumber); } } RefreshVisualStateEvent(); }
public void Execute() { BindingList<Part> parts = new BindingList<Part>(); var query = session.CreateSQLQuery(PartQuery.BuildSqlForInspection(viewModel.SearchNumber)) .SetResultTransformer(PartQuery.Transformer); var qparts = query.List<Part>(); foreach (var item in qparts) { parts.Add(item); } viewModel.Parts = parts; if (parts.Count > 0) { if (inspectionDialog == null) { inspectionDialog = new InspectionSelectPartDialog(parts, viewModel); } else { inspectionDialog.SetupForm(parts, viewModel); } inspectionDialog.ShowDialog(); } else if (ctx.HasAccess(global::Domain.Entity.Security.Privileges.PartsInspection)) { if (dialog == null) { dialog = new CreateSpoolComponentDialog(viewModel.SearchNumber); } else { dialog.SetupForm(viewModel.SearchNumber); } dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.Yes) { FormManager.Instance.OpenChildForm(DocumentTypes.ConstructionSpool, viewModel.SearchNumber); } else if (dialog.DialogResult == DialogResult.No) { FormManager.Instance.OpenChildForm(DocumentTypes.ConstructionComponent, viewModel.SearchNumber); } } RefreshVisualStateEvent(); }