public static DataTable SearchUser(XiHuan_UserSearchFilter f, out int rowcount) { int minId = f.PageIndex * f.PageSize; int maxId = (f.PageIndex + 1) * f.PageSize + 1; string sql = @"DECLARE @indextable table(Id int identity(1,1) PRIMARY KEY,uid int); insert into @indextable(uid) select Id from XiHuan_UserInfo with(nolock) where IsLocked=0 {0}; select @@ROWCOUNT; select {1} from XiHuan_UserInfo u with(nolock) inner join @indextable t on u.Id=t.uid and t.Id>{2} and t.Id<{3} "; StringBuilder sqlwhere = new StringBuilder(""); if (f.UserName.Trim().Length > 0) { sqlwhere.AppendFormat(" AND UserName like'%{0}%' ", ValidatorHelper.SafeSql(f.UserName.Trim())); } if (f.ProvinceId != int.MaxValue) { sqlwhere.AppendFormat(" AND ProvinceId={0} ", f.ProvinceId); } if (f.CityId != int.MaxValue) { sqlwhere.AppendFormat(" AND CityId={0} ", f.CityId); } if (f.AreaId != int.MaxValue) { sqlwhere.AppendFormat(" AND AreaId={0} ", f.AreaId); } if (f.SchooId != int.MaxValue) { sqlwhere.AppendFormat(" AND SchoolId={0} ", f.SchooId); } if (f.IsStartUser != int.MaxValue) { sqlwhere.AppendFormat(" AND IsStarUser={0} ", f.IsStartUser); } if (f.Gender != int.MaxValue) { sqlwhere.AppendFormat(" AND Gender={0} ", f.Gender); } if (f.IsHavePhoto != int.MaxValue) { sqlwhere.Append(" AND HeadImage <> 'images/nophoto.gif'"); } if (f.CreateDateBegin != DateTime.MinValue) { sqlwhere.AppendFormat(" AND RegisterDate>='{0}' ", f.CreateDateBegin); } if (f.CreateDateEnd != DateTime.MaxValue) { sqlwhere.AppendFormat(" AND RegisterDate<'{0}' ", f.CreateDateEnd.AddDays(1)); } DataSet ds = Query.ProcessMultiSql(string.Format(sql, sqlwhere.ToString() + " order by " + f.OrderByParam, f.SelectFileds, minId, maxId), GlobalVar.DataBase_Name); rowcount = CommonMethodFacade.ConvertToInt(ds.Tables[0].Rows[0][0], 0); return(ds.Tables[1]); }
public static int GetNewChangeRequireCount(int uid) { Query require = new Query(typeof(XiHuan_UserGoodsChangeRequireEntity)); Condition c = require.GetQueryCondition(); c.AddEqualTo(XiHuan_UserGoodsChangeRequireEntity.__OWNERID, uid); c.AddEqualTo(XiHuan_UserGoodsChangeRequireEntity.__FLAG, ChangeRequireState.新发起.ToString("d")); require.SelectCount(XiHuan_MessageEntity.__ID, "requirecount"); return(CommonMethodFacade.ConvertToInt(require.ExecuteScalar(), 0)); }
public static int GetNewNotesCount(int uid) { Query notes = new Query(typeof(XiHuan_GuestBookEntity)); Condition c = notes.GetQueryCondition(); c.AddEqualTo(XiHuan_GuestBookEntity.__TOID, uid); c.AddEqualTo(XiHuan_GuestBookEntity.__ISCHECKED, 1); notes.SelectCount(XiHuan_GuestBookEntity.__ID, "notescount"); return(CommonMethodFacade.ConvertToInt(notes.ExecuteScalar(), 0)); }
public int AddHBByAddGoods() { DataRow[] dr = dt.Select("ConfigKey='AddGoodsHuanBi'"); return(dr.Length > 0 ? CommonMethodFacade.ConvertToInt(dr[0]["ConfigValue"], 0) : 0); }
public int TuiJianAddHuanBi() { DataRow[] dr = dt.Select("ConfigKey='TuiJianAddHuanBi'"); return(dr.Length > 0 ? CommonMethodFacade.ConvertToInt(dr[0]["ConfigValue"], 0) : 0); }
public int RegisterAddScore() { DataRow[] dr = dt.Select("ConfigKey='RegisterAddScore'"); return(dr.Length > 0 ? CommonMethodFacade.ConvertToInt(dr[0]["ConfigValue"], 0) : 0); }