One-step call in Asp.net

Source: Internet
Author: User

///
/// </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 );
}
}

}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.