Ejemplo n.º 1
0
        public virtual void DocumentFlowChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            if (e.NewValue != e.OldValue && e.NewValue != null && e.NewValue != SignatureSetting.DocumentFlow.All)
            {
                var suitableDocumentKinds = _obj.DocumentKinds.Where(dk => dk.DocumentKind.DocumentFlow == e.NewValue).Select(k => k.DocumentKind).ToList();

                if (suitableDocumentKinds.Count < _obj.DocumentKinds.Count())
                {
                    Functions.Module.TryToShowNotifyMessage(SignatureSettings.Resources.IncompatibleDocumentKindsExcluded);
                    _obj.DocumentKinds.Clear();
                    foreach (var documentKind in suitableDocumentKinds)
                    {
                        _obj.DocumentKinds.AddNew().DocumentKind = documentKind;
                    }
                }
            }

            var categories = Functions.SignatureSetting.GetPossibleCashedCategories(_obj);

            _obj.State.Properties.Categories.IsEnabled = categories.Any();

            if (!_obj.State.Properties.Categories.IsEnabled && _obj.Categories.Any())
            {
                Docflow.PublicFunctions.Module.TryToShowNotifyMessage(SignatureSettings.Resources.IncompatibleCategoriesExcluded);
                _obj.Categories.Clear();
            }
        }
Ejemplo n.º 2
0
 public virtual void IntervalTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
 {
     if (!Equals(e.NewValue, e.OldValue))
     {
         _obj.NextRetention = Functions.RetentionPolicy.GetNextRetentionDate(_obj.RepeatType, e.NewValue, _obj.Interval, Calendar.Now);
     }
 }
Ejemplo n.º 3
0
        public virtual void DocumentFlowChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            if (e.NewValue != e.OldValue)
            {
                _obj.DocumentType = null;
            }

            if (e.NewValue != e.OldValue)
            {
                var actions = _obj.AvailableActions.ToList();
                foreach (var action in actions)
                {
                    _obj.AvailableActions.Remove(action);
                }
            }

            if (e.NewValue != null && !Equals(e.NewValue, e.OldValue))
            {
                if (e.NewValue != DocumentFlow.Outgoing)
                {
                    _obj.AvailableActions.AddNew().Action = Functions.Module.GetSendAction(OfficialDocuments.Info.Actions.SendActionItem);
                }

                if (e.NewValue == DocumentFlow.Incoming)
                {
                    _obj.AvailableActions.AddNew().Action = Functions.Module.GetSendAction(OfficialDocuments.Info.Actions.SendForReview);
                }
                else
                {
                    _obj.AvailableActions.AddNew().Action = Functions.Module.GetSendAction(OfficialDocuments.Info.Actions.SendForFreeApproval);
                    _obj.AvailableActions.AddNew().Action = Functions.Module.GetSendAction(OfficialDocuments.Info.Actions.SendForApproval);
                }
            }
        }
Ejemplo n.º 4
0
 public virtual void ReworkTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
 {
     Functions.ApprovalStage.SetPropertiesAvailability(_obj);
     if (e.NewValue != null && e.NewValue == ReworkType.AfterAll)
     {
         _obj.AllowChangeReworkPerformer = false;
     }
 }
Ejemplo n.º 5
0
        public virtual void NumberingTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            var isNumerable   = e.NewValue == NumberingType.Numerable;
            var isRegistrable = e.NewValue == NumberingType.Registrable;

            _obj.State.Properties.AutoNumbering.IsVisible = isNumerable;
            _obj.GenerateDocumentName = isNumerable || isRegistrable;
        }
Ejemplo n.º 6
0
 public override void ConnectionStatusChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
 {
     base.ConnectionStatusChanged(e);
     if (!e.Params.Contains(Constants.BoxBase.JobRunned) && !Equals(e.NewValue, e.OldValue) && Equals(e.NewValue, BusinessUnitBox.ConnectionStatus.Connected))
     {
         Functions.Module.Remote.RequeueBoxSync();
     }
 }
Ejemplo n.º 7
0
 public virtual void ReasonChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
 {
     if (!Equals(e.NewValue, e.OldValue))
     {
         _obj.Document     = null;
         _obj.DocumentInfo = null;
     }
 }
Ejemplo n.º 8
0
 public virtual void LimitChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
 {
     // При смене типа ограничения очистить поля с суммой и валютой.
     if (e.NewValue != e.OldValue)
     {
         _obj.Amount   = null;
         _obj.Currency = null;
     }
     Functions.SignatureSetting.ChangePropertiesAccess(_obj);
 }
Ejemplo n.º 9
0
 public virtual void StageChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
 {
     if (e.NewValue != Stage.Completed)
     {
         _obj.Status = Sungero.CoreEntities.DatabookEntry.Status.Active;
     }
     else
     {
         _obj.Status = Sungero.CoreEntities.DatabookEntry.Status.Closed;
     }
 }
Ejemplo n.º 10
0
        public virtual void DocumentFlowChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            _obj.State.Properties.DocumentRegister.IsEnabled = e.NewValue != null;
            _obj.State.Properties.DocumentKinds.IsEnabled    = e.NewValue != null;

            if (e.NewValue == null || !Equals(e.NewValue, e.OldValue))
            {
                _obj.DocumentRegister = null;
                _obj.DocumentKinds.Clear();
            }
        }
Ejemplo n.º 11
0
        public virtual void TrackingReturnResultChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            if (Equals(e.NewValue, e.OldValue))
            {
                return;
            }

            if (!_obj.ReturnDate.HasValue)
            {
                _obj.ReturnDate = Calendar.UserToday;
            }
        }
Ejemplo n.º 12
0
        public virtual void ReworkPerformerTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            Functions.ApprovalRuleBase.SetStateProperties(_obj);
            if (!Equals(e.NewValue, ApprovalRuleBase.ReworkPerformerType.EmployeeRole) && !Equals(e.NewValue, e.OldValue))
            {
                _obj.ReworkPerformer = null;
            }

            if (!Equals(e.NewValue, ApprovalRuleBase.ReworkPerformerType.ApprovalRole) && !Equals(e.NewValue, e.OldValue))
            {
                _obj.ReworkApprovalRole = null;
            }
        }
Ejemplo n.º 13
0
        public virtual void RegisterTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            var numerable = e.NewValue == RegisterType.Numbering;

            if (numerable && e.NewValue != e.OldValue)
            {
                _obj.RegistrationGroup = null;
            }
            var  isUsed = Constants.Module.IsUsedParamName;
            bool isUsedValue;

            _obj.State.Properties.RegistrationGroup.IsEnabled = (!e.Params.TryGetValue(isUsed, out isUsedValue) || !isUsedValue) && e.NewValue == RegisterType.Registration;
            Functions.DocumentRegister.SetRequiredProperties(_obj);
        }
Ejemplo n.º 14
0
        public virtual void VerificationStateChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            if (e.NewValue == Docflow.OfficialDocument.VerificationState.Completed)
            {
                ((Domain.Shared.IExtendedEntity)_obj).Params[Constants.OfficialDocument.NeedStoreVerifiedPropertiesValuesParamName] = true;
            }
            else
            {
                ((Domain.Shared.IExtendedEntity)_obj).Params.Remove(Constants.OfficialDocument.NeedStoreVerifiedPropertiesValuesParamName);
            }

            // Вызвать переформирование имени документа, т.к. статус верификации влияет на формирование имени в случае,
            // когда для вида документа отключено формирование имени документа автоматически.
            this.FillName();
        }
Ejemplo n.º 15
0
        public virtual void ReworkPerformerTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            Functions.ApprovalStage.SetRequiredProperties(_obj);
            Functions.ApprovalStage.SetPropertiesAvailability(_obj);
            Functions.ApprovalStage.SetPropertiesVisibility(_obj);

            if (!Equals(e.NewValue, ApprovalStage.ReworkPerformerType.EmployeeRole) && !Equals(e.NewValue, e.OldValue))
            {
                _obj.ReworkPerformer = null;
            }

            if (!Equals(e.NewValue, ApprovalStage.ReworkPerformerType.ApprovalRole) && !Equals(e.NewValue, e.OldValue))
            {
                _obj.ReworkApprovalRole = null;
            }
        }
Ejemplo n.º 16
0
        public virtual void DocumentFlowChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            if (e.NewValue != e.OldValue && e.NewValue != null)
            {
                var suitableDocumentKinds = _obj.DocumentKinds.Where(dk => dk.DocumentKind.DocumentFlow == e.NewValue).Select(k => k.DocumentKind).ToList();

                if (suitableDocumentKinds.Count < _obj.DocumentKinds.Count())
                {
                    Functions.Module.TryToShowNotifyMessage(ApprovalRuleBases.Resources.IncompatibleDocumentKindsExcluded);
                    _obj.DocumentKinds.Clear();
                    foreach (var documentKind in suitableDocumentKinds)
                    {
                        _obj.DocumentKinds.AddNew().DocumentKind = documentKind;
                    }
                }
            }
        }
Ejemplo n.º 17
0
        public virtual void SettingTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            _obj.State.Properties.DocumentRegister.IsEnabled = e.NewValue != null;
            _obj.State.Properties.DocumentKinds.IsEnabled    = e.NewValue != null;

            var docRegisterTypeChanged = ((e.OldValue == SettingType.Numeration) || (e.NewValue == SettingType.Numeration)) && (e.NewValue != e.OldValue);

            if (e.NewValue == null || docRegisterTypeChanged)
            {
                _obj.DocumentRegister = null;
                _obj.DocumentKinds.Clear();
            }

            // Для входящих документов резервирование не имеет смысла.
            if (e.NewValue == SettingType.Reservation && _obj.DocumentFlow == DocumentFlow.Incoming)
            {
                _obj.DocumentFlow = null;
            }
        }
