public override string ToString(bool html)
        {
            string result    = "";
            string formatStr = @"{0}" + ";" +
                               @"{2}" + ";" +
                               @"{3}" + Environment.NewLine +
                               @"" + ";" +
                               @"{1}" + ";" +
                               @"" + ";" + Environment.NewLine;

            if (html)
            {
                formatStr = "<tr><td>" +
                            @"{0}" + "</td><td>" +
                            @"<a href =""{1}"">{2}</a>" + "</td><td>" +
                            @"{3}" + "</td></tr>";
            }

            result += String.Format(formatStr,
                                    HTMLParser.ClearHtml(Section, html),
                                    LotNameUrl, HTMLParser.ClearHtml(LotNameStr, html),
                                    HTMLParser.ClearHtml(Description, html)
                                    );
            return(result);
        }
Beispiel #2
0
        public override string ToString(bool html)
        {
            string result    = "";
            string formatStr = @"{1}" + ";" +
                               @"{2}" + ";" +
                               @"{4}" + ";" +
                               @"{5}" + ";" +
                               @"{6}" + ";" +
                               @"{7}" + ";" +
                               @"{8}" + ";" +
                               @"{9}" + ";" +
                               @"{10}" + ";" +
                               @"{11}" + Environment.NewLine +
                               // строка таблицы с ссылками
                               @"{0}" + ";" +
                               @"{0}" + ";" +
                               @"{3}" + ";" +
                               @"" + ";" +
                               @"" + ";" +
                               @"" + ";" +
                               @"" + ";" +
                               @"" + ";" +
                               @"" + ";" +
                               @"" + Environment.NewLine;

            if (html)
            {
                formatStr = "<tr><td>" +
                            @"<a href =""{0}"">{1}</a>" + "</td><td>" + // Номер + ссылка
                            @"<a href =""{0}"">{2}</a>" + "</td><td>" + // Наименование + ссылка
                            @"<a href =""{3}"">{4}</a>" + "</td><td>" + // Организатор + ссылка
                            @"{5}" + "</td><td>" +                      // Цена (если есть)
                            @"{6}" + "</td><td>" +                      // Статус
                            @"{7}" + "</td><td>" +                      // ДатаКонца
                            @"{8}" + "</td><td>" +                      // ДатаОбновления
                            @"{9}" + "</td><td>" +                      // ДатаПоста
                            @"{10}" + "</td><td>" +                     // ТипТорга
                            @"{11}" + "</td></tr>";                     // Секция
            }
            result += String.Format(formatStr,
                                    baseUrl + LotNameUrl.Replace("https://zakupki.gov.ru", ""), HTMLParser.ClearHtml(LotNumberStr, html),
                                    HTMLParser.ClearHtml(LotNameStr, html),
                                    baseUrl + OrganizerUrl.Replace("https://zakupki.gov.ru", ""), HTMLParser.ClearHtml(OrganizerStr, html),
                                    HTMLParser.ClearHtml(PriceStart, html),
                                    HTMLParser.ClearHtml(Status, html),
                                    DateFinishAccept,
                                    DateUpdate,
                                    DatePost,
                                    HTMLParser.ClearHtml(TorgType, html),
                                    HTMLParser.ClearHtml(Section, html)
                                    );


            return(result);
        }
        public override string ToString(bool html)
        {
            string result    = "";
            string formatStr = @"{1}" + ";" +
                               @"{3}" + ";" +
                               @"{5}" + ";" +
                               @"{7}" + ";" +
                               @"{8}" + ";" +
                               @"{10}" + ";" +
                               @"{11}" + ";" +
                               @"{12}" + ";" +
                               @"{13}" + ";" +
                               @"{15}" + ";" +
                               @"{16}" + Environment.NewLine +
                               // строка таблицы с ссылками
                               @"{0}" + ";" +
                               @"{2}" + ";" +
                               @"{4}" + ";" +
                               @"{6}" + ";" +
                               @"" + ";" +
                               @"{9}" + ";" +
                               @"" + ";" +
                               @"" + ";" +
                               @"" + ";" +
                               @"{14}" + ";" +
                               @"" + Environment.NewLine;

            if (html)
            {
                formatStr = "<tr><td>" +
                            @"<a href =""{0}"">{1}</a>" + "</td><td>" +
                            @"<a href =""{2}"">{3}</a>" + "</td><td>" +
                            @"<a href =""{4}"">{5}</a>" + "</td><td>" +
                            @"<a href =""{6}"">{7}</a>" + "</td><td>" +
                            @"{8}" + "</td><td>" +
                            @"<a href =""{9}"">{10}</a>" + "</td><td>" +
                            @"{11}" + "</td><td>" +
                            @"{12}" + "</td><td>" +
                            @"{13}" + "</td><td>" +
                            @"<a href =""{14}"">{15}</a>" + "</td><td>" +
                            @"{16}" + "</td></tr>";
            }

            result += String.Format(formatStr,
                                    baseUrl + TorgNumberUrl, HTMLParser.ClearHtml(TorgNumberStr, html),
                                    baseUrl + TorgNameUrl, HTMLParser.ClearHtml(TorgNameStr, html),
                                    baseUrl + LotNumberUrl, HTMLParser.ClearHtml(LotNumberStr, html),
                                    baseUrl + LotNameUrl, HTMLParser.ClearHtml(LotNameStr, html),
                                    HTMLParser.ClearHtml(PriceStart, html),
                                    baseUrl + OrganizerUrl, HTMLParser.ClearHtml(OrganizerStr, html),
                                    DateAcceptFinish,
                                    DateAuctionStart,
                                    HTMLParser.ClearHtml(Status, html),
                                    baseUrl + WinnerUrl, HTMLParser.ClearHtml(WinnerStr, html),
                                    HTMLParser.ClearHtml(TorgType, html)
                                    );

            /*
             * else
             *  result += String.Format(
             *      @"{1}" + ";" +
             *      @"{3}" + ";" +
             *      @"{5}" + ";" +
             *      @"{7}" + ";" +
             *      @"{8}" + ";" +
             *      @"{10}" + ";" +
             *      @"{11}" + ";" +
             *      @"{12}" + ";" +
             *      @"{13}" + ";" +
             *      @"{15}" + ";" +
             *      @"{16}" + Environment.NewLine +
             *      // строка таблицы с ссылками
             *      @"{0}" + ";" +
             *      @"{2}" + ";" +
             *      @"{4}" + ";" +
             *      @"{6}" + ";" +
             *      @"" + ";" +
             *      @"{9}" + ";" +
             *      @"" + ";" +
             *      @"" + ";" +
             *      @"" + ";" +
             *      @"{14}" + ";" +
             *      @"" + Environment.NewLine,
             *      baseUrl + TorgNumberUrl.Replace("\'", "").Replace("class", ""), TorgNumberStr,
             *      baseUrl + TorgNameUrl.Replace("\"", ""), TorgNameStr,
             *      baseUrl + LotNumberUrl.Replace("\"", "").Replace("\'", ""), LotNumberStr,
             *      baseUrl + LotNameUrl.Replace("\"", ""), LotNameStr,
             *      PriceStart,
             *      baseUrl + OrganizerUrl.Replace("\"", ""), OrganizerStr,
             *      DateAcceptFinish,
             *      DateAuctionStart,
             *      Status,
             *      baseUrl + WinnerUrl.Replace("\"", ""), WinnerStr,
             *      TorgType
             *      );
             */

            return(result);
        }
