protected void Page_Load(object sender, EventArgs e) { //下拉分类 List <KeyVauleDataInfo> KeyVauleList = bllKeyValueData.GetKeyVauleDataInfoList("ComponentType", null, "Common"); dynamic keyvalues = from p in KeyVauleList select new { name = p.DataValue, value = p.DataKey }; keyvalue_list = JsonConvert.SerializeObject(keyvalues); //List<string> ToolBarList = bllCompanyWebSite.GetToolBarUseTypeList(bllCompanyWebSite.WebsiteOwner); //改成写死 List <string> ToolBarList = new List <string>() { "foottool", "tab", "button", "headtool", "nav" }; dynamic tool_result = from p in ToolBarList select new { value = p, name = bllCompanyWebSite.GetToolBarUseTypeName(p) }; tool_list = JsonConvert.SerializeObject(tool_result); }
public void ProcessRequest(HttpContext context) { string AutoId = context.Request["id"]; KeyVauleDataInfo KeyVauleDataModel = bllKeyValueData.GetByKey <KeyVauleDataInfo>("AutoId", AutoId); if (KeyVauleDataModel == null) { resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "模板没有找到"; bllKeyValueData.ContextResponse(context, resp); return; } List <KeyVauleDataInfo> oldFieldList = bllKeyValueData.GetKeyVauleDataInfoList(EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsgData), KeyVauleDataModel.DataKey , KeyVauleDataModel.WebsiteOwner); resp.isSuccess = true; resp.returnObj = new { id = KeyVauleDataModel.AutoId, data_key = KeyVauleDataModel.DataKey, data_value = KeyVauleDataModel.DataValue, child_list = (from p in oldFieldList select new { data_key = p.DataKey, data_value = p.DataValue }) }; bllKeyValueData.ContextResponse(context, resp); }
private string getRechargePriceList(HttpContext context) { List <KeyVauleDataInfo> rechargePriceList = bllkeyValueData.GetKeyVauleDataInfoList("RechargePrice", null, bllUser.WebsiteOwner); return(Common.JSONHelper.ObjectToJson(new { rows = rechargePriceList, total = rechargePriceList.Count })); }
protected void Page_Load(object sender, EventArgs e) { var moduleNameReq = Request["moduleName"]; isHideEx1 = Convert.ToInt32(Request["isHideEx1"]); isHideEvent = Convert.ToInt32(Request["isHideEvent"]); if (!string.IsNullOrWhiteSpace(moduleNameReq)) { moduleName = moduleNameReq; } List <KeyVauleDataInfo> list = bllKeyValueData.GetKeyVauleDataInfoList("ScoreDefineType", "0", bllKeyValueData.WebsiteOwner); if (list.Count == 0) { list = bllKeyValueData.GetKeyVauleDataInfoList("ScoreDefineType", "0", "Common"); } selectOptionHtml = new ZentCloud.Common.MyCategoriesV2().GetSelectOptionHtml(list, "DataKey", "PreKey", "DataValue", "0", "ddlType", "width:200px", ""); }
protected void Page_Load(object sender, EventArgs e) { //下拉分类 List <KeyVauleDataInfo> KeyVauleList = bllKeyValueData.GetKeyVauleDataInfoList("ComponentType", null, "Common"); dynamic keyvalues = from p in KeyVauleList select new { name = p.DataValue, value = p.DataKey }; keyvalue_list = JsonConvert.SerializeObject(keyvalues); }
/// <summary> /// 查询数据管理 /// </summary> /// <param name="context"></param> /// <returns></returns> private string Query(HttpContext context) { string type = context.Request["type"]; string websiteowner = context.Request["websiteowner"]; string preKey = context.Request["preKey"]; if (string.IsNullOrWhiteSpace(websiteowner)) { websiteowner = bllKeyValueData.WebsiteOwner; } List <KeyVauleDataInfo> dataList = bllKeyValueData.GetKeyVauleDataInfoList(type, preKey, websiteowner); return(Common.JSONHelper.ObjectToJson( new { total = dataList.Count, rows = dataList })); }
public void ProcessRequest(HttpContext context) { int pageIndex = Convert.ToInt32(context.Request["page"]); int pageSize = Convert.ToInt32(context.Request["rows"]); int totalCount = 0; List <KeyVauleDataInfo> dataList = bllKeyValueData.GetKeyVauleDataInfoList(pageSize, pageIndex, EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsg), null, bllKeyValueData.WebsiteOwner, out totalCount); resp.isSuccess = true; resp.returnObj = new { totalcount = totalCount, list = (from p in dataList select new { id = p.AutoId, data_key = p.DataKey, data_value = p.DataValue }) }; bllKeyValueData.ContextResponse(context, resp); }
/// <summary> /// 提交模板数据 /// </summary> /// <param name="context"></param> /// <returns></returns> private string PostWXTempmsg(HttpContext context) { int autoId = Convert.ToInt32(context.Request["AutoId"]); KeyVauleDataInfo keyValue = new KeyVauleDataInfo(); if (autoId > 0) { keyValue = bllKeyValueData.GetKeyData(autoId); if (keyValue == null) { resp.errmsg = "原模板没有找到"; return(Common.JSONHelper.ObjectToJson(resp)); } if (keyValue.WebsiteOwner != bllKeyValueData.WebsiteOwner) { resp.errmsg = "原模板不是本站模板"; return(Common.JSONHelper.ObjectToJson(resp)); } } else { keyValue.Creater = currentUserInfo.UserID; keyValue.WebsiteOwner = bllKeyValueData.WebsiteOwner; keyValue.CreateTime = DateTime.Now; keyValue.PreKey = "0"; keyValue.DataType = EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsg); } string oldKey = keyValue.DataKey; keyValue = bllKeyValueData.ConvertRequestToModel <KeyVauleDataInfo>(keyValue); //微信模板Id变化则清除以前的字段数据 if (!string.IsNullOrWhiteSpace(oldKey) && oldKey != keyValue.DataKey) { bllKeyValueData.DeleteDataVaule(EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsgData), null, oldKey, bllKeyValueData.WebsiteOwner); } string keyFieldsJson = context.Request["KeyFields"]; List <KeyVauleDataInfo> newFieldList = Common.JSONHelper.JsonToModel <List <KeyVauleDataInfo> >(keyFieldsJson);//jSON 反序列化 for (int i = 0; i < newFieldList.Count; i++) { newFieldList[i].DataType = EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsgData); } List <KeyVauleDataInfo> oldFieldList = bllKeyValueData.GetKeyVauleDataInfoList(EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsgData), keyValue.DataKey , bllKeyValueData.WebsiteOwner); List <KeyVauleDataInfo> deleteFieldList = new List <KeyVauleDataInfo>(); List <KeyVauleDataInfo> editFieldList = new List <KeyVauleDataInfo>(); List <KeyVauleDataInfo> addFieldList = new List <KeyVauleDataInfo>(); foreach (KeyVauleDataInfo item in oldFieldList) { KeyVauleDataInfo temp = newFieldList.FirstOrDefault(p => p.DataType == item.DataType && p.DataKey == item.DataKey); if (temp == null) { deleteFieldList.Add(item); } else { item.DataValue = temp.DataValue; item.OrderBy = temp.OrderBy; editFieldList.Add(item); } } foreach (KeyVauleDataInfo item in newFieldList) { if (!oldFieldList.Exists(p => p.DataType == item.DataType && p.DataKey == item.DataKey)) { item.Creater = currentUserInfo.UserID; item.WebsiteOwner = bllKeyValueData.WebsiteOwner; item.CreateTime = DateTime.Now; item.PreKey = keyValue.DataKey; addFieldList.Add(item); } } if (deleteFieldList.Count > 0) { string delIds = Common.MyStringHelper.ListToStr(deleteFieldList.Select(p => p.AutoId).ToList(), "", ","); bllKeyValueData.DeleteDataVaule(delIds); } BLLTransaction tran = new BLLTransaction();//事务 try { if (keyValue.AutoId == 0) { if (!bllKeyValueData.Add(keyValue, tran)) { resp.errmsg = "添加模板失败"; tran.Rollback(); return(Common.JSONHelper.ObjectToJson(resp)); } } else { if (!bllKeyValueData.Update(keyValue, tran)) { resp.errmsg = "修改模板失败"; tran.Rollback(); return(Common.JSONHelper.ObjectToJson(resp)); } } foreach (KeyVauleDataInfo item in editFieldList)//添加问题表 { if (!bllKeyValueData.Update(item, tran)) { resp.errmsg = "模板字段修改失败"; tran.Rollback(); return(Common.JSONHelper.ObjectToJson(resp)); } } foreach (KeyVauleDataInfo item in addFieldList)//添加问题表 { if (!bllKeyValueData.Add(item, tran)) { resp.errmsg = "模板字段添加失败"; tran.Rollback(); return(Common.JSONHelper.ObjectToJson(resp)); } } tran.Commit(); resp.isSuccess = true; } catch (Exception ex) { resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "提交失败," + ex.Message; tran.Rollback(); } return(Common.JSONHelper.ObjectToJson(resp)); }