Exemplo n.º 1
0
        public virtual void ShowDuplicates(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var duplicates = Functions.JobTitle.Remote.GetDuplicates(_obj);

            if (duplicates.Any())
            {
                duplicates.Show();
            }
        }
Exemplo n.º 2
0
        public override void CreateFromTemplate(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            // Добавить признак того, что версия создается из шаблона.
            e.Params.Add(Constants.Module.CreateFromTemplate, true);

            base.CreateFromTemplate(e);

            e.Params.Remove(Constants.Module.CreateFromTemplate);
        }
Exemplo n.º 3
0
        public virtual void ShowEmployeesWithSameJobTitle(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var employees = Functions.JobTitle.Remote.GetEmployeesWithSameJobTitle(_obj);

            if (employees.Any())
            {
                employees.Show();
            }
        }
Exemplo n.º 4
0
        public virtual void ExportDocument(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var documents = new List <IOfficialDocument>()
            {
                _obj
            };

            Functions.Module.ExportDocumentDialog(documents);
        }
Exemplo n.º 5
0
 public virtual void ShowAcquaintanceFormReport(Sungero.Domain.Client.ExecuteActionArgs e)
 {
     if (!_obj.DocumentGroup.OfficialDocuments.Any())
     {
         e.AddError(AcquaintanceTasks.Resources.DocumentCantBeEmpty);
         return;
     }
     RecordManagement.Functions.Module.GetAcquaintanceFormReport(_obj).Open();
 }
Exemplo n.º 6
0
        public virtual void ApprovalForm(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            if (!Functions.ApprovalTask.Remote.HasDocumentAndCanRead(_obj))
            {
                e.AddError(ApprovalTasks.Resources.NoRightsToDocument);
                return;
            }

            Docflow.Functions.Module.RunApprovalSheetReport(_obj.DocumentGroup.OfficialDocuments.Single());
        }
Exemplo n.º 7
0
        public override void Register(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            if (_obj.IsManyAddressees == true && !_obj.Addressees.Any())
            {
                e.AddError(OutgoingDocumentBases.Resources.NeedFillAddressee);
                return;
            }

            base.Register(e);
        }
Exemplo n.º 8
0
        public virtual void BarcodeReport(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var report            = Reports.GetBarcodePageReport();
            var tenantId          = Functions.Module.Remote.GetCurrentTenantId();
            var formattedTenantId = PublicFunctions.Module.FormatTenantIdForBarcode(tenantId);

            report.barcode     = string.Format("{0} - {1}", formattedTenantId, _obj.Id);
            report.barcodeName = string.Format("{0} - {1}", SystemInfo.GetBrandName(), _obj.Id);
            report.Open();
        }
Exemplo n.º 9
0
        public virtual void ShowAcquaintanceReport(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            if (!Functions.OfficialDocument.Remote.GetAcquaintanceTasks(_obj).Any())
            {
                Dialogs.NotifyMessage(OfficialDocuments.Resources.NoAcquaintanceTasks);
                return;
            }

            RecordManagement.PublicFunctions.Module.GetAcquaintanceReport(_obj).Open();
        }
        public virtual void CreateCoverLetter(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            if (!Functions.ApprovalTask.Remote.HasDocumentAndCanRead(ApprovalTasks.As(_obj.Task)))
            {
                e.AddError(ApprovalTasks.Resources.NoRightsToDocument);
                return;
            }

            Functions.ApprovalSendingAssignment.CreateCoverLetter(_obj.DocumentGroup.OfficialDocuments.FirstOrDefault(), _obj.OtherGroup);
        }
Exemplo n.º 11
0
 public override void Start(Sungero.Domain.Client.ExecuteActionArgs e)
 {
     if (!Docflow.PublicFunctions.Module.ShowDialogGrantAccessRightsWithConfirmationDialog(_obj,
                                                                                           _obj.OtherGroup.All.ToList(),
                                                                                           e.Action))
     {
         return;
     }
     base.Start(e);
 }
