how to do gedcom import with minimal database roundtrip. what is best practice for this kind of development -
in current application, need import users gedcom file. these users may exist in registered users or need create 1 registered user same. gedcom file contain s many information e.g. personaldetails,addresses, education details, professionaldetails 1 sample of xml file storing store user's profile.
<userprofile xmlns=""> <basicinfo> <title value="basic details" /> <fields> <userid title="userid" right="public" value="151" /> <emailaddress title="email address" right="cug" value="xyz@gmail.com" /> <firstname title="first name" right="public" value="anju" /> <lastname title="last name" right="public" value="trivedi" /> <displayname title="display name" right="private" value="anju" /> <registrationstatusid title="registrationstatusid" right="public" value="19" /> <registrationstatus title="registration status" right="private" value="registered" /> <cityid title="cityid" right="private" value="19" /> <cityname title="city" right="public" value="delhi" /> <stateid title="stateid" right="private" value="69" /> <statename title="state" right="public" value="delhi" /> <countryid title="countryid" right="private" value="109" /> <countryname title="country" right="public" value="india" /> <gender title="gender" right="private" value="male" /> <createdby title="createdby" right="public" value="0" /> <createdon title="createdon" right="public" value="nov 27 2009 3:08pm " /> <modifiedby title="modifiedby" right="public" value="13" /> <modifiedon title="modifiedon" right="public" value="mar 3 2010 6:56pm " /> <loginstatusid title="loginstatusid" right="public" value="1" /> <loginstatus title="login status" right="private" value="free" /> <profileimagepath title="profile pic" right="public" value="~/images/13_holidaybarbie07cl2010427143129.jpg" /> <profilethumbnailpath title="profile thumbnail" right="public" value="~/images/thumb13_holidaybarbie07cl2010427143129.jpg" /> </fields> </basicinfo> <personalinfo> <title value="personal details" /> <fields> <nickname title="nick name" right="public" value="anju" /> <nativelocation title="native" right="public" value="mehsana" /> <dateofanniversary title="anniversary dt." right="private" value="4/1/2010" /> <bloodgroupid title="bloodgroupid" right="public" value="24" /> <bloodgroupname title="blood group" right="public" value="a+" /> <maritalstatusid title="maritalstatusid" right="private" value="35" /> <maritalstatusname title="marital status" right="private" value="unmarried" /> <dateofdeath title="death dt" right="private" value="" /> <createdby title="createdby" right="public" value="" /> <createdon title="createdon" right="public" value="" /> <modifiedby title="modifiedby" right="public" value="13" /> <modifiedon title="modifiedon" right="public" value="4/27/2010 2:32:07 pm" /> <dateofbirth title="birth date" value="" right="public" /> <birthplace title="birth place" value="jaipur" right="private" /> </fields> </personalinfo> <familyinfo> <title value="family details" /> <fields> <gallantryhistory title="gallantry history" right="public" value="anjli history" /> <ethinicity title="ethinicity" right="public" value="indian" /> <kuldev title="kuldev" right="public" value="krishna" /> <kuldevi title="kuldevi" right="public" value="lakhsmi" /> <caste title="caste" right="private" value="vaishnav" /> <sunsignid title="sunsignid" right="public" value="15" /> <sunsignname title="sunsignname" right="public" value="gemini" /> </fields> </familyinfo> <hobbyinfo> <title value="hobbies/interests" /> <fields> <abountme title="abount me" right="public" value="" /> <hobbies title="hobbies" right="public" value="" /> <food title="food" right="public" value="" /> <movies title="movies" right="public" value="" /> <music title="music" right="public" value="" /> <tvshows title="tv shows" right="public" value="" /> <books title="books" right="public" value="" /> <sports title="sports" right="public" value="" /> <will title="will" right="public" value="" /> <favouritequotes title="favourite quotes" right="public" value="" /> <cremationprefernces title="cremation prefernces" right="public" value="" /> </fields> </hobbyinfo> <permenantaddr> <title value="permenant address" /> <fields> <address title="address" right="public" value="select" /> <cityid title="cityid" right="public" value="116" /> <cityname title="city" right="public" value="iran" /> <stateid title="stateid" right="public" value="95" /> <statename title="state" right="public" value="iran" /> <countryid title="countryid" right="public" value="7" /> <countryname title="country" right="public" value="afghanistan" /> <zipcode title="zipcode" right="private" value="" /> </fields> </permenantaddr> <presentaddr> <title value="present address" /> <fields> <address title="address" right="public" value="select" /> <cityid title="cityid" right="public" value="1" /> <cityname title="city" right="public" value="select" /> <stateid title="stateid" right="public" value="1" /> <statename title="state" right="public" value="select" /> <countryid title="countryid" right="public" value="1" /> <countryname title="country" right="public" value="select" /> <zipcode title="zipcode" right="private" value="" /> </fields> </presentaddr> <contactinfo> <title value="contact details" /> <fields> <dayphoneno title="day phone" right="public" value="" /> <nightphoneno title="night phone" right="public" value="" /> <mobileno title="mobile no" right="private" value="" /> <faxno title="fax no" right="cug" value="" /> </fields> </contactinfo> <emailinfo> <title value="alternate email addresses" /> <fields> <record right="public"> <id title="id" right="public" value="3" /> <provider title="provider" right="public" value="google" /> <emailaddress title="email address" right="public" value="am@gmail.com" /> <isactive title="isactive" right="public" value="false" /> <createdby title="createdby" right="public" value="13" /> <createdon title="createdon" right="public" value="mar 3 2010 10:17am " /> <modifiedby title="modifiedby" right="public" value="0" /> <modifiedon title="modifiedon" right="public" value=" " /> </record> <record right="public"> <id title="id" right="public" value="4" /> <provider title="provider" right="public" value="yahoo" /> <emailaddress title="email address" right="public" value="am@yahoo.co.in" /> <isactive title="isactive" right="public" value="false" /> </record> <record right="private"> <provider value="111" right="private" /> <emailaddress value="111@11.com" right="private" /> <id value="5" /> </record> </fields> </emailinfo> <academicinfo> <title value="education details" /> <fields> <record right="public"> <id title="id" right="public" value="0" /> <education title="education" right="public" value="" /> <institute title="institute" right="public" value="" /> <passingyear title="passing year" right="public" value="" /> </record> </fields> </academicinfo> <achievementinfo> <title value="achievement details" /> <fields> <record right="public"> <id title="id" right="public" value="0" /> <awards title="award" right="public" value="" /> <fieldofaward title="field of award" right="public" value="" /> <tournament title="tournament" right="public" value="" /> <awarddescription title="description" right="public" value="" /> <awardyear title="award year" right="public" value="" /> </record> </fields> </achievementinfo> <professionalinfo> <title value="professional details" /> <fields> <record right="public"> <id title="id" right="public" value="4" /> <occupation title="occupation" right="public" value="a" /> <organization title="organization" right="public" value="a" /> <projectsdescription title="description" right="public" value="a" /> <duration title="duration" right="public" value="2" / </record> <record right="public"> <id title="id" right="public" value="5" /> <occupation title="occupation" right="public" value="ab" /> <organization title="organization" right="public" value="zsd" /> <projectsdescription title="description" right="public" value="sd" /> <duration title="duration" right="public" value="5" /> </record> <record right="public"> <id title="id" right="public" value="8" /> <occupation title="occupation" right="public" value="fgdf" /> <organization title="organization" right="public" value="gdfg" /> <projectsdescription title="description" right="public" value="dfgdf" /> <duration title="duration" right="public" value="12" /> </record> <record right="public"> <id title="id" right="public" value="9" /> <occupation title="occupation" right="public" value="fgdf" /> <organization title="organization" right="public" value="gdfg" /> <projectsdescription title="description" right="public" value="dfgdf" /> <duration title="duration" right="public" value="12" /> </record> <record right="public"> <id title="id" right="public" value="10" /> <occupation title="occupation" right="public" value="fgdf" /> <organization title="organization" right="public" value="gdfg" /> <projectsdescription title="description" right="public" value="dfgdf" /> <duration title="duration" right="public" value="12" /> </record> </fields> </professionalinfo> </userprofile>
now when importing data gedcom, creating 1 person object contains info. before insert itodatabase have check if userid exist emailaddress dont update data else create user , update profilexml data fecthed gedcom.
for think need soln can 1 roundtrip database , can update user's xml.
or can execute 1 sp userid users i'll check if user exist return userid else insert basic data , return inserted userid
then every user make xml data , update it.
please provide suggestion best practice kind of development.
if need more details please write me
you send 1 query database users new file:
select * person_table userid=foo@foo.com or userid = bar@bar.com or ...
then results can check see if there record each user in result set , procede accordingly.
Comments
Post a Comment