示例#1
0
        protected override DeleteMenuRD ProcessRequest(DTO.Base.APIRequest <DeleteMenuRP> pRequest)
        {
            var rd     = new DeleteMenuRD();
            var menuId = pRequest.Parameters.MenuId;

            var bll = new WMenuBLL(CurrentUserInfo);

            var entity = bll.QueryByEntity(new WMenuEntity()
            {
                ID = menuId
            }, null);

            var level = entity[0].Level;

            if (level == "1")
            {
                throw new APIException("一级菜单不能删除")
                      {
                          ErrorCode = ErrorFirstLevelNotDelete
                      };
            }
            if (entity.Length > 0)
            {
                bll.Delete(entity);
            }
            else
            {
                throw new APIException("MenuId无效")
                      {
                          ErrorCode = ErrorMenuIdInavial
                      };
            }

            return(rd);
        }
        /// <summary>
        /// 取消授权
        /// </summary>
        /// <param name="appid"></param>
        /// <param name="clientid"></param>
        /// <returns></returns>
        public static bool UnauthWechatApp(string appid)
        {
            var clientId           = "eb17cc2569c74ab7888b1f403972d37d";//测试用
            var loggingSessionInfo = Default.GetBSLoggingSession(clientId, "open");
            var waiBll             = new WApplicationInterfaceBLL(loggingSessionInfo);
            var wmenuBll           = new WMenuBLL(loggingSessionInfo);
            var userInfo           = loggingSessionInfo;

            userInfo.CurrentLoggingManager.Connection_String = WebConfigurationManager.AppSettings["APConn"];
            var customerWxMappingBll = new TCustomerWeiXinMappingBLL(userInfo);
            var customerId           = customerWxMappingBll.GetCustomerIdByAppId(appid);
            var waiEntitys           = new WApplicationInterfaceEntity[] { };
            var waiEntity            = new WApplicationInterfaceEntity();
            var component_Appid      = WebConfigurationManager.AppSettings["Component_Appid"];

            waiEntitys = waiBll.QueryByEntity(new WApplicationInterfaceEntity {
                AppID = appid, OpenOAuthAppid = component_Appid, CustomerId = customerId, IsDelete = 0
            }, null);
            if (waiEntitys != null && waiEntitys.Length > 0)
            {
                waiEntity = waiEntitys.FirstOrDefault();
                //waiEntity.OpenOAuthAppid = null;//置空
                //waiBll.Update(waiEntity);
                waiBll.Delete(waiEntity);



                //查询参数
                List <IWhereCondition> complexCondition = new List <IWhereCondition> {
                };
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "WeiXinID", Value = waiEntity.WeiXinID
                });
                var tempList = wmenuBll.PagedQuery(complexCondition.ToArray(), null, 10, 1);
                if (tempList.Entities.Length > 0)
                {
                    foreach (var item in tempList.Entities)
                    {
                        wmenuBll.Delete(item);
                    }
                }

                //var wmenuEntitys = wmenuBll.QueryByEntity(new WMenuEntity { WeiXinID = waiEntity.WeiXinID }, null);
                //if (wmenuEntitys != null && wmenuEntitys.Length > 0)
                //{
                //    foreach (var item in wmenuEntitys)
                //    {
                //        wmenuBll.Delete(item);
                //    }
                //}
            }
            return(true);
        }