Esempio n. 1
0
        public DocListItemDO(Docs.Api.Models.Doc d, UnitUser unitUser = null)
            : this()
        {
            if (d != null)
            {
                this.DocId = d.DocId;
                this.RegDate = d.RegDate;
                this.RegUri = d.RegUri;
                this.DocSubject = d.DocSubject;

                if (d.DocStatus != null)
                {
                    this.DocStatusName = d.GetDocStatusName();
                }

                if (d.DocType != null)
                {
                    this.DocTypeName = d.DocType.Name;
                }

                if (d.DocDirection != null)
                {
                    this.DocDirectionName = d.DocDirection.Name;
                }

                if (d.DocHasReads != null && d.DocHasReads.Any())
                {
                    this.IsRead = d.DocHasReads.Any(e => e.HasRead);
                }

                if (d.DocSourceType != null)
                {
                    this.IsElectronic = d.DocSourceType.Alias == "Internet";
                }
            }
        }
Esempio n. 2
0
        public DocDO(Docs.Api.Models.Doc d, UnitUser unitUser = null)
            : this()
        {
            if (d != null)
            {
                this.DocId = d.DocId;
                this.DocDirectionId = d.DocDirectionId;
                this.DocEntryTypeId = d.DocEntryTypeId;
                this.DocSourceTypeId = d.DocSourceTypeId;
                this.DocDestinationTypeId = d.DocDestinationTypeId;
                this.DocSubject = d.DocSubject;
                this.DocBody = d.DocBody;
                this.DocStatusId = d.DocStatusId;
                this.DocTypeId = d.DocTypeId;
                this.DocFormatTypeId = d.DocFormatTypeId;
                this.DocCasePartTypeId = d.DocCasePartTypeId;
                this.DocRegisterId = d.DocRegisterId;
                this.RegUri = d.RegUri;
                this.RegIndex = d.RegIndex;
                this.RegNumber = d.RegNumber;
                this.RegDate = d.RegDate;
                this.ExternalRegNumber = d.ExternalRegNumber;
                this.CorrRegNumber = d.CorrRegNumber;
                this.CorrRegDate = d.CorrRegDate;
                this.ReceiptOrder = d.ReceiptOrder;
                this.AccessCode = d.AccessCode;
                this.AssignmentTypeId = d.AssignmentTypeId;
                this.AssignmentDate = d.AssignmentDate;
                this.AssignmentDeadline = d.AssignmentDeadline;
                this.IsCase = d.IsCase;
                this.IsRegistered = d.IsRegistered;
                this.IsSigned = d.IsSigned;
                this.HasIncommingDocs = d.DocIncomingDocs != null && d.DocIncomingDocs.Any();
                this.IsActive = d.IsActive;
                this.Version = d.Version;

                if (d.DocType != null)
                {
                    this.DocTypeGroupId = d.DocType.DocTypeGroupId;
                    this.DocTypeAlias = d.DocType.Alias;
                    this.DocTypeName = d.DocType.Name;
                    this.DocTypeIsElectronicService = d.DocType.IsElectronicService;
                }

                if (d.DocDirection != null)
                {
                    this.DocDirectionAlias = d.DocDirection.Alias;
                    this.DocDirectionName = d.DocDirection.Name;
                }

                if (d.DocEntryType != null)
                {
                    this.DocEntryTypeAlias = d.DocEntryType.Alias;
                    this.DocEntryTypeName = d.DocEntryType.Name;
                }

                if (d.DocStatus != null)
                {
                    this.DocStatusAlias = d.DocStatus.Alias;
                    this.DocStatusName = d.GetDocStatusName();
                }

                if (d.DocCasePartType != null)
                {
                    this.DocCasePartTypeAlias = d.DocCasePartType.Alias;
                    this.DocCasePartTypeName = d.DocCasePartType.Name;
                }

                this.UnitUser = new UnitUserDO(unitUser);

                if (d.DocHasReads != null && unitUser != null)
                {
                    this.IsRead = d.DocHasReads.Any(e => e.UnitId == unitUser.UnitId && e.HasRead);
                }

                if (d.DocSourceType != null)
                {
                    this.IsElectronic = d.DocSourceType.Alias == "Internet";
                }
            }
        }