Exemplo n.º 12
0
        public virtual void AddApprover(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var dialog   = Dialogs.CreateInputDialog(FreeApprovalTasks.Resources.AddApprover);
            var employee = dialog.AddSelect <Sungero.Company.IEmployee>(FreeApprovalTasks.Resources.Approver, true, null)
                           .Where(x => x.Status != Company.Employee.Status.Closed);
            var defaultDeadline = Functions.Module.CheckDeadline(_obj.Deadline, Calendar.Now) ? _obj.Deadline : null;
            var deadline        = dialog.AddDate(FreeApprovalTasks.Resources.AddApproverDeadline, _obj.Deadline.HasValue, defaultDeadline).AsDateTime();
            var addButton       = dialog.Buttons.AddCustom(FreeApprovalTasks.Resources.Add);

            dialog.Buttons.AddCancel();
            dialog.SetOnButtonClick(a =>
            {
                if (a.IsValid && a.Button == addButton)
                {
                    if (Functions.FreeApprovalAssignment.Remote.CanForwardTo(_obj, employee.Value))
                    {
                        // Довыдаем права новому согласующему на вложения.
                        if (Functions.Module.ShowDialogGrantAccessRights(_obj,
                                                                         _obj.OtherGroup.All.ToList(),
                                                                         new List <IRecipient>()
                        {
                            employee.Value
                        }) == false)
                        {
                            a.CloseAfterExecute = false;
                            return;
                        }

                        Docflow.Functions.Module.Remote.AddApprover(_obj, employee.Value, deadline.Value);
                        Dialogs.NotifyMessage(FreeApprovalTasks.Resources.SendedToFormat(Company.PublicFunctions.Employee.GetShortName(employee.Value, DeclensionCase.Dative, false)));
                    }
                    else
                    {
                        a.AddError(FreeApprovalAssignments.Resources.ApproverAlreadyExistsFormat(employee.Value.Person.ShortName));
                    }
                }
            });
            dialog.SetOnRefresh((r) =>
            {
                if (!Docflow.PublicFunctions.Module.CheckDeadline(employee.Value ?? Users.Current, deadline.Value, Calendar.Now))
                {
                    r.AddError(FreeApprovalTasks.Resources.ImpossibleSpecifyDeadlineLessThanToday, deadline);
                }
                else
                {
                    var warnMessage = Docflow.Functions.Module.CheckDeadlineByWorkCalendar(employee.Value ?? Users.Current, deadline.Value);
                    if (!string.IsNullOrEmpty(warnMessage))
                    {
                        r.AddWarning(warnMessage);
                    }
                }
            });
            var result = dialog.Show();
        }
        public virtual void ExtendDeadline(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var newDeadline = Functions.ApprovalTask.GetNewDeadline(_obj.Deadline);

            if (newDeadline != null)
            {
                _obj.Deadline = newDeadline.Value;
                _obj.Save();
                Dialogs.NotifyMessage(Docflow.Resources.CurrentAssignmentNewDeadline);
            }
        }
Exemplo n.º 14
0
        public virtual void PrintResolution(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            _obj.Save();
            var report      = RecordManagement.Reports.GetDraftResolutionReport();
            var actionItems = _obj.ResolutionGroup.ActionItemExecutionTasks;

            report.Resolution.AddRange(actionItems);
            report.TextResolution = _obj.ActiveText;
            report.Document       = _obj.DocumentForReviewGroup.OfficialDocuments.FirstOrDefault();
            report.Author         = DocumentReviewTasks.As(_obj.Task).Addressee;
            report.Open();
        }
Exemplo n.º 15
0
 public virtual void VerificationStateValueInput(Sungero.Presentation.EnumerationValueInputEventArgs e)
 {
     if (e.NewValue == Docflow.OfficialDocument.VerificationState.Completed)
     {
         var args = new Sungero.Domain.Client.ExecuteActionArgs(Sungero.Domain.Shared.FormType.Card, _obj);
         if (!args.Validate())
         {
             // Bug 96585. Прервать смену значения в контроле невозможно.
             e.NewValue = e.OldValue;
         }
     }
 }
