Пример #1
0
        public int beginCount( String countSql, PageHelper pager, EntityInfo entityInfo ) {

            String commandText = countSql;
            logger.Info( "[Page Record Count] " + commandText );
            IDbCommand command = DataFactory.GetCommand( commandText, DbContext.getConnection( entityInfo ) );
            pager.RecordCount = cvt.ToInt( command.ExecuteScalar() );
            pager.computePageCount();
            pager.resetCurrent();

            return pager.getCurrent();
        }
Пример #2
0
        public ActionResult Search()
        {
            var queryString = Request.QueryString;
            string type = queryString["Type"].ToString();
            int pageNumber = Convert.ToInt32(queryString["PageNumber"]);

            int pageSize = 10;
            int recordAmount;
            int pageAmount;
            List<Student> listPage = GetStudentPage(type, pageNumber, pageSize, out recordAmount, out pageAmount);

            PageHelper pageHelper = new PageHelper();
            string pageElement = pageHelper.CreatePageElement(Request, pageNumber, recordAmount, pageAmount);

            ViewData["Page"] = pageElement;
            return View("Index", listPage);
        }
 public void ThenIShouldSeeAccessDeniedError()
 {
     Thread.Sleep(3000);
     PageHelper.VerifyPageUrl(WebDriver.Url, Error401);
     Assert.IsTrue(WebDriver.FindElement(PageHeader).Text.Contains(Constants.Error401));
 }
 /// <summary>
 /// Initializes an instance of the <see cref="ContactFilter"/> class.
 /// </summary>
 public ContactFilter()
 {
     PageHelper = new PageHelper();
 }
Пример #5
0
 /// <summary>
 /// Runs the report for current report period.
 /// </summary>
 /// <param name="contextReportPeriod">The context report period.</param>
 public void RunReportForCurrentReportPeriod(string contextReportPeriod)
 {
     PageHelper.SelectValueFromDropdown(SignOffReportPeriod, contextReportPeriod);
     RunReport.Click();
 }
Пример #6
0
        /// <summary>
        /// Updates the changes to a page.
        /// </summary>
        public async Task <Page> UpdateAsync(PageEditorVM vm, ClaimsPrincipal principal, Guid?revertedChangeId = null, Guid?pageId = null)
        {
            await ValidateRequestAsync(vm);

            if (pageId == null)
            {
                pageId = vm.Id;
            }

            var page = await _db.Pages
                       .Include(x => x.Aliases)
                       .Include(x => x.MainPhoto)
                       .GetAsync(x => x.Id == pageId, "Страница не найдена");

            await _validator.ValidateAsync(page, vm.Facts);

            var prevVm    = page.IsDeleted ? null : _mapper.Map <PageEditorVM>(page);
            var changeset = await GetChangesetAsync(prevVm, vm, pageId.Value, principal, revertedChangeId);

            _db.Changes.Add(changeset);

            _mapper.Map(vm, page);
            page.MainPhotoId = (await FindMainPhotoAsync(vm.MainPhotoKey))?.Id;

            page.IsDeleted = false;

            await _db.PageAliases.RemoveWhereAsync(x => x.Page.Id == pageId);

            var aliasValues = JsonConvert.DeserializeObject <List <string> >(vm.Aliases ?? "[]");

            if (!aliasValues.Contains(vm.Title))
            {
                aliasValues.Add(vm.Title);
            }

            _db.PageAliases.AddRange(
                aliasValues.Select((x, idx) => new PageAlias
            {
                Id    = Guid.NewGuid(),
                Key   = PageHelper.EncodeTitle(x).ToLowerInvariant(),
                Page  = page,
                Order = idx,
                Title = x
            })
                );

            if (prevVm?.Title != vm.Title || prevVm?.Facts != vm.Facts)
            {
                _cache.Clear();
            }
            else
            {
                _cache.Remove <PageDescriptionVM>(page.Key);
                _cache.Remove <InfoBlockVM>(page.Key);
            }

            if (revertedChangeId == null)
            {
                await DiscardPageDraftAsync(vm.Id, principal);
            }

            return(page);
        }
Пример #7
0
        private void btnTiJiao_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            string ip = Request.UserHostAddress;

            //DataTable dt = DBAcc.Fill("");
            System.Collections.ArrayList list = new System.Collections.ArrayList();
            for (int i = 0; i < 20; i++)
            {
                string id = this.Request.Form["t_" + i.ToString()];
                if ((id == null) || id == "")
                {
                    break;
                }

                #region 检测:5分钟内同一ip不可连续提交
                if (i == 0)
                {
                    DataTable dt = NDDBAccess.Fill("select edittime from UT_DiaoChaResult where diaochaid='" + id + "' and ip='" + ip + "'");
                    if (dt.Rows.Count > 0)
                    {
                        TimeSpan sp = DateTime.Now - Convert.ToDateTime(dt.Rows[0]["edittime"]);
                        if (sp.Minutes <= 5)
                        {
                            PageHelper.ShowExceptionMessage("5分钟内同一ip不可连续提交");
                            return;
                        }
                    }
                }
                #endregion

                #region 设置实体
                BLL.Entity.DiaoChaResultEntity entity = new BLL.Entity.DiaoChaResultEntity();
                entity.id        = Guid.NewGuid().ToString();
                entity.ip        = ip;
                entity.edittime  = DateTime.Now;
                entity.DiaoChaID = id;

                string a1 = this.Request.Form["d_" + i.ToString()];
                if (a1 == null || a1 == "")
                {
                    continue;
                }
                foreach (string j in a1.Split(','))
                {
                    //entity.SetFieldValue("a" + j.ToString(), "1");

                    if (j == "1")
                    {
                        entity.a1 = 1;
                    }
                    if (j == "2")
                    {
                        entity.a2 = 1;
                    }
                    if (j == "3")
                    {
                        entity.a3 = 1;
                    }
                    if (j == "4")
                    {
                        entity.a4 = 1;
                    }
                    if (j == "5")
                    {
                        entity.a5 = 1;
                    }
                    if (j == "6")
                    {
                        entity.a6 = 1;
                    }
                }
                #endregion
                list.Add(entity);
            }

            if (list.Count > 0)
            {
                try
                {
                    DiaoChaResultRule rule = new DiaoChaResultRule();

                    foreach (BLL.Entity.DiaoChaResultEntity entity in list)
                    {
                        rule.Add(entity);
                    }

                    PageHelper.ShowExceptionMessage("谢谢参与");
                }
                catch (Exception E)
                {
                    PageHelper.ShowExceptionMessage(E);
                }
            }
        }
Пример #8
0
/// <summary>
/// 取信息分页列表
/// </summary>
        public DataTable GetInfoPageList(SqlTransaction trans, Hashtable hs, PageHelper p, out StringBuilder PageStr)
        {
            return(linDAL.GetInfoPageList(trans, hs, p, out PageStr));
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.RouteData.Values["Id"] != null)
            {
                id = Page.RouteData.Values["Id"] as string;
            }
            if (Microsoft.VisualBasic.Information.IsNumeric(id) == false)
            {
                return;
            }
            if (Request.Cookies["CurrentLanguage"] != null)
            {
                Lang = Request.Cookies["CurrentLanguage"].Value;
            }
            if (!IsPostBack)
            {
                try
                {
                    DataTable dtNews = NewsService.News_GetById(id);
                    if (dtNews.Rows.Count > 0)
                    {
                        Label lblName = (Label)Master.FindControl("lblName");
                        sTitleName = dtNews.Rows[0]["Name"].ToString();
                        Page.Title = sTitleName;
                        sContent   = dtNews.Rows[0]["Content"].ToString();
                        sDetail    = dtNews.Rows[0]["Detail"].ToString();
                        sDateTime  = DateTimeClass.ConvertDate(dtNews.Rows[0]["Date"].ToString(), "dd/MM/yyyy - HH:mm");
                        if (Request.RawUrl.IndexOf(Consts.CON_VAN_BAN) < 0)
                        {
                            SqlDataProvider sql  = new SqlDataProvider();
                            string          view = dtNews.Rows[0]["Views"].ToString();
                            view = (int.Parse(view) + 1).ToString();
                            string sSQL = "Update News set Views=" + view + " Where Id=" + id;
                            sql.ExecuteNonQuery(sSQL);

                            DataTable dtG = GroupNewsService.GroupNews_GetById(dtNews.Rows[0]["GroupNewsId"].ToString());
                            if (dtG.Rows.Count > 0)
                            {
                                idU_OtherGroupNews.Level = dtG.Rows[0]["Level"].ToString();
                                groupName = dtG.Rows[0]["Name"].ToString();
                                if (lblName != null)
                                {
                                    lblName.Text = groupName;
                                }
                            }

                            DataTable dtNewsReleate = NewsService.News_GetByTop("4", "Id <> " + id + " AND Active = 1 AND GroupNewsId = '" + dtNews.Rows[0]["GroupNewsId"].ToString() + "' AND Language='" + Lang + "'", "Date Desc");
                            if (dtNewsReleate.Rows.Count > 0)
                            {
                                if (Lang == "en")
                                {
                                    titleReleate = "Relative News";
                                }
                                else
                                {
                                    titleReleate = "Tin liên quan";
                                }
                                rptReleative.DataSource = PageHelper.ModifyData(dtNewsReleate, Consts.CON_TIN_TUC);
                                rptReleative.DataBind();
                            }
                            dtNewsReleate.Clear();
                            dtNewsReleate.Dispose();
                        }
                        else
                        {
                            idU_OtherGroupNews.Visible = false;
                            rptReleative.Visible       = false;
                        }
                        DataTable dtLastNews = NewsService.News_GetByTop("10", "Id <> " + id + "  AND GroupNewsId IN (Select Id from GroupNews where Active=1 AND [Index]=0) AND Active = 1 AND Language='" + Lang + "'", "Date Desc");
                        dtLastNews = PageHelper.ModifyData(dtLastNews, Consts.CON_TIN_TUC);
                        DataTable dtLeft = dtLastNews.Clone();
                        for (int i = 0; i < dtLastNews.Rows.Count; i++)
                        {
                            DataRow dr = dtLastNews.Rows[i];
                            if (i < 5)
                            {
                                dtLeft.Rows.Add(dr.ItemArray);
                                dr.Delete();
                                dtLastNews.AcceptChanges();
                            }
                            else
                            {
                                break;
                            }
                        }
                        rptLeft.DataSource = dtLeft;
                        rptLeft.DataBind();
                        rptRight.DataSource = dtLastNews;
                        rptRight.DataBind();
                    }
                }
                catch (Exception ex)
                {
                    MailSender.SendMail("", "", "Error System", ex.Message);
                }
            }
        }
 public void ThenTermsAndConditionsPageShouldOpen()
 {
     PageHelper.WaitForUrl(TermsUrl);
     PageHelper.VerifyPageUrl(WebDriver.Url, TermsUrl);
     Assert.AreEqual("Terms and conditions", WebDriver.FindElement(PageHeader).Text);
 }
Пример #11
0
 public void AddPage( Type t, String condition, PageHelper pager, IList list ) {
     String key = CacheKey.getPageList( t, condition, pager.getSize(), pager.getCurrent() );
     addList( key, list );
 }
Пример #12
0
 public IPageList FindPage( Type t, String condition, PageHelper pager ) {
     return null;
 }
Пример #13
0
    protected void ctSubmit_Click(object sender, EventArgs e)
    {
        string sqlExp;

        #region 准备数据
        string   title    = ctTitle.Text.PrepareForSql();
        string   type     = DataHelper.ArticleClass.Contains(ctType.Text) ? ctType.Text : "";
        string   content  = ctContent.Text;
        DateTime datetime = DateTime.Now;
        #endregion

        #region 创建日志
        DataHelper.CreateLog((articleId == -1) ? "发布文章" : "修改文章 " + articleId);
        #endregion

        #region 创建文章
        if (articleId == -1)
        {
            sqlExp = @"
INSERT INTO [Tibet].[dbo].[article]
           ([publisher]
           ,[post_date])
     VALUES
           ('{0}'
           ,'{1}')
";
            sqlExp = string.Format(sqlExp, Session["admin_id"], datetime);
            if (SqlHelper.ExecuteNonQuery(sqlExp) != 1)
            {
                PageHelper.ShowResultPage("初始化文章失败,请联系管理员");
            }
            sqlExp    = @"
  SELECT TOP 1 
         [id]
    FROM [Tibet].[dbo].[article]
   WHERE [publisher] = '{0}' and
         [post_date] = '{1}'
ORDER BY [edit_date] DESC
";
            sqlExp    = string.Format(sqlExp, Session["admin_id"], datetime);
            articleId = (int)(SqlHelper.ExecuteScalar(sqlExp) ?? -1);
            if (articleId == -1)
            {
                PageHelper.ShowResultPage("初始化文章失败,请联系管理员");
            }
        }
        #endregion

        #region 修改文章
        sqlExp = @"
UPDATE [Tibet].[dbo].[article]
   SET [class] = '{1}'
      ,[title] = '{2}'
      ,[content] = '{3}'
      ,[edit_date] = '{4}'
 WHERE [id] = '{0}'
";
        sqlExp = string.Format(sqlExp, articleId, type, title, content, datetime);
        if (SqlHelper.ExecuteNonQuery(sqlExp) != 1)
        {
            PageHelper.ShowResultPage("提交失败");
        }
        PageHelper.ShowResultPage("提交成功", "ArticleList.aspx");
        #endregion
    }
Пример #14
0
        private void init( EntityInfo entityInfo )
        {
            if (entityInfo == null) throw new ArgumentNullException( "EntityInfo" );
            _entityInfo = entityInfo;

            _order = "desc";
            _findChild = true;
            pager = new PageHelper();
        }
Пример #15
0
 public void AddPage( Type t, String condition, PageHelper pager, IList list )
 {
     String key = CacheKey.getPageList( t, condition, pager.getSize(), pager.getCurrent() );
     addList( key, list );
     addToApplication( CacheKey.getPagerInfoKey( key ), pager ); // 添加分页统计数据
 }
        public JsonResult Load(int pageIndex, int pageSize, string sort,
                               OrderType order, string controllerName, string actionName,
                               string requestMessage, string responseMessage, string httpMethod, int application)
        {
            PageHelper.GetPageIndex(ref pageIndex);
            PageHelper.GetPageSize(ref pageSize);

            var tempMonitors = MonitorInfoServices.LoadEntities(r => true);

            #region 查询
            if (!String.IsNullOrEmpty(controllerName))
            {
                tempMonitors = tempMonitors.Where(r => r.Controller.Contains(controllerName));
            }
            if (!String.IsNullOrEmpty(actionName))
            {
                tempMonitors = tempMonitors.Where(r => r.Action.Contains(actionName));
            }
            if (!String.IsNullOrEmpty(requestMessage))
            {
                tempMonitors = tempMonitors.Where(r => r.RequestMessage.Contains(requestMessage));
            }
            if (!String.IsNullOrEmpty(responseMessage))
            {
                tempMonitors = tempMonitors.Where(r => r.ResponseMessage.Contains(responseMessage));
            }
            if (!String.IsNullOrEmpty(httpMethod))
            {
                tempMonitors = tempMonitors.Where(r => r.HttpMethod.Equals(httpMethod, StringComparison.InvariantCultureIgnoreCase));
            }
            if (application > -1)
            {
                tempMonitors = tempMonitors.Where(r => r.ApplicationType == (ApplicationType)application);
            }
            #endregion
            #region 排序
            if ("AddTime".Equals(sort, StringComparison.InvariantCultureIgnoreCase))
            {
                tempMonitors = Sort(tempMonitors, r => r.AddTime, order).ThenBy(r => r.ID);
            }
            if ("SumTime".Equals(sort, StringComparison.InvariantCultureIgnoreCase))
            {
                tempMonitors = Sort(tempMonitors, r => r.SumTime, order).ThenBy(r => r.ID);
            }
            else
            {
                tempMonitors = Sort(tempMonitors, r => r.ID, order);
            }
            #endregion
            int totalCount = tempMonitors.Count();
            var monitors   = MonitorInfoServices
                             .LoadPageEntities(pageIndex, pageSize, tempMonitors);

            int pageCount = PageHelper.GetPageCount(totalCount, pageSize);
            return(Json(new
            {
                total = totalCount,
                rows = monitors.Select(m => new
                {
                    m.ID,
                    m.Head,
                    m.StartTime,
                    m.EndTime,
                    m.SumTime,
                    m.Controller,
                    m.Action,
                    m.HttpMethod,
                    m.IP,
                    m.Description,
                    m.RequestMessage,
                    m.ResponseMessage,
                    m.ApplicationType,
                    m.AddTime
                })
            }));
        }
Пример #17
0
        protected void grdPage_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            string strCA = e.CommandArgument.ToString();

            switch (e.CommandName)
            {
            case "AddSub":
                Level = strCA;
                AddButton_Click(source, e);
                break;

            case "Edit":
                Insert      = false;
                txtId.Value = strCA;
                DataTable dt = new DataTable();
                dt              = PageService.Page_GetById(strCA);
                Level           = dt.Rows[0]["Level"].ToString().Substring(0, dt.Rows[0]["Level"].ToString().Length - 5);
                txtName.Text    = dt.Rows[0]["Name"].ToString();
                fckDetail.Value = dt.Rows[0]["Detail"].ToString();
                txtContent.Text = dt.Rows[0]["Description"].ToString();
                //txtKeyword.Text = dt.Rows[0]["Keyword"].ToString();
                PageHelper.LoadDropDownListPagePosition(ddlPosition);
                PageHelper.LoadDropDownListTarget(ddlTarget);
                PageHelper.LoadDropDownListPageType(ddlType);
                PageHelper.LoadDropDownListLanguage(ddlLanguage);
                ddlLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                LoadDropDownListPageLinkType();
                LoadDropDownListPageLink();
                ddlType.Text = dt.Rows[0]["Type"].ToString();
                txtLink.Text = dt.Rows[0]["Link"].ToString();
                try
                {
                    ddlLink.Text     = dt.Rows[0]["Link"].ToString();
                    ddlLinkType.Text = "2";
                }
                catch
                {
                    ddlLinkType.Text = "1";
                }
                ddlTarget.Text    = dt.Rows[0]["Target"].ToString();
                ddlPosition.Text  = dt.Rows[0]["Position"].ToString();
                txtOrd.Text       = dt.Rows[0]["Ord"].ToString();
                chkActive.Checked = dt.Rows[0]["Active"].ToString() == "1" || dt.Rows[0]["Active"].ToString() == "True";
                pnView.Visible    = false;
                pnUpdate.Visible  = true;
                break;

            case "Active":
                string strA = "";
                string str  = e.Item.Cells[2].Text;
                strA = str == "1" ? "0" : "1";
                sql.ExecuteNonQuery("Update Page set Active=" + strA + "  Where Id='" + strCA + "'");
                BindGrid();
                break;

            case "Delete":
                PageService.Page_Delete(strCA);
                BindGrid();
                break;
            }
        }
Пример #18
0
 protected void btnImport_Click(object sender, System.EventArgs e)
 {
     this.taskArray = this.hfldExcelColumns.Value.Split(new char[]
     {
         ','
     });
     this.resourceArray = this.hfldResource.Value.Split(new char[]
     {
         ','
     });
     this.hfldExcelColumns.Value = string.Empty;
     this.hfldResource.Value     = string.Empty;
     if (this.ViewState["ExcelName"] != null && !string.IsNullOrEmpty(this.ViewState["ExcelName"].ToString()))
     {
         bool flag = true;
         if (string.IsNullOrEmpty(this.taskId))
         {
             this.dtWBS = (this.ViewState["dtwbs"] as DataTable);
             if (this.dtWBS.Rows.Count > 0)
             {
                 BudContractTask.ClearByPrjId(this.prjId);
             }
         }
         else
         {
             flag = (BudContractTask.GetById(this.taskId) != null);
         }
         if (flag)
         {
             this.dtWBS = (this.ViewState["dtwbs"] as DataTable);
             BudTaskServices budTaskServices = new BudTaskServices(this.taskId, this.prjId, this.version, this.dtWBS);
             bool            flag2           = false;
             System.Collections.Generic.IDictionary <string, int> relation = ExcelUtility.GetRelation(this.taskArray);
             int    num  = -1;
             int    num2 = -1;
             string str  = string.Empty;
             foreach (System.Collections.Generic.KeyValuePair <string, int> current in relation)
             {
                 string key;
                 if ((key = current.Key) != null)
                 {
                     if (!(key == "TaskCode"))
                     {
                         if (key == "SerialNo")
                         {
                             num = current.Value;
                         }
                     }
                     else
                     {
                         num2 = current.Value;
                     }
                 }
             }
             if (num != -1)
             {
                 str = this.dtWBS.Columns[num].ColumnName;
                 this.dtWBS.DefaultView.Sort = str + " DESC";
                 for (int i = 1; i < this.dtWBS.Rows.Count; i++)
                 {
                     if (this.dtWBS.Rows[i][num].ToString().Trim() == this.dtWBS.Rows[i - 1][num].ToString().Trim())
                     {
                         flag2 = true;
                         break;
                     }
                 }
             }
             else
             {
                 if (num2 != -1)
                 {
                     str = this.dtWBS.Columns[num2].ColumnName;
                     this.dtWBS.DefaultView.Sort = str + " DESC";
                     for (int j = 1; j < this.dtWBS.Rows.Count; j++)
                     {
                         if (this.dtWBS.Rows[j][num2].ToString().Trim() == this.dtWBS.Rows[j - 1][num2].ToString().Trim())
                         {
                             flag2 = true;
                             break;
                         }
                     }
                 }
             }
             if (flag2)
             {
                 base.RegisterScript("top.ui.alert('导入失败!\\n导入的Excel中有节点的序号出现重复,请修改!');");
                 return;
             }
             if (num == -1 && num2 != -1)
             {
                 foreach (DataRow dataRow in this.dtWBS.Rows)
                 {
                     string code = (dataRow[num2] == null) ? "" : dataRow[num2].ToString();
                     flag2 = BudContractTask.CheckCode(code, this.prjId);
                     if (flag2)
                     {
                         break;
                     }
                 }
             }
             if (!flag2)
             {
                 this.inputUser = PageHelper.QueryUser(this, base.UserCode);
                 int num3 = budTaskServices.ConverConTaskList(this.taskArray, this.inputUser, this.errors);
                 this.AddResource();
                 string text = "成功";
                 if (num3 == 0)
                 {
                     text = "失败";
                 }
                 string text2 = string.Empty;
                 if (this.errors.Count > 0)
                 {
                     this.ViewState["errors"] = this.errors;
                     this.ShowErrors();
                     text2 = "\\n部分节点导入失败,详见“警告信息”!";
                 }
                 else
                 {
                     this.CloseSkip();
                 }
                 base.RegisterScript(string.Concat(new string[]
                 {
                     "top.ui.alert('Excel导入",
                     text,
                     "!",
                     text2,
                     "');"
                 }));
                 base.RegisterScript("top.ui._contractTask.location.href = top.ui._contractTask.location.href;");
                 return;
             }
             base.RegisterScript("top.ui.alert('导入失败!\\n导入的Excel中有节点的任务编码与已有的节点出现重复,请修改!');");
             base.RegisterScript("top.ui._contractTask.location.href = top.ui._contractTask.location.href;");
             return;
         }
         else
         {
             base.RegisterScript("top.ui.alert('Excel导入失败!\\n你选择要导入的上级节点已不存在!');");
             base.RegisterScript("top.ui._contractTask.location.href = top.ui._contractTask.location.href;");
         }
     }
 }
Пример #19
0
 public static IPageList FindPage( Type t, String condition, PageHelper pager ) {
     foreach (IObjectPool pool in pools) {
         IPageList result = pool.FindPage( t, condition, pager );
         if (result != null) return result;
     }
     return null;
 }
Пример #20
0
 private void GeneralNewsReleate(int i, DataRow row)
 {
     ltrNewsReleate.Text += "<li class='col-xs-12 col-sm-6 col-md-4 ";
     if (i % 3 == 0)
     {
         ltrNewsReleate.Text += "first-in-line ";
     }
     if (i % 3 == 2)
     {
         ltrNewsReleate.Text += "last-in-line ";
     }
     if (i > 0)
     {
         ltrNewsReleate.Text += "last-line ";
     }
     if (i % 2 == 0)
     {
         ltrNewsReleate.Text += "first-item-of-tablet-line first-item-of-mobile-line";
     }
     else
     {
         ltrNewsReleate.Text += "last-item-of-tablet-line last-item-of-mobile-line";
     }
     ltrNewsReleate.Text += "'>\n";
     ltrNewsReleate.Text += "<a class='products-block-image' title='" + row["Name"].ToString() + "' href='" + PageHelper.GeneralDetailUrl(Consts.CON_TIN_TUC, groupName, row["Id"].ToString(), row["Name"].ToString()) + "'>\n";
     ltrNewsReleate.Text += "<img class='img-responsive' alt='" + row["Name"].ToString() + "' src='" + row["Image"].ToString() + "'></a>\n";
     ltrNewsReleate.Text += "<h5><a class='post-name product-name' title='" + row["Name"].ToString() + "' href='" + PageHelper.GeneralDetailUrl(Consts.CON_TIN_TUC, groupName, row["Id"].ToString(), row["Name"].ToString()) + "'>" + row["Name"].ToString() + "</a></h5>\n";
     ltrNewsReleate.Text += "<span class='info'>" + row["Date"].ToString() + "</span>\n</li>\n";
 }
Пример #21
0
        public IPageList FindPage( Type t, String condition, PageHelper pager )
        {
            String key = CacheKey.getPageList( t, condition, pager.getSize(), pager.getCurrent() );
            logger.Debug( "FindPage=>" + t.FullName );
            IList list = getListFromCache( key, t );
            if (list == null) return null;

            IPageList result = new DataPageInfo();

            PageHelper pageInfo = getPagerInfo( key );
            if (pageInfo == null) return null;

            result.Results = list;
            result.PageCount = pageInfo.PageCount;
            result.RecordCount = pageInfo.RecordCount;
            result.Size = pageInfo.getSize();
            result.PageBar = pageInfo.PageBar;
            result.Current = pageInfo.getCurrent();

            return result;
        }
 /// <summary>
 /// 行业数据显示(首次加载)
 /// </summary>
 /// <returns></returns>
 public ActionResult BranchMain()
 {
     PageHelper<BranchInfoContract> branchList = new PageHelper<BranchInfoContract>(bs.GetBranchByPager("proc_GetBranchPager", pageIndex, pageSize, ""), pageIndex, pageSize, bs.GetAllBranchCount(""));
     ViewData["list_PageAuthority"] = GetPageAuthority("BranchMain");
     return View(branchList);
 }
