protected void gvTemplates_RowDataBound(object sender, GridViewRowEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } if (e.Row.RowType == DataControlRowType.DataRow) { UserPropertyTemplate pt = (UserPropertyTemplate)e.Row.DataItem; bool fOwned = pt.Owner.CompareCurrentCultureIgnoreCase(User.Identity.Name) == 0; MultiView mvStatus = (MultiView)e.Row.FindControl("mvStatus"); if (fOwned) { mvStatus.SetActiveView((View)mvStatus.FindControl("vwOwned")); } else if (AddedTemplates.Contains(pt.ID)) { mvStatus.SetActiveView((View)mvStatus.FindControl("vwAdded")); } else { mvStatus.SetActiveView((View)mvStatus.FindControl("vwUnOwned")); } if (MatchingOwnedTemplate(pt) != null) { ((AjaxControlToolkit.ConfirmButtonExtender)e.Row.FindControl("confirmOverwrite")).Enabled = true; } } }
protected void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { MultiView mv = e.Item.FindControl("multiView") as MultiView; View view = null; string productSku = DataBinder.Eval(e.Item.DataItem, "ProductSku") as string; int categoryID = (int)DataBinder.Eval(e.Item.DataItem, "CategoryID"); if (!CanEdit) { if (productSku != string.Empty && productSku != null && productSku != "0") { view = mv.FindControl("hasSku") as View; mv.SetActiveView(view); } else if (categoryID != 0) { view = mv.FindControl("hasCategoryId") as View; mv.SetActiveView(view); } else { view = mv.FindControl("noSkuOrCategoryId") as View; mv.SetActiveView(view); } } else { view = mv.FindControl("canEdit") as View; mv.SetActiveView(view); } }
//********************************************** //* Name: LinkButton1_Click //* Description: Handles the logic for LinkButton1 being clicked //****VARIABLES**** //* mvLogging -local handle of the multiview on loggingform.ascx //* vLogForm -local handle for the view "LogForm" //********************************************* protected void LinkButton1_Click(object sender, System.EventArgs e) { MultiView mvLogging = (MultiView)this.Parent.FindControl("mvGiveAnAward"); View vLogForm = (View)mvLogging.FindControl("LogForm"); mvLogging.SetActiveView(vLogForm); }
protected void gvMilestoneProgress_RowDataBound(object sender, GridViewRowEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } if (e.Row.RowType == DataControlRowType.DataRow) { MilestoneItem mi = (MilestoneItem)e.Row.DataItem; MultiView mv = (MultiView)e.Row.FindControl("mvProgress"); if (mi.Type == MilestoneItem.MilestoneType.AchieveOnce) { mv.ActiveViewIndex = 1; HyperLink l = (HyperLink)e.Row.FindControl("lnkFlight"); l.NavigateUrl = String.Format(CultureInfo.InvariantCulture, "~/Public/ViewPublicFlight.aspx/{0}", mi.MatchingEventID); MultiView mvAchievedStatus = (MultiView)e.Row.FindControl("mvAchievement"); mvAchievedStatus.ActiveViewIndex = (mi.IsSatisfied) ? 0 : 1; } else { mv.ActiveViewIndex = 0; HtmlControl c = (HtmlControl)mv.FindControl("divPercent"); int cappedPercentage = (int)Math.Min(mi.Percentage, 100); c.Style["width"] = String.Format(CultureInfo.InvariantCulture, "{0}%", cappedPercentage); c.Style["background-color"] = (cappedPercentage < 100) ? "#CCCCCC" : "limegreen"; } Panel pnlNote = (Panel)e.Row.FindControl("pnlNote"); pnlNote.Visible = !String.IsNullOrEmpty(mi.Note); } }
private void DisplaySelectedExtension(string extensionType, DropDownList dropDown, MultiView multiView, View notConfiguredView, Dictionary <string, string> extensionSettings) { // Get the new active view name var newActiveViewName = Null.NullString; if (!string.IsNullOrEmpty(dropDown.SelectedValue)) { newActiveViewName = this.GetExtensionViewName(dropDown.SelectedValue, extensionType); } // Get the current active view var activeView = multiView.GetActiveView(); if (activeView != null && activeView.ID.Equals(newActiveViewName, StringComparison.OrdinalIgnoreCase)) { return; // If current and new active view are the same, just return } // Get the new active view View newActiveView = null; if (string.IsNullOrEmpty(newActiveViewName)) { // If <No Visualizer/DataSource> is selected, use the not configured view newActiveView = notConfiguredView; if (ReferenceEquals(newActiveView, null)) { newActiveView = multiView.Views[0]; } } else { // Otherwise, find the view with the new active view name newActiveView = (View)multiView.FindControl(newActiveViewName); } // Set that view as the active view multiView.SetActiveView(newActiveView); // Get the settings control in the new active view var settingsControl = this.GetSettingsControlFromView(newActiveView); // If we successfully got it, load its settings if (settingsControl != null) { settingsControl.LoadSettings(extensionSettings); } }
//********************************************** //* Name: btnSubmit_Click //* Description: Handles the logic if the submit button is clicked //****VARIABLES**** //* webTab -local handle of UltraWebTab on main page //* loggingTab -local handle for current logging tab //********************************************* protected void btnSubmit_Click(object sender, System.EventArgs e) { MultiView mvLogging = null; View loggingActiveView = new View(); mvLogging = (MultiView)this.Parent.FindControl("mvGiveAnAward"); string newPage = null; if (!SessionHelper.GetValue <bool>(Session["Record_Submitted"])) { try { // Insert record into database //sqlAYB_Insert.Insert(); var responseMessage = InsertRecognitionDetail(); //string seedValue = null; //SqlCommand command = null; //MultiView mvLogging = null; //View loggingActiveView = new View(); if (responseMessage.IsSuccessStatusCode) { // Send email to accounts payable if award is any award type other than $25.00 SendAccountsPayableEmail(); // seedValue = command.Parameters["@Award_ID"].Value.ToString(); var insertedRedemptionDetail = responseMessage.Content.ReadAsAsync <RecognitionInsertDto>().Result; if (insertedRedemptionDetail != null) { Session["seedValue"] = insertedRedemptionDetail.Award_Id.ToString(); } newPage = "success"; } else { //If there was a problem adding the record, go to fail page Session["errorMsg"] = responseMessage.ReasonPhrase; newPage = "fail"; } loggingActiveView = (View)mvLogging.FindControl(newPage); mvLogging.SetActiveView(loggingActiveView); } catch (Exception ex) { } } }
//********************************************** //* Name: btnReturn_Click //* Description: Returns to logging page //****VARIABLES**** //* webTab -local handle of UltraWebTab on main page //* loggingTab -local handle for current logging tab //* newPage -variable holding location to logging page //********************************************* protected void btnReturn_Click(object sender, System.EventArgs e) { MultiView mvLogging = null; View loggingActiveView; try { mvLogging = (MultiView)this.Parent.FindControl("mvGiveAnAward"); loggingActiveView = (View)mvLogging.FindControl("logForm"); mvLogging.SetActiveView(loggingActiveView); } catch (Exception) { } }
private void BuildExtensionList(string extensionType, string resxFileName, string nameResourceKey, string typeResourceKey, DropDownList dropDown, MultiView multiView, bool buildView, bool buildNotSpecifiedItem) { // Map the root physical path by using this control's location var rootPhysicalPath = this.Server.MapPath(this.TemplateSourceDirectory); // Load all the Settings.ascx files for the Extension var extTypeFolder = string.Concat(extensionType, "s"); var exts = Utilities.GetExtensions(rootPhysicalPath, extTypeFolder); // Build the Drop down list dropDown.Items.Clear(); if (buildNotSpecifiedItem) { dropDown.Items.Add(new ListItem( Localization.GetString(string.Format("No{0}.Text", extensionType), this.LocalResourceFile), string.Empty)); } buildView = buildView && multiView.Views.Count <= 1; foreach (var ext in exts) { // Resolve the extension path var extPath = string.Format("{0}/{1}", extTypeFolder, ext); // Locate the Local Resource File var lrWeb = string.Format("{0}/{1}/{2}", extPath, Localization.LocalResourceDirectory, resxFileName); var localResourceFile = this.ResolveUrl(lrWeb); if (!File.Exists(this.Server.MapPath(localResourceFile))) { continue; } // Locate the Settings control var ctrlPath = this.ResolveUrl(string.Format("{0}/{1}/{2}", extTypeFolder, ext, "Settings.ascx")); if (!File.Exists(this.Server.MapPath(ctrlPath))) { continue; } // Get the name of the data source var extName = Localization.GetString(nameResourceKey, localResourceFile); // Construct the settings control var ctrl = default(Control); try { ctrl = this.LoadControl(ctrlPath); } catch (HttpException) { continue; } var rptExt = ctrl as IReportsExtension; var rptCtrl = ctrl as IReportsControl; // Validate implemented interfaces if (ReferenceEquals(rptCtrl, null)) { continue; } if (ReferenceEquals(rptExt, null)) { continue; } if (!(ctrl is IReportsSettingsControl)) { continue; } // Construct an extension context var ctxt = new ExtensionContext(this.TemplateSourceDirectory, extensionType, ext); // Set properties and initialize extension rptExt.Initialize(ctxt); ctrl.ID = this.GetExtensionControlName(ext, extensionType); rptCtrl.ParentModule = this; // Don't build the view unless we're asked to AND // the views haven't already been built if (buildView) { // Create a View to hold the control var view = new View(); view.ID = this.GetExtensionViewName(ext, extensionType); view.Controls.Add(ctrl); // Add the view to the multi view if (multiView.FindControl(view.ID) == null) { multiView.Views.Add(view); } } // Get the full text for the drop down list item var itemText = string.Format(Localization.GetString(typeResourceKey, this.LocalResourceFile), extName); // Create the dropdown list items dropDown.Items.Add(new ListItem(itemText, ext)); //End Try } }