/// <summary> /// 修改标签展示顺序 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateTags(SWfsTagRel model) { return(DapperUtil.Update(model)); }
/// <summary> /// 标签展示排序 /// </summary> /// <returns></returns> public ActionResult ajaxTagSave() { string tagsId = Request["tagsStr"]; string _location = Request["location"]; string _des = Request["des"]; if (_des == "sort") { if (!string.IsNullOrEmpty(tagsId) && !string.IsNullOrEmpty(_location)) { IList <SWfsTagRel> TagList = new List <SWfsTagRel>(); string[] tagsArray = tagsId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); //styleService.DeleteTagsByLocation(); TagList = styleService.GetTagsList(short.Parse(_location)); int j = 1; for (int i = 0; i < tagsArray.Length; i++) { SWfsTagRel tagEntity = TagList.Where(c => c.TagNo == tagsArray[i]).FirstOrDefault(); tagEntity.Sort = j; tagEntity.CreateUserId = PresentationHelper.GetPassport().UserName; if (styleService.UpdateTags(tagEntity)) { j++; } else { return(Json(new { result = 0, message = "排序失败!" })); } } return(Json(new { result = 1, message = "排序成功!" })); } else { return(Json(new { result = 0, message = "排序失败,没有获取到排序的对象!" })); } } else if (_des == "add") { IList <t_tag_base> tagBaseList = new List <t_tag_base>(); if (!string.IsNullOrEmpty(tagsId) && !string.IsNullOrEmpty(_location)) { tagBaseList = styleService.GetTagsCreatListByTagIds(tagsId); if (tagBaseList != null && tagBaseList.Count() > 0) { foreach (t_tag_base TagbaseEntity in tagBaseList) { SWfsTagRel tagRelEntity = new SWfsTagRel(); tagRelEntity.TagNo = TagbaseEntity.tag_id; tagRelEntity.TagName = TagbaseEntity.tag_name; tagRelEntity.Status = 1; tagRelEntity.Location = short.Parse(_location); tagRelEntity.Sort = 18; tagRelEntity.Tag_code = TagbaseEntity.tag_code; tagRelEntity.CreateDate = DateTime.Now; tagRelEntity.CreateUserId = PresentationHelper.GetPassport().UserName; styleService.AddTags(tagRelEntity); } } return(Json(new { result = 1, message = "添加成功!" })); } else { return(Json(new { result = 0, message = "排序失败,没有获取到排序的对象!" })); } } else { return(Json(new { result = 0, message = "排序失败,没有获取到排序的对象!" })); } }
/// <summary> /// 根据编号添加标签展示 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddTags(SWfsTagRel model) { return(DapperUtil.Insert(model)); }