Example #1
0
        public Doc GetDoc(IDocRepository docRepo)
        {
            //using (var docRepo = new DocRepository(Guid.Empty))

            var doc = docRepo.CreateDoc(Query.Source.GetDocDef());

            var i = 0;

            foreach (var attr in Query.Attributes)
            {
                if (attr.Source == Query.Source)
                {
                    if (attr.Def == null)
                    {
                        switch (attr.Attribute.Ident)
                        {
                        case SystemIdent.Id:
                            if (!Reader.IsDBNull(i))
                            {
                                doc.Id = Reader.GetGuid(i);
                            }
                            break;

                        case SystemIdent.Created:
                            if (!Reader.IsDBNull(i))
                            {
                                doc.CreationTime = Reader.GetDateTime(i);
                            }
                            break;

                        case SystemIdent.UserId:
                            if (!Reader.IsDBNull(i))
                            {
                                doc.UserId = Reader.GetGuid(i);
                            }
                            break;

                        case SystemIdent.OrgId:
                            if (!Reader.IsDBNull(i))
                            {
                                doc.OrganizationId = Reader.GetGuid(i);
                            }
                            break;

                        case SystemIdent.State:
                            if (!Reader.IsDBNull(i))
                            {
                                if (doc.State == null)
                                {
                                    doc.State = new DocState {
                                        Type = new DocStateType {
                                            Id = Reader.GetGuid(i)
                                        }
                                    }
                                }
                            }
                            ;
                            else
                            {
                                doc.State.Type = new DocStateType {
                                    Id = Reader.GetGuid(i)
                                }
                            };
                            break;