zoukankan      html  css  js  c++  java
  • 在asp.net中的一步调用

       ///
            /// </summary>
            /// <param name="objType"></param>
            /// <param name="type"></param>
            /// <returns></returns>
            AsyncCallback callback = new AsyncCallback(ProcessContact);//这是。netFrameWork提供的class,AsyncCallback是一个委托
             UserBCard userBCard = new UserBCard() { UserId = Cfsns.Bll.User.CurrentUserId, NetAccessType = type };
              iContact.BeginGetContact(callback, userBCard);//
                        

            static void ProcessContact(IAsyncResult ar)
            {
                UserBCard 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 iUserInfo in list2)
                    {
                        //编辑json位置
                        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.IUserDefaultLogo) + "\",\"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);
                    }
                }

            }

  • 相关阅读:
    ABAP 捕获回车键更新值
    拼接报错信息
    你知道什么叫金丝雀分布吗?你知道如何在Service Mesh微服务架构中实现吗?
    java代码在阿里云函数计算中的应用
    创投机构BP联系方式3
    迁移到RDS或者腾讯云MYSQL实例发生sql_mode=only_full_group_by错误的解决
    我国广告业存在的问题
    【微信小程序】固定头部,只滚动内容部分功能
    低智商屌丝蒟蒻的2012成都题解
    罪过啊,废了好大的力气才搞出了 Kth 数
  • 原文地址:https://www.cnblogs.com/Minghao_HU/p/2475234.html
Copyright © 2011-2022 走看看