Esempio n. 1
0
        public static IPageOfList <OrderAdminInfo> List(SearchSetting settings)
        {
            FastPaging fp = new FastPaging();

            fp.PageIndex   = settings.PageIndex;
            fp.PageSize    = settings.PageSize;
            fp.TableName   = "OrderAdmins";
            fp.TableReName = "p";
            fp.PrimaryKey  = "ID";
            fp.QueryFields = "p.*";
            fp.OverOrderBy = "  CreateDateTime DESC";
            IList <OrderAdminInfo> list  = new List <OrderAdminInfo>();
            OrderAdminInfo         model = null;
            DataTable dt = SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005());

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    model = Get(dr);
                    if (model != null)
                    {
                        list.Add(model);
                    }
                }
            }
            int count = Count();

            return(new PageOfList <OrderAdminInfo>(list, settings.PageIndex, settings.PageSize, count));
        }
Esempio n. 2
0
        private static int Count(SearchSetting settings)
        {
            StringBuilder sbCondition = new StringBuilder(" SELECT COUNT(*) FROM Attachments WITH(NOLOCK) WHERE 1 = 1");

            sbCondition.AppendFormat("  AND SiteId = @SiteId ");
            if (!settings.ShowDeleted)
            {
                sbCondition.Append("    AND IsDeleted = 0 ");
            }
            if (settings.CategoryId > 0)
            {
                sbCondition.Append(@" AND EXISTS(
                                            SELECT * FROM dbo.Categories AS AC WITH(NOLOCK)
                                            WHERE  (AC.ID = @CID OR CHARINDEX(','+CAST(@CID AS NVARCHAR(MAX))+',',','+AC.ParentIdList+',') >0)	/*获取此分类下所有的子分类*/
                                            AND SiteId = @SiteId
                                            AND IsDeleted = 0
                                            AND Attachments.CategoryId = AC.ID
                    )");
            }

            SqlParameter[] parms =
            {
                new SqlParameter("@SiteId", SqlDbType.Int),
                new SqlParameter("@CID",    SqlDbType.Int)
            };
            parms[0].Value = settings.SiteId;
            parms[1].Value = settings.CategoryId;
            return(Convert.ToInt32(Goodspeed.Library.Data.SQLPlus.ExecuteScalar(CommandType.Text, sbCondition.ToString(), parms)));
        }
Esempio n. 3
0
        public IActionResult GetSearchSetting()
        {
            string userJWTId = User.FindFirst("id")?.Value;
            Client client    = clientDB.GetCurrentClient(userJWTId);

            if (client != null)
            {
                SearchSetting searchSetting = SearchSettingDB.GetEntity(client.Id);

                if (searchSetting != null)
                {
                    return(Ok(searchSetting));
                }

                SearchSetting defaultSearchSetting = new SearchSetting
                {
                    SearchSettingId = client.Id,
                    Radius          = 500,
                    WantedCost      = 100
                };

                SearchSettingDB.Create(defaultSearchSetting);

                return(Ok(defaultSearchSetting));
            }

            return(NotFound());
        }
