Example #1
0
        /// <summary>
        /// Проверить акт на дубли.
        /// </summary>
        /// <param name="contractStatement">Акт.</param>
        /// <param name="businessUnit">НОР.</param>
        /// <param name="registrationNumber">Рег. номер.</param>
        /// <param name="registrationDate">Дата регистрации.</param>
        /// <param name="counterparty">Контрагент.</param>
        /// <param name="leadingDocument">Ведущий документ.</param>
        /// <returns>Признак дублей.</returns>
        public static bool HaveDuplicates(IContractStatement contractStatement,
                                          Sungero.Company.IBusinessUnit businessUnit,
                                          string registrationNumber,
                                          DateTime?registrationDate,
                                          Sungero.Parties.ICounterparty counterparty,
                                          Docflow.IOfficialDocument leadingDocument)
        {
            if (contractStatement == null ||
                businessUnit == null ||
                string.IsNullOrWhiteSpace(registrationNumber) ||
                registrationDate == null ||
                counterparty == null ||
                leadingDocument == null)
            {
                return(false);
            }

            return(Functions.ContractStatement.Remote.GetDuplicates(contractStatement,
                                                                    businessUnit,
                                                                    registrationNumber,
                                                                    registrationDate,
                                                                    counterparty,
                                                                    leadingDocument)
                   .Any());
        }
Example #2
0
 public static IQueryable <IContractStatement> GetDuplicates(IContractStatement contractStatement,
                                                             Sungero.Company.IBusinessUnit businessUnit,
                                                             string registrationNumber,
                                                             DateTime?registrationDate,
                                                             Sungero.Parties.ICounterparty counterparty,
                                                             Docflow.IOfficialDocument leadingDocument)
 {
     return(ContractStatements.GetAll()
            .Where(l => Equals(contractStatement.DocumentKind, l.DocumentKind))
            .Where(l => Equals(businessUnit, l.BusinessUnit))
            .Where(l => registrationDate == l.RegistrationDate)
            .Where(l => registrationNumber == l.RegistrationNumber)
            .Where(l => Equals(counterparty, l.Counterparty))
            .Where(l => Equals(leadingDocument, l.LeadingDocument))
            .Where(l => !Equals(contractStatement, l)));
 }