Ejemplo n.º 18
0
        public virtual void RepeatTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            if (!Equals(e.NewValue, e.OldValue))
            {
                if (e.NewValue == null || e.NewValue.Value != RetentionPolicy.RepeatType.CustomInterval)
                {
                    _obj.Interval     = null;
                    _obj.IntervalType = null;
                }

                if (e.NewValue != null && e.NewValue.Value == RetentionPolicy.RepeatType.WhenJobStart)
                {
                    _obj.NextRetention = null;
                }

                _obj.NextRetention = Functions.RetentionPolicy.GetNextRetentionDate(e.NewValue, _obj.IntervalType, _obj.Interval, Calendar.Now);
            }

            Functions.RetentionPolicy.SetRequiredProperties(_obj);
        }
Ejemplo n.º 19
0
        public virtual void RoutingChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            if (e.NewValue == Sungero.ExchangeCore.BoxBase.Routing.NoAssignments)
            {
                _obj.State.Properties.DeadlineInDays.IsEnabled  = false;
                _obj.State.Properties.DeadlineInHours.IsEnabled = false;
                _obj.DeadlineInDays  = null;
                _obj.DeadlineInHours = null;
            }
            else
            {
                _obj.State.Properties.DeadlineInDays.IsEnabled  = true;
                _obj.State.Properties.DeadlineInHours.IsEnabled = true;
                if (_obj.DeadlineInDays == null && _obj.DeadlineInHours == null)
                {
                    _obj.DeadlineInHours = Sungero.ExchangeCore.PublicConstants.BoxBase.DefaultDeadlineInHours;
                }
            }

            _obj.State.Properties.DeadlineInDays.IsRequired  = !_obj.DeadlineInHours.HasValue && e.NewValue != Sungero.ExchangeCore.BoxBase.Routing.NoAssignments;
            _obj.State.Properties.DeadlineInHours.IsRequired = !_obj.DeadlineInDays.HasValue && e.NewValue != Sungero.ExchangeCore.BoxBase.Routing.NoAssignments;
        }
Ejemplo n.º 20
0
 public virtual void AssigneeTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
 {
     if (e.NewValue == e.OldValue)
     {
         return;
     }
     Functions.ApprovalStage.SetPropertiesVisibility(_obj);
     Functions.ApprovalStage.SetPropertiesAvailability(_obj);
     Functions.ApprovalStage.SetRequiredProperties(_obj);
     if (e.NewValue == null)
     {
         _obj.ApprovalRole = null;
         _obj.Assignee     = null;
     }
     if (e.NewValue == AssigneeType.Role)
     {
         _obj.Assignee = null;
         Functions.ApprovalStage.SetDefaultRole(_obj);
     }
     if (e.NewValue == AssigneeType.Employee)
     {
         _obj.ApprovalRole = null;
     }
 }
Ejemplo n.º 21
0
        public virtual void TrackingActionChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            // Установить срок возврата: 10 раб.дней для внутренней выдачи и 20 раб.дней для Отправки КА.
            if (!_obj.State.Properties.ReturnDeadline.OriginalValue.HasValue)
            {
                var user = _obj.DeliveredTo ?? Users.Current;
                var issuingScheduledDate = Calendar.Today.AddWorkingDays(user, 10).Date;
                var sendingScheduledDate = Calendar.Today.AddWorkingDays(user, 20).Date;

                if (e.NewValue == Docflow.OfficialDocumentTracking.Action.Delivery &&
                    (!_obj.ReturnDeadline.HasValue || (_obj.ReturnDeadline == sendingScheduledDate &&
                                                       e.OldValue == Docflow.OfficialDocumentTracking.Action.Sending)))
                {
                    _obj.ReturnDeadline = issuingScheduledDate;
                }

                if (e.NewValue == Docflow.OfficialDocumentTracking.Action.Sending &&
                    (!_obj.ReturnDeadline.HasValue || (_obj.ReturnDeadline == issuingScheduledDate &&
                                                       e.OldValue == Docflow.OfficialDocumentTracking.Action.Delivery)))
                {
                    _obj.ReturnDeadline = sendingScheduledDate;
                }
            }
        }
Ejemplo n.º 22
0
 public override void StatusChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
 {
     base.StatusChanged(e);
     Functions.BusinessUnitBox.ResetConnectionStatus(_obj);
 }
 public override void LifeCycleStateChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
 {
 }
Ejemplo n.º 24
0
 public virtual void ExternalApprovalStateChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
 {
     Functions.OfficialDocument.UpdateLifeCycle(_obj, _obj.RegistrationState, _obj.InternalApprovalState, e.NewValue);
 }