Esempio n. 4
0
        private static int CountForList(SearchSetting setting)
        {
            SqlParameter[] parms =
            {
                new SqlParameter("CID",         SqlDbType.Int),
                new SqlParameter("Title",       SqlDbType.NVarChar),
                new SqlParameter("PublishDate", SqlDbType.NVarChar)
            };
            parms[0].Value = setting.CategoryId;
            parms[1].Value = setting.Title;
            parms[2].Value = setting.PublishDate;
            StringBuilder sbSQL = new StringBuilder();

            sbSQL.Append(@"SELECT COUNT(*) AS c  FROM Articles AS p WITH(NOLOCK)
                        WHERE EXISTS(
	                        SELECT * FROM Categories AS AC WITH(NOLOCK) 
		                    WHERE (AC.ID = @CID OR CHARINDEX(','+CAST(@CID AS NVARCHAR(MAX))+',',','+AC.ParentIdList+',') >0)
		                    AND p.CategoryId = AC.ID
                        )");
            sbSQL.Append("  AND IsDeleted = 0   ");
            if (!string.IsNullOrEmpty(setting.Title))
            {
                sbSQL.Append("    AND CONTAINS(Title,@Title)  ");
            }
            if (Regex.IsMatch(setting.PublishDate, @"^\d{4}-\d{1,2}-\d{1,2}$", RegexOptions.IgnoreCase))
            {
                sbSQL.Append("    AND CONVERT(VARCHAR(10),PublishDateTime,120) = @PublishDate");
            }

            return(Convert.ToInt32(Goodspeed.Library.Data.SQLPlus.ExecuteScalar(CommandType.Text, sbSQL.ToString(), parms)));
        }
Esempio n. 5
0
        SearchSetting GetEntity(SearchSetting model)
        {
            var r = Provider.Get(new SearchSetting(Repository, model.Name));

            r.Name = model.Name;
            return(r);
        }
Esempio n. 6
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="setting"></param>
        /// <returns></returns>
        public static IPageOfList <ResumeInfo> List(SearchSetting setting)
        {
            FastPaging fp = new FastPaging();

            fp.PageIndex   = setting.PageIndex;
            fp.PageSize    = setting.PageSize;
            fp.Ascending   = false;
            fp.TableName   = "Resumes";
            fp.TableReName = "p";
            fp.PrimaryKey  = "ID";
            fp.QueryFields = "p.*";
            fp.OverOrderBy = " CreateDateTime DESC";
            fp.WithOptions = " WITH(NOLOCK)";
            fp.Condition   = " IsDeleted = 0";


            IList <ResumeInfo> list  = new List <ResumeInfo>();
            ResumeInfo         model = null;
            DataTable          dt    = SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005());

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    model = GetByRow(dr);
                    if (model != null)
                    {
                        list.Add(model);
                    }
                }
            }
            int count = Convert.ToInt32(SQLPlus.ExecuteScalar(CommandType.Text, fp.BuildCountSQL()));

            return(new PageOfList <ResumeInfo>(list, setting.PageIndex, setting.PageSize, count));
        }
Esempio n. 7
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="setting"></param>
        /// <returns></returns>
        public static IPageOfList<MemberInfo> List(SearchSetting setting)
        {
            FastPaging fp = new FastPaging();
            fp.PageIndex = setting.PageIndex;
            fp.PageSize = setting.PageSize;
            fp.Ascending = false;
            fp.TableName = "Members";
            fp.TableReName = "p";
            fp.PrimaryKey = "ID";
            fp.QueryFields = "p.*";
            fp.OverOrderBy = " CreateDateTime DESC";
            fp.WithOptions = " WITH(NOLOCK)";

            IList<MemberInfo> list = new List<MemberInfo>();
            DataTable dt = Goodspeed.Library.Data.SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005());
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(GetByRow(dr));
                }
            }

            int count = Convert.ToInt32(SQLPlus.ExecuteScalar(CommandType.Text, fp.BuildCountSQL())); ;
            return new PageOfList<MemberInfo>(list, setting.PageIndex, setting.PageSize, count);
        }
Esempio n. 8
0
        public static IPageOfList <AttachmentInfo> List(SearchSetting settings)
        {
            FastPaging fp = new FastPaging();

            fp.PageIndex   = settings.PageIndex;
            fp.PageSize    = settings.PageSize;
            fp.TableName   = "Attachments";
            fp.TableReName = "p";
            fp.PrimaryKey  = "ID";
            fp.QueryFields = "p.*";

            StringBuilder sbCondition = new StringBuilder();

            sbCondition.AppendFormat("  SiteId = @SiteId ");
            if (!settings.ShowDeleted)
            {
                sbCondition.Append("    AND IsDeleted = 0 ");
            }
            if (settings.CategoryId > 0)
            {
                sbCondition.Append(@" AND EXISTS(
                                            SELECT * FROM dbo.Categories AS AC WITH(NOLOCK)
                                            WHERE  (AC.ID = @CID OR CHARINDEX(','+CAST(@CID AS NVARCHAR(MAX))+',',','+AC.ParentIdList+',') >0)	/*获取此分类下所有的子分类*/
                                            AND SiteId = @SiteId
                                            AND IsDeleted = 0
                                            AND p.CategoryId = AC.ID
                    )");
            }
            fp.Condition   = sbCondition.ToString();
            fp.OverOrderBy = "Sort ASC ,PublishDate DESC";
            SqlParameter[] parms =
            {
                new SqlParameter("@SiteId", SqlDbType.Int),
                new SqlParameter("@CID",    SqlDbType.Int)
            };
            parms[0].Value = settings.SiteId;
            parms[1].Value = settings.CategoryId;

            IList <AttachmentInfo> list  = new List <AttachmentInfo>();
            AttachmentInfo         model = null;
            DataTable dt = Goodspeed.Library.Data.SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005(), parms);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    model = Get(dr);
                    if (model != null)
                    {
                        list.Add(model);
                    }
                }
            }
            int count = Count(settings);

            return(new PageOfList <AttachmentInfo>(list, settings.PageIndex, settings.PageSize, count));
        }
