Beispiel #1
0
        private void FillInSierraModelFromSolrData(dynamic recordData, /* out */ SierraModel result)
        {
            var    address1        = BuildSierraAddressModel(((string)recordData.address));
            var    address2        = BuildSierraAddressModel(((string)recordData.address2));
            var    address3        = BuildSierraAddressModel(((string)recordData.address3));
            string patronName      = recordData.pname;
            var    patronNameParts = patronName.Split(',');
            string recordId        = recordData.recordnum;

            if (address1 != null)
            {
                result.adress.Add(address1);
            }

            if (address2 != null)
            {
                result.adress.Add(address2);
            }

            if (address3 != null)
            {
                result.adress.Add(address3);
            }

            result.barcode                  = recordData.barcode;
            result.home_library             = ((string)recordData.homelib).Trim();
            result.home_library_pretty_name = _templateService.GetPrettyLibraryNameFromLibraryAbbreviation(result.home_library);
            result.id    = "0";
            result.email = recordData.email;

            if (patronNameParts.Length == 2)
            {
                result.first_name = patronNameParts[1].Trim();
                result.last_name  = patronNameParts[0].Trim();
            }
            else
            {
                result.first_name = patronName;
            }

            result.mblock    = recordData.mblock;
            result.ptype     = recordData.ptype;
            result.record_id = Convert.ToInt32(recordId.Remove(recordId.Length - 1).Remove(0, 1));
            result.aff       = _affiliationDataProvider.GetAffiliationFromPersonNumber(recordData.pnum.ToString());
        }
        private void FillInSierraModelFromFolioData(dynamic recordData, dynamic mblockData, /* out */ SierraModel result)
        {
            result.barcode = recordData.barcode;
            result.id      = recordData.id;
            if (recordData.personal != null)
            {
                result.email      = recordData.personal.email;
                result.first_name = recordData.personal.firstName;
                result.last_name  = recordData.personal.lastName;
            }

            result.mblock = mblockData != null?CalculateMblock(mblockData, recordData.id.ToString()) : "";

            result.ptype   = ConvertToSierraPtype(recordData.patronGroup.ToString());
            result.expdate = recordData.expirationDate;
            result.pnum    = recordData.username;
            result.aff     = _affiliationDataProvider.GetAffiliationFromPersonNumber(Convert.ToString(recordData.username));
        }