Exemplo n.º 16
0
        public override void ShowDuplicates(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var bikDuplicates = Functions.Bank.Remote.GetBanksWithSameBic(_obj, true).Where(x => !Equals(x, _obj));

            if (bikDuplicates.Any())
            {
                bikDuplicates.Show();
                return;
            }

            base.ShowDuplicates(e);
        }
Exemplo n.º 17
0
        public virtual void SendViaExchangeService(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            if (!Functions.ApprovalTask.Remote.HasDocumentAndCanRead(ApprovalTasks.As(_obj.Task)))
            {
                e.AddError(ApprovalTasks.Resources.NoRightsToDocument);
                return;
            }

            var document = _obj.DocumentGroup.OfficialDocuments.FirstOrDefault();

            Functions.ApprovalSendingAssignment.SendToCounterparty(document, _obj.Task);
        }
Exemplo n.º 18
0
        public virtual void SendForAcquaintance(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            _obj.Save();

            var acqTask = RecordManagement.PublicFunctions.Module.Remote.CreateAcquaintanceTask(_obj);

            if (acqTask != null)
            {
                acqTask.Show();
                e.CloseFormAfterAction = true;
            }
        }
Exemplo n.º 19
0
        public virtual void ExtendDeadline(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            if (!Functions.ApprovalTask.Remote.HasDocumentAndCanRead(ApprovalTasks.As(_obj.Task)))
            {
                e.AddError(ApprovalTasks.Resources.NoRightsToDocument);
                return;
            }

            var task = Docflow.PublicFunctions.DeadlineExtensionTask.Remote.GetDeadlineExtension(_obj);

            task.Show();
        }
Exemplo n.º 20
0
        public virtual void AddApprover(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            if (!Functions.ApprovalTask.Remote.HasDocumentAndCanRead(ApprovalTasks.As(_obj.Task)))
            {
                e.AddError(ApprovalTasks.Resources.NoRightsToDocument);
                return;
            }

            var dialog   = Dialogs.CreateInputDialog(FreeApprovalTasks.Resources.AddApprover);
            var employee = dialog.AddSelect <Sungero.Company.IEmployee>(FreeApprovalTasks.Resources.Approver, true, null)
                           .Where(x => x.Status != Company.Employee.Status.Closed);
            var addButton = dialog.Buttons.AddCustom(FreeApprovalTasks.Resources.Add);

            dialog.Buttons.AddCancel();
            dialog.SetOnButtonClick(a =>
            {
                if (a.IsValid && a.Button == addButton)
                {
                    if (Functions.ApprovalAssignment.Remote.CanForwardTo(_obj, employee.Value))
                    {
                        // Довыдаем права новому согласующему на вложения.
                        if (Functions.Module.ShowDialogGrantAccessRights(_obj,
                                                                         _obj.OtherGroup.All.ToList(),
                                                                         new List <IRecipient>()
                        {
                            employee.Value
                        }) == false)
                        {
                            a.CloseAfterExecute = false;
                            return;
                        }

                        Docflow.Functions.Module.Remote.AddApprover(_obj, employee.Value);
                        _obj.State.Controls.Control.Refresh();
                        var employeeNameInDative = Company.PublicFunctions.Employee.GetShortName(employee.Value, DeclensionCase.Dative, false);
                        if (_obj.Stage.Sequence == ApprovalStage.Sequence.Parallel)
                        {
                            Dialogs.NotifyMessage(FreeApprovalTasks.Resources.SendedToFormat(employeeNameInDative));
                        }
                        else
                        {
                            Dialogs.NotifyMessage(ApprovalTasks.Resources.TaskWillBeSendedFormat(employeeNameInDative));
                        }
                    }
                    else
                    {
                        a.AddError(FreeApprovalAssignments.Resources.ApproverAlreadyExistsFormat(employee.Value.Person.ShortName));
                    }
                }
            });
            var result = dialog.Show();
        }
Exemplo n.º 21
0
        public virtual void RequireReport(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var task = Functions.StatusReportRequestTask.Remote.CreateStatusReportRequest(_obj);

            if (task == null)
            {
                e.AddWarning(ActionItemExecutionTasks.Resources.NoActiveChildActionItems);
            }
            else
            {
                task.Show();
            }
        }
        public override void ShowDuplicate(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var duplicates = Docflow.PublicFunctions.ApprovalRuleBase.Remote.GetDoubleRules(_obj);

            if (duplicates.Any())
            {
                duplicates.Show();
            }
            else
            {
                Dialogs.NotifyMessage(Docflow.ApprovalRuleBases.Resources.DuplicateNotFound);
            }
        }
Exemplo n.º 23
0
        public virtual void ShowDuplicate(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var duplicates = Functions.RegistrationSetting.Remote.GetDoubleSettings(_obj);

            if (duplicates.Any())
            {
                duplicates.Show();
            }
            else
            {
                Dialogs.NotifyMessage(RegistrationSettings.Resources.DuplicateNotFound);
            }
        }
Exemplo n.º 24
0
        public virtual void ShowDuplicates(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var duplicates = Functions.IncomingLetter.Remote.GetDuplicates(_obj, _obj.DocumentKind, _obj.BusinessUnit, _obj.InNumber, _obj.Dated, _obj.Correspondent);

            if (duplicates.Any())
            {
                duplicates.Show();
            }
            else
            {
                Dialogs.NotifyMessage(IncomingLetters.Resources.DuplicateNotFound);
            }
        }
Exemplo n.º 25
0
        public virtual void ShowDuplicates(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var duplicates = Functions.Counterparty.GetDuplicates(_obj, true);

            if (duplicates.Any())
            {
                duplicates.Show();
            }
            else
            {
                Dialogs.NotifyMessage(Parties.Counterparties.Resources.DuplicateNotFound);
            }
        }
Exemplo n.º 26
0
        public virtual void ShowDuplicates(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var duplicates = Functions.Contact.Remote.GetDuplicates(_obj);

            if (duplicates.Any())
            {
                duplicates.Show();
            }
            else
            {
                Dialogs.NotifyMessage(Sungero.Commons.Resources.DuplicateNotFound);
            }
        }
Exemplo n.º 27
0
        public virtual void PrintDistributionSheet(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            if (_obj.IsManyAddressees != true)
            {
                Dialogs.NotifyMessage(OutgoingDocumentBases.Resources.SpecifyMultipleRecipients);
                return;
            }

            var report = Docflow.Reports.GetDistributionSheetReport();

            report.OutgoingDocument = _obj;
            report.Open();
        }
Exemplo n.º 28
0
        public virtual void SendForApproval(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            // Если по документу ранее были запущены задачи, то вывести соответствующий диалог.
            if (!Docflow.PublicFunctions.OfficialDocument.NeedCreateApprovalTask(_obj))
            {
                return;
            }

            // Принудительно сохранить документ, чтобы сохранились связи. Иначе они не попадут в задачу.
            _obj.Save();

            this.CreateApprovalTask(e);
        }
Exemplo n.º 29
0
        public virtual void SendActionItem(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            // Принудительно сохранить документ, чтобы сохранились связи. Иначе они не попадут в задачу.
            _obj.Save();

            var hackTask = Functions.Module.CreateActionItemExecution(_obj);

            if (hackTask != null)
            {
                hackTask.Show();
                e.CloseFormAfterAction = true;
            }
        }
Exemplo n.º 30
0
        public virtual void CreateOrShowMinutes(Sungero.Domain.Client.ExecuteActionArgs e)
        {
            var minutes = Functions.Meeting.Remote.GetOrCreateMinutes(_obj);

            if (minutes.Count == 1)
            {
                minutes.Single().Show();
            }
            else
            {
                minutes.Show();
            }
        }