Example #1
0
        /// <summary>
        /// 我的收藏信息数
        /// </summary>
        /// <param name="keywordView">关键字视图</param>
        /// <returns>收藏信息总数</returns>
        public int GetCollectCount(MyKeywordView keywordView)
        {
            Contract.Requires <ArgumentNullException>(keywordView != null, "参数keywordView:不能为空");
            int    result  = 0;
            string message = string.Empty;
            MiicConditionCollections condition       = keywordView.visitor(this);
            MiicFriendRelation       collectRelation = new MiicFriendRelation(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.ID),
                                                                              Config.Attribute.GetSqlTableNameByClassName <CollectInfo>(),
                                                                              Config.Attribute.GetSqlColumnNameByPropertyName <CollectInfo, string>(o => o.PublishID),
                                                                              MiicDBOperatorSetting.Equal,
                                                                              MiicDBRelationSetting.InnerJoin);

            MiicFriendRelation accRelation = new MiicFriendRelation(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.ID),
                                                                    Config.Attribute.GetSqlTableNameByClassName <AccessoryInfo>(),
                                                                    Config.Attribute.GetSqlColumnNameByPropertyName <AccessoryInfo, string>(o => o.PublishID),
                                                                    MiicDBOperatorSetting.Equal,
                                                                    MiicDBRelationSetting.LeftJoin);

            List <MiicFriendRelation> relations = new List <MiicFriendRelation>();

            relations.Add(collectRelation);
            relations.Add(accRelation);

            MiicRelationCollections relation = new MiicRelationCollections(Config.Attribute.GetSqlTableNameByClassName <PublishInfo>(), relations);

            MiicColumn column = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <CollectInfo>(),
                                               Config.Attribute.GetSqlColumnNameByPropertyName <CollectInfo, string>(o => o.ID));

            try
            {
                result = dbService.GetCount(column, relation, condition, out message);
            }
            catch (Exception ex)
            {
                Config.IlogicLogService.Write(new LogicLog()
                {
                    AppName       = Config.AppName,
                    ClassName     = ClassName,
                    NamespaceName = NamespaceName,
                    MethodName    = MethodBase.GetCurrentMethod().Name,
                    Message       = ex.Message,
                    Oper          = Config.Oper
                });
            }
            return(result);
        }
