///
/// </Summary>
/// <Param name = "objtype"> </param>
/// <Param name = "type"> </param>
/// <Returns> </returns>
Asynccallback callback = new asynccallback (processcontact); // This is. Class provided by netframework, asynccallback is a delegate
Userbcard = new userbcard () {userid = CFSNS. BLL. User. currentuserid, netaccesstype = type };
Icontact. begingetcontact (callback, userbcard );//
Static void processcontact (iasyncresult AR)
{
Userbcard = (userbcard) Ar. asyncstate;
Asyncresult aresult = (asyncresult) Ar;
CFSNS. netaccess. model. servicebase. getcontactorlistdelegate temp = (CFSNS. netaccess. model. servicebase. getcontactorlistdelegate) aresult. asyncdelegate;
List <iuserinfo> List = temp. endinvoke (aresult );//
Using (VAR conn = CFSNS. Common. SQL. Operate. SNS)
{
Operatesqlanswer answer = CFSNS. Applications. Connection. BLL. Bcard. selectimportfrombind (userbcard. netaccesstype, userbcard. userid, Conn );
Datatable dt1 = answer. datasource. tosourcetable ();
Ienumerable <iuserinfo> list2 = List. Where (model => (dt1.select ("binduid = '" + model. uid + "'"). Length = 0 ));
List <CFSNS. Common. Tools. model. imodelbase> tosave = new list <CFSNS. Common. Tools. model. imodelbase> ();
Foreach (iuserinfo in list2)
{
// Edit the JSON location
String userinfojson = "{\" Name \ ": {\" lastname \ ": \" "+ iuserinfo. realname. toemptystring (string. empty) + "\", \ "firstname \": \ "\", \ "additionalnames \": \ "\"}, \ "nickname \": \ "" + iuserinfo. nickname + "\", \ "notetext \": \ "\", \ "organization \": \ "" + iuserinfo. organization. toemptystring (string. empty) + "\", "+
"\" Phonenumbers \ ": [{\" number \ ": \" "+ iuserinfo. phone. toemptystring (string. empty) + "\", \ "numbertype \": 8 },{ \ "number \": \ "" + iuserinfo. phone. toemptystring (string. empty) + "\", \ "numbertype \": 32 },{ \ "number \": \ "" + iuserinfo. phone. toemptystring (string. empty) + "\", \ "numbertype \": 64}], \ "Photo \": \ "" + iuserinfo. logo. toemptystring (CFSNS. pagepath. images. iuserdefalogo logo) + "\", \ "title \": \ "" + iuserinfo. title. toemptystring (string. empty) + "\", "+
"\" Workurl \ ": [{\" website \ ": \" "+ iuserinfo. website. toemptystring (string. empty) + "\", \ "websitetype \": 32}], \ "emailaddresses \": [{\ "email \": \ "" + iuserinfo. email. toemptystring (string. empty) + "\", \ "emailtype \": 64}], \ "birthdate \": \ "" + iuserinfo. birthday. toemptystring (string. empty) + "\", "+
"\" Address \ ": [{\" addresstype \ ": 64, \" address \ ": \" "+ iuserinfo. address. toemptystring (string. empty) + "\"}], \ "specialities \":\"\"}";
Model. Bcard ibcard = new model. Bcard ();
Ibcard. creatorid = userbcard. userid;
Ibcard. bindtype = userbcard. netaccesstype;
Ibcard. jsoncontent = userinfojson;
Ibcard. binduid = iuserinfo. uid;
Tosave. Add (ibcard );
}
Operatesqlanswer answerbcard = CFSNS. Common. SQL. Operate. Save (tosave, Conn );
If (answer. errmessage. errorflag)
{
CFSNS. BLL. sitelog. Logit (answer. errmessage, 1 );
}
}
}