Пример #23
0
 /// <summary>
 /// Deletes the report period.
 /// </summary>
 public void DeleteTheReportPeriod()
 {
     DeleteButton.Click();
     PageHelper.WaitForElement(Driver, ConfirmDeleteButton).Click();
 }
        public ActionResult BranchMain(FormCollection fc)
        {
            ViewData["list_PageAuthority"] = GetPageAuthority("BranchMain");
            //处理输入数据时候的异常
            if (!int.TryParse(fc["CurPage"], out pageIndex))
            {
                //throw new Exception("输入的页码有误!");
                pageIndex = 1;
            }
            else if (int.Parse(fc["CurPage"]) < 0)
            {
                pageIndex = 1;
            }
            else
            {
                int nowPageIndex = int.Parse(fc["curPage"]);
                if (fc["keyWords"] == "")
                {
                    if (nowPageIndex != 0)
                    {
                        pageIndex = nowPageIndex;
                    }
                    else
                    {
                        pageIndex = 1;
                    }
                }
                else if (fc["keyWords"] != "" && nowPageIndex == 0)
                {
                    pageIndex = 1;
                }
            }
            ViewData["BranchName"] = fc["keyWords"];
            PageHelper<BranchInfoContract> branchList =
                new PageHelper<BranchInfoContract>(bs.GetBranchByPager("proc_GetBranchPager",
                    pageIndex, pageSize, fc["keyWords"].Trim()), pageIndex, pageSize,
                    bs.GetAllBranchCount(fc["keyWords"].Trim()));

            return View(branchList);
        }
Пример #25
0
 public void CheckCookies()
 {
     PageHelper.VerifyPageUrl(WebDriver.Url, CookieUrl);
     Assert.AreEqual(Constants.CookieHeader, CheckPageTitle.Text);
 }
Пример #26
0
        private void SetItemsSource()
        {
            var startIndex = PageHelper.GetVisibleIndexFromPageIndex(this.currentPageIndex, this.parent.ViewType);

            this.itemsControl.ItemsSource = this.imageProvider.FetchRange(startIndex, this.parent.GetPagesPerRow()).FirstOrDefault();
        }
Пример #27
0
 /// <summary>
 /// 生成分页SQL语句
 /// </summary>
 /// <param name="pageIndex"></param>
 /// <param name="pageSize"></param>
 /// <param name="selectSql"></param>
 /// <param name="sqlCount"></param>
 /// <param name="orderBy"></param>
 /// <returns></returns>
 public string GetPagingSql(int pageIndex, int pageSize, string selectSql, string sqlCount, string orderBy)
 {
     return(PageHelper.GetPagingSql(pageIndex, pageSize, selectSql, sqlCount, orderBy));
 }
Пример #28
0
        /// <summary>
        /// Adds a generic media element.
        /// </summary>
        private Media AddMedia(MediaType type, string source, string preview = null, string date = null, string description = null, Guid?explicitId = null, string mimeType = null)
        {
            string GetDefaultMimeType()
            {
                if (type == MediaType.Photo)
                {
                    return("image/jpeg");
                }

                if (type == MediaType.Document)
                {
                    return("application/pdf");
                }

                if (type == MediaType.Video)
                {
                    return("video/mpeg");
                }

                throw new ArgumentException("Unknown MediaType!");
            }

            var id         = explicitId ?? Guid.NewGuid();
            var key        = PageHelper.GetMediaKey(id);
            var newName    = key + Path.GetExtension(source);
            var sourcePath = Path.Combine(_rootPath, "Media", source);
            var diskPath   = Path.Combine(Path.GetFullPath(Directory.GetCurrentDirectory()), "wwwroot", "media", newName);
            var webPath    = "~/media/" + newName;

            Directory.CreateDirectory(Path.GetDirectoryName(diskPath));

            // copy original file
            File.Copy(sourcePath, diskPath);

            // copy previews
            var paths = EnumHelper.GetEnumValues <MediaSize>()
                        .Where(x => x != MediaSize.Original)
                        .Select(x => MediaPresenterService.GetSizedMediaPath(diskPath, x));

            foreach (var path in paths)
            {
                File.Copy(Path.Combine(_rootPath, "Media", preview), path);
            }

            var media = new Media
            {
                Id          = id,
                Type        = type,
                Key         = key,
                FilePath    = webPath,
                Date        = date,
                Description = description,
                Tags        = new List <MediaTag>(),
                UploadDate  = DateTimeOffset.Now,
                IsProcessed = true,
                MimeType    = mimeType ?? GetDefaultMimeType()
            };

            _db.Media.Add(media);
            return(media);
        }
Пример #29
0
 public HttpResponseMessage GetAdmin([FromBody] BrokerModel brokerModel)
 {
     return(PageHelper.toJson(_brokerService.GetBrokerById(brokerModel.Id)));
 }
Пример #30
0
        /// <summary>
        /// Creates a new page.
        /// </summary>
        public Page AddPage(string title, bool?gender = null, string birth = null, string death = null, PageType type = PageType.Person, string descrSource = null, string factsSource = null)
        {
            var descrFile = Path.Combine(_rootPath, descrSource ?? "");
            var factsFile = Path.Combine(_rootPath, factsSource ?? "");

            var factsObj = JObject.Parse(
                File.Exists(factsFile)
                    ? File.ReadAllText(factsFile)
                    : factsSource ?? "{}"
                );

            if (factsObj["Main.Name"] == null)
            {
                if (type == PageType.Person)
                {
                    var titleParts = title.Split(' ');
                    var nameData   = new JObject {
                        ["Range"] = $"{birth}-{death}"
                    };
                    if (titleParts.Length > 0)
                    {
                        nameData["LastName"] = titleParts[0];
                    }
                    if (titleParts.Length > 1)
                    {
                        nameData["FirstName"] = titleParts[1];
                    }
                    if (titleParts.Length > 2)
                    {
                        nameData["MiddleName"] = titleParts[2];
                    }

                    factsObj["Main.Name"] = new JObject
                    {
                        ["Values"] = new JArray {
                            nameData
                        }
                    };
                }
                else
                {
                    factsObj["Main.Name"] = new JObject {
                        ["Value"] = title
                    };
                }
            }

            if (factsObj["Bio.Gender"] == null && gender != null)
            {
                factsObj["Bio.Gender"] = new JObject {
                    ["IsMale"] = gender.Value
                };
            }

            if (birth != null)
            {
                var birthData = factsObj["Birth.Date"] ?? (factsObj["Birth.Date"] = new JObject());
                birthData["Value"] = birth;
            }

            if (death != null)
            {
                var deathData = factsObj["Death.Date"] ?? (factsObj["Death.Date"] = new JObject());
                deathData["Value"] = death;
            }

            var key  = PageHelper.EncodeTitle(title);
            var page = new Page
            {
                Id             = Guid.NewGuid(),
                Title          = title,
                Key            = key,
                Type           = type,
                Description    = (File.Exists(descrFile) ? File.ReadAllText(descrFile) : descrSource) ?? title,
                Facts          = factsObj.ToString(Formatting.None),
                CreationDate   = DateTimeOffset.Now,
                LastUpdateDate = DateTimeOffset.Now
            };

            _db.Pages.Add(page);
            _db.PageAliases.Add(new PageAlias {
                Id = Guid.NewGuid(), Key = key.ToLowerInvariant(), Title = title, Page = page
            });

            return(page);
        }
Пример #31
0
        static LoadCompletedEventHandler LastEventHandler = null;//
        public void Execute(object parameter)
        {
            var oldSrc = Container.Source;

            Container.Source         = null;
            Container.LoadCompleted -= LastEventHandler;
            OpenFuncParam param = (OpenFuncParam)parameter;

            if (param == null)
            {
                _logHelper.LogError("parameter不是有效的OpenFuncParam类型");
                MessageWindow.ShowMsg(MessageType.Error, OperationDesc.OpenFunc, MsgConst.Msg_ViewAppLog);
                return;
            }
            if (string.IsNullOrEmpty(param.PageUri))
            {
                _logHelper.LogError("PageUri不能为空");
                MessageWindow.ShowMsg(MessageType.Error, OperationDesc.OpenFunc, MsgConst.Msg_ViewAppLog);
                return;
            }
            //需要在LoadCompleted事件中,才能获取到绑定到Frame的Page实例
            LastEventHandler = (o, e) =>
            {
                try
                {
                    var page = e.Content as BasePage;
                    if (page == null)
                    {
                        throw new Exception("未找到page,请检查uri是否正确或是否继承BasePage");
                    }
                    page.FuncCode = param.FuncCode;
                }
                catch (Exception ex)
                {
                    _logHelper.LogError("Container(Frame).LoadCompleted事件", ex);
                    throw new Exception("打开功能菜单错误", ex);
                }
            };
            Container.LoadCompleted += LastEventHandler;
            if (oldSrc != null && oldSrc.ToString() == param.PageUri.Trim('/'))
            {
                //相同uri,不会重新加载,需要实例化对象
                //“/Biz.PartyBuilding.YS.Client;component/Learn/PartyLearnPage.xaml”
                var strUri    = param.PageUri.Trim('/');
                var start     = strUri.LastIndexOf("/") + 1;
                var len       = strUri.LastIndexOf(".xaml") - start;
                var className = strUri.Substring(start, len);
                var assName   = strUri.Substring(0, strUri.IndexOf(';'));
                try
                {
                    var      ass  = AppDomain.CurrentDomain.GetAssemblies().Where(a => a.GetName().Name == assName).FirstOrDefault();
                    Type     type = ass.GetTypes().Where(t => t.Name == className).FirstOrDefault();
                    BasePage page = Activator.CreateInstance(type) as BasePage;
                    Container.Navigate(page);
                }
                catch (Exception ex)
                {
                    _logHelper.LogError("OpenFuncCmd.Execute——相同uri Page实例化失败,uri:" + param.PageUri, ex);
                    throw new Exception("打开功能菜单失败,实例化page失败,请检查uri是否正确");
                }
            }
            else
            {
                Container.Navigate(PageHelper.GetPageFullUri(param.PageUri));
            }
        }
        /// <summary>
        /// 登陆验证事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOk_Click(object sender, EventArgs e)
        {
            //帐号
            if (txtAccount.Text.Trim() == "")
            {
                PageHelper.ShowExceptionMessage("请输入用户名!");
                return;
            }

            //密码
            if (txtPwd.Text.Trim() == "")
            {
                PageHelper.ShowExceptionMessage("请输入密码!");
                return;
            }

            //验证码
            //if (txtCheckCode.Text.Trim() == "")
            //{
            //    PageHelper.ShowExceptionMessage("请输入验证码!");
            //    return;
            //}

            string CheckCode = "";

            //if (Session["CheckCode"] != null)
            //{
            //    CheckCode = Session["CheckCode"].ToString();
            //    Session.Remove("CheckCode");
            //}
            //else
            //{
            //    PageHelper.ShowExceptionMessage("验证码错误!");
            //    return;
            //}

            //if (CheckCode != "")
            //{
            //    if (CheckCode.ToLower() != txtCheckCode.Text.Trim().ToLower())
            //    {
            //        PageHelper.ShowExceptionMessage("验证码错误!");
            //        return;
            //    }
            //}
            //else
            //{
            //    PageHelper.ShowExceptionMessage("验证码错误!");
            //    return;
            //}


            try
            {
                string    dd = Security.EncryptQueryString("123@abcd");
                DataTable dt = new UserQuery().GetUserByAccount(txtAccount.Text.Trim());
                if (dt.Rows.Count > 0)
                {
                    UserEntity entity = new UserEntity(NDConvert.ToInt64(dt.Rows[0]["UserID"].ToString()));
                    if (entity.Status == 2) //锁定
                    {
                        PageHelper.ShowExceptionMessage("此用户已经被锁定,无法登陆,请与管理员联系!");
                        return;
                    }


                    if (Security.EncryptQueryString(txtPwd.Text.Trim()).ToLower() == entity.Password.ToLower())
                    {
                        switch (entity.UserType)
                        {
                        case (int)CommonEnum.UserType.Admin:
                            SessionState.UserType = CommonEnum.UserType.Admin;
                            SessionState.IsAdmin  = true;
                            break;

                        case (int)CommonEnum.UserType.InnerUser:
                            SessionState.UserType = CommonEnum.UserType.InnerUser;
                            SessionState.IsAdmin  = false;
                            break;

                        default:
                            SessionState.UserType = CommonEnum.UserType.InnerUser;
                            SessionState.IsAdmin  = false;
                            break;
                        }
                        SessionState.UserID   = entity.UserID;
                        SessionState.UserName = entity.UserName;
                        SessionState.Account  = entity.Account;
                        SessionState.OUID     = entity.OUID;
                        OUEntity OUEntity = new OUEntity(entity.OUID);
                        SessionState.OUType = OUEntity.OUType;
                        SessionState.OUName = OUEntity.OUName;
                        Response.Redirect("Platform/MainWeb/root.aspx");
                        return;
                    }
                }

                PageHelper.ShowExceptionMessage("帐号或密码错误!");
                txtAccount.Focus();
            }
            catch (Exception ex)
            {
                PageHelper.ShowExceptionMessage(ex);
            }
        }
Пример #33
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    string groupId            = string.Empty;
                    string level              = string.Empty;
                    int    count              = 0;
                    string strUrl             = string.Empty;
                    List <GroupProduct> listG = GroupProductService.GroupProduct_GetByTop("", "Active=1", "Level, Ord");
                    if (listG.Count > 0)
                    {
                        for (int i = 0; i < listG.Count; i++)
                        {
                            if (listG[i].Level.Length == 5)
                            {
                                List <GroupProduct> listSub = listG.Where(l => l.Level.Length == 10 && l.Level.Substring(0, 5) == listG[i].Level).ToList();
                                ltrmenu.Text += "<div class='layered_filter'>\n";
                                ltrmenu.Text += "<div class='layered_subtitle_heading'>\n";
                                count         = ProductService.Product_GetCount(listG[i].Level);
                                ltrmenu.Text += "<input type='checkbox' class='checkbox' name='layer_id_attribute_group_" + (i + 1).ToString() + "' id='layered_id_attribute_group_" + (i + 1).ToString() + "' value='" + listG[i].Id + "' />\n";
                                ltrmenu.Text += "<label for='layer_id_attribute_group_" + (i + 1).ToString() + "'>\n";

                                strUrl        = PageHelper.GeneralGroupUrl(Consts.CON_SAN_PHAM, listG[i].Id, listG[i].Name);
                                ltrmenu.Text += "<a href='" + strUrl + "'>";
                                ltrmenu.Text += "<strong>" + listG[i].Name + "</strong>\n";

                                count         = ProductService.Product_GetCount(listG[i].Level);
                                ltrmenu.Text += "<span>(" + count.ToString() + ")</span></a>\n</label></div>\n";
                                if (listSub.Count > 0)
                                {
                                    ltrmenu.Text += "<ul id='ul_layered_id_attribute_group_" + (i + 1).ToString() + "' class='col-lg-12 layered_filter_ul'>\n";
                                    for (int j = 0; j < listSub.Count; j++)
                                    {
                                        ltrmenu.Text += "<li class='nomargin hiddable col-lg-12'>\n";
                                        ltrmenu.Text += "<input type='checkbox' class='checkbox' name='layered_id_attribute_group_" + (j + 1).ToString() + "' id='layered_id_attribute_group_" + (j + 1).ToString() + "' value='" + listSub[j].Id + "' />\n";
                                        ltrmenu.Text += "<label for='layered_id_attribute_group_" + (j + 1).ToString() + "'>\n";

                                        strUrl        = PageHelper.GeneralGroupUrl(Consts.CON_SAN_PHAM, listSub[j].Id, listSub[j].Name);
                                        ltrmenu.Text += "<a href='" + strUrl + "'>";
                                        ltrmenu.Text += "<strong>" + listSub[j].Name + "</strong>\n";
                                        count         = ProductService.Product_GetCount(listSub[j].Level);
                                        ltrmenu.Text += "<span>(" + count.ToString() + ")</span></a>\n</label>\n</li>\n";
                                    }
                                    ltrmenu.Text += "</ul>\n";
                                }
                                ltrmenu.Text += "</div>\n";
                            }
                        }
                    }
                    DataTable dtSub = GroupNewsService.GroupNews_GetByTop("", "Active=1 And left(Level,5)='" + level + "' And len(Level) = 10", "Level, Ord");
                    if (dtSub.Rows.Count > 0)
                    {
                        for (int i = 0; i < dtSub.Rows.Count; i++)
                        {
                            ltrmenu.Text += "<h3><a href='/" + dtSub.Rows[i]["Id"] + "/" + StringClass.NameToTag(dtSub.Rows[i]["Name"].ToString()) + ".aspx' title='" + dtSub.Rows[i]["Name"] + "'>" + dtSub.Rows[i]["Name"] + "</a></h3>";
                            DataTable dt3 = NewsService.News_GetByTop("5", "Active=1 And GroupNewsId='" + dtSub.Rows[i]["Id"] + "'", "Date Desc");
                            if (dt3.Rows.Count > 0)
                            {
                                ltrmenu.Text += "<div class='content-menu'><ul>";
                                for (int j = 0; j < dt3.Rows.Count; j++)
                                {
                                    if ("1".Equals(dt3.Rows[j]["Index"].ToString()))
                                    {
                                        ltrmenu.Text += "<li><a href='/" + dtSub.Rows[i]["Id"] + "/" + StringClass.NameToTag(dtSub.Rows[i]["Name"].ToString()) + "/" + dt3.Rows[j]["Id"] + "/" + StringClass.NameToTag(dt3.Rows[j]["Name"].ToString()) + ".aspx' title='" + dt3.Rows[j]["Name"] + "'>" + dt3.Rows[j]["Name"] + "</a><img src='/Images/icon_hot.gif' style='margin-left:2px' /></li>";
                                    }
                                    else
                                    {
                                        ltrmenu.Text += "<li><a href='/" + dtSub.Rows[i]["Id"] + "/" + StringClass.NameToTag(dtSub.Rows[i]["Name"].ToString()) + "/" + dt3.Rows[j]["Id"] + "/" + StringClass.NameToTag(dt3.Rows[j]["Name"].ToString()) + ".aspx' title='" + dt3.Rows[j]["Name"] + "'>" + dt3.Rows[j]["Name"] + "</a></li>";
                                    }
                                }
                                ltrmenu.Text += "</ul></div>";
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MailSender.SendMail("", "", "Error System", ex.Message);
                }
            }
        }
 public void ManageCentres()
 {
     ClickElement(CentresLink);
     PageHelper.WaitForPageLoad(2);
     Assert.AreEqual(WebDriver.FindElement(PageTitle).Text, ManageCentresPageHeader);
 }
Пример #35
0
        private void LoadDropDownListPageLink()
        {
            ddlLink.Items.Clear();
            ddlLink.Items.Add(new ListItem("Trang chủ", "/"));
            DataTable dt = new DataTable();

            dt = GroupNewsService.GroupNews_GetByTop("", "Active=1", "Level, Ord");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["Index"].ToString() == "0")
                {
                    ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Level"].ToString()), PageHelper.GeneralGroupUrl(Consts.CON_TIN_TUC, dt.Rows[i]["Id"].ToString(), dt.Rows[i]["Name"].ToString())));
                }
                else
                {
                    ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Level"].ToString()), PageHelper.GeneralGroupUrl(Consts.CON_VAN_BAN, dt.Rows[i]["Id"].ToString(), dt.Rows[i]["Name"].ToString())));
                }
            }
            List <Data.GroupImages> listG = GroupImagesService.GroupImages_GetByTop("", "Active=1", "Level, Ord");

            if (listG.Count > 0)
            {
                for (int i = 0; i < listG.Count; i++)
                {
                    ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(listG[i].Name, listG[i].Level), "/thu-vien-anh/" + listG[i].Id + "/" + StringClass.NameToTag(listG[i].Name)));
                }
            }
            ddlLink.Items.Add(new ListItem("Liên hệ", "/lien-he"));
            ddlLink.Items.Add(new ListItem("Videos", "/video-hoi"));
            ddlLink.DataBind();
        }
 public void ManageTlevels()
 {
     ClickElement(TlevelLink);
     PageHelper.VerifyPageUrl(WebDriver.Url, TlevelPageUrl);
 }
Пример #37
0
        /// <summary>
        /// 获取
        /// </summary>
        /// <returns></returns>
        public JQResult <UC_User_Ext> Get(JQParas Paras)
        {
            //默认初始化
            JQResult <UC_User_Ext> result = new JQResult <UC_User_Ext>();

            result.page = Paras.page;
            Dictionary <string, object> DbParas = new Dictionary <string, object>();

            string SQL_base = "SELECT Id,UserName,LoginName,IsValid,Status,Mobile,Email,CreateUser,DATE_FORMAT(CreateTime,'%Y-%c-%d %h:%i:%s') AS CreateTimeStr FROM UC_User WHERE 1=1 AND IsValid=0 ";

            #region 搜索(注意字符串类型注入)

            StringBuilder serchstr = new StringBuilder();
            UC_User_Ext   _csearch;
            if (!string.IsNullOrWhiteSpace(Paras.cSearch))
            {
                _csearch = JsonConvert.DeserializeObject <UC_User_Ext>(Paras.cSearch);
            }
            else
            {
                _csearch = new UC_User_Ext();
            }


            if (!string.IsNullOrWhiteSpace(_csearch.UserName))
            {
                if (serchstr.Length > 0)
                {
                    serchstr.Append(" AND ");
                }
                DbParas.Add("@UserName", "%" + _csearch.UserName + "%");
                serchstr.Append("AND UserName LIKE @UserName");
            }
            if (!string.IsNullOrWhiteSpace(_csearch.LoginName))
            {
                if (serchstr.Length > 0)
                {
                    serchstr.Append(" AND ");
                }
                DbParas.Add("@LoginName", "%" + _csearch.LoginName + "%");
                serchstr.Append(" AND LoginName LIKE @LoginName");
            }
            if (!string.IsNullOrWhiteSpace(_csearch.Mobile))
            {
                if (serchstr.Length > 0)
                {
                    serchstr.Append(" AND ");
                }
                DbParas.Add("@Mobile", "%" + _csearch.Mobile + "%");
                serchstr.Append(" AND Mobile LIKE @Mobile");
            }
            if (!string.IsNullOrWhiteSpace(_csearch.Email))
            {
                if (serchstr.Length > 0)
                {
                    serchstr.Append(" AND ");
                }
                DbParas.Add("@Email", "%" + _csearch.Email + "%");
                serchstr.Append(" AND Email LIKE @Email");
            }
            if (_csearch.Status != null)
            {
                if (serchstr.Length > 0)
                {
                    serchstr.Append(" AND ");
                }
                DbParas.Add("@Status", _csearch.Status);
                serchstr.Append(" AND Status LIKE @Status");
            }

            if (serchstr.Length > 0)
            {
                SQL_base += serchstr.ToString();
            }
            #endregion

            #region 排序

            string SortUnion = "ORDER BY ";
            //默认排序方式
            SortUnion += string.IsNullOrWhiteSpace(Paras.sidx) ? "__TMP__ID" : Paras.sidx;
            SortUnion += " " + (string.IsNullOrWhiteSpace(Paras.sord) ? "DESC" : Paras.sord);
            #endregion

            PageHelperParas php = new PageHelperParas()
            {
                types     = 1,
                rows      = Paras.rows,
                page      = Paras.page,
                SortUnion = SortUnion
            };

            if (Paras.export)    //导出
            {
                php.dataSql          = string.Format("SELECT {0} FROM ({1}) B", "*", SQL_base);
                php.exportColumnName = new List <string> {
                    "序号", "名称"
                };
                php.exportIgnoreColumnName = new List <string>()
                {
                    "__TMP__ID", "FormTypeID", "OUID", "ParentID", "Gradecode", "parent", "leaf", "expanded", "loaded", "level"
                };

                php.export         = Paras.export;
                php.exportAll      = (Paras.exportType == 0);
                php.exportFileName = Paras.exportFileName;
                php.start_page     = Paras.exportStartPage;
                php.end_page       = Paras.exportEndPage;
            }
            else    //分页查询
            {
                php.dataSql  = string.Format("SELECT {0} FROM ({1}) B", "*", SQL_base);
                php.countSql = string.Format("SELECT {0} FROM ({1}) B", "count(1)", SQL_base);
            }

            PageHelper.Query <UC_User_Ext>(php, ref result, DbParas);

            return(result);
        }
 public void CheckServiceBannerLink()
 {
     ClickElement(DashboardHeadLink);
     PageHelper.VerifyPageUrl(WebDriver.Url, DashboardUrl);
 }
Пример #39
0
 public static void AddPage( Type t, String condition, PageHelper pager, IList list ) {
     foreach (IObjectPool pool in pools) {
         pool.AddPage( t, condition, pager, list );
     }
 }
 public static void VerifyTLevelHeader()
 {
     PageHelper.VerifyPageUrl(WebDriver.Url, DashboardUrl);
     Assert.AreEqual(Constants.DashBoardHeader, WebDriver.FindElement(PageTitle).Text);
 }
Пример #41
0
        public void List()
        {
            String url = ctx.Get( "url" );
            url = strUtil.SqlClean( url, 100 );

            int dataId = ctx.GetInt( "dataId" );
            String dataType = ctx.Get( "dataType" );
            int pageSize = ctx.GetInt( "pageSize" );

            set( "createLink", to( Create ) );
            set( "thisUrl", url );
            set( "thisDataType", dataType );
            set( "thisDataId", dataId );
            set( "thisDataTitle", ctx.Get( "dataTitle" ) );
            set( "thisDataUserId", ctx.GetInt( "dataUserId" ) );
            set( "thisAppId", ctx.GetInt( "appId" ) );

            DataPage<OpenComment> datas = commentService.GetByDataDesc( dataType, dataId, pageSize );
            int replies = commentService.GetReplies( dataId, dataType, url );

            List<OpenComment> lists = datas.Results;

            set( "cmCount", replies );
            set( "moreLink", to( MoreReply ) );
            set( "subCacheSize", OpenComment.subCacheSize );

            Boolean canAdmin = checkAdminPermission( dataType, dataId );

            if (canAdmin) {
                set( "deleteAllHideClass", "" );
            }
            else {
                set( "deleteAllHideClass", "hide" );
            }

            set( "deleteAllLink", to( DeleteAll ) + "?dataId=" + dataId + "&dataType=" + dataType + "&url=" + url );

            bindComments( lists, canAdmin );
            bindForm();

            String pageBar = "";
            if (datas.PageCount > 1) {
                pageBar = new PageHelper( datas.RecordCount, datas.Size, datas.Current ).GetSimplePageBar();
            }
            set( "page", pageBar );
        }
Пример #42
0
        public HttpResponseMessage Detailed(int id)
        {
            var coupon = _otherCouponService.GetCouponById(id);

            return(PageHelper.toJson(coupon));
        }