Exemplo n.º 1
0
        private void initializeTabStrip(RadTabStrip rts, RadMultiPage rmp)
        {
            string selected = Request.QueryString["selected"];

            if (!String.IsNullOrEmpty(selected))
            {
                try {
                    //Convert it to an integer
                    var selectedIndex = Convert.ToInt32(selected);
                    //Check to see if it is in an appropriate range for the page
                    if (selectedIndex >= 0 && selectedIndex <= rts.Tabs.Count() - 1)
                    {
                        rts.SelectedIndex = selectedIndex;
                        rmp.SelectedIndex = selectedIndex;
                    }
                    else
                    {
                        rts.SelectedIndex = 0; rmp.SelectedIndex = 0;
                    }
                }
                catch (Exception ex) { rts.SelectedIndex = 0; rmp.SelectedIndex = 0; }
            }
            else
            {
                rts.SelectedIndex = 0;
                rmp.SelectedIndex = 0;
            }
        }
Exemplo n.º 2
0
        protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
        {
            RadTabStrip  rtabstrip = RadTabStrip1;
            RadMultiPage rmultipg  = rtabstrip.MultiPage;

            if (e.Tab.Text == "Search Customer")
            {
                ViewState["tabselected"] = 1;
            }
            else
            {
                ViewState["tabselected"] = 0;
            }
        }