Example #2
0
        /// <summary>
        /// 获得企业留言列表
        /// </summary>
        /// <param name="orgID">企业ID</param>
        /// <param name="page">分页</param>
        /// <returns>留言列表信息</returns>
        public DataTable GetOrgCommentInfos(string orgID, MiicPage page)
        {
            Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(orgID), "参数orgID:不能为空");
            DataTable result  = new DataTable();
            string    message = string.Empty;
            MiicRelationCollections relation     = new MiicRelationCollections(Config.Attribute.GetSqlTableNameByClassName <OrgCommentInfo>());
            MiicFriendRelation      fromRelation = new MiicFriendRelation(Config.Attribute.GetSqlColumnNameByPropertyName <OrgCommentInfo, string>(o => o.FromCommenterID),
                                                                          new MiicTableName()
            {
                TableAliasName = "FROM_USER",
                TableName      = Config.Attribute.GetSqlTableNameByClassName <MiicSocialUserInfo>()
            },
                                                                          Config.Attribute.GetSqlColumnNameByPropertyName <MiicSocialUserInfo, string>(o => o.ID),
                                                                          MiicDBOperatorSetting.Equal,
                                                                          MiicDBRelationSetting.LeftJoin);

            relation.Add(fromRelation);
            MiicFriendRelation toRelation = new MiicFriendRelation(Config.Attribute.GetSqlColumnNameByPropertyName <OrgCommentInfo, string>(o => o.ToCommenterID),
                                                                   new MiicTableName()
            {
                TableAliasName = "TO_USER",
                TableName      = Config.Attribute.GetSqlTableNameByClassName <MiicSocialUserInfo>()
            },
                                                                   Config.Attribute.GetSqlColumnNameByPropertyName <MiicSocialUserInfo, string>(o => o.ID),
                                                                   MiicDBOperatorSetting.Equal,
                                                                   MiicDBRelationSetting.LeftJoin);

            relation.Add(toRelation);
            MiicCondition orgIDCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <OrgCommentInfo, string>(o => o.OrgID),
                                                             orgID,
                                                             DbType.String,
                                                             MiicDBOperatorSetting.Equal);
            MiicConditionCollections conditions = new MiicConditionCollections();

            conditions.Add(new MiicConditionLeaf(MiicDBLogicSetting.No, orgIDCondition));
            List <MiicOrderBy> order     = new List <MiicOrderBy>();
            MiicOrderBy        timeOrder = new MiicOrderBy()
            {
                Desc         = true,
                PropertyName = Config.Attribute.GetSqlColumnNameByPropertyName <OrgCommentInfo, DateTime?>(o => o.CommentTime)
            };

            order.Add(timeOrder);
            conditions.order = order;
            MiicColumn            allColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <OrgCommentInfo>());
            MiicColumnCollections column    = new MiicColumnCollections();

            column.Add(allColumn);
            MiicColumn fromUserUrlColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <MiicSocialUserInfo>(),
                                                          "FROM_USER",
                                                          Config.Attribute.GetSqlColumnNameByPropertyName <MiicSocialUserInfo, string>(o => o.MicroUserUrl),
                                                          "FROM_USER_URL");

            column.Add(fromUserUrlColumn);
            MiicColumn fromUserTypeColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <MiicSocialUserInfo>(),
                                                           "FROM_USER",
                                                           Config.Attribute.GetSqlColumnNameByPropertyName <MiicSocialUserInfo, string>(o => o.UserType),
                                                           "FROM_USER_TYPE");

            column.Add(fromUserTypeColumn);
            MiicColumn toUserUrlColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <MiicSocialUserInfo>(),
                                                        "TO_USER",
                                                        Config.Attribute.GetSqlColumnNameByPropertyName <MiicSocialUserInfo, string>(o => o.MicroUserUrl),
                                                        "TO_USER_URL");

            column.Add(toUserUrlColumn);
            MiicColumn toUserTypeColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <MiicSocialUserInfo>(),
                                                         "TO_USER",
                                                         Config.Attribute.GetSqlColumnNameByPropertyName <MiicSocialUserInfo, string>(o => o.UserType),
                                                         "TO_USER_TYPE");

            column.Add(toUserTypeColumn);
            try
            {
                if (page == null)
                {
                    result = dbService.GetInformations(column, relation, conditions, out message);
                }
                else
                {
                    result = dbService.GetInformationsPage(column, relation, conditions, page, out message);
                }
            }
            catch (Exception ex)
            {
                Config.IlogicLogService.Write(new LogicLog()
                {
                    AppName       = Config.AppName,
                    ClassName     = ClassName,
                    NamespaceName = NamespaceName,
                    MethodName    = MethodBase.GetCurrentMethod().Name,
                    Message       = ex.Message,
                    Oper          = Config.Oper
                });
            }
            return(result);
        }