Ejemplo n.º 25
0
        public virtual void StageTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            if (e.NewValue == e.OldValue)
            {
                return;
            }

            // Тип исполнителя по умолчанию Роль.
            _obj.AssigneeType = AssigneeType.Role;

            Functions.ApprovalStage.SetPropertiesVisibility(_obj);
            Functions.ApprovalStage.SetPropertiesAvailability(_obj);

            #region Очистка скрытых свойств

            var properties = _obj.State.Properties;

            if (!properties.Assignee.IsVisible)
            {
                _obj.Assignee = null;
            }

            if (!properties.ApprovalRole.IsVisible)
            {
                _obj.ApprovalRole = null;
            }

            if (!properties.ApprovalRoles.IsVisible)
            {
                _obj.ApprovalRoles.Clear();
            }

            if (!properties.Sequence.IsVisible)
            {
                _obj.Sequence = null;
            }

            if (!properties.NeedStrongSign.IsVisible)
            {
                _obj.NeedStrongSign = false;
            }

            if (!properties.AllowSendToRework.IsVisible)
            {
                _obj.AllowSendToRework = false;
            }

            if (!properties.IsConfirmSigning.IsVisible)
            {
                _obj.IsConfirmSigning = false;
            }

            if (!properties.IsResultSubmission.IsVisible)
            {
                _obj.IsResultSubmission = false;
            }

            if (!properties.DeadlineInDays.IsVisible)
            {
                _obj.DeadlineInDays = null;
            }

            if (!properties.DeadlineInHours.IsVisible || !properties.DeadlineInHours.IsEnabled)
            {
                _obj.DeadlineInHours = null;
            }

            if (!properties.StartDelayDays.IsEnabled)
            {
                _obj.StartDelayDays = null;
            }

            if (!properties.ReworkType.IsVisible || !properties.ReworkType.IsEnabled)
            {
                _obj.ReworkType = null;
            }

            if (!properties.Subject.IsVisible)
            {
                _obj.Subject = null;
            }

            if (!properties.ReworkPerformerType.IsVisible || !properties.ReworkPerformerType.IsEnabled)
            {
                _obj.ReworkPerformerType = null;
            }

            if (!properties.ReworkPerformer.IsVisible || !properties.ReworkPerformer.IsEnabled)
            {
                _obj.ReworkPerformer = null;
            }

            if (!properties.ReworkApprovalRole.IsVisible)
            {
                _obj.ReworkApprovalRole = null;
            }

            if (!properties.AllowChangeReworkPerformer.IsVisible || !properties.AllowChangeReworkPerformer.IsEnabled)
            {
                _obj.AllowChangeReworkPerformer = false;
            }

            #endregion

            Functions.ApprovalStage.SetDefaultRole(_obj);

            // Установить тип подписи по умолчанию.
            if (e.NewValue == StageType.Approvers || e.NewValue == StageType.Manager || e.NewValue == StageType.Review)
            {
                _obj.NeedStrongSign = false;
            }
            else if (e.NewValue == StageType.Sign)
            {
                _obj.NeedStrongSign = true;
            }
            else
            {
                _obj.NeedStrongSign = null;
            }

            if (e.NewValue == StageType.Approvers)
            {
                _obj.ReworkType = Docflow.ApprovalStage.ReworkType.AfterAll;
            }

            if (e.NewValue == StageType.Approvers || e.NewValue == StageType.Manager || e.NewValue == StageType.Sign || e.NewValue == StageType.Review)
            {
                _obj.ReworkPerformerType = Docflow.ApprovalStage.ReworkPerformerType.FromRule;
            }

            // Для контроля возврата старт всегда параллельно, доработка после каждого.
            if (e.NewValue == StageType.CheckReturn)
            {
                _obj.Sequence   = Sequence.Parallel;
                _obj.ReworkType = ReworkType.AfterEach;
            }

            // Для задания, печати, регистрации, отправки, создании поручений по умолчанию нет доработки.
            if (e.NewValue == StageType.SimpleAgr || e.NewValue == StageType.Print || e.NewValue == StageType.Register ||
                e.NewValue == StageType.Sending || e.NewValue == StageType.Execution)
            {
                _obj.AllowSendToRework = false;
            }

            // HACK, BUG 28505
            ((Domain.Shared.Validation.IValidationObject)_obj).ValidationResult.Clear();

            Functions.ApprovalStage.SetRequiredProperties(_obj);
        }
Ejemplo n.º 26
0
        public virtual void ConditionTypeChanged(Sungero.Domain.Shared.EnumerationPropertyChangedEventArgs e)
        {
            Functions.ConditionBase.ChangePropertiesAccess(_obj);

            Functions.ConditionBase.ClearHiddenProperties(_obj);
        }