Esempio n. 9
0
 public IActionResult UpdateSearchSetting([FromBody] SearchSetting searchSetting)
 {
     if (searchSetting == null)
     {
         return(BadRequest());
     }
     SearchSettingDB.Update(searchSetting);
     return(Ok(searchSetting));
 }
Esempio n. 10
0
 public IActionResult CreateEquipment([FromBody] SearchSetting searchSetting)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest());
     }
     SearchSettingDB.Create(searchSetting);
     SearchSettingDB.Save();
     return(Ok(searchSetting));
 }
Esempio n. 11
0
        public static IPageOfList <ArticleInfo> List(SearchSetting setting, WebLanguage language = WebLanguage.zh_cn)
        {
            var list = ArticleManage.List(setting);

            foreach (var item in list)
            {
                LoadExtensionInfo(item, language);
            }
            return(list);
        }
Esempio n. 12
0
        private static int Count(SearchSetting settings)
        {
            StringBuilder sbCondition = new StringBuilder(" SELECT COUNT(*) FROM Admins WITH(NOLOCK) WHERE 1 = 1");

            if (!settings.ShowDeleted)
            {
                sbCondition.Append("    AND IsDeleted = 0 ");
            }
            return(Convert.ToInt32(SQLPlus.ExecuteScalar(CommandType.Text, sbCondition.ToString())));
        }
Esempio n. 13
0
 public SearchWorkplaces(int clientId)
 {
     _workplaceParameterDB = new WorkplaceParameterRepository();
     _searchSettingDB      = new SearchSettingRepository();
     _buildingDB           = new BuildingRepository();
     _workplaceDB          = new WorkplaceRepository();
     _workplaceEquipmentDB = new WorkplaceEquipmentRepository();
     _workplaceParameters  = _workplaceParameterDB.GetEntityListByClientId(clientId);
     _idealMark            = GetIdealMark();
     _searchSetting        = _searchSettingDB.GetEntity(clientId);
 }
Esempio n. 14
0
        public IActionResult DeleteEquipment(int id)
        {
            SearchSetting searchSetting = SearchSettingDB.GetEntity(id);

            if (searchSetting == null)
            {
                return(NotFound());
            }
            SearchSettingDB.Delete(id);
            return(Ok(searchSetting));
        }
Esempio n. 15
0
 public bool validStatus(RNGSearch.RNGResult result, SearchSetting setting)
 {
     for (int i = 0; i < 6; i++)
     {
         if (setting.Status[i] != 0 && setting.Status[i] != p_Status[i])
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 16
0
        private static int Count(SearchSetting settings)
        {
            StringBuilder sbCondition = new StringBuilder(" SELECT COUNT(*) FROM Feedbacks WITH(NOLOCK) WHERE 1 = 1");

            sbCondition.AppendFormat("  AND SiteId = @SiteId ");
            SqlParameter[] parms =
            {
                new SqlParameter("@SiteId", SqlDbType.Int),
            };
            parms[0].Value = settings.SiteId;
            return(Convert.ToInt32(Goodspeed.Library.Data.SQLPlus.ExecuteScalar(CommandType.Text, sbCondition.ToString(), parms)));
        }
Esempio n. 17
0
 public SearchWorkplaces(double latitude, double longitude, int clientId)
 {
     _workplaceParameterDB = new WorkplaceParameterRepository();
     _searchSettingDB      = new SearchSettingRepository();
     _buildingDB           = new BuildingRepository();
     _workplaceDB          = new WorkplaceRepository();
     _workplaceEquipmentDB = new WorkplaceEquipmentRepository();
     _latitude             = latitude;
     _longitude            = longitude;
     _workplaceParameters  = _workplaceParameterDB.GetEntityListByClientId(clientId);
     _idealMark            = GetIdealMark();
     _searchSetting        = _searchSettingDB.GetEntity(clientId);
     _buildingsInRadius    = GetBuildingsInRadius();
 }
Esempio n. 18
0
        public virtual ActionResult Edit(SearchSetting model, string @return)
        {
            var data = new JsonResultData(ModelState);

            if (ModelState.IsValid)
            {
                data.RunWithTry((resultData) =>
                {
                    model.Repository = Repository;
                    Provider.Update(model, model);
                    resultData.RedirectUrl = @return;
                });
            }
            return(Json(data));
        }
Esempio n. 19
0
        public virtual ActionResult Create(SearchSetting model)
        {
            var entry = new JsonResultEntry();

            try
            {
                model.Repository = Repository;
                Provider.Add(model);
                entry.SetSuccess();
            }
            catch (Exception e)
            {
                entry.AddException(e);
            }
            return(Json(entry));
        }
Esempio n. 20
0
 protected virtual string GenerateContentUrl(TextContent content, SearchSetting searchSetting)
 {
     if (Page_Context.Current.Initialized)
     {
         var routeValues = new RouteValueDictionary();
         if (searchSetting.RouteValueFields != null && searchSetting.RouteValueFields.Count > 0)
         {
             foreach (var routeValue in searchSetting.RouteValueFields)
             {
                 routeValues[routeValue.Key] = EvaluateStringFormulas(content, routeValue.Value);
             }
         }
         return(Page_Context.Current.FrontUrl.PageUrl(searchSetting.LinkPage, routeValues).ToString());
     }
     return("");
 }
Esempio n. 21
0
        public static IPageOfList <JobInfo> List(SearchSetting settings)
        {
            FastPaging fp = new FastPaging();

            fp.PageIndex   = settings.PageIndex;
            fp.PageSize    = settings.PageSize;
            fp.TableName   = "Jobs";
            fp.TableReName = "p";
            fp.PrimaryKey  = "ID";
            fp.QueryFields = "p.*";

            StringBuilder sbCondition = new StringBuilder();

            sbCondition.AppendFormat("  SiteId = @SiteId ");
            if (!settings.ShowDeleted)
            {
                sbCondition.Append("    AND IsDeleted = 0 ");
            }
            fp.Condition   = sbCondition.ToString();
            fp.OverOrderBy = "Sort ASC , EndDateTime DESC";

            SqlParameter[] parms =
            {
                new SqlParameter("@SiteId", SqlDbType.Int),
            };
            parms[0].Value = settings.SiteId;

            IList <JobInfo> list  = new List <JobInfo>();
            JobInfo         model = null;
            DataTable       dt    = Goodspeed.Library.Data.SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005(), parms);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    model = Get(dr);
                    if (model != null)
                    {
                        list.Add(model);
                    }
                }
            }
            int count = Count(settings);

            return(new PageOfList <JobInfo>(list, settings.PageIndex, settings.PageSize, count));
        }
Esempio n. 22
0
        public static IPageOfList <AttachmentInfo> List(SearchSetting setting)
        {
            FastPaging fp = new FastPaging();

            fp.PageIndex   = setting.PageIndex;
            fp.PageSize    = setting.PageSize;
            fp.Ascending   = false;
            fp.TableName   = "Attachments";
            fp.TableReName = "p";
            fp.PrimaryKey  = "ID";
            fp.QueryFields = "p.*";
            fp.WithOptions = " WITH(NOLOCK)";
            fp.OverOrderBy = " CreateDateTime DESC";
            if (!setting.ShowDeleted)
            {
                fp.Condition += " IsDeleted = 0";
            }
            IList <AttachmentInfo> list  = new List <AttachmentInfo>();
            AttachmentInfo         model = null;
            DataTable dt = Goodspeed.Library.Data.SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005());

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    model = new AttachmentInfo()
                    {
                        Id             = dr.Field <int>("ID"),
                        Title          = dr.Field <string>("Title"),
                        CreateDateTime = dr.Field <DateTime>("CreateDateTime"),
                        FileType       = dr.Field <string>("FileType"),
                        Size           = dr.Field <int>("Size"),
                        Url            = dr.Field <string>("Url"),
                        IsDeleted      = dr.Field <bool>("IsDeleted")
                    };
                    list.Add(model);
                }
            }
            int count = Convert.ToInt32(Goodspeed.Library.Data.SQLPlus.ExecuteScalar(CommandType.Text, "SELECT COUNT(*) FROM Attachments"));

            return(new PageOfList <AttachmentInfo>(list, setting.PageIndex, setting.PageSize, count));
        }
Esempio n. 23
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="setting"></param>
        /// <returns></returns>
        public static IPageOfList <AttachmentDownloadLogInfo> ListLog(int attachId, SearchSetting setting)
        {
            FastPaging fp = new FastPaging();

            fp.PageIndex   = setting.PageIndex;
            fp.PageSize    = setting.PageSize;
            fp.Ascending   = false;
            fp.TableName   = "AttachmentDownloadLog";
            fp.TableReName = "p";
            fp.PrimaryKey  = "ID";
            fp.QueryFields = "p.*,A.Title";
            fp.OverOrderBy = " LastDownloadDateTime DESC";
            fp.WithOptions = " WITH(NOLOCK)";
            fp.JoinSQL     = " INNER JOIN Attachment AS A WITH(NOLOCK) ON A.Id = P.AttachId";

            if (attachId > 0)
            {
                fp.Condition = string.Format("    AttachId = {0}", attachId);
            }
            IList <AttachmentDownloadLogInfo> list = new List <AttachmentDownloadLogInfo>();
            DataTable dt = Goodspeed.Library.Data.SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005());

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(new AttachmentDownloadLogInfo()
                    {
                        Id                   = dr.Field <int>("Id"),
                        UserId               = dr.Field <int>("UserId"),
                        UserName             = dr.Field <string>("UserName"),
                        DownloadCount        = dr.Field <int>("DownloadCount"),
                        LastDownloadDateTime = dr.Field <DateTime>("LastDownloadDateTime"),
                        AttachTitle          = dr.Field <string>("Title")
                    });
                }
            }

            int count = Convert.ToInt32(Goodspeed.Library.Data.SQLPlus.ExecuteScalar(CommandType.Text, fp.BuildCountSQL()));;

            return(new PageOfList <AttachmentDownloadLogInfo>(list, setting.PageIndex, setting.PageSize, count));
        }
Esempio n. 24
0
        public void getStatus(RNGSearch.RNGResult result, SearchSetting setting)
        {
            setting.p_Status = new int[6];
            int[] IV = new int[6];

            for (int i = 0; i < 6; i++)
            {
                IV[i] = result.IVs[i];
            }

            p_Status[0] = (((BS[0] * 2 + IV[0]) * Lv) / 100) + Lv + 10;
            for (int i = 1; i < 6; i++)
            {
                p_Status[i] = (int)(((((BS[i] * 2 + IV[i]) * Lv) / 100) + 5) * natures_mag[result.Nature, i]);
            }

            result.p_Status = setting.p_Status;

            return;
        }
Esempio n. 25
0
        public void it_should_call_search_service_once()
        {
            // setup
            var givenRequest  = new GetSearchPositionsQuery("google", "www.google.com");
            var givenResponse = Task.FromResult("<div></div>");
            var givenSetting  = new SearchSetting {
                ResultNumber = 1
            };
            var givenUrl = $"/search?num={givenSetting.ResultNumber}&q={givenRequest.Keyword}";

            _mockSearchSetting.Setup(s => s.Value).Returns(givenSetting);
            _mockGoogleSearchService.Setup(g => g.GetHtmlString(It.IsAny <string>())).Returns(givenResponse);
            _mockHtmlProcessor.Setup(h => h.GetSearchPositions(givenResponse.Result, givenRequest.TargetUrl)).Returns(It.IsAny <IEnumerable <int> >());

            // act
            var result = _handler.Handle(givenRequest, CancellationToken.None);

            // assert
            _mockGoogleSearchService.Verify(g => g.GetHtmlString(givenUrl), Times.Exactly(1));
        }
