Exemplo n.º 1
0
 /// <summary>
 /// 删除Member
 /// </summary>
 /// <param name="DeleteUserid">操作者ID</param>
 /// <param name="errMsg">返回错误信息</param>
 /// <returns></returns>
 public bool DeleteMember(string DeleteUserid, ref string errMsg)
 {
     try
     {
         QYConfig.RegistWX();
         var accessToken = AccessTokenContainer.GetToken(QYConfig.CorpId);
         var result      = MailListApi.DeleteMember(accessToken, UserId);
         if (result.errcode.ToString() == "请求成功")
         {
             if (MembertDA.DeleteMember(ID.ToString(), DeleteUserid))
             {
                 return(true);
             }
             else
             {
                 errMsg = result.errcode + ":" + result.errmsg;
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         Logger.Log4Net.Error("add Member error:" + e);
         errMsg = "操作失敗:" + e.Message;
         return(false);
     }
 }
Exemplo n.º 2
0
        public WorkJsonResult DeleteMember(DeleteMemberDto dto)
        {
            //dto.AccessToken = GetAccessToken(QyConfig.CorpID, QyConfig.CorpSecret);
            var result = MailListApi.DeleteMember(dto.AccessToken, dto.ID);

            return(result);
        }
Exemplo n.º 3
0
        //[TestMethod]
        public void DeleteMemberTest(string userId)
        {
            var accessToken = AccessTokenContainer.GetToken(_corpId, base._corpSecret);
            var result      = MailListApi.DeleteMember(accessToken, userId);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.errcode == ReturnCode_Work.请求成功);
        }
Exemplo n.º 4
0
        public WorkJsonResult WX_DelUser(string strUserName)
        {
            WorkJsonResult Ret = new WorkJsonResult();

            if (Qyinfo.IsUseWX == "Y")
            {
                Ret = MailListApi.DeleteMember(GetToken(), strUserName);
            }
            return(Ret);
        }
Exemplo n.º 5
0
        public static bool DeleteMember(string userId, ref string erromsg)
        {
            try
            {
                var result = MailListApi.DeleteMember(GetToken(), userId);
            }
            catch (ErrorJsonResultException ex)
            {
                erromsg = WxReturnCodeMessage.GetReturnMessage((int)ex.JsonResult.errcode);
                return(false);
            }

            return(true);
        }
Exemplo n.º 6
0
        public override JsonResult Delete(string sIds)
        {
            try
            {
                //string[] arrID = sIds.Split(',');
                //foreach (string strID in arrID)
                //{
                //    if (string.IsNullOrEmpty(strID)) { continue; }
                //    MailListApi.DeleteMember(GetToken(), strID);

                //    NewEmployee employee = new NewEmployee();

                //    employee.LilyId = strID;

                //    service.Repository.Delete(a => a.LilyId == employee.LilyId);
                //}
                //删除后会清除掉缓存

                if (!string.IsNullOrEmpty(sIds))

                {
                    string[] arrID = sIds.Split(',');

                    foreach (string strID in arrID)
                    {
                        if (string.IsNullOrEmpty(strID))
                        {
                            continue;
                        }
                        MailListApi.DeleteMember(GetToken(), strID);
                        _userWechatService.UpdateSysUser(strID);
                        _localservice.Repository.Delete(a => a.LillyID.ToUpper() == strID.ToUpper());
                    }
                    //删除后会清除掉缓存
                    if (WeChatCommonService.lstUser != null)
                    {
                        cacheManager.Remove("UserItem");
                    }
                }
            }
            catch (Exception)
            {
                return(Json("删除错误", JsonRequestBehavior.AllowGet));
            }

            return(Json(doJson(null), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 删除人员
        /// </summary>
        /// <param name="_userId"></param>
        /// <returns></returns>
        public static bool DeleteMember(string _userId)
        {
            AccessTokenResult access_token_result = new AccessTokenResult();
            QYConfigInfo      config = GetQYConfig();

            access_token_result = CommonApi.GetToken(config.QYCorpId, config.QYSecret);
            //调用接口
            var result = MailListApi.DeleteMember(access_token_result.access_token, _userId);

            if (result.errmsg == "deleted")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 8
0
Arquivo: WxFO.cs Projeto: Luyingjin/Qy
        /// <summary>
        /// 删除成员
        /// </summary>
        /// <param name="QyID">企业ID</param>
        /// <param name="userId">员工UserID。必须企业内唯一</param>
        /// <returns></returns>
        public QyJsonResult DeleteUser(string QyID, string userId)
        {
            QyJsonResult result = null;

            try
            {
                result = MailListApi.DeleteMember(GetAccessToken(QyID), userId);
            }
            catch (Exception ex)
            {
                LogWriter.Error(ex, string.Format("删除QyID为{0}的成员失败", QyID));
                result = MailListApi.DeleteMember(GetAccessToken(QyID, true), userId);
            }
            if (result.errcode != ReturnCode_QY.请求成功)
            {
                LogWriter.Info(string.Format("删除QyID为{0}的成员失败,原因:{1}", QyID, result.errmsg));
            }
            return(result);
        }
Exemplo n.º 9
0
 public QyCallResult DeleteMember(string accessToken, string userId)
 {
     return(MailListApi.DeleteMember(accessToken, userId).ToQyCallResult());
 }