Exemple #1
0
    private void CapturePageRequestParameters()
    {
        string advertismentsMode = null;

        if (Page.RouteData.Values[SUBPURCHASE_MODE] != null)
        {
            advertismentsMode = Page.RouteData.Values[SUBPURCHASE_MODE].ToString();
        }
        switch (advertismentsMode)
        {
        case VKLUCHAYA_POSREDNIKOV:
            AdvertismentsMode             = AdvertismentsState.SubpurchaseWithNotSubpurchase;
            lnkWithSubpurchases.InnerText = Resources.Resource.WithSubpurchasesLinkText;
            lnkWithSubpurchases.HRef      = Page.GetRouteUrl(ROUTE_RENTCOMMERCIAL_SECTION, new System.Web.Routing.RouteValueDictionary()
            {
                { SUBPURCHASE_MODE, BEZ_POSREDNIKOV }
            });
            //AdvertismentsView.NotShowSubpurchaseCheckbox = true;
            break;

        case BEZ_POSREDNIKOV:
        default:
            AdvertismentsMode             = AdvertismentsState.NotSubpurchase;
            lnkWithSubpurchases.InnerText = Resources.Resource.WithoutSubpurchasesLinkText;
            lnkWithSubpurchases.HRef      = Page.GetRouteUrl(ROUTE_RENTCOMMERCIAL_SECTION, new System.Web.Routing.RouteValueDictionary()
            {
                { SUBPURCHASE_MODE, VKLUCHAYA_POSREDNIKOV }
            });
            //AdvertismentsView.NotShowSubpurchaseCheckbox = false;
            break;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //--- default
        AdvSectionID      = 1;
        AdvSubSectionID   = 1;
        AdvertismentsMode = AdvertismentsState.NotSubpurchase;
        //---

        string parameterDate = Request["date"];

        if (!DateTime.TryParse(parameterDate, out Date))
        {
            Date = DateTime.Now;
        }

        string advSection = null;

        if (Page.RouteData.Values["Section"] != null)
        {
            advSection = Page.RouteData.Values["Section"].ToString();
        }
        switch (advSection)
        {
        case "Sdam-kvartiru":
            AdvSectionName  = "Сдам квартиру";
            AdvSectionID    = 1;
            AdvSubSectionID = 1;
            break;

        case "Snimu-kvartiru":
            AdvSectionName  = "Сниму квартиру";
            AdvSectionID    = 1;
            AdvSubSectionID = 2;
            break;

        case "Prodam-kvartiru":
            AdvSectionName  = "Продам квартиру";
            AdvSectionID    = 3;
            AdvSubSectionID = 3;
            break;

        case "Kuplu-kvartiru":
            AdvSectionName  = "Куплю квартиру";
            AdvSectionID    = 3;
            AdvSubSectionID = 4;
            break;

        case "Obyavleniya-Doma-Dachi":
            AdvSectionName  = "Дома, дачи";
            AdvSectionID    = 6;
            AdvSubSectionID = null;
            break;

        case "Arenda-ofisov":
            AdvSectionName  = "Аренда офисов";
            AdvSectionID    = 4;
            AdvSubSectionID = null;
            break;

        case "Prodam-kommercheskuu-nedvijimost":
            AdvSectionName  = "Продажа коммерческой недвижимости";
            AdvSectionID    = 5;
            AdvSubSectionID = null;
            break;
        }

        AdvertismentsViewControl.Settings.SectionId    = AdvSectionID;
        AdvertismentsViewControl.Settings.SubSectionId = AdvSubSectionID;
        AdvertismentsViewControl.Settings.State        = AdvertismentsMode;
        AdvertismentsViewControl.Settings.Limit        = Constants.Max_Advertisments_View_Count;
        AdvertismentsViewControl.Settings.Date         = Date.ToShortDateString();
    }