Esempio n. 26
0
        /// <summary>
        /// 反馈列表
        /// </summary>
        /// <param name="setting"></param>
        /// <returns></returns>
        public static IPageOfList <FeedbackInfo> List(SearchSetting setting)
        {
            FastPaging fp = new FastPaging();

            fp.PageIndex   = setting.PageIndex;
            fp.PageSize    = setting.PageSize;
            fp.Ascending   = false;
            fp.TableName   = "Feedback";
            fp.TableReName = "p";
            fp.PrimaryKey  = "ID";
            fp.QueryFields = "p.*";
            fp.OverOrderBy = "CreateDateTime DESC";

            fp.Condition = " IsDeleted = 0";

            IList <FeedbackInfo> list = new List <FeedbackInfo>();
            DataTable            dt   = Goodspeed.Library.Data.SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005());

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(new FeedbackInfo()
                    {
                        Id             = dr.Field <int>("Id"),
                        Title          = dr.Field <string>("Title"),
                        Content        = dr.Field <string>("Content"),
                        Contact        = dr.Field <string>("Contact"),
                        Email          = dr.Field <string>("Email"),
                        Phone          = dr.Field <string>("Phone"),
                        Address        = dr.Field <string>("Address"),
                        Fax            = dr.Field <string>("Fax"),
                        CreateDateTime = dr.Field <DateTime>("CreateDateTime")
                    });
                }
            }

            int count = Convert.ToInt32(Goodspeed.Library.Data.SQLPlus.ExecuteScalar(CommandType.Text, fp.BuildCountSQL()));;

            return(new PageOfList <FeedbackInfo>(list, setting.PageIndex, setting.PageSize, count));
        }
Esempio n. 27
0
        public virtual ActionResult Create(SearchSetting model, string @return)
        {
            var data = new JsonResultData(ModelState);

            if (ModelState.IsValid)
            {
                data.RunWithTry((resultData) =>
                {
                    model.Repository = Repository;
                    if (Provider.Get(model) != null)
                    {
                        resultData.AddErrorMessage("The item already exists.".Localize());
                    }
                    else
                    {
                        Provider.Add(model);
                        resultData.RedirectUrl = @return;
                    }
                });
            }
            return(Json(data));
        }
Esempio n. 28
0
        public static IPageOfList <AdminInfo> List(SearchSetting settings)
        {
            FastPaging fp = new FastPaging();

            fp.PageIndex   = settings.PageIndex;
            fp.PageSize    = settings.PageSize;
            fp.TableName   = "Admins";
            fp.TableReName = "p";
            fp.PrimaryKey  = "ID";
            fp.QueryFields = "p.*";

            StringBuilder sbCondition = new StringBuilder();

            if (!settings.ShowDeleted)
            {
                sbCondition.Append("  IsDeleted = 0 ");
            }
            fp.Condition   = sbCondition.ToString();
            fp.OverOrderBy = " CreateDateTime DESC";
            IList <AdminInfo> list  = new List <AdminInfo>();
            AdminInfo         model = null;
            DataTable         dt    = SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005());

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    model = Get(dr, true);
                    if (model != null)
                    {
                        list.Add(model);
                    }
                }
            }
            int count = Count(settings);

            return(new PageOfList <AdminInfo>(list, settings.PageIndex, settings.PageSize, count));
        }
Esempio n. 29
0
        public virtual ActionResult Edit(SearchSetting model)
        {
            var entry = new JsonResultEntry();

            try
            {
                if (ModelState.IsValid)
                {
                    model.Repository = Repository;
                    Provider.Update(model, model);
                    entry.SetSuccess();
                }
                else
                {
                    entry.AddModelState(ModelState).SetFailed();
                }
            }
            catch (Exception e)
            {
                entry.AddException(e);
            }
            return(Json(entry));
        }
Esempio n. 30
0
        public async Task <ProductSearchResult> GetProductsAsync(SearchSetting filter)
        {
            //todo : if where is not well formed, throw back bad request
            string whereLine = filter.GetWhereLine();
            var    countTask = DbContext.Products.Where(whereLine).CountAsync();

            var query = DbContext.Products.Where(whereLine);

            if (!string.IsNullOrEmpty(filter.OrderColumn))
            {
                query = query.OrderBy(filter.OrderColumn + (filter.IsDesc ? " desc" : string.Empty));
            }

            var pageTask = query
                           .Skip(filter.PageIndex * filter.PageSize)
                           .Take(filter.PageSize)
                           .ToListAsync();

            return(new ProductSearchResult()
            {
                Count = await countTask, PageData = await pageTask
            });
        }
Esempio n. 31
0
        /// <summary>
        /// 反馈列表
        /// </summary>
        /// <param name="setting"></param>
        /// <returns></returns>
        public static IPageOfList<FeedbackInfo> List(SearchSetting setting)
        {
            FastPaging fp = new FastPaging();
            fp.PageIndex = setting.PageIndex;
            fp.PageSize = setting.PageSize;
            fp.Ascending = false;
            fp.TableName = "Feedback";
            fp.TableReName = "p";
            fp.PrimaryKey = "ID";
            fp.QueryFields = "p.*";
            fp.OverOrderBy = "CreateDateTime DESC";
            
            fp.Condition = " IsDeleted = 0";

            IList<FeedbackInfo> list = new List<FeedbackInfo>();
            DataTable dt = Goodspeed.Library.Data.SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005());
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(new FeedbackInfo(){
                        Id = dr.Field<int>("Id"),
                        Title = dr.Field<string>("Title"),
                        Content = dr.Field<string>("Content"),
                        Contact = dr.Field<string>("Contact"),
                        Email = dr.Field<string>("Email"),
                        Phone = dr.Field<string>("Phone"),
                        Address = dr.Field<string>("Address"),
                        Fax = dr.Field<string>("Fax"),
                        CreateDateTime = dr.Field<DateTime>("CreateDateTime")
                    });
                }
            }

            int count = Convert.ToInt32(Goodspeed.Library.Data.SQLPlus.ExecuteScalar(CommandType.Text, fp.BuildCountSQL())); ;
            return new PageOfList<FeedbackInfo>(list, setting.PageIndex, setting.PageSize, count);
        }
Esempio n. 32
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="setting"></param>
        /// <returns></returns>
        public static IPageOfList<AttachmentDownloadLogInfo> ListLog(int attachId,SearchSetting setting)
        {
            FastPaging fp = new FastPaging();
            fp.PageIndex = setting.PageIndex;
            fp.PageSize = setting.PageSize;
            fp.Ascending = false;
            fp.TableName = "AttachmentDownloadLog";
            fp.TableReName = "p";
            fp.PrimaryKey = "ID";
            fp.QueryFields = "p.*,A.Title";
            fp.OverOrderBy = " LastDownloadDateTime DESC";
            fp.WithOptions = " WITH(NOLOCK)";
            fp.JoinSQL = " INNER JOIN Attachment AS A WITH(NOLOCK) ON A.Id = P.AttachId";

            if(attachId>0){
                fp.Condition = string.Format("    AttachId = {0}",attachId);
            }
            IList<AttachmentDownloadLogInfo> list = new List<AttachmentDownloadLogInfo>();
            DataTable dt = Goodspeed.Library.Data.SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005());
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(new AttachmentDownloadLogInfo() { 
                        Id = dr.Field<int>("Id"),
                        UserId = dr.Field<int>("UserId"),
                        UserName = dr.Field<string>("UserName"),
                        DownloadCount = dr.Field<int>("DownloadCount"),
                        LastDownloadDateTime = dr.Field<DateTime>("LastDownloadDateTime"),
                        AttachTitle = dr.Field<string>("Title")
                    });
                }
            }

            int count = Convert.ToInt32(Goodspeed.Library.Data.SQLPlus.ExecuteScalar(CommandType.Text, fp.BuildCountSQL())); ;
            return new PageOfList<AttachmentDownloadLogInfo>(list, setting.PageIndex, setting.PageSize, count);
        }
Esempio n. 33
0
  /// <summary>
 /// 列表
 /// </summary>
 /// <param name="setting"></param>
 /// <returns></returns>
 public static IPageOfList<AttachmentDownloadLogInfo> ListLog(int attachId, SearchSetting setting) {
     return AttachmentManage.ListLog(attachId,setting);
 }
Esempio n. 34
0
 public static IPageOfList <JobInfo> List(SearchSetting settings)
 {
     return(JobManage.List(settings));
 }
Esempio n. 35
0
 }/// <summary>
 /// 列表
 /// </summary>
 /// <param name="setting"></param>
 /// <returns></returns>
 public static IPageOfList<MemberInfo> List(SearchSetting setting){
     return MemberManage.List(setting);
 }
Esempio n. 36
0
  /// <summary>
 /// 列表
 /// </summary>
 /// <param name="setting"></param>
 /// <returns></returns>
 public static IPageOfList<ResumeInfo> List(SearchSetting setting) {
     return ResumeManage.List(setting);
 }
Esempio n. 37
0
 /// <summary>
 /// 列表
 /// </summary>
 /// <param name="setting"></param>
 /// <returns></returns>
 public static IPageOfList<FeedbackInfo> List(SearchSetting setting) {
     return FeedbackManage.List(setting);
 }