Exemplo n.º 3
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (survey != null && Settings != null && Settings.ContainsKey("SurveyAnswerRow") && Settings.ContainsKey("SurveyAnswersType") && Settings.ContainsKey("surveyDataClassDataContext"))
            {
                currentRowAnswer           = Settings["SurveyAnswerRow"] as hitbl_Survey_Answer_Row_SAR;
                CurrentAnswerType          = (SurveyAnswersType)Settings["SurveyAnswersType"];
                surveyDataClassDataContext = Settings["surveyDataClassDataContext"] as SurveyDataClassDataContext;
                surveyQuestionMultiPage    = Settings["SurveyQuestionMultiPage"] as RadMultiPage;

                FillEditForm();
            }
            else
            {
                throw new SiemeArgumentException("_4screen.CSB.DataObj.UserControls.Wizards.SurveySimpleQuestion", "OnInit", "SurveyAnswerRow", "SurveyAnswerRow was not send with the Settings Dictionary");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Hides the inaccessible tabs.
        /// </summary>
        /// <param name="tabs">The tabs.</param>
        /// <param name="multipage">The multipage.</param>
        public void HideInaccessibleTabs(ref RadTabStrip tabs, ref RadMultiPage multipage)
        {
            var dataManager = new DataManager();
            var user        = dataManager.User.SelectById(CurrentUser.Instance.ID);

            for (int i = 0; i < tabs.Tabs.Count; i++)
            {
                if (!string.IsNullOrEmpty(tabs.Tabs[i].Value))
                {
                    var access = Access.Check(user, tabs.Tabs[i].Value);
                    if (!access.Read)
                    {
                        tabs.Tabs[i].Visible           = false;
                        multipage.PageViews[i].Visible = false;
                    }
                }
            }
        }
Exemplo n.º 5
0
        internal static NsTabs UtworzTabs(TabsWidget panelWidget)
        {
            var panel = NsPanel.UtworzPanel(new Panel());

            var tabs = new NsTabs()
            {
                Widget = panelWidget
            };

            tabs.Panel       = panel;
            tabs.ID          = "RadTabStrip1";
            tabs.MultiPageID = "RadMultiPage1";

            var multi = new RadMultiPage();

            multi.ID         = "RadMultiPage1";
            tabs.NsMultiPage = multi;

            panel.Controls.Add(tabs);
            panel.Controls.Add(tabs.NsMultiPage);


            return(tabs);
        }
        /// <summary>
        /// Handles the ItemDataBound event of the DetailsView control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.RadListViewItemEventArgs"/> instance containing the event data.</param>
        private void DetailsView_ItemDataBound(object sender, RadListViewItemEventArgs e)
        {
            if (e.Item.ItemType != RadListViewItemType.DataItem && e.Item.ItemType != RadListViewItemType.AlternatingItem)
            {
                return;
            }

            RealEstateItem item = ((RadListViewDataItem)e.Item).DataItem as RealEstateItem;

            if (item == null)
            {
                return;
            }

            #region Contact Our Agent
            RadTabStrip  tabStrip           = (RadTabStrip)e.Item.FindControl("tabStrip");
            RadMultiPage multiPage          = (RadMultiPage)e.Item.FindControl("multiPage");
            RadTab       tabContactOurAgent = tabStrip.Tabs[5];

            if (tabContactOurAgent != null && !item.AgentId.Equals(Guid.Empty))
            {
                AgentItem agent = this.AgentsManager.GetAgent(item.AgentId);
                if (agent != null)
                {
                    tabContactOurAgent.NavigateUrl = AGENTS_PAGE + this.AgentsManager.GetItemUrl(agent);
                }
                else
                {
                    tabContactOurAgent.Visible     = false;
                    multiPage.PageViews[5].Visible = false;
                }
            }
            else
            {
                tabContactOurAgent.Visible     = false;
                multiPage.PageViews[5].Visible = false;
            }
            #endregion

            RadListView  rlvOverview       = (RadListView)e.Item.FindControl("rlvOverview");
            List <Photo> overviewTabPhotos = item.GetPhotos(MultiplePhotoType.OverviewTabPhoto);
            rlvOverview.DataSource = overviewTabPhotos;
            rlvOverview.DataBind();
            tabStrip.Tabs[0].Visible       = (overviewTabPhotos.Count > 0);
            multiPage.PageViews[0].Visible = tabStrip.Tabs[0].Visible;

            RadListView  rlvPhotos       = (RadListView)e.Item.FindControl("rlvPhotos");
            List <Photo> photosTabPhotos = item.GetPhotos(MultiplePhotoType.PhotosTabPhoto);
            rlvPhotos.DataSource = photosTabPhotos;
            rlvPhotos.DataBind();
            tabStrip.Tabs[1].Visible       = (photosTabPhotos.Count > 0);
            multiPage.PageViews[1].Visible = tabStrip.Tabs[1].Visible;

            RadListView  rlvPanaromicView       = (RadListView)e.Item.FindControl("rlvPanaromicView");
            List <Photo> panaromicViewTabPhotos = item.GetPhotos(MultiplePhotoType.PanaromicViewTabPhoto);
            rlvPanaromicView.DataSource = panaromicViewTabPhotos;
            rlvPanaromicView.DataBind();
            tabStrip.Tabs[2].Visible       = (panaromicViewTabPhotos.Count > 0);
            multiPage.PageViews[2].Visible = tabStrip.Tabs[2].Visible;

            RadListView  rlvFloorPlan       = (RadListView)e.Item.FindControl("rlvFloorPlan");
            List <Photo> floorPlanTabPhotos = item.GetPhotos(MultiplePhotoType.FloorPlanTabPhoto);
            rlvFloorPlan.DataSource = floorPlanTabPhotos;
            rlvFloorPlan.DataBind();
            tabStrip.Tabs[3].Visible       = (floorPlanTabPhotos.Count > 0);
            multiPage.PageViews[3].Visible = tabStrip.Tabs[3].Visible;

            if (item.Latitude <= 0 || item.Longitude <= 0)
            {
                tabStrip.Tabs[4].Visible       = false;
                multiPage.PageViews[4].Visible = false;
            }

            for (int i = 0; i < tabStrip.Tabs.Count; i++)
            {
                if (tabStrip.Tabs[i].Visible)
                {
                    tabStrip.SelectedIndex  = i;
                    multiPage.SelectedIndex = i;

                    this.Page.ClientScript.RegisterClientScriptBlock(
                        this.GetType(), "initialTabStripId",
                        string.Format("var initialTabStripId = '{0}';", multiPage.PageViews[i].ClientID), true);

                    break;
                }
            }

            Panel pnlPrice = (Panel)e.Item.FindControl("pnlPrice");
            pnlPrice.Controls.Clear();
            pnlPrice.Controls.Add(new Literal()
            {
                Text = item.Price.ToString("n2")
            });

            if (!item.Description.Value.IsNullOrEmpty())
            {
                PlaceHolder phDescription = (PlaceHolder)e.Item.FindControl("phDescription");
                phDescription.Visible = true;
            }

            #region Location
            FlatTaxon locationTaxon = item.GetTaxon <FlatTaxon>(TaxonType.Locations);
            if (locationTaxon != null)
            {
                Literal ltrLocation = (Literal)e.Item.FindControl("ltrLocation");

                ltrLocation.Text = locationTaxon.Title;
            }
            #endregion

            #region Item Type
            FlatTaxon itemTypeTaxon = item.GetTaxon <FlatTaxon>(TaxonType.Types);
            if (itemTypeTaxon != null)
            {
                PlaceHolder phItemType  = (PlaceHolder)e.Item.FindControl("phItemType");
                Literal     ltrItemType = (Literal)e.Item.FindControl("ltrItemType");

                ltrItemType.Text   = itemTypeTaxon.Title;
                phItemType.Visible = true;
            }
            #endregion

            #region Housing
            if (!item.Housing.IsNullOrEmpty())
            {
                PlaceHolder phHousing  = (PlaceHolder)e.Item.FindControl("phHousing");
                Literal     ltrHousing = (Literal)e.Item.FindControl("ltrHousing");
                ltrHousing.Text   = string.Format("{0} m<sup>2</sup>", item.Housing);
                phHousing.Visible = true;
            }
            #endregion

            #region Rooms
            if (!item.NumberOfRooms.IsNullOrEmpty())
            {
                PlaceHolder phRooms  = (PlaceHolder)e.Item.FindControl("phRooms");
                Literal     ltrRooms = (Literal)e.Item.FindControl("ltrRooms");
                ltrRooms.Text   = item.NumberOfRooms;
                phRooms.Visible = true;
            }
            #endregion

            #region Floors
            if (!item.NumberOfFloors.IsNullOrEmpty())
            {
                PlaceHolder phFloors  = (PlaceHolder)e.Item.FindControl("phFloors");
                Literal     ltrFloors = (Literal)e.Item.FindControl("ltrFloors");
                ltrFloors.Text   = item.NumberOfFloors;
                phFloors.Visible = true;
            }
            #endregion

            #region Built
            if (!item.YearBuilt.IsNullOrEmpty())
            {
                PlaceHolder phBuilt  = (PlaceHolder)e.Item.FindControl("phBuilt");
                Literal     ltrBuilt = (Literal)e.Item.FindControl("ltrBuilt");
                ltrBuilt.Text   = item.YearBuilt;
                phBuilt.Visible = true;
            }
            #endregion

            #region Payment
            if (item.Payment > 0)
            {
                PlaceHolder phPayment  = (PlaceHolder)e.Item.FindControl("phPayment");
                Literal     ltrPayment = (Literal)e.Item.FindControl("ltrPayment");
                ltrPayment.Text   = item.Payment.ToString("n2");
                phPayment.Visible = true;
            }
            #endregion

            #region MonthlyRate
            if (item.MonthlyRate > 0)
            {
                PlaceHolder phMonthlyRate  = (PlaceHolder)e.Item.FindControl("phMonthlyRate");
                Literal     ltrMonthlyRate = (Literal)e.Item.FindControl("ltrMonthlyRate");
                ltrMonthlyRate.Text   = item.MonthlyRate.ToString("n2");
                phMonthlyRate.Visible = true;
            }
            #endregion

            #region Net
            if (item.Net > 0)
            {
                PlaceHolder phNet  = (PlaceHolder)e.Item.FindControl("phNet");
                Literal     ltrNet = (Literal)e.Item.FindControl("ltrNet");
                ltrNet.Text   = item.Net.ToString("n2");
                phNet.Visible = true;
            }
            #endregion

            #region PriceSquareMeter
            if (item.PriceSquareMeter > 0)
            {
                PlaceHolder phPriceSquareMeter  = (PlaceHolder)e.Item.FindControl("phPriceSquareMeter");
                Literal     ltrPriceSquareMeter = (Literal)e.Item.FindControl("ltrPriceSquareMeter");
                ltrPriceSquareMeter.Text   = item.PriceSquareMeter.ToString("n2");
                phPriceSquareMeter.Visible = true;
            }
            #endregion

            RadListView FeaturesList = (RadListView)e.Item.FindControl("FeaturesList");
            FeaturesList.ItemDataBound += new EventHandler <RadListViewItemEventArgs>(FeaturesList_ItemDataBound);
            FeaturesList.DataSource     = item.GetTaxons <FlatTaxon>(TaxonType.Features);
            FeaturesList.DataBind();

            RadListView RoomsList = (RadListView)e.Item.FindControl("RoomsList");
            RoomsList.ItemDataBound += new EventHandler <RadListViewItemEventArgs>(RoomsList_ItemDataBound);
            RoomsList.DataSource     = item.GetTaxons <FlatTaxon>(TaxonType.Rooms);
            RoomsList.DataBind();

            #region Agent
            if (!item.AgentId.Equals(Guid.Empty))
            {
                AgentItem agent = this.AgentsManager.GetAgent(item.AgentId);

                if (agent != null)
                {
                    PlaceHolder phAgent = (PlaceHolder)e.Item.FindControl("phAgent");
                    phAgent.Visible = true;

                    Literal ltrAgentName = (Literal)e.Item.FindControl("ltrAgentName");
                    ltrAgentName.Text = agent.Title;


                    #region Address
                    if (!agent.Address.IsNullOrEmpty())
                    {
                        PlaceHolder phAgentAddress  = (PlaceHolder)e.Item.FindControl("phAgentAddress");
                        Literal     ltrAgentAddress = (Literal)e.Item.FindControl("ltrAgentAddress");
                        ltrAgentAddress.Text   = agent.Address;
                        phAgentAddress.Visible = true;
                    }
                    #endregion

                    #region PhoneNumber
                    if (!agent.PhoneNumber.IsNullOrEmpty())
                    {
                        PlaceHolder phAgentPhoneNumber  = (PlaceHolder)e.Item.FindControl("phAgentPhoneNumber");
                        Literal     ltrAgentPhoneNumber = (Literal)e.Item.FindControl("ltrAgentPhoneNumber");
                        ltrAgentPhoneNumber.Text   = agent.PhoneNumber;
                        phAgentPhoneNumber.Visible = true;
                    }
                    #endregion


                    #region Email
                    if (!agent.Email.IsNullOrEmpty())
                    {
                        PlaceHolder phAgentEmail = (PlaceHolder)e.Item.FindControl("phAgentEmail");
                        HyperLink   hlAgentEmail = (HyperLink)e.Item.FindControl("hlAgentEmail");
                        hlAgentEmail.Text        = agent.Email;
                        hlAgentEmail.NavigateUrl = tabContactOurAgent.NavigateUrl;
                        phAgentEmail.Visible     = true;
                    }
                    #endregion
                }
            }
            #endregion
        }