/// <summary> /// 添加 /// </summary> /// <param name="context"></param> /// <returns></returns> private string Add(HttpContext context) { string templateName = context.Request["TemplateName"]; string templateId = context.Request["TemplateId"]; string templatyType = context.Request["TemplatyType"]; KeyVauleDataInfo model = new KeyVauleDataInfo(); model.WebsiteOwner = bllKeyValueData.WebsiteOwner; model.CreateTime = DateTime.Now; model.DataType = "WXTemplateMsg"; model.DataKey = templateName; model.DataValue = templateId; model.PreKey = templatyType; if (bllKeyValueData.GetCount <KeyVauleDataInfo>(string.Format(" Websiteowner='{0}' And DataType='WXTemplateMsg' And PreKey='{1}'", bllKeyValueData.WebsiteOwner, model.PreKey)) > 0) { resp.errmsg = "类型重复"; return(Common.JSONHelper.ObjectToJson(resp)); } if (bllKeyValueData.Add(model)) { resp.isSuccess = true; } return(Common.JSONHelper.ObjectToJson(resp)); }
private string UpdateRechargePrice(HttpContext context) { string autoId = context.Request["AutoId"]; string dataValue = context.Request["DataValue"]; string orderNum = context.Request["OrderNum"]; KeyVauleDataInfo rechargePriceKeyValue = bllkeyValueData.GetKeyVauleData(autoId); if (rechargePriceKeyValue == null) { resp.Status = -1; resp.Msg = "找不到记录"; return(Common.JSONHelper.ObjectToJson(resp)); } rechargePriceKeyValue.DataValue = dataValue; rechargePriceKeyValue.OrderBy = Convert.ToInt32(orderNum); if (bllkeyValueData.Update(rechargePriceKeyValue)) { resp.Status = 1; resp.Msg = "修改成功"; } else { resp.Status = -1; resp.Msg = "修改失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
public void ProcessRequest(HttpContext context) { string key = context.Request["key"]; string value = context.Request["value"]; if (string.IsNullOrEmpty(key)) { apiResp.msg = "key 参数必传"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } if (string.IsNullOrEmpty(value)) { apiResp.msg = "value 参数必传"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } KeyVauleDataInfo model = new KeyVauleDataInfo(); model.WebsiteOwner = bllKeyValueData.WebsiteOwner; model.CreateTime = DateTime.Now; model.DataType = "MallConfig"; model.DataKey = key; model.DataValue = value; if (bllKeyValueData.Add(model)) { apiResp.status = true; apiResp.msg = "ok"; } else { apiResp.msg = "添加失败"; } context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); }
/// <summary> /// 获取模板数据 /// </summary> /// <param name="context"></param> /// <returns></returns> private string GetWXTempmsg(HttpContext context) { int autoId = Convert.ToInt32(context.Request["AutoId"]); KeyVauleDataInfo 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)); } List <KeyVauleDataInfo> fieldList = bllKeyValueData.GetKeyVauleDataInfoList(EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsgData), keyValue.DataKey , bllKeyValueData.WebsiteOwner); var fields = from p in fieldList select new { p.DataKey, p.DataValue }; resp.returnObj = new { keyValue.DataValue, keyValue.DataKey, keyValue.OrderBy, KeyFields = fields }; resp.isSuccess = true; return(Common.JSONHelper.ObjectToJson(resp)); }
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); }
public void ProcessRequest(HttpContext context) { int rows = Convert.ToInt32(context.Request["rows"]); int page = Convert.ToInt32(context.Request["page"]); string show_delete = context.Request["show_delete"]; bool showDelete = false; if (show_delete == "1") { showDelete = true; } int total = 0; List <ComponentModel> list = bll.GetComponentModelList(rows, page, context.Request["keyword"], out total, context.Request["component_model_type"], showDelete); List <ComponentModelField> componentModelFields = new List <ComponentModelField>(); if (list.Count > 0) { string cpKeys = ZentCloud.Common.MyStringHelper.ListToStr(list.Select(p => p.ComponentModelKey).Distinct().ToList(), "'", ","); componentModelFields = bll.GetMultListByKey <ComponentModelField>("ComponentModelKey", cpKeys).OrderBy(p => p.ComponentFieldSort).ToList(); } apiResp.status = true; apiResp.msg = "查询完成"; apiResp.code = (int)APIErrCode.IsSuccess; List <dynamic> result = new List <dynamic>(); foreach (var item in list) { KeyVauleDataInfo keydata = bllKeyValueData.GetKeyData("ComponentType", item.ComponentModelType, "Common"); result.Add(new { component_model_id = item.AutoId, component_model_key = item.ComponentModelKey, component_model_name = item.ComponentModelName, is_delete = item.IsDelete, component_model_fields = (from p in componentModelFields.Where(p => p.ComponentModelKey == item.ComponentModelKey && p.ComponentFieldType >= 4 && p.ComponentFieldType != 8 && limitControls.Contains(p.ComponentField)) select new { component_field_id = p.AutoId, component_field = p.ComponentField, component_field_name = p.ComponentFieldName, component_field_type = p.ComponentFieldType, component_field_data_value = p.ComponentFieldDataValue, disabled = false }) }); } apiResp.result = new { totalcount = total, list = result }; bll.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { RequestModel requestModel = new RequestModel(); try { requestModel = bllScoreDefine.ConvertRequestToModel <RequestModel>(requestModel); } catch (Exception ex) { resp.errcode = (int)APIErrCode.PrimaryKeyIncomplete; resp.errmsg = ex.Message; bllScoreDefine.ContextResponse(context, resp); return; } KeyVauleDataInfo ScoreDefineData = bllkeyValueData.GetKeyData("ScoreDefineType", requestModel.score_type, "Common"); if (ScoreDefineData == null) { resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "规则类型暂不支持"; bllScoreDefine.ContextResponse(context, resp); return; } ScoreDefineInfo scoreDefineInfo = new ScoreDefineInfo(); scoreDefineInfo.Score = requestModel.score; scoreDefineInfo.DayLimit = requestModel.day_limit; scoreDefineInfo.Description = requestModel.description; scoreDefineInfo.WebsiteOwner = bllScoreDefine.WebsiteOwner; scoreDefineInfo.CreateUserId = currentUserInfo.UserID; scoreDefineInfo.IsHide = requestModel.ishide; scoreDefineInfo.InsertTime = DateTime.Now; scoreDefineInfo.OrderNum = requestModel.order_num; scoreDefineInfo.Name = ScoreDefineData.DataValue; scoreDefineInfo.ScoreType = ScoreDefineData.DataKey; if (bllScoreDefine.PutScoreDefine(scoreDefineInfo)) { resp.errcode = (int)APIErrCode.IsSuccess; resp.isSuccess = true; } else { resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "提交失败"; } bllScoreDefine.ContextResponse(context, resp); }
/// <summary> /// 更新 /// </summary> /// <param name="context"></param> /// <returns></returns> private string Update(HttpContext context) { string autoId = context.Request["AutoID"]; string templateName = context.Request["TemplateName"]; string templateId = context.Request["TemplateId"]; string templatyType = context.Request["TemplatyType"]; KeyVauleDataInfo model = bllKeyValueData.Get <KeyVauleDataInfo>(string.Format(" AutoID={0}", autoId)); model.DataKey = templateName; model.DataValue = templateId; model.PreKey = templatyType; if (bllKeyValueData.Update(model, string.Format(" DataKey='{0}',DataValue='{1}',PreKey='{2}'", model.DataKey, model.DataValue, model.PreKey), string.Format(" AutoId={0}", model.AutoId)) > 0) { resp.isSuccess = true; } return(Common.JSONHelper.ObjectToJson(resp)); }
private string AddRechargePrice(HttpContext context) { string dataValue = context.Request["DataValue"]; string orderNum = context.Request["OrderNum"]; KeyVauleDataInfo rechargePriceKeyValue = new KeyVauleDataInfo("RechargePrice", bllkeyValueData.GetGUID(TransacType.CommAdd), dataValue , bllkeyValueData.WebsiteOwner, null, currentUserInfo.UserID, orderNum); if (bllkeyValueData.Add(rechargePriceKeyValue)) { resp.Status = 1; resp.Msg = "新增成功"; } else { resp.Status = -1; resp.Msg = "新增失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 课程基本设置 /// </summary> /// <param name="context"></param> /// <returns></returns> private string EditOpenConfig(HttpContext context) { string Creater = context.Request["Creater"]; if (string.IsNullOrWhiteSpace(Creater)) { resp.Status = (int)APIErrCode.PrimaryKeyIncomplete; resp.Msg = "创建人不能为空"; return(Common.JSONHelper.ObjectToJson(resp)); } if (bllUserExpand.ExistUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID)) { bllUserExpand.UpdateUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID, Creater); } else { bllUserExpand.AddUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID, Creater); } string OpenClassNotice = context.Request["OpenClassNotice"]; if (!string.IsNullOrWhiteSpace(OpenClassNotice)) { BLLKeyValueData bllKeyValueData = new BLLKeyValueData(); KeyVauleDataInfo value = new KeyVauleDataInfo(); value.DataType = "OpenClassNotice"; value.DataKey = "0"; value.DataValue = OpenClassNotice; value.Creater = this.currentUserInfo.UserID; value.WebsiteOwner = bll.WebsiteOwner; value.CreateTime = DateTime.Now; bllKeyValueData.PutDataValue(value); } resp.Status = 1; resp.Msg = "修改完成"; return(Common.JSONHelper.ObjectToJson(resp)); }
public void ProcessRequest(HttpContext context) { string id = context.Request["id"]; string key = context.Request["key"]; string value = context.Request["value"]; if (string.IsNullOrEmpty(id)) { apiResp.msg = "id 参数必传"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } if (string.IsNullOrEmpty(key)) { apiResp.msg = "key 参数必传"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } if (string.IsNullOrEmpty(value)) { apiResp.msg = "value 参数必传"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } KeyVauleDataInfo model = bllKeyValueData.Get <KeyVauleDataInfo>(string.Format(" AutoID={0}", id)); model.DataKey = key; model.DataValue = value; if (bllKeyValueData.Update(model, string.Format(" DataKey='{0}',DataValue='{1}'", model.DataKey, model.DataValue), string.Format(" AutoId={0}", model.AutoId)) > 0) { apiResp.status = true; apiResp.msg = "ok"; } else { apiResp.msg = "添加失败"; } context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); }
public void ProcessRequest(HttpContext context) { string id = context.Request["id"]; if (string.IsNullOrEmpty(id)) { apiResp.msg = "id 参数必传"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } KeyVauleDataInfo model = bllKeyValueData.GetKeyData(int.Parse(id)); var result = new { id = model.AutoId, key = model.DataKey, value = model.DataValue }; apiResp.status = true; apiResp.msg = "ok"; apiResp.result = result; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); }
/// <summary> /// 添加分组广告比例 /// </summary> /// <param name="slideType">广告类型</param> /// <returns></returns> public bool AddSlideProportion(string slideType, string proportion) { var modelRecord = GetSlideProportionModel(slideType); if (modelRecord != null)//更新 { return(UpdateSlideProportion(slideType, proportion)); } else//添加 { KeyVauleDataInfo model = new KeyVauleDataInfo(); model.WebsiteOwner = WebsiteOwner; model.CreateTime = DateTime.Now; model.Creater = WebsiteOwner; model.DataType = "SlideProportion"; model.DataKey = slideType; model.DataValue = proportion; if (Add(model)) { return(true); } } return(false); }
public void ProcessRequest(HttpContext context) { RequestModel requestModel = new RequestModel(); try { requestModel = JsonConvert.DeserializeObject <RequestModel>(context.Request["data"]); } catch (Exception ex) { resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = ex.Message; bllKeyValueData.ContextResponse(context, resp); return; } KeyVauleDataInfo KeyVauleDataModel = new KeyVauleDataInfo(); if (requestModel.id > 0) { KeyVauleDataModel = bllKeyValueData.GetByKey <KeyVauleDataInfo>("AutoId", requestModel.id.ToString()); if (KeyVauleDataModel == null) { resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "原模板没有找到"; bllKeyValueData.ContextResponse(context, resp); return; } if (KeyVauleDataModel.WebsiteOwner != bllKeyValueData.WebsiteOwner) { resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "原模板不是本站模板"; bllKeyValueData.ContextResponse(context, resp); return; } } else { KeyVauleDataModel.Creater = currentUserInfo.UserID; KeyVauleDataModel.WebsiteOwner = bllKeyValueData.WebsiteOwner; KeyVauleDataModel.CreateTime = DateTime.Now; KeyVauleDataModel.PreKey = "0"; KeyVauleDataModel.DataType = EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsg); } string OldKey = KeyVauleDataModel.DataKey; KeyVauleDataModel.DataKey = requestModel.data_key; KeyVauleDataModel.DataValue = requestModel.data_value; //微信模板Id变化则清除以前的字段数据 if (!string.IsNullOrWhiteSpace(OldKey) && OldKey != KeyVauleDataModel.DataKey) { bllKeyValueData.DeleteDataVaule(EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsgData), null, OldKey, bllKeyValueData.WebsiteOwner); } List <KeyVauleDataInfo> newFieldList = new List <KeyVauleDataInfo>(); for (int i = 0; i < requestModel.child_list.Count; i++) { KeyVauleDataInfo newField = new KeyVauleDataInfo(); newField.Creater = currentUserInfo.UserID; newField.WebsiteOwner = KeyVauleDataModel.WebsiteOwner; newField.CreateTime = DateTime.Now; newField.PreKey = KeyVauleDataModel.DataKey; newField.DataType = EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsgData); newField.DataKey = requestModel.child_list[i].data_key; newField.DataValue = requestModel.child_list[i].data_value; newField.OrderBy = i + 1; newFieldList.Add(newField); } List <KeyVauleDataInfo> oldFieldList = bllKeyValueData.GetKeyVauleDataInfoList(EnumStringHelper.ToString(KeyVauleDataType.WXTmplmsgData), KeyVauleDataModel.DataKey , KeyVauleDataModel.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)) { addFieldList.Add(item); } } BLLTransaction tran = new BLLTransaction();//事务 try { if (KeyVauleDataModel.AutoId == 0) { if (!bllKeyValueData.Add(KeyVauleDataModel, tran)) { tran.Rollback(); resp.errmsg = "添加模板失败"; bllKeyValueData.ContextResponse(context, resp); return; } } else { if (!bllKeyValueData.Update(KeyVauleDataModel, tran)) { tran.Rollback(); resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "修改模板失败"; bllKeyValueData.ContextResponse(context, resp); return; } } if (deleteFieldList.Count > 0) { string delIds = MyStringHelper.ListToStr(deleteFieldList.Select(p => p.AutoId).ToList(), "", ","); if (bllKeyValueData.DeleteMultByKey <KeyVauleDataInfo>("AutoId", delIds) < 0) { tran.Rollback(); resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "删除旧字段失败"; bllKeyValueData.ContextResponse(context, resp); return; } } foreach (KeyVauleDataInfo item in editFieldList)//添加问题表 { if (!bllKeyValueData.Update(item, tran)) { tran.Rollback(); resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "模板字段修改失败"; bllKeyValueData.ContextResponse(context, resp); return; } } foreach (KeyVauleDataInfo item in addFieldList)//添加问题表 { if (!bllKeyValueData.Add(item, tran)) { tran.Rollback(); resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "模板字段添加失败"; bllKeyValueData.ContextResponse(context, resp); return; } } tran.Commit(); resp.isSuccess = true; resp.errcode = (int)APIErrCode.IsSuccess; } catch (Exception ex) { tran.Rollback(); resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "提交失败," + ex.Message; } 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)); }
/// <summary> /// 提交数据字典 /// </summary> /// <param name="context"></param> /// <returns></returns> private string PutKeyValue(HttpContext context) { string autoId = context.Request["AutoId"]; string key = context.Request["key"]; string dataName = context.Request["dataName"]; string type = context.Request["type"]; string preKey = context.Request["preKey"]; string value = context.Request["value"]; string websiteowner = context.Request["websiteowner"]; KeyVauleDataInfo keyValue = new KeyVauleDataInfo(); bool isAdd = false; if (string.IsNullOrWhiteSpace(autoId) || autoId == "0") { if (string.IsNullOrWhiteSpace(websiteowner)) { keyValue.WebsiteOwner = bllKeyValueData.WebsiteOwner; } else { keyValue.WebsiteOwner = websiteowner; } keyValue.Creater = currentUserInfo.UserID; keyValue.CreateTime = DateTime.Now; isAdd = true; if (string.IsNullOrWhiteSpace(key)) { keyValue.DataKey = Guid.NewGuid().ToString("N").ToUpper(); } } else { keyValue = bllKeyValueData.GetByKey <KeyVauleDataInfo>("AutoId", autoId); if (!string.IsNullOrWhiteSpace(key)) { keyValue.DataKey = key; } } keyValue.DataName = dataName; keyValue.DataType = type; keyValue.DataValue = value; if (!string.IsNullOrWhiteSpace(preKey)) { keyValue.PreKey = preKey; } bool r = false; if (isAdd) { r = bllKeyValueData.Add(keyValue); } else { r = bllKeyValueData.Update(keyValue); } if (r) { resp.Status = 1; if (keyValue.DataType == "WeixinKindeditor") { Comm.StaticData.InitKeyValueData(); } resp.Msg = "提交完成"; } else { resp.Msg = "提交失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
private string EditRechargeConfig(HttpContext context) { string recharge = context.Request["Recharge"]; string vipPrice = context.Request["VIPPrice"]; string sendNoticePrice = context.Request["SendNoticePrice"]; string minScore = context.Request["MinScore"]; string minWithdrawCashScore = context.Request["MinWithdrawCashScore"]; string vipPrice0 = context.Request["VIPPrice0"]; string vipDatelong = context.Request["VIPDatelong"]; string vipInterestID = context.Request["VIPInterestID"]; string vipInterestDescription = context.Request["VIPInterestDescription"]; string websiteOwner = bllkeyValueData.WebsiteOwner; KeyVauleDataInfo rechargeKeyValue = new KeyVauleDataInfo("Recharge", "100", recharge, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo sendNoticePriceValue = new KeyVauleDataInfo("SendNoticePrice", "1", sendNoticePrice, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo minScoreValue = new KeyVauleDataInfo("MinScore", "1", minScore, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo minWithdrawCashScoreValue = new KeyVauleDataInfo("MinWithdrawCashScore", "1", minWithdrawCashScore, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo VIPPriceKeyValue = new KeyVauleDataInfo("VIPPrice", "1", vipPrice, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo VIPPrice0KeyValue = new KeyVauleDataInfo("VIPPrice", "0", vipPrice0, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo VIPDatelongKeyValue = new KeyVauleDataInfo("VIPDatelong", "1", vipDatelong, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo VIPInterestIDKeyValue = new KeyVauleDataInfo("VIPInterestID", "1", vipInterestID, websiteOwner, null, currentUserInfo.UserID); JuActivityInfo juAct = new JuActivityInfo(); BLLJuActivity bllJuAct = new BLLJuActivity(); if (!string.IsNullOrWhiteSpace(vipInterestID) && vipInterestID != "0") { juAct = bllJuAct.GetJuActivity(Convert.ToInt32(vipInterestID)); juAct.ActivityDescription = vipInterestDescription; if (!bllJuAct.PutArticle(juAct)) { resp.Status = -1; resp.Msg = "提交VIP权益失败"; return(Common.JSONHelper.ObjectToJson(resp)); } } else if (!string.IsNullOrWhiteSpace(vipInterestDescription)) { vipInterestID = bllJuAct.GetGUID(TransacType.CommAdd); VIPInterestIDKeyValue.DataValue = vipInterestID; juAct.JuActivityID = Convert.ToInt32(vipInterestID); juAct.ActivityName = "VIP权益"; juAct.ArticleType = "ConfigContent"; juAct.UserID = currentUserInfo.UserID; juAct.WebsiteOwner = websiteOwner; juAct.CreateDate = DateTime.Now; juAct.ActivityDescription = vipInterestDescription; if (!bllJuAct.Add(juAct)) { resp.Status = -1; resp.Msg = "提交VIP权益失败"; return(Common.JSONHelper.ObjectToJson(resp)); } } BLLTransaction tran = new BLLTransaction(); if (bllkeyValueData.PutDataValue(rechargeKeyValue, tran) && bllkeyValueData.PutDataValue(sendNoticePriceValue, tran) && bllkeyValueData.PutDataValue(minScoreValue, tran) && bllkeyValueData.PutDataValue(minWithdrawCashScoreValue, tran) && bllkeyValueData.PutDataValue(VIPPriceKeyValue, tran) && bllkeyValueData.PutDataValue(VIPPrice0KeyValue, tran) && bllkeyValueData.PutDataValue(VIPDatelongKeyValue, tran) && bllkeyValueData.PutDataValue(VIPInterestIDKeyValue, tran)) { tran.Commit(); resp.Status = 1; resp.Msg = "提交成功"; } else { tran.Rollback(); resp.Status = -1; resp.Msg = "提交失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 添加编辑积分规则 /// </summary> /// <param name="context"></param> /// <returns></returns> private string PutDefine(HttpContext context) { int scoreId = int.Parse(context.Request["score_id"]); int score = int.Parse(context.Request["score"]); int limit = int.Parse(context.Request["limit"]); int totalLimit = int.Parse(context.Request["total_limit"]); string summary = context.Request["summary"]; string type = context.Request["type"]; int hide = int.Parse(context.Request["hide"]); int order = int.Parse(context.Request["order"]); string ex1 = context.Request["ex1"]; string scoreEvent = context.Request["score_event"]; string baseRateValue = context.Request["base_rate_value"]; string baseRateScore = context.Request["base_rate_score"]; KeyVauleDataInfo scoreDefineData = bllkeyValueData.GetKeyData("ScoreDefineType", type, bllkeyValueData.WebsiteOwner); if (scoreDefineData == null) { scoreDefineData = bllkeyValueData.GetKeyData("ScoreDefineType", type, "Common"); if (scoreDefineData == null) { resp.Status = (int)APIErrCode.OperateFail; resp.Msg = "规则类型暂不支持"; return(Common.JSONHelper.ObjectToJson(resp)); } } ScoreDefineInfo scoreDefineInfo = new ScoreDefineInfo(); scoreDefineInfo.ScoreId = scoreId; scoreDefineInfo.Score = score; scoreDefineInfo.DayLimit = limit; scoreDefineInfo.TotalLimit = totalLimit; scoreDefineInfo.Description = summary; scoreDefineInfo.WebsiteOwner = bllUser.WebsiteOwner; scoreDefineInfo.CreateUserId = this.currentUserInfo.UserID; scoreDefineInfo.IsHide = hide; scoreDefineInfo.InsertTime = DateTime.Now; scoreDefineInfo.OrderNum = order; scoreDefineInfo.Name = scoreDefineData.DataValue; scoreDefineInfo.ScoreType = scoreDefineData.DataKey; scoreDefineInfo.Ex1 = ex1; scoreDefineInfo.ScoreEvent = scoreEvent; if (!string.IsNullOrEmpty(baseRateValue)) { scoreDefineInfo.BaseRateValue = decimal.Parse(baseRateValue); } if (!string.IsNullOrEmpty(baseRateScore)) { scoreDefineInfo.BaseRateScore = decimal.Parse(baseRateScore); } if (bllScoreDefine.PutScoreDefine(scoreDefineInfo)) { resp.Status = 1; resp.Msg = "提交成功"; } else { resp.Status = -1; resp.Msg = "提交失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }