/// <summary> /// 查询角色列表 /// </summary> public string QueryWQRCodeTypeListData() { var form = Request("form").DeserializeJSONTo <WQRCodeTypeQueryEntity>(); var appSysService = new WQRCodeTypeBLL(CurrentUserInfo); IList <WQRCodeTypeEntity> list = new List <WQRCodeTypeEntity>(); string content = string.Empty; string key = string.Empty; int pageIndex = Utils.GetIntVal(FormatParamValue(Request("page"))) - 1; WQRCodeTypeEntity queryEntity = new WQRCodeTypeEntity(); queryEntity.TypeName = form.wQRCodeType_name; queryEntity.TypeCode = form.wQRCodeType_code; list = appSysService.GetList(queryEntity, pageIndex, PageSize); var jsonData = new JsonData(); jsonData.totalCount = appSysService.GetListCount(queryEntity).ToString(); jsonData.data = list; content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}", list.ToJSON(), jsonData.totalCount); return(content); }
/// <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> /// GetList /// </summary> /// <param name="entity">entity</param> /// <param name="Page">分页页码。从0开始</param> /// <param name="PageSize">每页的数量。未指定时默认为15</param> /// <returns></returns> public IList <WQRCodeTypeEntity> GetList(WQRCodeTypeEntity entity, int Page, int PageSize) { if (PageSize <= 0) { PageSize = 15; } IList <WQRCodeTypeEntity> list = new List <WQRCodeTypeEntity>(); DataSet ds = new DataSet(); ds = _currentDAO.GetList(entity, Page, PageSize); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { list = DataTableToObject.ConvertToList <WQRCodeTypeEntity>(ds.Tables[0]); } return(list); }
/// <summary> /// 保存角色 /// </summary> public string SaveWQRCodeTypeData() { var wQRCodeTypeService = new WQRCodeTypeBLL(CurrentUserInfo); WQRCodeTypeEntity obj = new WQRCodeTypeEntity(); string content = string.Empty; string error = ""; var responseData = new ResponseData(); string key = string.Empty; string wQRCodeType_id = string.Empty; if (Request("wQRCodeType") != null && Request("wQRCodeType") != string.Empty) { key = Request("wQRCodeType").ToString().Trim(); } if (Request("wQRCodeType_id") != null && Request("wQRCodeType_id") != string.Empty) { wQRCodeType_id = Request("wQRCodeType_id").ToString().Trim(); } obj = key.DeserializeJSONTo <WQRCodeTypeEntity>(); //if (obj.TypeCode == null || obj.TypeCode.Trim().Length == 0) //{ // responseData.success = false; // responseData.msg = "编码不能为空"; // return responseData.ToJSON(); //} //if (obj.TypeName == null || obj.TypeName.Trim().Length == 0) //{ // responseData.success = false; // responseData.msg = "名称不能为空"; // return responseData.ToJSON(); //} if (wQRCodeType_id.Trim().Length == 0 || wQRCodeType_id == "null" || wQRCodeType_id == "undefined") { obj.QRCodeTypeId = Guid.NewGuid(); wQRCodeTypeService.Create(obj); } else { obj.QRCodeTypeId = Guid.Parse(wQRCodeType_id); wQRCodeTypeService.Update(obj, false); } // WModelId var wQRCodeTypeModelMappingBLL = new WQRCodeTypeModelMappingBLL(CurrentUserInfo); var mappingList = wQRCodeTypeModelMappingBLL.QueryByEntity(new WQRCodeTypeModelMappingEntity() { QRCodeTypeId = obj.QRCodeTypeId }, null); if (mappingList != null && mappingList.Length > 0) { foreach (var mappingItem in mappingList) { wQRCodeTypeModelMappingBLL.Delete(mappingItem); } } if (obj.WModelIds != null && obj.WModelIds.Count > 0) { foreach (var wModelIdItem in obj.WModelIds) { if (wModelIdItem.Trim().Length == 0) { continue; } wQRCodeTypeModelMappingBLL.Create(new WQRCodeTypeModelMappingEntity() { Mapping = Guid.NewGuid(), ModelId = wModelIdItem, QRCodeTypeId = obj.QRCodeTypeId }); } } responseData.success = true; responseData.msg = error; content = responseData.ToJSON(); return(content); }
/// <summary> /// GetListCount /// </summary> /// <param name="entity">entity</param> public int GetListCount(WQRCodeTypeEntity entity) { return(_currentDAO.GetListCount(entity)); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Update(WQRCodeTypeEntity pEntity, IDbTransaction pTran) { Update(pEntity, true, pTran); }
public void Update(WQRCodeTypeEntity pEntity, bool pIsUpdateNullField, IDbTransaction pTran) { _currentDAO.Update(pEntity, pIsUpdateNullField, pTran); }
/// <summary> /// 创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> public void Create(WQRCodeTypeEntity pEntity) { _currentDAO.Create(pEntity); }
/// <summary> /// 在事务内创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Create(WQRCodeTypeEntity pEntity, IDbTransaction pTran) { _currentDAO.Create(pEntity, pTran); }
/// <summary> /// 分页根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public PagedQueryResult <WQRCodeTypeEntity> PagedQueryByEntity(WQRCodeTypeEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex) { return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex)); }
/// <summary> /// 根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public WQRCodeTypeEntity[] QueryByEntity(WQRCodeTypeEntity pQueryEntity, OrderBy[] pOrderBys) { return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys)); }
/// <summary> /// 删除 /// </summary> /// <param name="pEntity"></param> public void Delete(WQRCodeTypeEntity pEntity) { _currentDAO.Delete(pEntity); }
public void Update(WQRCodeTypeEntity pEntity, bool pIsUpdateNullField) { _currentDAO.Update(pEntity, pIsUpdateNullField); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> public void Update(WQRCodeTypeEntity pEntity) { Update(pEntity, true); }