Ejemplo n.º 1
0
        public int GetPersonBlackListCount(GeneralSimpleGroupSearchView searchView)
        {
            Contract.Requires <ArgumentNullException>(searchView != null, "参数searchView:不能为空");
            int result = 0;
            MiicConditionCollections conditions           = searchView.visitor(this);
            MiicCondition            isBlackListCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <AddressBookInfo, string>(o => o.IsBlackList),
                                                                              ((int)MiicYesNoSetting.Yes).ToString(),
                                                                              DbType.String,
                                                                              MiicDBOperatorSetting.Equal);

            conditions.Add(new MiicConditionLeaf(isBlackListCondition));
            string message = string.Empty;

            try
            {
                result = dbService.GetCount <AddressBookInfo>(null, conditions, 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);
        }
Ejemplo n.º 2
0
        public DataTable Search(GeneralSimpleGroupSearchView searchView, MiicPage page)
        {
            Contract.Requires <ArgumentNullException>(searchView != null, "参数searchView:不能为空");
            DataTable result  = new DataTable();
            string    message = string.Empty;
            MiicConditionCollections conditions           = searchView.visitor(this);
            MiicCondition            isBlackListCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <AddressBookInfo, string>(o => o.IsBlackList),
                                                                              ((int)MiicYesNoSetting.No).ToString(),
                                                                              DbType.String,
                                                                              MiicDBOperatorSetting.Equal);

            conditions.Add(new MiicConditionLeaf(isBlackListCondition));
            List <MiicOrderBy> order = new List <MiicOrderBy>();

            order.Add(new MiicOrderBy()
            {
                Desc         = true,
                PropertyName = Config.Attribute.GetSqlColumnNameByPropertyName <AddressBookInfo, string>(o => o.AddresserName)
            });
            order.Add(new MiicOrderBy()
            {
                Desc         = true,
                PropertyName = Config.Attribute.GetSqlColumnNameByPropertyName <AddressBookInfo, string>(o => o.OftenUsed)
            });
            conditions.order = order;
            MiicRelation relation = new MiicRelation(Config.Attribute.GetSqlTableNameByClassName <AddressBookInfo>(),
                                                     Config.Attribute.GetSqlColumnNameByPropertyName <AddressBookInfo, string>(o => o.AddresserID),
                                                     Config.Attribute.GetSqlTableNameByClassName <Miic.Friends.User.SimpleUserView>(),
                                                     Config.Attribute.GetSqlColumnNameByPropertyName <Miic.Friends.User.SimpleUserView, string>(o => o.UserID),
                                                     MiicDBOperatorSetting.Equal,
                                                     MiicDBRelationSetting.InnerJoin);
            MiicColumnCollections columns = new MiicColumnCollections();
            MiicColumn            addressBookInfoColumns = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <AddressBookInfo>());

            columns.Add(addressBookInfoColumns);
            MiicColumn ImageUrlColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <Miic.Friends.User.SimpleUserView>(),
                                                       Config.Attribute.GetSqlColumnNameByPropertyName <Miic.Friends.User.SimpleUserView, string>(o => o.UserUrl));

            columns.Add(ImageUrlColumn);
            MiicColumn NickNameColumn = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <Miic.Friends.User.SimpleUserView>(),
                                                       "",
                                                       Config.Attribute.GetSqlColumnNameByPropertyName <Miic.Friends.User.SimpleUserView, string>(o => o.UserName), "NickName");

            columns.Add(NickNameColumn);
            if (page != null)
            {
                result = dbService.GetInformationsPage(columns, relation, conditions, page, out message);
            }
            else
            {
                result = dbService.GetInformations(columns, relation, conditions, out message);
            }
            return(result);
        }