Example #3
0
        /// <summary>
        /// 我的收藏信息列表
        /// </summary>
        /// <param name="keywordView">关键字视图</param>
        /// <param name="orderView">排序视图</param>
        /// <param name="page">分页</param>
        /// <returns>收藏信息列表</returns>
        public DataTable GetCollectInfos(MyKeywordView keywordView, MiicPage page)
        {
            Contract.Requires <ArgumentNullException>(keywordView != null, "参数keywordView:不能为空");
            DataTable                result    = new DataTable();
            string                   message   = string.Empty;
            List <MiicOrderBy>       orders    = new List <MiicOrderBy>();
            MiicColumnCollections    column    = new MiicColumnCollections();
            MiicConditionCollections condition = keywordView.visitor(this);

            MiicOrderBy collectOrder = new MiicOrderBy()
            {
                Desc         = true,
                PropertyName = Config.Attribute.GetSqlColumnNameByPropertyName <CollectInfo, DateTime?>(o => o.CollectTime)
            };

            orders.Add(collectOrder);

            condition.order = orders;

            MiicFriendRelation collectRelation = new MiicFriendRelation(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.ID),
                                                                        Config.Attribute.GetSqlTableNameByClassName <CollectInfo>(),
                                                                        Config.Attribute.GetSqlColumnNameByPropertyName <CollectInfo, string>(o => o.PublishID),
                                                                        MiicDBOperatorSetting.Equal,
                                                                        MiicDBRelationSetting.InnerJoin);

            MiicFriendRelation accRelation = new MiicFriendRelation(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.ID),
                                                                    Config.Attribute.GetSqlTableNameByClassName <AccessoryInfo>(),
                                                                    Config.Attribute.GetSqlColumnNameByPropertyName <AccessoryInfo, string>(o => o.PublishID),
                                                                    MiicDBOperatorSetting.Equal,
                                                                    MiicDBRelationSetting.LeftJoin);

            MiicFriendRelation userRelation = new MiicFriendRelation(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.CreaterID),
                                                                     Config.Attribute.GetSqlTableNameByClassName <Miic.Manage.User.SimplePersonUserView>(),
                                                                     Config.Attribute.GetSqlColumnNameByPropertyName <Miic.Manage.User.SimplePersonUserView, string>(o => o.UserID),
                                                                     MiicDBOperatorSetting.Equal,
                                                                     MiicDBRelationSetting.LeftJoin);

            List <MiicFriendRelation> relations = new List <MiicFriendRelation>();

            relations.Add(collectRelation);
            relations.Add(accRelation);
            relations.Add(userRelation);

            MiicRelationCollections relation = new MiicRelationCollections(Config.Attribute.GetSqlTableNameByClassName <PublishInfo>(), relations);


            MiicColumn microPartakePublishInfoAllColumns = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <PublishInfo>());

            column.Add(microPartakePublishInfoAllColumns);

            MiicColumn microCollectInfoIDColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <CollectInfo>(),
                                                                 string.Empty,
                                                                 Config.Attribute.GetSqlColumnNameByPropertyName <CollectInfo, string>(o => o.ID),
                                                                 "CommunityCollectInfoID");

            column.Add(microCollectInfoIDColumn);
            MiicColumn collectTime = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <CollectInfo>(),
                                                    Config.Attribute.GetSqlColumnNameByPropertyName <CollectInfo, DateTime?>(o => o.CollectTime));

            column.Add(collectTime);
            //收藏人员表
            MiicColumn collectorIDColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <CollectInfo>(),
                                                          Config.Attribute.GetSqlColumnNameByPropertyName <CollectInfo, string>(o => o.CollectorID));

            column.Add(collectorIDColumn);
            MiicColumn collectorNameColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <CollectInfo>(),
                                                            Config.Attribute.GetSqlColumnNameByPropertyName <CollectInfo, string>(o => o.CollectorName));

            column.Add(collectorNameColumn);

            MiicColumn microAccessoryIDColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <AccessoryInfo>(),
                                                               string.Empty,
                                                               Config.Attribute.GetSqlColumnNameByPropertyName <AccessoryInfo, string>(o => o.ID),
                                                               "CommunityAccessoryInfoID");

            column.Add(microAccessoryIDColumn);
            MiicColumn fileNameColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <AccessoryInfo>(),
                                                       Config.Attribute.GetSqlColumnNameByPropertyName <AccessoryInfo, string>(o => o.FileName));

            column.Add(fileNameColumn);
            MiicColumn filePathColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <AccessoryInfo>(),
                                                       Config.Attribute.GetSqlColumnNameByPropertyName <AccessoryInfo, string>(o => o.FilePath));

            column.Add(filePathColumn);
            MiicColumn uploadTime = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <AccessoryInfo>(),
                                                   Config.Attribute.GetSqlColumnNameByPropertyName <AccessoryInfo, DateTime?>(o => o.UploadTime));

            column.Add(uploadTime);
            MiicColumn fileTypeColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <AccessoryInfo>(),
                                                       Config.Attribute.GetSqlColumnNameByPropertyName <AccessoryInfo, string>(o => o.FileType));

            column.Add(fileTypeColumn);

            MiicColumn orgNameColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <Miic.Manage.User.SimplePersonUserView>(),
                                                      Config.Attribute.GetSqlColumnNameByPropertyName <Miic.Manage.User.SimplePersonUserView, string>(o => o.OrgName));

            column.Add(orgNameColumn);
            MiicColumn userUrlColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <Miic.Manage.User.SimplePersonUserView>(),
                                                      Config.Attribute.GetSqlColumnNameByPropertyName <Miic.Manage.User.SimplePersonUserView, string>(o => o.UserUrl));

            column.Add(userUrlColumn);
            MiicColumn userTypeColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <Miic.Manage.User.SimplePersonUserView>(),
                                                       Config.Attribute.GetSqlColumnNameByPropertyName <Miic.Manage.User.SimplePersonUserView, string>(o => o.UserType));

            column.Add(userTypeColumn);

            try
            {
                if (page == null)
                {
                    result = dbService.GetInformations(column, relation, condition, out message);
                }
                else
                {
                    result = dbService.GetInformationsPage(column, relation, condition, page, out message, MiicDBPageRowNumberSetting.DenseRank);
                }
            }
            catch (Exception ex)
            {
                Config.IlogicLogService.Write(new LogicLog()
                {
                    AppName       = Config.AppName,
                    ClassName     = ClassName,
                    NamespaceName = NamespaceName,
                    MethodName    = MethodBase.GetCurrentMethod().Name,
                    Message       = ex.Message,
                    Oper          = Config.Oper
                });
            }
            return(result);
        }
Example #4
0
        /// <summary>
        /// 根据标签ID获取指定标签集合
        /// </summary>
        /// <param name="labelIDs">标签ID数组</param>
        /// <returns>标签集合</returns>
        DataTable ILabelInfo.GetLabelListWithIDs(List <string> labelIDs)
        {
            Contract.Requires <ArgumentNullException>(labelIDs != null, "参数labelIDs:不为空!");
            Contract.Requires <ArgumentOutOfRangeException>(labelIDs.Count != 0, "参数labelIDs:不为空!");
            DataTable result  = new DataTable();
            string    message = string.Empty;
            MiicConditionCollections condition      = new MiicConditionCollections(MiicDBLogicSetting.No);
            MiicCondition            validCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyNameWithTable <LabelInfo, string>(o => o.Valid),
                                                                        ((int)MiicValidTypeSetting.Valid).ToString(),
                                                                        DbType.String,
                                                                        MiicDBOperatorSetting.Equal);

            condition.Add(new MiicConditionLeaf(MiicDBLogicSetting.No, validCondition));

            MiicConditionCollections idsCondition = new MiicConditionCollections();

            for (int i = 0, lableCount = labelIDs.Count; i < lableCount; i++)
            {
                if (i == 0)
                {
                    idsCondition.Add(new MiicConditionLeaf(MiicDBLogicSetting.No, new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyNameWithTable <LabelInfo, string>(o => o.ID),
                                                                                                    labelIDs[i],
                                                                                                    DbType.String,
                                                                                                    MiicDBOperatorSetting.Equal)));
                }
                else
                {
                    idsCondition.Add(new MiicConditionLeaf(MiicDBLogicSetting.Or, new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyNameWithTable <LabelInfo, string>(o => o.ID),
                                                                                                    labelIDs[i],
                                                                                                    DbType.String,
                                                                                                    MiicDBOperatorSetting.Equal)));
                }
            }
            condition.Add(idsCondition);
            List <MiicOrderBy> order = new List <MiicOrderBy>();

            order.Add(new MiicOrderBy()
            {
                Desc         = true,
                PropertyName = Config.Attribute.GetSqlColumnNameByPropertyNameWithTable <LabelInfo, int?>(o => o.SortNo)
            });
            condition.order = order;

            MiicRelationCollections realtions          = new MiicRelationCollections(Config.Attribute.GetSqlTableNameByClassName <LabelInfo>());
            MiicFriendRelation      searchInfoRelation = new MiicFriendRelation(Config.Attribute.GetSqlColumnNameByPropertyName <LabelInfo, string>(o => o.ID),
                                                                                Config.Attribute.GetSqlTableNameByClassName <LabelSearchInfo>(),
                                                                                Config.Attribute.GetSqlColumnNameByPropertyName <LabelSearchInfo, string>(o => o.LabelID),
                                                                                MiicDBOperatorSetting.Equal,
                                                                                MiicDBRelationSetting.LeftJoin);

            realtions.Add(searchInfoRelation);
            MiicFriendRelation userInfoRelation = new MiicFriendRelation(Config.Attribute.GetSqlColumnNameByPropertyName <LabelInfo, string>(o => o.CreaterID),
                                                                         Config.Attribute.GetSqlTableNameByClassName <Miic.Friends.User.SimpleUserView>(),
                                                                         Config.Attribute.GetSqlColumnNameByPropertyName <Miic.Friends.User.SimpleUserView, string>(o => o.UserID),
                                                                         MiicDBOperatorSetting.Equal,
                                                                         MiicDBRelationSetting.LeftJoin);

            realtions.Add(userInfoRelation);


            MiicColumnCollections columns       = new MiicColumnCollections();
            MiicColumn            labelIDColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <LabelInfo>(),
                                                                 Config.Attribute.GetSqlColumnNameByPropertyName <LabelInfo, string>(o => o.ID));

            columns.Add(labelIDColumn);
            MiicColumn labelNameColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <LabelInfo>(),
                                                        Config.Attribute.GetSqlColumnNameByPropertyName <LabelInfo, string>(o => o.LabelName));

            columns.Add(labelNameColumn);
            MiicColumn createTimeColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <LabelInfo>(),
                                                         Config.Attribute.GetSqlColumnNameByPropertyName <LabelInfo, DateTime?>(o => o.CreateTime));

            columns.Add(createTimeColumn);
            MiicColumn createrIDColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <LabelInfo>(),
                                                        Config.Attribute.GetSqlColumnNameByPropertyName <LabelInfo, string>(o => o.CreaterID));

            columns.Add(createrIDColumn);
            MiicColumn createrNameColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <Miic.Friends.User.SimpleUserView>(),
                                                          "",
                                                          Config.Attribute.GetSqlColumnNameByPropertyName <Miic.Friends.User.SimpleUserView, string>(o => o.UserName)
                                                          , Config.Attribute.GetSqlColumnNameByPropertyName <LabelInfo, string>(o => o.CreaterName));

            columns.Add(createrNameColumn);

            MiicColumn labelSearchCommunityIDColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <LabelSearchInfo>(),
                                                                     Config.Attribute.GetSqlColumnNameByPropertyName <LabelSearchInfo, string>(o => o.CommunityID));

            columns.Add(labelSearchCommunityIDColumn);
            MiicColumn labelSearchPublishIDColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <LabelSearchInfo>(),
                                                                   Config.Attribute.GetSqlColumnNameByPropertyName <LabelSearchInfo, string>(o => o.PublishID));

            columns.Add(labelSearchPublishIDColumn);
            MiicColumn labelSearchUserIDColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <LabelSearchInfo>(),
                                                                Config.Attribute.GetSqlColumnNameByPropertyName <LabelSearchInfo, string>(o => o.UserID));

            columns.Add(labelSearchUserIDColumn);
            MiicColumn labelSearchUserNameColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <LabelSearchInfo>(),
                                                                  Config.Attribute.GetSqlColumnNameByPropertyName <LabelSearchInfo, string>(o => o.UserName));

            columns.Add(labelSearchUserNameColumn);
            MiicColumn labelSearchUserTypeColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <LabelSearchInfo>(),
                                                                  Config.Attribute.GetSqlColumnNameByPropertyName <LabelSearchInfo, string>(o => o.UserType));

            columns.Add(labelSearchUserTypeColumn);
            MiicColumn labelSearchUserUrlColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <LabelSearchInfo>(),
                                                                 Config.Attribute.GetSqlColumnNameByPropertyName <LabelSearchInfo, string>(o => o.UserUrl));

            columns.Add(labelSearchUserUrlColumn);
            try
            {
                result = dbService.GetInformations(columns, realtions, condition, out message);
            }
            catch (Exception ex)
            {
                Config.IlogicLogService.Write(new LogicLog()
                {
                    AppName       = Config.AppName,
                    ClassName     = ClassName,
                    NamespaceName = NamespaceName,
                    MethodName    = MethodBase.GetCurrentMethod().Name,
                    Message       = ex.Message,
                    Oper          = Config.Oper
                });
            }
            return(result);
        }