예제 #1
0
        /// <summary>
        /// 查询标签
        /// </summary>
        public string GetTagsListData()
        {
            var form = Request("form").DeserializeJSONTo <TagsQueryEntity>();

            var tagsBLL = new TagsBLL(CurrentUserInfo);
            IList <TagsEntity> tagsList;
            string             content = string.Empty;

            int pageIndex = Utils.GetIntVal(FormatParamValue(Request("page"))) - 1;

            TagsEntity queryEntity = new TagsEntity();

            queryEntity.TagsName = FormatParamValue(form.TagsName);
            queryEntity.TagsDesc = FormatParamValue(form.TagsDesc);
            queryEntity.TypeId   = FormatParamValue(form.TypeId);
            queryEntity.StatusId = FormatParamValue(form.StatusId);

            tagsList = tagsBLL.GetWebTags(queryEntity, pageIndex, PageSize);
            var dataTotalCount = tagsBLL.GetWebTagsCount(queryEntity);

            var jsonData = new JsonData();

            jsonData.totalCount = dataTotalCount.ToString();
            jsonData.data       = tagsList;

            content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}",
                                    jsonData.data.ToJSON(),
                                    jsonData.totalCount);
            return(content);
        }
예제 #2
0
        internal TagsEntity GetTagByTagId(int TagId)
        {
            TagsEntity results = new TagsEntity();

            try
            {
                StoredProcedureEntity sproc = new StoredProcedureEntity();
                sproc.StoredProcedureName = "dnb.GetTagByTagId";
                sproc.StoredProceduresParameter.Add(GetParam("@TagId", TagId.ToString(), SQLServerDatatype.IntDataType));
                DataTable dt;
                dt = sql.ExecuteDataTable(CommandType.StoredProcedure, sproc, "");
                if (dt != null && dt.Rows.Count > 0)
                {
                    TagsAdapter ta = new TagsAdapter();
                    foreach (DataRow rw in dt.Rows)
                    {
                        results = ta.AdaptItem(rw);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(results);
        }
예제 #3
0
파일: TagsApp.cs 프로젝트: guzii/gushi
 public void SubmitForm(TagsEntity tagsEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         tagsEntity.Modify(keyValue);
         service.Update(tagsEntity);
     }
     else
     {
         tagsEntity.Create();
         service.Insert(tagsEntity);
     }
 }
예제 #4
0
 public ActionResult SubmitForm(TagsEntity tagsEntity, string keyValue)
 {
     if (tagsApp.ExistTitle(tagsEntity.F_Title))
     {
         return(Error("标签名称已存在"));
     }
     if (tagsEntity.F_DeleteMark == null)
     {
         tagsEntity.F_DeleteMark = false;
     }
     tagsApp.SubmitForm(tagsEntity, keyValue);
     return(Success("操作成功。"));
 }
예제 #5
0
        /// <summary>
        /// 保存标签
        /// </summary>
        public string SaveTagsData()
        {
            var        service      = new TagsBLL(CurrentUserInfo);
            TagsEntity tags         = new TagsEntity();
            string     content      = string.Empty;
            var        responseData = new ResponseData();

            string key     = string.Empty;
            string tags_id = string.Empty;

            if (Request("tags") != null && Request("tags") != string.Empty)
            {
                key = Request("tags").ToString().Trim();
            }
            if (Request("TagsId") != null && Request("TagsId") != string.Empty)
            {
                tags_id = Request("TagsId").ToString().Trim();
            }

            tags = key.DeserializeJSONTo <TagsEntity>();

            if (tags.TagsName == null || tags.TagsName.Trim().Length == 0)
            {
                responseData.success = false;
                responseData.msg     = "标签名称不能为空";
                return(responseData.ToJSON());
            }

            bool   status  = true;
            string message = "保存成功";

            if (tags.TagsId.Trim().Length == 0)
            {
                tags.TagsId     = Utils.NewGuid();
                tags.CustomerId = this.CurrentUserInfo.CurrentUser.customer_id;
                service.Create(tags);
            }
            else
            {
                tags.TagsId = tags_id;
                service.Update(tags, false);
            }

            responseData.success = status;
            responseData.msg     = message;

            content = responseData.ToJSON();
            return(content);
        }
예제 #6
0
        /// <summary>
        /// Web列表获取
        /// </summary>
        public IList <TagsEntity> GetWebTags(TagsEntity entity, int Page, int PageSize)
        {
            if (PageSize <= 0)
            {
                PageSize = 15;
            }

            IList <TagsEntity> list = new List <TagsEntity>();
            DataSet            ds   = new DataSet();

            ds = _currentDAO.GetWebTags(entity, Page, PageSize);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                list = DataTableToObject.ConvertToList <TagsEntity>(ds.Tables[0]);
            }
            return(list);
        }
예제 #7
0
        public JsonResult AddTags(TagsEntity objTags)
        {
            string Parameters = string.Empty;
            string strOption  = "";

            if (objTags.TagId > 0 || (!string.IsNullOrEmpty(objTags.Tag?.Trim()) && !string.IsNullOrEmpty(objTags.TagTypeCode?.Trim())))
            {
                if (objTags.TagId > 0 || CommonMethod.isValidTagName(objTags.Tag) == true)
                {
                    TagFacade fac = new TagFacade(this.CurrentClient.ApplicationDBConnectionString);
                    if (objTags.TagId > 0)
                    {
                        TagsEntity newObjTags = fac.GetTagByTagId(objTags.TagId);
                        newObjTags.LOBTag = objTags.LOBTag;
                        fac.UpdateTags(newObjTags);
                        return(Json(new { result = true, message = CommonMessagesLang.msgCommanUpdateMessage, tagValue = objTags.Tag }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        string[] separatingStrings = { "@#$" };
                        string[] tagCode           = objTags.TagTypeCode.Split(separatingStrings, System.StringSplitOptions.RemoveEmptyEntries);
                        objTags.TagValue      = objTags.Tag;
                        objTags.Tag           = "[" + tagCode[1] + "::" + objTags.Tag + "]";
                        objTags.TagTypeCode   = tagCode[0];
                        objTags.CreatedUserId = Convert.ToInt32(User.Identity.GetUserId());

                        if (!IsTasExists(objTags.Tag))// Validate tag is already exists or not
                        {
                            // Insert Tag into database.
                            fac.InsertTags(objTags, Helper.oUser.UserId);
                            return(Json(new { result = true, message = CommonMessagesLang.msgCommanInsertMessage, tagValue = objTags.Tag }, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            return(Json(new { result = false, message = TagLang.msgTagAlreadyExists, tagValue = objTags.Tag }, JsonRequestBehavior.AllowGet));
                        }
                    }
                }
                else
                {
                    return(Json(new { result = false, message = CommonMessagesLang.msgValidCharacters, tagValue = "" }, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(new { result = false, message = CommonMessagesLang.msgCommanErrorMessage, tagValue = "" }, JsonRequestBehavior.AllowGet));
        }
예제 #8
0
        internal void InsertTags(TagsEntity objTags, int UserId)
        {
            try
            {
                StoredProcedureEntity sproc = new StoredProcedureEntity();

                sproc.StoredProcedureName = "dnb.InsertTag";
                sproc.StoredProceduresParameter.Add(GetParam("@TagValue", objTags.TagValue, SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@CreatedUserId", objTags.CreatedUserId.ToString(), SQLServerDatatype.IntDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@Tag", objTags.Tag, SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@TagTypeCode", objTags.TagTypeCode, SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@LOBTag", objTags.LOBTag, SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@UserId", Convert.ToString(UserId), SQLServerDatatype.IntDataType));
                sql.ExecuteNoReturn(CommandType.StoredProcedure, sproc);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #9
0
        private async Task InsertTags(TagEventVal val, string courseId, int schoolId, int regionId, int creatorId, string schoolName, string regiongName)
        {
            var tag = new TagsEntity
            {
                AssetId    = val.Id,
                Name       = val.Name,
                CourseId   = courseId,
                SchoolId   = schoolId,
                RegtionId  = regionId,
                Creator    = creatorId,
                SchoolName = schoolName,
                RegionName = regiongName
            };


            var tags = new List <TagsEntity>
            {
                tag
            };

            foreach (var item in val.Items)
            {
                tags.Add(new TagsEntity
                {
                    AssetId    = item.Id,
                    Name       = item.Name,
                    TypeName   = item.TypeName,
                    CourseId   = courseId,
                    CategoryId = tag.AssetId,
                    SchoolId   = schoolId,
                    RegtionId  = regionId,
                    Creator    = creatorId,
                    SchoolName = schoolName,
                    RegionName = regiongName
                });
            }


            await this._unitOfWork.GetRepositoryAsync <TagsEntity>()
            .AddAsync(tags.ToArray());
        }
예제 #10
0
        /// <summary>
        /// 根据标签ID获取标签信息
        /// </summary>
        public string GetTagsInfoById()
        {
            var        service = new TagsBLL(CurrentUserInfo);
            TagsEntity tags    = new TagsEntity();
            string     content = string.Empty;

            string key = string.Empty;

            if (Request("TagsID") != null && Request("TagsID") != string.Empty)
            {
                key = Request("TagsID").ToString().Trim();
            }

            tags = service.GetByID(key);

            var jsonData = new JsonData();

            jsonData.totalCount = tags == null ? "0" : "1";
            jsonData.data       = tags;

            content = jsonData.ToJSON();
            return(content);
        }
예제 #11
0
        public ActionResult GetFormJson(string keyValue)
        {
            TagsEntity tagsEntity = tagsApp.GetForm(keyValue);

            return(Content(tagsEntity.ToJson()));
        }
예제 #12
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Update(TagsEntity pEntity)
 {
     Update(pEntity, true);
 }
예제 #13
0
 public void Update(TagsEntity pEntity, bool pIsUpdateNullField)
 {
     _currentDAO.Update(pEntity, pIsUpdateNullField);
 }
예제 #14
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Delete(TagsEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Delete(pEntity, pTran);
 }
예제 #15
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(TagsEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }
예제 #16
0
 public void UpdateTags(TagsEntity objTags)
 {
     rep.UpdateTags(objTags);
 }
예제 #17
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public TagsEntity[] QueryByEntity(TagsEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
예제 #18
0
        public string SetVipTags(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <SetVipTagsRP> >();
            LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
            var rd = new SetVipTagsRD();//返回值

            if (string.IsNullOrEmpty(rp.Parameters.VIPID))
            {
                throw new APIException("缺少参数【VIPID】或参数值为空")
                      {
                          ErrorCode = 135
                      };
            }

            VipTagsMappingBLL _VipTagsMappingBLL = new VipTagsMappingBLL(loggingSessionInfo);
            TagsBLL           _TagsBLL           = new TagsBLL(loggingSessionInfo);

            //删除之前该会员的标签
            //ItemCategoryMappingBLL itemCategoryMappingBLL=new itemCategoryMappingBLL()
            //   itemCategoryMappingBLL.DeleteByItemID(rp.Parameters.VIPID);
            _VipTagsMappingBLL.DeleteByVipID(rp.Parameters.VIPID);
            //这里不应该删除之前的促销分组,而应该根据商品的id和促销分组的id找一找,如果有isdelete=0的,就不要加,没有就加

            foreach (var tagsInfo in rp.Parameters.IdentityTagsList)
            {
                //如果该标签的id为空//创建一条记录
                if (string.IsNullOrEmpty(tagsInfo.TagsId))
                {
                    TagsEntity en = new TagsEntity();
                    en.TagsId         = Guid.NewGuid().ToString();
                    en.TagsName       = tagsInfo.TagsName;
                    en.TagsDesc       = tagsInfo.TagsName;
                    en.CreateTime     = DateTime.Now;
                    en.CreateBy       = rp.UserID;
                    en.LastUpdateTime = DateTime.Now;
                    en.LastUpdateBy   = rp.UserID;
                    en.IsDelete       = 0;
                    en.CustomerId     = rp.CustomerID;
                    //  en.TypeId
                    _TagsBLL.Create(en);
                    tagsInfo.TagsId = en.TagsId;//
                }

                //创建vip的年龄标签
                VipTagsMappingEntity TagsEn = new VipTagsMappingEntity();
                TagsEn.MappingId      = Guid.NewGuid().ToString();
                TagsEn.VipId          = rp.Parameters.VIPID;
                TagsEn.TagsId         = tagsInfo.TagsId;//标签的id
                TagsEn.CreateTime     = DateTime.Now;
                TagsEn.CreateBy       = rp.UserID;
                TagsEn.LastUpdateTime = DateTime.Now;
                TagsEn.LastUpdateBy   = rp.UserID;
                TagsEn.IsDelete       = 0;
                _VipTagsMappingBLL.Create(TagsEn);
            }


            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }
예제 #19
0
 public void InsertTags(TagsEntity objTags, int UserId)
 {
     rep.InsertTags(objTags, UserId);
 }
예제 #20
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <TagsEntity> PagedQueryByEntity(TagsEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
예제 #21
0
 public void Update(TagsEntity pEntity, bool pIsUpdateNullField, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pIsUpdateNullField, pTran);
 }
예제 #22
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(TagsEntity pEntity, IDbTransaction pTran)
 {
     Update(pEntity, true, pTran);
 }
예제 #23
0
 /// <summary>
 /// 在事务内创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Create(TagsEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Create(pEntity, pTran);
 }
예제 #24
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(TagsEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
예제 #25
0
 /// <summary>
 /// 列表数量获取
 /// </summary>
 public int GetWebTagsCount(TagsEntity entity)
 {
     return(_currentDAO.GetWebTagsCount(entity));
 }
예제 #26
0
        public string SaveTagsType(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <SaveTagsTypeRP> >();
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var rd = new SaveTagsTypeRD();//返回值

            var _TagsTypeInfo = rp.Parameters.TagsTypeInfo;

            if (string.IsNullOrEmpty(_TagsTypeInfo.TypeName))
            {
                throw new APIException("缺少参数【TypeName】或参数值为空")
                      {
                          ErrorCode = 135
                      };
            }
            TagsTypeEntity TagsTypeEn = new TagsTypeEntity();
            bool           isNew      = false;

            if (string.IsNullOrEmpty(_TagsTypeInfo.TypeId))
            {
                _TagsTypeInfo.TypeId = Guid.NewGuid().ToString();
                isNew = true;
            }
            TagsTypeEn.TypeId   = _TagsTypeInfo.TypeId;
            TagsTypeEn.TypeName = _TagsTypeInfo.TypeName;

            TagsTypeEn.LastUpdateBy   = loggingSessionInfo.UserID;
            TagsTypeEn.LastUpdateTime = DateTime.Now;
            TagsTypeEn.IsDelete       = 0;
            string error = "";
            //service.SaveProp(propInfo, ref error);
            TagsTypeBLL TagsTypeBLL = new TagsTypeBLL(loggingSessionInfo);

            if (isNew)
            {
                TagsTypeEn.CreateBy   = loggingSessionInfo.UserID;
                TagsTypeEn.CreateTime = DateTime.Now;
                TagsTypeBLL.Create(TagsTypeEn);
            }
            else
            {
                TagsTypeBLL.Update(TagsTypeEn, false);
            }
            TagsBLL TagsBLL = new TagsBLL(loggingSessionInfo);

            if (!isNew)//不是新的
            {
                string propIds = "";
                foreach (var itemInfo in _TagsTypeInfo.TagsList)//数组,更新数据
                {
                    if (!string.IsNullOrEmpty(itemInfo.TagsId))
                    {
                        if (propIds != "")
                        {
                            propIds += ",";
                        }
                        propIds += "'" + itemInfo.TagsId + "'";
                    }
                }
                //删除不在这个里面的
                if (!string.IsNullOrEmpty(propIds))
                {
                    TagsBLL.DeleteByIds(propIds, TagsTypeEn);
                }
            }


            foreach (var itemInfo in _TagsTypeInfo.TagsList)//数组,更新数据
            {
                TagsEntity TagsEn = new TagsEntity();

                TagsEn.TagsName       = itemInfo.TagsName;
                TagsEn.TagsDesc       = itemInfo.TagsName;
                TagsEn.LastUpdateBy   = rp.UserID;
                TagsEn.LastUpdateTime = DateTime.Now;
                TagsEn.IsDelete       = 0;
                TagsEn.CustomerId     = loggingSessionInfo.ClientID;
                TagsEn.TypeId         = TagsTypeEn.TypeId;

                if (string.IsNullOrEmpty(itemInfo.TagsId))
                {
                    TagsEn.TagsId     = Guid.NewGuid().ToString();
                    TagsEn.CreateBy   = rp.UserID;
                    TagsEn.CreateTime = DateTime.Now;
                    TagsBLL.Create(TagsEn);
                }
                else
                {
                    TagsEn.TagsId = itemInfo.TagsId;
                    TagsBLL.Update(TagsEn, false);
                }
            }



            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }