Exemple #1
0
        public Dictionary <string, string> ToRouteDataDictionary()
        {
            var dict = new Dictionary <string, string> {
                { "page", PageNumber.ToString() }
            };

            if (SearchString != null)
            {
                dict.Add("searchString", SearchString);
            }

            if (SortBy != null)
            {
                dict.Add("sortBy", SortBy);
            }

            if (SortDirection != null)
            {
                dict.Add("sortDirection", SortDirection);
            }

            if (ItemsPerPage != null)
            {
                dict.Add("itemsPerPage", ItemsPerPage.Value.ToString());
            }

            return(dict);
        }
Exemple #2
0
        protected override Dictionary <string, string> ExtQueryParameters()
        {
            var ret = new Dictionary <string, string>()
            {
                ["DomainName"] = DomainName,
            };

            if (PageNumber > 0)
            {
                ret["RRKeyWord"] = PageNumber.ToString();
            }
            if (PageSize > 0 && PageSize < 500)
            {
                ret["PageSize"] = PageSize.ToString();
            }
            if (!string.IsNullOrWhiteSpace(RRKeyWord))
            {
                ret["RRKeyWord"] = RRKeyWord;
            }
            if (!string.IsNullOrWhiteSpace(TypeKeyWord))
            {
                ret["TypeKeyWord"] = TypeKeyWord;
            }
            if (!string.IsNullOrWhiteSpace(ValueKeyWord))
            {
                ret["ValueKeyWord"] = ValueKeyWord;
            }
            return(ret);
        }
Exemple #3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            LocalizePage();

            ClearPageAnswersButton.Attributes.Add("onClick",
                                                  "javascript:if(confirm('" + ((PageBase)Page).GetPageResource("ClearPageAnswersConfirmationMessage") + "')== false) return false;");

            PageLabel.Text = PageNumber.ToString();
        }
        private string SetBaseUrlQuery(string baseUrl)
        {
            var query = QueryHelpers.AddQueryString(baseUrl, "pageSize", PageSize.ToString());

            query = QueryHelpers.AddQueryString(query, "pageNumber", PageNumber.ToString());
            query = QueryHelpers.AddQueryString(query, "onlyEbooks", OnlyEbooks.ToString());
            query = QueryHelpers.AddQueryString(query, "onlyRealBooks", OnlyRealBooks.ToString());
            query = QueryHelpers.AddQueryString(query, "sortOrder", SortOrder);
            return(query);
        }
        public List <(string, string)> GetParameters()
        {
            var headers = new List <(string, string)>();

            headers.Add(("method", _method));
            headers.Add(("search_expression", SearchExpression));
            headers.Add(("page_number", PageNumber.ToString()));
            headers.Add(("max_results", MaxResults.ToString()));
            return(headers);
        }
 private void AddPageNumberAttribute()
 {
     btnFirst.Attributes.Add("pn", PageNumber.ToString(CultureInfo.InvariantCulture));
     btnBFirst.Attributes.Add("pn", PageNumber.ToString(CultureInfo.InvariantCulture));
     btnNext.Attributes.Add("pn", PageNumber.ToString(CultureInfo.InvariantCulture));
     btnBNext.Attributes.Add("pn", PageNumber.ToString(CultureInfo.InvariantCulture));
     btnPrevous.Attributes.Add("pn", PageNumber.ToString(CultureInfo.InvariantCulture));
     btnBPrevous.Attributes.Add("pn", PageNumber.ToString(CultureInfo.InvariantCulture));
     btnLast.Attributes.Add("pn", PageNumber.ToString(CultureInfo.InvariantCulture));
     btnBLast.Attributes.Add("pn", PageNumber.ToString(CultureInfo.InvariantCulture));
 }
        public void SetDetail()
        {
            string     timestamp = String.Format("{0:" + CultureInfo.DateTimeFormat.FullDateTimePattern + "}", CurrentTimestamp);
            ColumnText ct        = new ColumnText(Canvas);
            Phrase     phrase    = new Phrase("page:" + PageNumber.ToString() + ", " + App.Settings.CurrentUser?.FullName ?? "Machine User" + ", " + timestamp);

            phrase.Font.Size  = 6;
            phrase.Font.Color = Color.GRAY;
            ct.SetSimpleColumn(phrase, 5, 2 + Margin.Bottom, (WidthPt - 20 - Margin.Left) - 20, 20 + Margin.Bottom, 15, Element.ALIGN_RIGHT);
            ct.Go();
        }
 public override string ToString()
 {
     return("PageNumber: " + PageNumber.ToString() + "\n" +
            "PageSize: " + PageSize.ToString() + "\n" +
            "TotalPages: " + TotalPages.ToString() + "\n" +
            "TotalRecords: " + TotalRecords.ToString() + "\n" +
            "NextPage: " + NextPage.ToString() + "\n" +
            "PreviousPage: " + PreviousPage.ToString() + "\n" +
            "Data: " + Data + "\n" +
            "Succeeded: " + Succeeded.ToString() + "\n" +
            "Errors: " + Errors.ToString() + "\n");
 }
Exemple #9
0
        public async Task <string> GetNews()
        {
            // ViewData["CurrentFilter"] = SearchString;
            //   List<Article> filternewsList = new List<Article>();
            //    NewsInfo newsList = new NewsInfo();
            string ServiceUrl = "https://newsapi.org/v2/everything?apiKey=61ade6b9828d455ba0f71a59800aa73a";


            if (PageNumber > 0)
            {
                ServiceUrl += "&page=" + PageNumber.ToString() + "&pageSize=" + PageSize.ToString();
            }

            if (From != null)
            {
                ServiceUrl += "&from=" + From;
            }

            if (To != null)
            {
                ServiceUrl += "&to=" + To;
            }

            if (Language != null)
            {
                ServiceUrl += "&language=" + Language;
            }

            if (Title != null)
            {
                ServiceUrl += "&q=" + Title;
            }

            using (var httpClient = new HttpClient())
            {
                using (var response = await httpClient.GetAsync(ServiceUrl))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    // newsList = JsonConvert.DeserializeObject<NewsInfo>(apiResponse);

//                    if (!String.IsNullOrEmpty(SearchString))
//                    {
//                        newsList.articles = newsList.articles
//                                           .Where(s => s.title.Contains(SearchString)
//                                          || s.author.Contains(SearchString)).ToList();
//                  }
                }
            }
            return(apiResponse);
        }
Exemple #10
0
        /// <summary>
        /// 创建一个ContentInfo类型的列表内容结果对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="s"></param>
        /// <param name="list">带总数的返回方法</param>
        /// <param name="t"></param>
        /// <returns></returns>
        public ActionResult Content <T>(bool isSuccess, List <T> list, ResultType type)
        {
            var totalPages = ((int)(TotalCount / (double)PageSize)) + ((TotalCount % PageSize == 0) ? 0 : 1);
            var result     = new ResultPageInfo <T>()
            {
                dataRows = list,
                page     = PageNumber.ToString(),
                rows     = totalPages.ToString(),
                total    = TotalCount.ToString()
            }.ToJsonString();

            //var result = "{\"dataRows\":" + list.ToJsonString() + ",\"page\":" + PageNumber + ",\"rows\":" + totalPages + ",\"total\":" + TotalCount + "}";
            return(Content(ContentInfo.Get(isSuccess, result, type)));
        }
        public void BuildSorting()
        {
            HttpContext context = HttpContext.Current;

            if (context != null)
            {
                HttpRequest request = context.Request;

                this.SortingBy = this.TheGrid.DefaultSort;

                if (!IsPostBack)
                {
                    bHeadClicked     = false;
                    hdnPageNbr.Value = "1";
                    SetSort();
                }
                else
                {
                    if (request.Form["__EVENTARGUMENT"] != null)
                    {
                        string arg = request.Form["__EVENTARGUMENT"].ToString();
                        string tgt = request.Form["__EVENTTARGET"].ToString();

                        if (tgt.Contains("$lnkHead") && tgt.Contains("$" + this.TheGrid.ID + "$"))
                        {
                            bHeadClicked = true;
                        }

                        if (tgt.Contains("$" + sBtnName) && tgt.Contains("$" + this.ThePager.ID + "$"))
                        {
                            string[] parms = tgt.Split('$');
                            int      pg    = int.Parse(parms[parms.Length - 1].Replace(sBtnName, ""));
                            PageNumber       = pg;
                            hdnPageNbr.Value = PageNumber.ToString();
                            bHeadClicked     = false;
                        }
                    }
                }
            }

            if (PageNumber <= 1 && !String.IsNullOrEmpty(hdnPageNbr.Value))
            {
                PageNumber = int.Parse(hdnPageNbr.Value);
            }

            if (IsPostBack)
            {
                SetSort();
            }
        }
Exemple #12
0
        //TODO: Write tests for this
        public string GetPageNumberInfo(string dataName)
        {
            switch (dataName)
            {
            case "PageNumber":
                return(PageNumber.ToString(CultureInfo.CurrentCulture));

            case "TotalPages":
                return(TotalPages == null ? "N/A" : TotalPages.Value.ToString(CultureInfo.CurrentCulture));

            default:
                return(null);
            }
        }
Exemple #13
0
        public MonthViewPrintPage(string month, IList <TotalSaleProduct> saleProducts, Size pageSize, int pageNr)
        {
            viewModel = new MonthStatisticViewModel();
            viewModel.TotalSaleProducts = new System.Collections.ObjectModel.ObservableCollection <TotalSaleProduct>(saleProducts);
            DataContext = this;

            InitializeComponent();

            this.pageNr       = pageNr + 1;
            this.Month        = month;
            this.saleProducts = saleProducts;
            this.RenderSize   = pageSize;

            PageNumberTextBlock.Text = PageNumber.ToString();
        }
        public List <(string, string)> GetParameters(bool isPremier)
        {
            var headers = new List <(string, string)>();

            headers.Add(("method", _method));
            headers.Add(("search_expression", SearchExpression));
            headers.Add(("page_number", PageNumber.ToString()));
            headers.Add(("max_results", MaxResults.ToString()));
            if (!isPremier)
            {
                return(headers);
            }

            headers.Add(("generic_description", GenericDescription.ToString()));
            return(headers);
        }
        /// <summary>
        /// 次の手順が実行可能かどうかの判定を行います。
        /// </summary>
        /// <returns></returns>
        private bool CanNextOperationExecute()
        {
            bool isExistsOperationManualInformation = false;

            // 最低限キャプチャと手順が入力されていなければ次の手順を入力できない
            String saveFileName = Define.CAPTURES_FILE_PREFIX + PageNumber.ToString() + ".png";
            String saveFilePath = Path.Combine(Define.CAPTURES_FOLDER_PATH, saveFileName);

            if (File.Exists(saveFilePath) &&
                !String.IsNullOrEmpty(OperationText))
            {
                isExistsOperationManualInformation = true;
            }

            return(isExistsOperationManualInformation);
        }
        /// <summary>
        /// 手順作成終了のコマンドの実行を行います。
        /// ※コマンドの引数として受け取ったウィンドウに対してClose実行するパターン
        /// </summary>
        private void ExitOperationCreateExecute(object window)
        {
            // 現在のページの内容をXMLに保存する
            String saveFileName = Define.CAPTURES_FILE_PREFIX + PageNumber.ToString() + ".png";
            String saveFilePath = Path.Combine(Define.CAPTURES_FOLDER_PATH, saveFileName);

            var xmlSerializer = new XMLSerializer();

            xmlSerializer.SaveCurrentPageForXML(PageNumber, LargeTitle, MidiumTitle, SmallTitle, OperationText,
                                                Notes, saveFilePath);

            if (window != null)
            {
                // ウィンドウを閉じる
                Window manualCreationWindow = (Window)window;
                manualCreationWindow.Close();
            }
        }
Exemple #17
0
 internal override void InitRanges()
 {
     Ranges.AddRange(new List <SheetRange>()
     {
         new SheetRange(Sheet.Cells[1, 37, 1, 70])
         {
             Value = Inn ?? string.Empty
         },                                                                           //ИНН
         new SheetRange(Sheet.Cells[4, 37, 4, 61])
         {
             Value = Kpp ?? string.Empty
         },                                                                          //КПП
         new SheetRange(Sheet.Cells[4, 70, 4, 76])
         {
             Value = PageNumber.ToString("D3")
         },                                                                                 //Номер страницы
     });
 }
Exemple #18
0
        private TagBuilder A()
        {
            var routeValues = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "order", Column }, { "page", PageNumber.ToString() }
            };

            if (Column == OrderBy)
            {
                routeValues.Add("desc", (!IsDescending).ToString().ToLower());
            }

            var routeValueDictionary = new RouteValueDictionary(routeValues);

            var a = Generator.GenerateActionLink(ViewContext, string.Empty, Action, Controller, Protocol,
                                                 Host, Fragment, routeValueDictionary, null);

            return(a);
        }
        public virtual Dictionary <string, string> AsDictionary()
        {
            var result = new Dictionary <string, string>(16)
            {
                { PageSize.Key, PageSize.ToString() },
                { PageNumber.Key, PageNumber.ToString() },
                { Query.Key, Query.ToString() },
                { SelectedFacetValues.Key, SelectedFacetValues.ToString() },
                { ExcludedFacetValues.Key, ExcludedFacetValues.ToString() },
                { SelectedFacetValuesSearchOperator.Key, SelectedFacetValuesSearchOperator.ToString() },
                { ExcludedItemIds.Key, ExcludedItemIds.ToString() },
                { SelectedTemplateIds.Key, SelectedTemplateIds.ToString() },
                { Path.Key, Path.ToString() },
                { Featured.Key, Featured.ToString() },
                { SortBy.Key, SortBy.ToString() }
            };

            return(result);
        }
        /// <summary>
        /// 次の手順のコマンドの実行を行います。
        /// </summary>
        private void NextOperationExecute()
        {
            // 現在のページの内容をXMLに保存する
            String saveFileName = Define.CAPTURES_FILE_PREFIX + PageNumber.ToString() + ".png";
            String saveFilePath = Path.Combine(Define.CAPTURES_FOLDER_PATH, saveFileName);

            var xmlSerializer = new XMLSerializer();

            xmlSerializer.SaveCurrentPageForXML(PageNumber, LargeTitle, MidiumTitle, SmallTitle, OperationText,
                                                Notes, saveFilePath);

            // 画面上の表示をクリア・更新する
            LargeTitle    = String.Empty;
            MidiumTitle   = String.Empty;
            SmallTitle    = String.Empty;
            OperationText = String.Empty;
            Notes         = String.Empty;

            // ページ番号を更新
            PageNumber++;
        }
Exemple #21
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            InitPageOptions();
            LocalizePage();

            PageLabel.Text = PageNumber.ToString();
            PageBranchingRules.PageNumber = PageNumber;
            PageBranchingRules.SurveyId   = SurveyId;
            PageBranchingRules.BindData();

            if (PreviousQuestionDisplayOrder == 0)
            {
                // No more question before page break
                UpImageButton.Visible       = false;
                InsertHyperLink.NavigateUrl =
                    String.Format(UINavigator.InsertQuestionLink + "?SurveyID={0}&DisplayOrder={1}&Page={2}&MenuIndex={3}",
                                  SurveyId, PageNumber, PreviousQuestionDisplayOrder, ((PageBase)Page).MenuIndex);
                EnableSubmitHyperlink.Enabled = false;
            }
            else
            {
                InsertHyperLink.NavigateUrl =
                    String.Format("{0}?SurveyID={1}&DisplayOrder={2}&Page={3}&MenuIndex={4}",
                                  UINavigator.InsertQuestionLink, SurveyId, _previousQuestionDisplayOrder, PageNumber, ((PageBase)Page).MenuIndex);
            }

            if (PageNumber < TotalPagesNumber)
            {
                BranchingHyperLink.NavigateUrl = string.Format("{0}?SurveyID={1}&Page={2}&MenuIndex={3}",
                                                               UINavigator.EditPageBranching, SurveyId, PageNumber, ((PageBase)Page).MenuIndex);
            }
            else
            {
                EnableSubmitHyperlink.Enabled = false;
                DownImageButton.Visible       = false;
                BranchingHyperLink.Enabled    = false;
            }
            DeleteButton.Attributes.Add("onClick",
                                        "javascript:if(confirm('" + ((PageBase)Page).GetPageResource("DeleteQuestionPageConfirmationMessage") + "')== false) return false;");
        }
Exemple #22
0
        /// <inheritdoc />
        /// <exception cref="FormatException">Thrown when <paramref name="format"/> is not supported.</exception>
        public string ToString(string format, IFormatProvider formatProvider)
        {
            if (string.IsNullOrWhiteSpace(format))
            {
                format = "G";
            }

            if (ReferenceEquals(formatProvider, null))
            {
                formatProvider = CultureInfo.CurrentCulture;
            }

            switch (format.Trim().ToUpperInvariant())
            {
            case "G":
                return($"ISBN 13: {Isbn} {Author} {Name} {PublishingHouse} " +
                       $"{PublicationYear.ToString(formatProvider)} " +
                       $"{PageNumber.ToString(formatProvider)} " +
                       $"{string.Format(formatProvider, "{0:C0}", Price)}");

            case "AN":
                return($"{Author} {Name}");

            case "ANH":
                return($"{Author} {Name} {PublishingHouse}");

            case "IANHYP":
                return($"ISBN 13: {Isbn} {Author} {Name} {PublishingHouse} " +
                       $"{PublicationYear.ToString(formatProvider)} " +
                       $"{PageNumber.ToString(formatProvider)}");

            case "ANHY":
                return($"{Author} {Name} {PublishingHouse} " +
                       $"{PublicationYear.ToString(formatProvider)}");

            default:
                throw new FormatException($"The {format} format string is not supported.");
            }
        }
Exemple #23
0
 public Book(string _title, string _author, int _pageNumber, string _isbn13)
 {
     if (_title.Length < 2)
     {
         throw new ArgumentOutOfRangeException(Title, "The title should be minimum 2 characters long");
     }
     if (_author.Length == 0)
     {
         throw new ArgumentNullException(Author, "The book should have an author");
     }
     if (_pageNumber < 10 || _pageNumber > 1000)
     {
         throw new ArgumentOutOfRangeException(paramName: PageNumber.ToString(), "The number of pages should be between 10 and 1000");
     }
     if (_isbn13.Length != 13)
     {
         throw new ArgumentOutOfRangeException(Isbn13, "The Isbn should have exactly 13 characters");
     }
     Title      = _title;
     Author     = _author;
     PageNumber = _pageNumber;
     Isbn13     = _isbn13;
 }
Exemple #24
0
        private void SetPagingCssClasses()
        {
            HyperLink hl = null;
            var       pn = PageNumber.ToString();
            Control   hlContainer;
            var       found = false;

            foreach (Control c in ulPager.Controls)
            {
                var t = c.GetType();

                hlContainer = c as HtmlGenericControl;

                if (hlContainer != null)
                {
                    foreach (var c2 in hlContainer.Controls)
                    {
                        hl = c2 as HyperLink;

                        if (hl != null && hl.Visible)
                        {
                            if (String.Compare(hl.Text, pn, false) == 0)
                            {
                                hl.CssClass = "active";
                                found       = true;
                                break;
                            }
                        }
                    }

                    if (found)
                    {
                        break;
                    }
                }
            }
        }
