public bool CanExecute() { return (viewModel.SaveCommand.CanExecute() && ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditComponent) && ctx.HasAccess(global::Domain.Entity.Security.Privileges.CreateComponent)); }
public ReleaseNoteNewEditXtraForm(Guid id) { this.id = id; InitializeComponent(); viewModel = (ReleaseNoteViewModel)Program.Kernel.Get <ReleaseNoteViewModel>(new ConstructorArgument("id", id)); viewModel.ModifiableView = this; viewModel.validatableView = this; viewModel.PropertyChanged += (s, e) => IsModified = true; releaseNoteDate.Properties.NullDate = DateTime.MinValue; releaseNoteDate.Properties.NullText = string.Empty; this.releaseNoteDate.SetRequiredText(); this.releaseNoteNumber.SetRequiredText(); SetControlsTextLength(); this.certificateNumber.SetAsIdentifier(); this.pipeNumberLookUp.SetAsIdentifier(); this.releaseNoteNumber.SetAsIdentifier(); this.railcarNumber.SetAsIdentifier(); SetAlwaysReadOnly(textEditReleaseNoteStatus); IsEditMode = true; //do not remove until IsEditMode logic is changed IsEditMode = ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditReleaseNote); attachmentsButton.Enabled = true; CannotOpenForViewing = id == Guid.Empty; }
public SpoolsXtraForm(Guid id, string number) { this.id = id; InitializeComponent(); SetControlsTextLength(); viewModel = (SpoolViewModel)Program.Kernel.Get <SpoolViewModel>(new ConstructorArgument("id", id)); viewModel.ModifiableView = this; pipeNumber.SetAsIdentifier(); spoolNumber.SetAsIdentifier(); if (number != string.Empty) { viewModel.SpoolNumber = number; } SetAlwaysReadOnly(pipeLength); if (id == Guid.Empty) { SetAlwaysEditable(pipeNumber); } else { this.Text = Program.LanguageManager.GetString(StringResources.Spool_EditDocumentHeader); SetAlwaysReadOnly(pipeNumber); } IsEditMode = true;//do not remove until IsEditMode logic is changed IsEditMode = ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditSpool); CannotOpenForViewing = id == Guid.Empty; }
public JointNewEditXtraForm(Guid id) { this.id = id; InitializeComponent(); SetControlsTextLength(); viewModel = (JointNewEditViewModel)Program .Kernel .Get <JointNewEditViewModel>( new ConstructorArgument("id", id)); viewModel.ModifiableView = this; viewModel.ValidatableView = this; loweringDate.Properties.NullText = String.Empty; loweringDate.Properties.NullDate = DateTime.MinValue; CannotOpenForViewing = id == Guid.Empty; #region --- Colouring of required controls, IsEditMode, uppercasing --- jointNumber.SetRequiredText(); SetAlwaysReadOnly(jointStatus); firstJointElement.SetRequiredText(); secondJointElement.SetRequiredText(); IsEditMode = ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditJoint); jointNumber.SetAsIdentifier(); firstJointElement.SetAsIdentifier(); secondJointElement.SetAsIdentifier(); attachmentsButton.Enabled = true; #endregion }
public bool CanExecute() { return(viewModel.Spool.IsActive && ctx.HasAccess(viewModel.IsNew ? global::Domain.Entity.Security.Privileges.CreateSpool : global::Domain.Entity.Security.Privileges.EditSpool)); }
public bool CanExecute() { return(viewModel.SpoolIsActive && !viewModel.IsNew && viewModel.ModifiableView.IsEditMode && ctx.HasAccess(global::Domain.Entity.Security.Privileges.DeactivateSpool)); }
public ComponentNewEditXtraForm(Guid id, string number) { this.id = id; InitializeComponent(); viewModel = (ComponentNewEditViewModel)Program .Kernel .Get <ComponentNewEditViewModel>(new ConstructorArgument("id", id)); viewModel.ModifiableView = this; viewModel.ValidatableView = this; viewModel.Number = number; IsEditMode = ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditComponent); attachmentsButton.Enabled = true; CannotOpenForViewing = id == Guid.Empty; #region --- Colouring of required controls --- componentNumber.SetRequiredText(); type.SetRequiredText(); #endregion //--- Colouring of required controls --- #region --- Set Properties.CharacterCasing to Upper --- componentNumber.SetAsIdentifier(); certificateNumber.SetAsIdentifier(); #endregion //--- Set Properties.CharacterCasing to Upper --- }
public bool CanExecute() { return(!viewModel.Shipped && !string.IsNullOrWhiteSpace(viewModel.Number) && viewModel.ReleaseNotePipes.Count > 0 && ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditReleaseNote)); }
public bool CanExecute() { return (viewModel.Component.IsActive && !viewModel.IsNew && ctx.HasAccess(global::Domain.Entity.Security.Privileges.DeactivateComponent)); }
public bool CanExecute() { return(viewModel.ModifiableView.IsEditMode && !string.IsNullOrEmpty(viewModel.PipeNumber) && ctx.HasAccess(viewModel.IsNew ? global::Domain.Entity.Security.Privileges.CreateSpool : global::Domain.Entity.Security.Privileges.EditSpool)); }
public bool CanExecute() { bool condition = !string.IsNullOrWhiteSpace(viewModel.Number) && !viewModel.Shipped; bool conditionAndPermission; if (viewModel.IsNew) { conditionAndPermission = condition && ctx.HasAccess(global::Domain.Entity.Security.Privileges.CreateReleaseNote); } else { conditionAndPermission = condition && ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditReleaseNote); } return(conditionAndPermission); }
public bool CanExecute() { return (viewModel.Pipe.Status != PipeMillStatus.Shipped && viewModel.Pipe.IsActive && !viewModel.IsNew && viewModel.ModifiableView.IsEditMode && ctx.HasAccess(global::Domain.Entity.Security.Privileges.DeactivatePipe)); }
public bool CanExecute() { return(!string.IsNullOrEmpty(viewModel.Number) && viewModel.Type != null && viewModel.ModifiableView.IsEditMode && ctx.HasAccess(viewModel.IsNew ? global::Domain.Entity.Security.Privileges.CreateComponent : global::Domain.Entity.Security.Privileges.EditComponent)); }
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(); }
/// <summary> /// helper method to determine security issues about document to be opened /// </summary> /// <param name="documentType">type of document</param> /// <returns>pack of flags</returns> private FormFlags GetSecurityRestrictionReasons(DocumentTypes documentType) { FormFlags reasons = FormFlags.Nothing; reasons |= SecurityUtil.ExistOnCurrentWorkstation(childForms.GetAccessOption(documentType, editMode: true)) ? FormFlags.CanEditAtThisWorkstation : FormFlags.Nothing; reasons |= SecurityUtil.ExistOnCurrentWorkstation(childForms.GetAccessOption(documentType, editMode: false)) ? FormFlags.CanReadAtThisWorkstation : FormFlags.Nothing; if (!ctx.HasAccess(childForms.GetAccessOption(documentType, editMode: true))) { reasons |= FormFlags.EditAccessDenied; } if (!ctx.HasAccess(childForms.GetAccessOption(documentType, editMode: false))) { reasons |= FormFlags.ReadAccessDenied; } return(reasons); }
public bool CanExecute() { return(viewModel.Heat != null && viewModel.PipeMillSizeType != null && viewModel.PipePurchaseOrder != null && !string.IsNullOrEmpty(viewModel.Number) && !string.IsNullOrEmpty(viewModel.PlateNumber) && viewModel.ProductionDate != DateTime.MinValue && !string.IsNullOrEmpty(viewModel.PlateNumber) && viewModel.ModifiableView.IsEditMode && ctx.HasAccess(viewModel.IsNew ? global::Domain.Entity.Security.Privileges.CreatePipe : global::Domain.Entity.Security.Privileges.EditPipe)); }
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 bool CanExecute() { return (!string.IsNullOrEmpty(viewModel.Number) && ((viewModel.FirstElement != null && viewModel.SecondElement != null) || viewModel.Joint.Status == Domain.Entity.Construction.JointStatus.Withdrawn) && viewModel.ModifiableView.IsEditMode && ctx.HasAccess(viewModel.IsNew ? global::Domain.Entity.Security.Privileges.CreateJoint : global::Domain.Entity.Security.Privileges.EditJoint)); }
public SpoolsXtraForm(Guid id, string number) { this.Id = id; InitializeComponent(); SetControlsTextLength(); viewModel = (SpoolViewModel)Program.Kernel.Get <SpoolViewModel>(new ConstructorArgument("id", id)); viewModel.ModifiableView = this; pipeNumber.SetAsLookUpIdentifier(); spoolNumber.SetAsLookUpIdentifier(); if (number != string.Empty) { viewModel.SpoolNumber = number; } SetAlwaysReadOnly(pipeLength); if (id == Guid.Empty) { SetAlwaysEditable(pipeNumber); } else { this.Text = Program.LanguageManager.GetString(StringResources.Spool_EditDocumentHeader); SetAlwaysReadOnly(pipeNumber); if (Program.ThisWorkstationType == Domain.Entity.Setup.WorkstationType.Master) { SetAlwaysReadOnly(spoolNumber); SetAlwaysReadOnly(spoolLength); SetAlwaysReadOnly(inspectionHistory); } else { SetConditional(inspectionHistory, delegate(bool editMode) { return(viewModel.Spool.ConstructionStatus != PartConstructionStatus.Welded); }); SetConditional(spoolNumber, delegate(bool editMode) { return(viewModel.SpoolIsActive); }); SetConditional(spoolLength, delegate(bool editMode) { return(viewModel.SpoolIsActive); }); SetConditional(pipeNumber, delegate(bool editMode) { return(viewModel.SpoolIsActive); }); } } IsEditMode = true;//do not remove until IsEditMode logic is changed IsEditMode = ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditSpool); CannotOpenForViewing = id == Guid.Empty; viewModel.editableForm = this; spoolLength.SetMask(Constants.PositiveDigitMask); spoolLength.Properties.MinValue = Constants.MinSpoolCut; spoolLength.Properties.MaxValue = viewModel.InitPipeLenght - Constants.MinSpoolCut; }
private void ProvideAccessToMenuItems() { ISecurityContext ctx = Program.Kernel.Get <ISecurityContext>(); barButtonItemAudit.Enabled = ctx.HasAccess(Privileges.Audit); barButtonItemSettingsProject.Enabled = barButtonItemSettingsPipe.Enabled = barButtonItemSettingsPipeline.Enabled = barButtonItemComponentry.Enabled = barButtonItemSettingsWelders.Enabled = barButtonItemSettingsInspectors.Enabled = barButtonItemSettingsUsers.Enabled = barButtonItemRoles.Enabled = ctx.HasAccess(Privileges.ViewSettings) || ctx.HasAccess(Privileges.EditSettings); barButtonItemMillReports.Enabled = ctx.HasAccess(Privileges.PrintMillReports); pipeConstructionRepoBarButton.Enabled = weldConstructionRepoBarButton.Enabled = barButtonItemConstructionReports.Enabled = ctx.HasAccess(Privileges.PrintConstructionReports); barButtonItemInspectionReports.Enabled = ctx.HasAccess(Privileges.PrintInspectionReports); barButtonItemNewPipe.Enabled = ctx.HasAccess(Privileges.CreatePipe); barButtonItemNewRailcar.Enabled = ctx.HasAccess(Privileges.CreateReleaseNote); barButtonItemNewJoint.Enabled = ctx.HasAccess(Privileges.CreateJoint); barButtonItemNewComponent.Enabled = ctx.HasAccess(Privileges.CreateComponent); barButtonItemSpool.Enabled = ctx.HasAccess(Privileges.CreateSpool) || ctx.HasAccess(Privileges.EditSpool); barButtonItemExport.Enabled = ctx.HasAccess(Privileges.ExportDataFromMaster) || ctx.HasAccess(Privileges.ExportDataFromConstruction) || ctx.HasAccess(Privileges.ExportDataFromMill); barButtonItemImport.Enabled = ctx.HasAccess(Privileges.ImportDataAtMaster) || ctx.HasAccess(Privileges.ImportDataAtConstruction); barButtonItemFindEditJoints.Enabled = ctx.HasAccess(Privileges.SearchJoints); barButtonItemFindEditParts.Enabled = ctx.HasAccess(Privileges.SearchParts); barButtonItemPartIncomingInspection.Enabled = ctx.HasAccess(Privileges.PartsInspection); barButtonItemMillFindEditPipes.Enabled = ctx.HasAccess(Privileges.SearchPipes); barButtonItemFindEditShipRailcars.Enabled = ctx.HasAccess(Privileges.SearchReleaseNotes); }
public bool CanExecute() { return(viewModel.Shipped && ctx.HasAccess(global::Domain.Entity.Security.Privileges.UnshipAtMill)); }
public bool CanExecute() { return(ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditSettings)); }
public MillPipeNewEditXtraForm(Guid id) { this.id = id; InitializeComponent(); SetControlsTextLength(); viewModel = (MillPipeNewEditViewModel)Program .Kernel .Get <MillPipeNewEditViewModel>( new ConstructorArgument("id", id)); viewModel.ModifiableView = this; viewModel.ValidatableView = this; pipeCreationDate.Properties.NullDate = DateTime.MinValue; pipeCreationDate.Properties.NullText = string.Empty; #region --- Colouring of required controls --- pipeNumber.SetRequiredText(); pipeSize.SetRequiredCombo(); pipeCreationDate.SetRequiredText(); heatsLookUp.SetRequiredGridLookUp(); ordersLookUp.SetRequiredText(); plateNumber.SetRequiredText(); #endregion //--- Colouring of required controls --- #region --- Read-only controls and edit mode --- SetAlwaysReadOnly(plateManufacturer); SetAlwaysReadOnly(purchaseOrderDate); SetAlwaysReadOnly(railcarNumber); SetAlwaysReadOnly(releaseNoteNumber); SetAlwaysReadOnly(releaseNoteDate); SetAlwaysReadOnly(certificateNumber); SetAlwaysReadOnly(destination); SetAlwaysReadOnly(steelGrade); SetAlwaysReadOnly(weight); SetAlwaysReadOnly(length); SetAlwaysReadOnly(pipeLength); SetAlwaysReadOnly(diameter); SetAlwaysReadOnly(thickness); SetAlwaysReadOnly(millStatus); IsEditMode = ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditPipe); attachmentsButton.Enabled = true; #endregion //--- Read-only controls --- #region --- Set Properties.CharacterCasing to Upper --- pipeNumber.SetAsIdentifier(); plateNumber.SetAsIdentifier(); heatsLookUp.SetAsIdentifier(); ordersLookUp.SetAsIdentifier(); certificateNumber.SetAsIdentifier(); #endregion //--- Set Properties.CharacterCasing to Upper --- heatsLookUp.ButtonSetup(); ordersLookUp.ButtonSetup(); // Allow change focus or close while heatsLookUp or ordersLookUp validation error AutoValidate = AutoValidate.EnableAllowFocusChange; IsEditMode = true; // Select tab depending on is new pipe or existed tabbedControlGroup.SelectedTabPage = (id == Guid.Empty) ? pipeTabLayoutControlGroup : inspectionsTabLayoutControlGroup; CannotOpenForViewing = id == Guid.Empty; }
public bool CanExecute() { return(viewModel.InspectionTestResults != null && ctx.HasAccess(global::Domain.Entity.Security.Privileges.PartsInspection)); }