Exemple #1
0
        protected override GetMaterialTextTypeListRD ProcessRequest(DTO.Base.APIRequest <GetMaterialTextTypeListRP> pRequest)
        {
            var rd = new GetMaterialTextTypeListRD();

            int?pageIndex = pRequest.Parameters.PageIndex;
            int?pageSize  = pRequest.Parameters.PageSize;

            string applicationId = pRequest.Parameters.ApplicationId;


            var bll = new WModelBLL(CurrentUserInfo);

            var ds = bll.GetWModelList(this.CurrentUserInfo.ClientID, applicationId, pageIndex ?? 0, pageSize ?? 15);

            if (ds.Tables[0].Rows.Count == 0)
            {
                rd.MaterialTextTypeList = null;
            }
            else
            {
                var tmp = ds.Tables[0].AsEnumerable().Select(t => new MaterialTextTypeInfo
                {
                    TypeId   = t["ModelId"].ToString(),
                    TypeName = t["ModelName"].ToString()
                });

                rd.MaterialTextTypeList = tmp.ToArray();
            }


            return(rd);
        }
        /// <summary>
        /// 通过ID获取角色信息
        /// </summary>
        public string GetWQRCodeTypeInfoByIdData()
        {
            var service               = new WQRCodeTypeBLL(CurrentUserInfo);
            WQRCodeTypeEntity data    = null;
            string            content = string.Empty;

            string key = string.Empty;

            if (Request("wQRCodeType_id") != null && Request("wQRCodeType_id") != string.Empty)
            {
                key = Request("wQRCodeType_id").ToString().Trim();
            }

            WQRCodeTypeEntity queryEntity = new WQRCodeTypeEntity();

            queryEntity.QRCodeTypeId = Guid.Parse(key);
            var list = service.GetList(queryEntity, 0, 1);

            if (list != null && list.Count > 0)
            {
                data = list[0];
            }

            data.WModelIds = new List <string>();
            var wQRCodeTypeModelMappingBLL = new WQRCodeTypeModelMappingBLL(CurrentUserInfo);
            var wModelBLL   = new WModelBLL(CurrentUserInfo);
            var mappingList = wQRCodeTypeModelMappingBLL.QueryByEntity(new WQRCodeTypeModelMappingEntity()
            {
                QRCodeTypeId = data.QRCodeTypeId
            }, null);

            if (mappingList != null && mappingList.Length > 0)
            {
                foreach (var mappingItem in mappingList)
                {
                    data.ApplicationId = wModelBLL.GetByID(mappingItem.ModelId).ApplicationId;
                    data.WModelIds.Add(mappingItem.ModelId);
                }
            }

            var jsonData = new JsonData();

            jsonData.totalCount = "1";
            jsonData.data       = data;

            content = jsonData.ToJSON();
            return(content);
        }
        /// <summary>
        /// 获取列表
        /// </summary>
        public string GetListData()
        {
            var service = new WModelBLL(new SessionManager().CurrentUserLoginInfo);
            var wApplicationInterfaceBLL = new WApplicationInterfaceBLL(new SessionManager().CurrentUserLoginInfo);
            IList <WModelEntity> data    = new List <WModelEntity>();
            string content = string.Empty;

            string key = "";

            if (Request("pid") != null && Request("pid") != string.Empty)
            {
                key = Request("pid").ToString().Trim();
            }
            string type = "";

            if (Request("type") != null && Request("type") != string.Empty)
            {
                type = Request("type").ToString().Trim();
            }
            if (type == "2")
            {
                var appList = wApplicationInterfaceBLL.QueryByEntity(new WApplicationInterfaceEntity()
                {
                    WeiXinID = key
                }, null);
                if (appList != null && appList.Length > 0)
                {
                    key = appList[0].ApplicationId;
                }
            }
            data = service.GetWModelListByAppId(key);

            var jsonData = new JsonData();

            jsonData.totalCount = data.Count.ToString();
            jsonData.data       = data;

            content = jsonData.ToJSON();
            return(content);
        }