Exemple #25
0
        /// <summary>
        /// Chiama il metodo Search_Movie.ConsumeWebService() e
        /// associa alle PictureBox e alle Label i risultati trovati
        /// </summary>
        private async void button_search_Click(object sender, EventArgs e)
        {
            #region
            PictureBox[] pic =
            {
                pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8, pictureBox9, pictureBox10
            };

            Label[] lab =
            {
                label_film1, label_film2, label_film3, label_film4, label_film5, label_film6, label_film7, label_film8, label_film9, label_film10
            };
            #endregion

            // se una ricerca produce meno di 10 risultati, nelle picturebox e nelle label che avanzano,
            // rimangono ancora i dati della ricerca precedente, modifico quindi quei valori
            for (int k = 0; k < 10; k++)
            {
                pic[k].Visible       = false;
                lab[k].Visible       = false;
                pic[k].ImageLocation = null;
                lab[k].Text          = "";
            }

            // se sto cercando il film imposto i valori inziali, se invece
            // sto cambiando pagina tengo conto di quelli precedenti
            if (FilmName != textBox_search.TextInput)
            {
                PageNumber = 1;
                FilmName   = textBox_search.TextInput;
            }

            Year = 0;
            Type = comboBox_search_type.Text;

            if (textBox_search_year.Text != "")
            {
                Year = Convert.ToInt32(textBox_search_year.Text);
            }

            // controllo che il nome del film non inizi con un carattere speciale
            Regex reg = new Regex("^[a-zA-Z0-9]");

            bool checkName = reg.IsMatch(textBox_search.TextInput);

            if (textBox_search.TextInput != "" && checkName)
            {
                list_film = await SearchList(FilmName, PageNumber, Type, Year);

                if (Response)
                {
                    for (int j = 0; j < list_film.Count(); j++)
                    {
                        pic[j].Visible = true;
                        lab[j].Visible = true;
                    }

                    int i = 0;
                    foreach (Search film in list_film)
                    {
                        pic[i].ImageLocation = film.Poster;
                        lab[i].Text          = film.Title;
                        i++;
                    }

                    label_pageNumber.Text    = PageNumber.ToString();
                    label_pageNumber.Visible = true;
                }
                else
                {
                    label_pageNumber.Visible = false;
                    MessageBox.Show("Movie not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    textBox_search.TextInput  = "";
                    comboBox_search_type.Text = null;
                    textBox_search_year.Text  = "";
                }
            }
            else
            {
                MessageBox.Show("Name of the movie not valid", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox_search.TextInput = "";
            }
        }
Exemple #26
0
        public virtual string SuggestFileName()
        {
            const string numberFormatString = "000";
            var          parentSeries       = ParentChapter.ParentSeries;
            var          output             = string.Format("{0} P{1}", ParentChapter.Title, PageNumber.ToString(numberFormatString));

            return(output);
        }
 public void SaveInto(IDictionary <string, string> destination)
 {
     destination["pagenum"] = PageNumber.ToString();
     destination["query"]   = SearchQuery;
 }
        public virtual IEnumerable <KeyValuePair <string, string> > GetQueryKeyValues()
        {
            yield return(new KeyValuePair <string, string>("page", PageNumber.ToString()));

            yield return(new KeyValuePair <string, string>("page_size", PageSize.ToString()));
        }
Exemple #29
0
 protected new string GetThreadPager(BasicThread thread, string style, string urlStyle)
 {
     if (ThreadCatalogID == -1)
     {
         if (IsNormalThreads)
         {
             if (IsDefaultList)
             {
                 return(GetThreadPager(thread, style, urlStyle, null, false, null, PageNumber));
                 //return GetThreadLink(thread,subjectLength,1,false,(PageIndex+1));
             }
             else
             {
                 return(GetThreadPager(thread, style, urlStyle, string.Concat("Action=", Action, "&page=", PageNumber.ToString()), true, null, PageNumber));
             }
         }
         else
         {
             if (StringUtil.EqualsIgnoreCase(Action, "recycled"))
             {
                 return(GetThreadPager(thread, style, urlStyle, "recyclebin", false, null, PageNumber));
             }
             else if (StringUtil.EqualsIgnoreCase(Action, "unapproved"))
             {
                 return(GetThreadPager(thread, style, urlStyle, "unapprovethreads", false, null, PageNumber));
             }
             else
             {
                 return(GetThreadPager(thread, style, urlStyle, "unapproveposts", false, null, PageNumber));
             }
         }
     }
     else
     {
         return(GetThreadPager(thread, style, urlStyle, string.Concat("ThreadCatalogID=", ThreadCatalogID.ToString(), "&page=", PageNumber.ToString()), true, null, PageNumber));
     }
 }
Exemple #30
0
 public void SaveInto(IDictionary <string, string> destination)
 {
     destination[nameof(PageNumber)] = PageNumber.ToString();
     destination[nameof(PageCount)]  = PageCount.ToString();
 }