protected void Page_Load(object sender, EventArgs e) { currUser = DataLoadTool.GetCurrUserModel(); cateRootId = Convert.ToInt32(Request["cateRootId"]); isNoPreSelect = Convert.ToInt32(Request["isNoPreSelect"]); selectMaxDepth = Convert.ToInt32(Request["selectMaxDepth"]); if (selectMaxDepth.Equals(0)) { selectMaxDepth = int.MaxValue; } isHide = bllMenupermission.CheckPerRelationByaccount(bllUser.GetCurrUserID(), -1); //是否传入了名称 var inputShowName = Request["currShowName"]; hasKeyValue = Request["hasKeyValue"]; if (!string.IsNullOrWhiteSpace(inputShowName)) { currShowName = inputShowName; nCategoryTypeConfig = new ArticleCategoryTypeConfig(); return; } //检查配置取名称 CategoryType = Request["type"]; nCategoryTypeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, CategoryType); if (nCategoryTypeConfig != null) { currShowName = nCategoryTypeConfig.CategoryTypeExDispalyName; } else { currShowName = "分类"; nCategoryTypeConfig = new ArticleCategoryTypeConfig(); } }
public ArticleCategoryTypeConfig GetArticleCategoryTypeConfig(string websiteOwner, string categoryType) { List <string> websiteOwnerList = new List <string>() { "Common" }; if (!string.IsNullOrWhiteSpace(websiteOwner)) { websiteOwnerList.Add(websiteOwner); } List <ArticleCategoryTypeConfig> list = GetArticleCategoryTypeConfigList(Common.MyStringHelper.ListToStr(websiteOwnerList, "'", ","), categoryType); ArticleCategoryTypeConfig temp = list.FirstOrDefault(p => !p.WebsiteOwner.Equals("Common")); if (temp != null) { return(temp); } ArticleCategoryTypeConfig result = list.FirstOrDefault(p => p.WebsiteOwner.Equals("Common")); if (result != null) { return(result); } return(new ArticleCategoryTypeConfig() { CategoryType = categoryType }); }
protected void Page_Load(object sender, EventArgs e) { string type = Request["type"]; id = this.Request["id"]; formField = bllTableFieldMap.GetTableFieldMapByWebsite(bllTableFieldMap.WebsiteOwner, "ZCJ_JuActivityInfo", Request["type"], null, "0", null); typeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, type); string colName = "JuActivityID,UserLongitude,UserLatitude"; if (formField.Count > 0) { colName = colName + "," + ZentCloud.Common.MyStringHelper.ListToStr(formField.Select(p => p.Field).Distinct().ToList(), "", ","); } if (id != "0") { nInfo = bll.GetColByKey <JuActivityInfo>("JuActivityID", id, colName); if (nInfo == null) { this.Response.Redirect("List.aspx?type=" + type, true); } } nInfoJtoken = JToken.FromObject(nInfo); List <ArticleCategory> list = bllArticleCategory.GetList <ArticleCategory>(string.Format("WebsiteOwner='{0}' And CategoryType='{1}'", bllArticleCategory.WebsiteOwner, type)); sbCategory.Append(new MySpider.MyCategories().GetSelectOptionHtml(list, "AutoID", "PreID", "CategoryName", cateRootId, "ddlCate", "width:200px", "")); }
protected void Page_Load(object sender, EventArgs e) { product_id = Request["product_id"]; if (product_id == "0") { currActionName = "添加"; } else { currActionName = "编辑"; } categoryType = Request["type"]; isAdded = categoryType.Contains("Added"); nCategoryTypeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, categoryType); if (nCategoryTypeConfig != null) { currShowName = nCategoryTypeConfig.CategoryTypeDispalyName; if (!string.IsNullOrWhiteSpace(nCategoryTypeConfig.CategoryTypeStockName)) { currStockName = nCategoryTypeConfig.CategoryTypeStockName; } } else { nCategoryTypeConfig = new ArticleCategoryTypeConfig(); } List <BLLJIMP.Model.ArticleCategory> list = bllArticleCategory.GetList <BLLJIMP.Model.ArticleCategory>(string.Format("WebsiteOwner='{0}' And CategoryType='{1}'", bllArticleCategory.WebsiteOwner, categoryType)); sbCategory.Append(new MySpider.MyCategories().GetSelectOptionHtml(list, "AutoID", "PreID", "CategoryName", cateRootId, "ddlCate", "width:300px", "")); }
protected void Page_Load(object sender, EventArgs e) { nCategoryTypeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, Request["type"]); MetaTable metaTable = DALEngine.GetMetas().Tables["ZCJ_JuActivityInfo"]; fieldList = metaTable.Columns.Keys.Where(p => !limitForeach.Contains(p)).ToList(); }
public void ProcessRequest(HttpContext context) { ConfigModel nConfig = bllArticleCategory.ConvertRequestToModel <ConfigModel>(new ConfigModel()); ArticleCategoryTypeConfig oConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, nConfig.type); string action = (oConfig == null || oConfig.WebsiteOwner == "Common")?"add":"edit"; if (oConfig == null) { oConfig = new ArticleCategoryTypeConfig(); } oConfig.WebsiteOwner = bllArticleCategory.WebsiteOwner; oConfig.CategoryType = nConfig.type; oConfig.TimeSetMethod = nConfig.time_set_method; oConfig.TimeSetStyle = nConfig.time_set_style; oConfig.CategoryTypeTitle = nConfig.title; oConfig.CategoryTypeHomeTitle = nConfig.home_title; oConfig.CategoryTypeOrderListTitle = nConfig.order_list_title; oConfig.CategoryTypeOrderDetailTitle = nConfig.order_detail_title; oConfig.CategoryTypeDispalyName = nConfig.name; oConfig.CategoryTypeExDispalyName = nConfig.name_ex; oConfig.ShareTitle = nConfig.share_title; oConfig.ShareImg = nConfig.share_img; oConfig.ShareDesc = nConfig.share_desc; oConfig.ShareLink = nConfig.share_link; oConfig.SpendMethod = nConfig.spend_method; oConfig.CategoryTypeStockName = nConfig.stock_name; bool result = false; if (action == "add") { result = bllArticleCategory.Add(oConfig); } else { result = bllArticleCategory.Update(new ArticleCategoryTypeConfig(), string.Format("CategoryTypeDispalyName='{0}',CategoryTypeExDispalyName='{1}',ShareTitle='{2}',ShareImg='{3}',ShareDesc='{4}'," + "ShareLink='{5}',CategoryTypeTitle='{6}',CategoryTypeHomeTitle='{7}',CategoryTypeOrderListTitle='{8}'," + "CategoryTypeOrderDetailTitle='{9}',TimeSetMethod='{10}',TimeSetStyle='{11}',SpendMethod='{12}',CategoryTypeStockName='{13}'", oConfig.CategoryTypeDispalyName, oConfig.CategoryTypeExDispalyName, oConfig.ShareTitle, oConfig.ShareImg, oConfig.ShareDesc, oConfig.ShareLink, oConfig.CategoryTypeTitle, oConfig.CategoryTypeHomeTitle, oConfig.CategoryTypeOrderListTitle, oConfig.CategoryTypeOrderDetailTitle, oConfig.TimeSetMethod, oConfig.TimeSetStyle, oConfig.SpendMethod, oConfig.CategoryTypeStockName), string.Format("WebsiteOwner='{0}' AND CategoryType='{1}'", oConfig.WebsiteOwner, oConfig.CategoryType)) > 0; } if (result) { apiResp.msg = "提交完成"; apiResp.code = (int)APIErrCode.IsSuccess; apiResp.status = true; } else { apiResp.msg = "提交失败"; apiResp.code = (int)APIErrCode.OperateFail; } bllArticleCategory.ContextResponse(context, apiResp); }
protected void Page_Load(object sender, EventArgs e) { categoryType = Request["type"]; isAdded = categoryType.Contains("Added"); nCategoryTypeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, categoryType); if (nCategoryTypeConfig != null) { currShowName = nCategoryTypeConfig.CategoryTypeDispalyName; } }
public void ProcessRequest(HttpContext context) { PostModel postModel = bllArticleCategory.ConvertRequestToModel <PostModel>(new PostModel()); ArticleCategoryTypeConfig nCategoryTypeConfig = bllArticleCategory.GetByKey <ArticleCategoryTypeConfig>("CategoryType", postModel.field, true); if (nCategoryTypeConfig == null) { isAdd = true; nCategoryTypeConfig = new ArticleCategoryTypeConfig(); nCategoryTypeConfig.CategoryType = postModel.field; nCategoryTypeConfig.WebsiteOwner = bllArticleCategory.WebsiteOwner; } nCategoryTypeConfig.CategoryTypeDispalyName = postModel.name; nCategoryTypeConfig.TimeSetMethod = postModel.map_show; //nCategoryTypeConfig.AppPagePath = postModel.app_page_path; nCategoryTypeConfig.ShareTitle = postModel.share_title; nCategoryTypeConfig.ShareImg = postModel.share_img; nCategoryTypeConfig.ShareDesc = postModel.share_desc; nCategoryTypeConfig.ShareLink = postModel.share_link; nCategoryTypeConfig.ShareTitle = postModel.share_title; nCategoryTypeConfig.ListFields = postModel.search_options; nCategoryTypeConfig.EditFields = postModel.search_fields; nCategoryTypeConfig.NeedFields = postModel.searc_keyword; nCategoryTypeConfig.Ex1 = postModel.search_app_options; nCategoryTypeConfig.Ex2 = postModel.searc_app_keyword; nCategoryTypeConfig.Ex3 = postModel.list_fields; nCategoryTypeConfig.Ex4 = postModel.list_app_fields; nCategoryTypeConfig.Ex5 = postModel.list_detail_fields; bool result = false; if (isAdd) { result = bllArticleCategory.Add(nCategoryTypeConfig); } else { result = bllArticleCategory.Update(nCategoryTypeConfig); } if (result) { apiResp.status = true; apiResp.msg = "提交成功"; apiResp.code = (int)APIErrCode.IsSuccess; } else { apiResp.msg = "提交失败"; apiResp.code = (int)APIErrCode.OperateFail; } bllArticleCategory.ContextResponse(context, apiResp); }
protected void Page_Load(object sender, EventArgs e) { WebsiteInfo model = bllWeisite.GetWebsiteInfo(); if (model != null && !string.IsNullOrEmpty(model.WeiXinBindDomain)) { strDomain = model.WeiXinBindDomain; } formField = bllTableFieldMap.GetTableFieldMapByWebsite(bllTableFieldMap.WebsiteOwner, "ZCJ_JuActivityInfo", Request["type"], null, "0", null); typeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, Request["type"]); }
protected void Page_Load(object sender, EventArgs e) { typeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, Request["type"]); List <TableFieldMapping> formField = bllTableFieldMap.GetTableFieldMapByWebsite(bllTableFieldMap.WebsiteOwner, "ZCJ_JuActivityInfo", Request["type"], null, "0", null); if (!string.IsNullOrWhiteSpace(typeConfig.Ex1)) { searchField = formField.Where(p => !string.IsNullOrWhiteSpace(p.Options) && typeConfig.Ex1.Split(',').Contains(p.Field)).ToList(); } if (!string.IsNullOrWhiteSpace(typeConfig.Ex4)) { listField = formField.Where(p => typeConfig.Ex4.Split(',').Contains(p.Field)).ToList(); } }
protected void Page_Load(object sender, EventArgs e) { string type = Request["type"]; string id = this.Request["id"]; List <TableFieldMapping> fields = bllTableFieldMap.GetTableFieldMapByWebsite(bllTableFieldMap.WebsiteOwner, "ZCJ_JuActivityInfo", type, null, "0", null); typeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, type); if (!string.IsNullOrWhiteSpace(typeConfig.Ex5)) { formField = fields.Where(p => typeConfig.Ex5.Split(',').Contains(p.Field)).ToList(); } if (typeConfig.TimeSetMethod == 1 || typeConfig.TimeSetMethod == 2) { formField.Add(new TableFieldMapping() { Field = "UserLongitude" }); formField.Add(new TableFieldMapping() { Field = "UserLatitude" }); } if (id != "0") { string colName = ZentCloud.Common.MyStringHelper.ListToStr(formField.Select(p => p.Field).Distinct().ToList(), "", ","); if (!colName.Contains("JuActivityID")) { colName = "JuActivityID," + colName; } JuActivityInfo nInfo = bll.GetColByKey <JuActivityInfo>("JuActivityID", id, colName); if (nInfo == null) { this.Response.Redirect("List.aspx?type=" + type, true); } JToken ttoken = JToken.FromObject(nInfo); foreach (var item in formField) { nInfoJtoken[item.Field] = ttoken[item.Field]; } } }
protected void Page_Load(object sender, EventArgs e) { categoryType = Request["type"]; isAdded = categoryType.Contains("Added"); nCategoryTypeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, categoryType); if (nCategoryTypeConfig != null) { currShowName = nCategoryTypeConfig.CategoryTypeDispalyName; } List <BLLJIMP.Model.ArticleCategory> list = bllArticleCategory.GetList <BLLJIMP.Model.ArticleCategory>(string.Format("WebsiteOwner='{0}' And CategoryType='{1}'", bllArticleCategory.WebsiteOwner, categoryType)); sbCategory.Append(new MySpider.MyCategories().GetSelectOptionHtml(list, "AutoID", "PreID", "CategoryName", cateRootId, "ddlCate", "width:200px", "")); WebsiteInfo model = bllWeisite.GetWebsiteInfo(); if (model != null && !string.IsNullOrEmpty(model.WeiXinBindDomain)) { strDomain = model.WeiXinBindDomain; } }
public ArticeCategoryTypeResponse GetTypeConfig(string websiteOwner, string categoryType) { ArticleCategoryTypeConfig nCategoryTypeConfig = GetArticleCategoryTypeConfig(websiteOwner, categoryType); CompanyWebsite_Config nWebsiteConfig = Get <CompanyWebsite_Config>(string.Format("WebsiteOwner='{0}'", websiteOwner)); var apply_url = "/App/Member/Wap/PhoneVerify.aspx?referrer=" + System.Web.HttpUtility.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()); if (nWebsiteConfig != null && (nWebsiteConfig.MemberStandard == 2 || nWebsiteConfig.MemberStandard == 3)) { apply_url = "/App/Member/Wap/CompleteUserInfo.aspx?referrer=" + System.Web.HttpUtility.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()); } UserInfo curUser = GetCurrentUserInfo(); return(new ArticeCategoryTypeResponse { time_set_method = nCategoryTypeConfig.TimeSetMethod, time_set_style = nCategoryTypeConfig.TimeSetStyle, spend_method = nCategoryTypeConfig.SpendMethod, title = nCategoryTypeConfig.CategoryTypeTitle, home_title = nCategoryTypeConfig.CategoryTypeHomeTitle, order_list_title = nCategoryTypeConfig.CategoryTypeOrderListTitle, order_detail_title = nCategoryTypeConfig.CategoryTypeOrderDetailTitle, category_type = nCategoryTypeConfig.CategoryType, category_name = nCategoryTypeConfig.CategoryTypeDispalyName, stock_name = nCategoryTypeConfig.CategoryTypeStockName, slide_width = nCategoryTypeConfig.SlideWidth, slide_height = nCategoryTypeConfig.SlideHeight, is_login = curUser != null ? true : false, is_member = IsMember(), truename = curUser != null ? curUser.TrueName : "", phone = curUser != null ? curUser.Phone : "", access_level = curUser != null ? curUser.AccessLevel : 0, apply_url = apply_url, nopms_url = "/Error/NoPmsMobile.htm", share_title = nCategoryTypeConfig.ShareTitle, share_img = nCategoryTypeConfig.ShareImg, share_desc = nCategoryTypeConfig.ShareDesc, share_link = nCategoryTypeConfig.ShareLink }); }
public void ProcessRequest(HttpContext context) { JuActivityInfo ninfo = new JuActivityInfo(); ninfo.WebsiteOwner = bll.WebsiteOwner; ninfo.UserID = currentUserInfo.UserID; ninfo.ArticleType = context.Request["ArticleType"]; #region 字段检查 ArticleCategoryTypeConfig typeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, ninfo.ArticleType); if (typeConfig.TimeSetMethod == 1 || typeConfig.TimeSetMethod == 2) { ninfo.UserLongitude = context.Request["UserLongitude"]; ninfo.UserLatitude = context.Request["UserLatitude"]; } List <TableFieldMapping> listFieldList = bllTableFieldMap.GetTableFieldMapByWebsite(bllTableFieldMap.WebsiteOwner, "ZCJ_JuActivityInfo", ninfo.ArticleType, null, "0", null); List <string> DefFields = new List <string>() { "JuActivityID" }; JObject jtCurUser = JObject.FromObject(ninfo); List <string> listPropertys = jtCurUser.Properties().Select(p => p.Name).ToList(); foreach (var item in listFieldList.Where(p => !DefFields.Contains(p.Field) && listPropertys.Contains(p.Field)).OrderBy(p => p.Sort)) { string nValue = context.Request[item.Field]; if (item.FieldIsNull == 1 && string.IsNullOrWhiteSpace(nValue)) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = "请完善" + item.MappingName; bllTableFieldMap.ContextResponse(context, apiResp); return; } if (!string.IsNullOrWhiteSpace(item.FormatValiFunc)) { #region 检查数据格式 //检查数据格式 if (item.FormatValiFunc == "number") { if (!MyRegex.IsNumber(nValue)) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bllTableFieldMap.ContextResponse(context, apiResp); return; } } if (item.FormatValiFunc == "phone")//email检查 { if (!MyRegex.PhoneNumLogicJudge(nValue)) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bllTableFieldMap.ContextResponse(context, apiResp); return; } } if (item.FormatValiFunc == "email")//email检查 { if (!MyRegex.EmailLogicJudge(nValue)) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bllTableFieldMap.ContextResponse(context, apiResp); return; } } if (item.FormatValiFunc == "url") //url检查 { System.Text.RegularExpressions.Regex regUrl = new System.Text.RegularExpressions.Regex(@"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"); //网址 System.Text.RegularExpressions.Match match = regUrl.Match(nValue); if (!match.Success) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bllTableFieldMap.ContextResponse(context, apiResp); return; } } #endregion } ninfo = bll.ConvertToModel <JuActivityInfo>(ninfo, item.Field, nValue); } #endregion ninfo.JuActivityID = int.Parse(bll.GetGUID(BLLJIMP.TransacType.AddOutlets)); if (bll.Add(ninfo)) { apiResp.status = true; apiResp.msg = "提交成功"; apiResp.code = (int)APIErrCode.IsSuccess; } else { apiResp.msg = "提交失败"; apiResp.code = (int)APIErrCode.OperateFail; } bll.ContextResponse(context, apiResp); }
protected void Page_Load(object sender, EventArgs e) { nCategoryTypeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, Request["type"]); }
public void ProcessRequest(HttpContext context) { Dictionary <string, string> equals = new Dictionary <string, string>(); Dictionary <string, string> contains = new Dictionary <string, string>(); Dictionary <string, string> keywords = new Dictionary <string, string>(); List <string> colFields = new List <string>() { "JuActivityID" }; int rows = Convert.ToInt32(context.Request["rows"]); int page = Convert.ToInt32(context.Request["page"]); string type = context.Request["type"]; string onlyLngLatIsNull = context.Request["OnlyLngLatIsNull"]; ArticleCategoryTypeConfig typeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, type); if (!string.IsNullOrWhiteSpace(typeConfig.ListFields)) { foreach (var item in typeConfig.ListFields.Split(',')) { if (!string.IsNullOrWhiteSpace(item) && !string.IsNullOrWhiteSpace(context.Request[item])) { equals.Add(item, context.Request[item]); } } } if (!string.IsNullOrWhiteSpace(typeConfig.EditFields)) { foreach (var item in typeConfig.EditFields.Split(',')) { if (!string.IsNullOrWhiteSpace(item) && !string.IsNullOrWhiteSpace(context.Request[item])) { contains.Add(item, context.Request[item]); } } } if (!string.IsNullOrWhiteSpace(typeConfig.NeedFields) && !string.IsNullOrWhiteSpace(context.Request["Keyword"])) { string keyword = context.Request["Keyword"]; foreach (var item in typeConfig.NeedFields.Split(',')) { if (!string.IsNullOrWhiteSpace(item)) { keywords.Add(item, keyword); } } } int total = 0; string colName = typeConfig.Ex3; if (!colName.Contains("Sort")) { colName = "Sort," + colName; } if (typeConfig.TimeSetMethod == 1 || typeConfig.TimeSetMethod == 2) { if (!colName.Contains("UserLongitude")) { colName = "UserLongitude," + colName; } if (!colName.Contains("UserLatitude")) { colName = "UserLatitude," + colName; } } if (!colName.Contains("JuActivityID")) { colName = "JuActivityID," + colName; } List <JuActivityInfo> list = bll.GetCommOutletsList(rows, page, bll.WebsiteOwner, type, false, typeConfig.TimeSetMethod, equals, contains, keywords, null, null, null, colName, out total, onlyLngLatIsNull); apiResp.result = new { totalcount = total, list = list }; apiResp.status = true; apiResp.msg = "查询完成"; apiResp.code = (int)APIErrCode.IsSuccess; bll.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { Dictionary <string, string> equals = new Dictionary <string, string>(); Dictionary <string, string> contains = new Dictionary <string, string>(); Dictionary <string, string> keywords = new Dictionary <string, string>(); int page = Convert.ToInt32(context.Request["page"]); int rows = Convert.ToInt32(context.Request["rows"]); string type = context.Request["type"]; ArticleCategoryTypeConfig typeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, type); if (!string.IsNullOrWhiteSpace(typeConfig.Ex1)) { foreach (var item in typeConfig.Ex1.Split(',')) { if (!string.IsNullOrWhiteSpace(item) && !string.IsNullOrWhiteSpace(context.Request[item])) { equals.Add(item, context.Request[item]); } } } if (!string.IsNullOrWhiteSpace(typeConfig.Ex2) && !string.IsNullOrWhiteSpace(context.Request["keyword"])) { string keyword = context.Request["keyword"]; foreach (var item in typeConfig.Ex2.Split(',')) { if (!string.IsNullOrWhiteSpace(item)) { keywords.Add(item, keyword); } } } int total = 0; string colName = typeConfig.Ex4; if (!colName.Contains("JuActivityID")) { colName = "JuActivityID," + colName; } if (!colName.Contains("Sort")) { colName = colName + ",Sort"; } if (typeConfig.TimeSetMethod == 1 || typeConfig.TimeSetMethod == 2) { colName = "UserLongitude,UserLatitude," + colName; } colName = colName.TrimStart(',').TrimEnd(','); List <JuActivityInfo> list = bll.GetCommOutletsList(rows, page, bll.WebsiteOwner, type, false, typeConfig.TimeSetMethod, equals, contains, keywords, context.Request["longitude"], context.Request["latitude"], null, colName, out total); JArray jrList = new JArray(); if (list.Count > 0) { if (typeConfig.TimeSetMethod == 1 || typeConfig.TimeSetMethod == 2) { colName = colName + ",Distance"; } JArray jList = JArray.FromObject(list); List <string> colFieldList = colName.Split(',').ToList(); foreach (JToken item in jList) { JToken jr = new JObject(); foreach (var field in colFieldList) { jr[field] = item[field]; } jrList.Add(jr); } } apiResp.result = new { totalcount = total, list = jrList }; apiResp.status = true; apiResp.msg = "查询完成"; apiResp.code = (int)APIErrCode.IsSuccess; bll.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { string type = context.Request["type"]; string cate_id = context.Request["cate_id"]; string keyword = context.Request["keyword"]; string sort = context.Request["sort"]; string rows = context.Request["rows"]; string page = context.Request["page"]; int total = 0; var data = bllMall.GetProductList(keyword, cate_id, null, sort, page, rows, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, out total, 0, false, type); bool isAdded = type.Contains("Added"); ArticleCategoryTypeConfig nCategoryTypeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, type); if (nCategoryTypeConfig == null) { nCategoryTypeConfig = new ArticleCategoryTypeConfig(); } List <dynamic> list = new List <dynamic>(); foreach (var item in data) { List <WXMallProductInfo> relList = new List <WXMallProductInfo>(); if (!string.IsNullOrWhiteSpace(item.RelationProductId)) { string pIDStrings = "'" + item.RelationProductId.Replace(",", "','") + "'"; relList = bllMall.GetColMultListByKey <WXMallProductInfo>(int.MaxValue, 1, "PID", pIDStrings, "PID,PName,Price,Unit"); } List <ProductSku> skuList = bllMall.GetColList <ProductSku>(int.MaxValue, 1, string.Format("ProductId={0}", item.PID), "SkuId,ProductId,PropValueIdEx1,PropValueIdEx2,PropValueIdEx3,Price"); list.Add(new { product_id = item.PID, category_name = bllMall.GetArticleCategoryName(item.CategoryId), title = item.PName, summary = item.Summary, access_level = item.AccessLevel, count = item.Stock, price = item.Price, img = item.RecommendImg, imgs = item.ShowImage, unit = item.Unit, relation_products = from p in relList select new { product_id = p.PID, title = p.PName, price = p.Price, unit = p.Unit, sku_id = bllMall.GetProductSkuId(p.PID) }, sku_list = from p in skuList.Where(p => checkEx(isAdded, nCategoryTypeConfig.TimeSetMethod, p)).OrderBy(p => p.PropValueIdEx1) select new { sku_id = p.SkuId, product_id = p.ProductId, price = p.Price, ex1 = p.PropValueIdEx1, ex2 = p.PropValueIdEx2, ex3 = p.PropValueIdEx3 }, sku_id = skuList.Count == 0? 0: skuList[0].SkuId }); } apiResp.result = new { totalcount = total, list = list }; apiResp.status = true; apiResp.code = (int)APIErrCode.IsSuccess; bllMall.ContextResponse(context, apiResp); }