/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, InterfaceEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
private void InitListView1() { objectListView1.ShowGroups = true; var col = objectListView1.AllColumns[0]; col.UseInitialLetterForGroup = true; col.GroupKeyGetter = p => { InterfaceEntity entity = (InterfaceEntity)p; return(entity.Group); }; }
/// <summary> /// 设置查询语句 /// </summary> /// <param name="url">接口地址</param> /// <returns></returns> public bool SetWhereSql(string url) { try { UserInfo userInfo = LoginUserInfo.Get(); if (userInfo.isSystem) { return(true); } // 判断该接口注册了 InterfaceEntity interfaceEntity = interfaceIBLL.GetEntityByUrl(url); if (interfaceEntity == null) { // 如果接口没有注册则不作过滤 return(true); } else { List <DataAuthorizeRelationEntity> relationList = (List <DataAuthorizeRelationEntity>)GetRelationList(interfaceEntity.F_Id); if (relationList.Count > 0) { relationList = relationList.FindAll(t => t.F_ObjectId.Equals(userInfo.userId) || t.F_ObjectId.Like(userInfo.roleIds)); if (relationList.Count > 0) { string whereSql = ""; DbWhere dbWhere = new DbWhere(); dbWhere.dbParameters = new List <FieldValueParam>(); int relationnum = 0; foreach (var item in relationList) { if (whereSql != "") { whereSql += " OR "; } whereSql += " ( "; string strSql = ""; List <DataAuthorizeConditionEntity> conditionList = (List <DataAuthorizeConditionEntity>)GetDataAuthorizeConditionList(item.F_Id); if (!string.IsNullOrEmpty(item.F_Formula)) { strSql = item.F_Formula; for (int i = 1; i < conditionList.Count + 1; i++) { strSql = strSql.Replace("" + i, "{@ayma" + i + "ayma@}"); } } else { for (int i = 1; i < conditionList.Count + 1; i++) { if (strSql != "") { strSql += " AND "; } strSql += " {@ayma" + i + "ayma@} "; } } int num = 1; foreach (var conditionItem in conditionList) { string strone = " " + conditionItem.F_FieldId; string value = " @" + conditionItem.F_FieldId + relationnum; FieldValueParam dbParameter = new FieldValueParam(); dbParameter.name = conditionItem.F_FieldId + relationnum; dbParameter.value = getValue(conditionItem.F_FiledValueType, conditionItem.F_FiledValue); dbParameter.type = conditionItem.F_FieldType; dbWhere.dbParameters.Add(dbParameter); //[{ value: 1, text: '等于' }, { value: 2, text: '大于' }, { value: 3, text: '大于等于' }, { value: 4, text: '小于' }, { value: 5, text: '小于等于' }, { value: 6, text: '包含' }, { value: 7, text: '包含于' }, { value: 8, text: '不等于' }, { value: 9, text: '不包含' }, { value: 10, text: '不包含于' }], switch (conditionItem.F_Symbol) { case 1: // 等于 strone += " = " + value; break; case 2: // 大于 strone += " > " + value; break; case 3: // 大于等于 strone += " >= " + value; break; case 4: // 小于 strone += " < " + value; break; case 5: // 小于等于 strone += " <= " + value; break; case 6: // 包含 strone += " like %" + value + "%"; break; case 7: // 包含于 strone += " in ( '" + value.Replace(",", "','") + "' )"; break; case 8: // 不等于 strone += " != " + value; break; case 9: // 不包含 strone += " not like %" + value + "%"; break; case 10: // 不包含于 strone += " not in ( '" + value.Replace(",", "','") + "' )"; break; default: break; } strone += " "; strSql = strSql.Replace("{@ayma" + num + "ayma@}", strone); num++; } whereSql += strSql; whereSql += " ) "; relationnum++; } dbWhere.sql = whereSql; WebHelper.AddHttpItems("DataAhthorCondition", dbWhere); } else { return(false); } } else { // 该接口没做权限过滤 return(true); } } return(true); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }
public ActionResult SaveForm(string keyValue, InterfaceEntity entity) { interfaceIBLL.SaveEntity(keyValue, entity); return(Success("保存成功!")); }
public ActionResult SaveForm(string keyValue, InterfaceEntity entity) { interfacebll.SaveForm(keyValue, entity); return(Success("操作成功。")); }