Beispiel #4
0
        public RTSTender(Tag inpTag, IRequest myReq) : base(myReq)
        {
            MyInitialize();
            string tmpStr = "";
            string sepStr = " | ";

            foreach (Tag item in inpTag.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-item__cell")))
            {
                if (item.IsProto & !item.IsComment)
                {
                    tmpStr += item.Value + sepStr;
                }
                else
                {
                    foreach (Tag inItem in item.LookForChildTag(null))
                    {
                        if (!inItem.IsComment)
                        {
                            tmpStr += inItem.Value + sepStr;
                        }
                    }
                }
                foreach (Tag inItem in item.LookForChildTag("span", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "link")))
                {
                    if (inItem.Attributes.ContainsKey("onclick"))
                    {
                        if (inItem.Attributes["onclick"] != "")
                        {
                            NoteUrl = inItem.Attributes["onclick"].Replace("window.open(\"", "").Replace("\",\"_blank\")", "");
                        }
                    }
                }
            }
            NoteUrl = baseUrl + NoteUrl.Replace(baseUrl, "");

            tmpStr  = tmpStr.Remove(tmpStr.LastIndexOf(sepStr));
            NoteStr = tmpStr.Replace("\n", "").Replace("\t", "");
            while (NoteStr.Contains("  "))
            {
                NoteStr = NoteStr.Replace("  ", " ");
            }

            foreach (Tag item in inpTag.LookForChildTag("a", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "button-red")))
            {
                if (item.Attributes.ContainsKey("href"))
                {
                    if (item.Attributes["href"] != "")
                    {
                        LotNameUrl = item.Attributes["href"];
                    }
                }
            }
            LotNameUrl = baseUrl + LotNameUrl.Replace(baseUrl, "");

            foreach (Tag item in inpTag.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-item__about")))
            {
                foreach (Tag inItem in item.LookForChildTag("span", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "link")))
                {
                    if (inItem.Attributes.ContainsKey("onclick"))
                    {
                        if (inItem.Attributes["onclick"] != "")
                        {
                            LotNumberUrl = inItem.Attributes["onclick"].Replace("window.open(\"", "").Replace("\",\"_blank\")", "");
                        }
                    }
                    foreach (Tag inInItem in inItem.LookForChildTag(null))
                    {
                        if (!inInItem.IsComment)
                        {
                            LotNumberStr = inInItem.Value;
                        }
                    }
                }
            }
            LotNumberUrl = baseUrl + LotNumberUrl.Replace(baseUrl, "");

            foreach (Tag item in inpTag.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-item__title")))
            {
                foreach (Tag inItem in item.LookForChildTag(null))
                {
                    if (!inItem.IsComment)
                    {
                        LotNameStr += inItem.Value + " ";
                    }
                }
            }
            while (LotNameStr.Contains("  "))
            {
                LotNameStr = LotNameStr.Replace("  ", " ");
            }

            foreach (Tag item in inpTag.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-item__properties-name")))
            {
                string caseSw = "";
                foreach (Tag inItem in item.LookForChildTag(null))
                {
                    if (!inItem.IsComment)
                    {
                        caseSw += inItem.Value;
                    }
                }
                string value = "";
                foreach (Tag inItem in item.Parent.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-item__properties-desc")))
                {
                    foreach (Tag inInItem in inItem.LookForChildTag(null))
                    {
                        if (!inInItem.IsComment)
                        {
                            value += inInItem.Value;
                        }
                    }
                }

                while (value.Contains("  "))
                {
                    value = value.Replace("  ", " ");
                }

                switch (caseSw)
                {
                case "НАЧАЛЬНАЯ ЦЕНА":
                    PriceStart = value;
                    break;

                case "ОБЕСПЕЧЕНИЕ ЗАЯВКИ":
                    GarantAcc = value;
                    break;

                case "ОБЕСПЕЧЕНИЕ КОНТРАКТА":
                    GarantContract = value;
                    break;

                case "СТАТУС":
                    Status = value;
                    break;

                default:
                    break;
                }
            }

            foreach (Tag item in inpTag.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-item__info")))
            {
                foreach (Tag inItem in item.LookForChildTag("time"))
                {
                    if (inItem.Attributes.ContainsKey("itemprop"))
                    {
                        string value = "";
                        if (inItem.Attributes.ContainsKey("datetime"))
                        {
                            value = inItem.Attributes["datetime"];
                        }
                        else
                        {
                            foreach (Tag inInItem in inItem.LookForChildTag(null))
                            {
                                if (!inInItem.IsComment)
                                {
                                    value += inInItem.Value;
                                }
                            }
                        }
                        switch (inItem.Attributes["itemprop"])
                        {
                        case "availabilityStarts":
                            DateAcceptStart = value;
                            break;

                        case "availabilityEnds":
                            DateAcceptFinish = value;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }

            foreach (Tag item in inpTag.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-item__organization")))
            {
                string swValue = "";
                foreach (Tag inItem in item.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-item__organization-title")))
                {
                    foreach (Tag inInItem in inItem.LookForChildTag(null))
                    {
                        if (!inInItem.IsComment)
                        {
                            swValue += inInItem.Value;
                        }
                    }
                }

                string url = "";
                foreach (Tag inItem in item.LookForChildTag("a", true))
                {
                    if (inItem.Attributes.ContainsKey("href"))
                    {
                        url = inItem.Attributes["href"];
                    }
                }

                string value   = "";
                string adValue = "";
                foreach (Tag inItem in item.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-item__organization-main")))
                {
                    foreach (Tag inInItem in inItem.LookForChildTag("p"))
                    {
                        foreach (Tag inInInItem in inInItem.LookForChildTag(null))
                        {
                            if (!inInInItem.IsComment)
                            {
                                value += inInInItem.Value + " ";
                            }
                        }
                    }

                    foreach (Tag inInItem in inItem.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "content-address")))
                    {
                        foreach (Tag inInInItem in inInItem.LookForChildTag(null))
                        {
                            if (!inInInItem.IsComment)
                            {
                                adValue += inInInItem.Value + " ";
                            }
                        }
                    }
                }

                switch (swValue)
                {
                case "ОРГАНИЗАТОР":
                    OrganisatorStr = value;
                    OrganisatorUrl = url;
                    url            = "";
                    break;

                case "ЗАКАЗЧИК":
                    OrgAcceptStr = value;
                    RegionStr    = adValue.Replace("Адрес поставки:", "");
                    RegionUrl    = url;
                    url          = "";
                    break;

                default:
                    break;
                }
            }
            OrganisatorUrl = baseUrl + OrganisatorUrl.Replace(baseUrl, "");
            RegionUrl      = baseUrl + RegionUrl.Replace(baseUrl, "");

            foreach (Tag item in inpTag.LookForChildTag("div", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-content__row parent")))
            {
                foreach (Tag inItem in item.LookForChildTag("table", true, new System.Collections.Generic.KeyValuePair <string, string>("class", "card-table")))
                {
                    Content = inItem.GetValue();
                }
            }

            TableRowMeans = new string[]
            {
                LotNumberStr,
                LotNameStr,
                HTMLParser.ClearHtml(OrganisatorStr, true),
                HTMLParser.ClearHtml(OrgAcceptStr, true),
                HTMLParser.ClearHtml(RegionStr, true),
                HTMLParser.ClearHtml(PriceStart, true),
                DateAcceptStart,
                DateAcceptFinish,
                NoteStr,
                Content
            };

            TableRowUrls = new string[]
            {
                baseUrl + LotNumberUrl.Replace(baseUrl, ""),
                baseUrl + LotNameUrl.Replace(baseUrl, ""),
                baseUrl + OrganisatorUrl.Replace(baseUrl, ""),
                "",
                baseUrl + RegionUrl.Replace(baseUrl, ""),
                "",
                "",
                "",
                baseUrl + NoteUrl.Replace(baseUrl, ""),
                ""
            };
        }