/// <summary> /// 全局的异常处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Application_Error(object sender, EventArgs e) { string s = HttpContext.Current.Request.Url.ToString(); HttpServerUtility server = HttpContext.Current.Server; if (server.GetLastError() != null) { Exception lastError = server.GetLastError(); // 此处进行异常记录,可以记录到数据库或文本,也可以使用其他日志记录组件。 //ExceptionHander.WriteException(lastError); Application["LastError"] = lastError; int statusCode = HttpContext.Current.Response.StatusCode; string exceptionOperator = "/SysException/Error"; try { if (!String.IsNullOrEmpty(exceptionOperator)) { exceptionOperator = new System.Web.UI.Control().ResolveUrl(exceptionOperator); string url = string.Format("{0}?ErrorUrl={1}", exceptionOperator, server.UrlEncode(s)); string script = String.Format("<script language='javascript' type='text/javascript'>window.top.location='{0}';</script>", url); Response.Write(script); Response.End(); } } catch { } } }
public void ExceptionHandlerStarter() { string s = HttpContext.Current.Request.Url.ToString(); HttpServerUtility server = HttpContext.Current.Server; if (server.GetLastError() != null) { Exception lastError = server.GetLastError(); Application["LastError"] = lastError; int statusCode = HttpContext.Current.Response.StatusCode; string exceptionOperator = System.Configuration.ConfigurationManager.AppSettings["ExceptionUrl"]; try { exceptionOperator = new System.Web.UI.Control().ResolveUrl(exceptionOperator); if (!String.IsNullOrEmpty(exceptionOperator) && !s.Contains(exceptionOperator)) { string url = string.Format("{0}?ErrorUrl={1}", exceptionOperator, server.UrlEncode(s)); string script = String.Format("<script language='javascript' type='text/javascript'>window.top.location='{0}';</script>", url); Response.Write(script); Response.End(); } } catch (Exception) { } } }
public PropertyMetadata(System.Web.UI.Control control, string name, string valueString) { if(control == null) throw new ArgumentNullException("control"); if(string.IsNullOrWhiteSpace(name)) throw new ArgumentNullException("name"); _control = control; this.Name = name.Trim(); this.AttributeName = this.Name.ToLowerInvariant(); this.ValueString = valueString; this.Bindable = true; this.Renderable = true; }
public void NewPostEmail(IEnumerable<Subscription> Subs, Post ThePost, Thread thread, string PostURL) { ListDictionary replacements = new ListDictionary(); string AutoFromEmail = SiteConfig.AutomatedFromEmail.Value; MailDefinition md = new MailDefinition(); md.BodyFileName = EmailTemplates.GenerateEmailPath(EmailTemplates.NewThreadReply); md.IsBodyHtml = true; md.From = AutoFromEmail; md.Subject = "Reply to Thread '" + thread.Title + "' - " + SiteConfig.BoardName.Value; replacements.Add("{REPLY_USERNAME}", ThePost.User.Username); replacements.Add("{REPLY_TEXT}", ThePost.Text); replacements.Add("{THREAD_TITLE}", thread.Title); replacements.Add("{POST_URL}", PostURL); replacements.Add("{BOARD_URL}", SiteConfig.BoardURL.Value); replacements.Add("{BOARD_NAME}", SiteConfig.BoardName.Value); System.Web.UI.Control ctrl = new System.Web.UI.Control { ID = "Something" }; MailMessage message = md.CreateMailMessage("*****@*****.**", replacements, ctrl); //Send the message SmtpClient client = Settings.GetSmtpClient(); foreach (Subscription s in Subs) { if (s.UserID == ThePost.UserID) continue; User u = s.User; message.To.Clear(); message.To.Add(u.Email); try { System.Threading.ThreadPool.QueueUserWorkItem(state => client.Send(message)); } catch { } } }
public PropertyMetadata(System.Web.UI.Control control, string name, Type propertyType, object value = null) { if(control == null) throw new ArgumentNullException("control"); if(string.IsNullOrWhiteSpace(name)) throw new ArgumentNullException("name"); if(propertyType == null) throw new ArgumentNullException("propertyType"); _control = control; this.Name = name.Trim(); this.AttributeName = this.Name.ToLowerInvariant(); this.PropertyType = propertyType; this.Value = value; this.DefaultValue = Zongsoft.Common.Convert.ConvertValue(null, propertyType); this.Bindable = true; this.Renderable = true; }
public EntityDataSourceStatementEditorForm(System.Web.UI.Control entityDataSource, IServiceProvider serviceProvider, bool hasAutoGen, bool isAutoGen, string propertyName, string statementLabelText, string statementAccessibleName, string helpTopic, string statement, ParameterCollection parameters) : base(serviceProvider) { _entityDataSource = entityDataSource; InitializeComponent(); InitializeUI(propertyName, statementLabelText, statementAccessibleName); InitializeTabIndexes(); InitializeAnchors(); _helpTopic = helpTopic; if (!hasAutoGen) { HideCheckBox(); } _parameters = parameters; _autoGenerateCheckBox.Checked = isAutoGen; _statementPanel.Enabled = !isAutoGen; _statementTextBox.Text = statement; _statementTextBox.Select(0, 0); List<Parameter> paramList = new List<Parameter>(); foreach (Parameter p in parameters) { paramList.Add(p); } _parameterEditorUserControl.AddParameters(paramList.ToArray()); _cachedStatementText = null; }
// when creating the main project menu, the control is passed a MenuHandler // instead of Event handler and is created specially for this puropose public void ToUControl(UControl container, WC.MenuEventHandler handler, string navigateUrl = null) { if(panel.type != PanelTypes.MenuDrop) throw new ArgumentException( "MenuEventHandler can operate only on a Menu - within a MenuDrop panel"); WC.Menu res = new CssMenu(); res.RenderingMode = MenuRenderingMode.Table; //res.CssClass = "inMenu"; res.StaticEnableDefaultPopOutImage = false; res.DynamicEnableDefaultPopOutImage = false; res.Orientation = WC.Orientation.Horizontal; res.StaticSubMenuIndent = 0; WC.MenuItem item; foreach (HierarchyRow r in storedHierarchyData.Rows) { if (r.ParentId == null) // root nodes first { item = new WC.MenuItem(r.Caption, null, null, "/" + ((CE.GlobalState == GlobalState.Administer) ? "admin/" : "architect/show/") + CE.project.Name + "/" + r.NavId.ToString()); AddSubmenuForItem(r, item); res.Items.Add(item); } } res.MenuItemClick += handler; res.ID = "Control" + controlId; res.CssClass = "inMenu"; WC.Panel cleaner = new WC.Panel(); container.Controls.Add(res); cleaner.CssClass = "clear"; container.Controls.Add(cleaner); }
public virtual void ToUControl(UControl container, WC.CommandEventHandler handler, string navigateUrl = null) { WC.Button button = new WC.Button(); button.Text = this.action.ToString(); button.CommandName = "_" + action.ToString(); button.Command += (WC.CommandEventHandler)handler; if (action == UserAction.Delete) button.OnClientClick = "return confirm('Really?')"; button.ID = "Control" + controlId; container.Controls.Add(button); }
/// <summary> /// Renders the controls. /// </summary> /// <param name="parentControl">The parent control.</param> /// <param name="writer">The writer.</param> /// <param name="controls">The controls.</param> public override void RenderControls(System.Web.UI.Control parentControl, System.Web.UI.HtmlTextWriter writer, System.Web.UI.Control[] controls) { base.RenderControls(parentControl, writer, controls); }
public override bool Transit(NAS.GUI.Pattern.Context context, string transition, System.Web.UI.Control _UIControl) { try { switch (transition) { case "UseDateTimeData": context.State = new CodeRuleDefinifionCreatingDateTimeData(_UIControl); break; case "UseStringData": context.State = new CodeRuleDefinifionCreatingStringData(_UIControl); break; case "Save": context.State = new CodeRuleDefinifionEditingNumberData(_UIControl); break; case "Cancel": context.State = new CodeRuleDefinitionCanceling(_UIControl); break; default: break; } return(true); } catch (Exception ex) { return(false); } }
public override bool Transit(NAS.GUI.Pattern.Context context, string transition, System.Web.UI.Control _UIControl) { switch (transition) { case "Cancel": context.State = new LegalInvoiceArtifact_Canceling(_UIControl); break; case "Save": context.State = new LegalInvoiceArtifact_Saving(_UIControl); break; default: throw new Exception("current compatibility setting is not supported"); } return(true); }
/// <summary> /// Returns the field's current value(s) /// </summary> /// <param name="parentControl">The parent control.</param> /// <param name="value">Information about the value</param> /// <param name="configurationValues">The configuration values.</param> /// <param name="condensed">Flag indicating if the value should be condensed (i.e. for use in a grid column)</param> /// <returns></returns> public override string FormatValue(System.Web.UI.Control parentControl, string value, System.Collections.Generic.Dictionary <string, ConfigurationValue> configurationValues, bool condensed) { string formattedValue = NumberRangeEditor.FormatDelimitedValues(value) ?? value; return(base.FormatValue(parentControl, formattedValue, configurationValues, condensed)); }
public SavingMovingInventoryCommand(System.Web.UI.Control _UIControl) : base(_UIControl) { }
/// <summary> /// Sets focus to the specified control. /// </summary> /// <param name="ctrl"></param> private void SetFocus(System.Web.UI.Control ctrl) { string s = "<SCRIPT language='javascript'>document.getElementById('" + ctrl.ClientID + "').focus() </SCRIPT>"; Page.RegisterStartupScript("focus", s); }
public CreatingOutputInventoryCommandByInvoiceArtifact(System.Web.UI.Control _UIControl) : base(_UIControl) { }
public override bool Transit(NAS.GUI.Pattern.Context context, string transition, System.Web.UI.Control _UIControl) { switch (transition) { case "Close": context.State = new ClosingMovingInventoryCommand(_UIControl); break; case "Save": context.State = new SavingMovingInventoryCommand(_UIControl); break; case "Delete": context.State = new DeletingMovingInventoryCommand(_UIControl); break; default: throw new Exception("current compatibility setting is not supported"); } return(true); }
public PricePolicyTabConfigPrice(System.Web.UI.Control _UIControl) : base(_UIControl) { }
public override bool Transit(NAS.GUI.Pattern.Context context, string transition, System.Web.UI.Control _UIControl) { switch (transition) { case "Next": context.State = new PricePolicy.State.PricePolicyTabDemoPrice(_UIControl); break; case "Back": context.State = new PricePolicy.State.PricePolicyTabException(_UIControl); break; case "SaveConfigPrice": context.State = new PricePolicy.State.PricePolicyTabConfigPriceSaving(_UIControl); break; case "Close": context.State = new PricePolicy.State.PricePolicyPoupClosing(_UIControl); break; default: throw new Exception("current compatibility setting is not supported"); } return(true); }
/// <summary> /// Sets the edit value from IEntity.Id value /// </summary> /// <param name="control">The control.</param> /// <param name="configurationValues">The configuration values.</param> /// <param name="id">The identifier.</param> public void SetEditValueFromEntityId(System.Web.UI.Control control, Dictionary <string, ConfigurationValue> configurationValues, int?id) { SetEditValue(control, configurationValues, id.ToString()); }
public override bool Transit(NAS.GUI.Pattern.Context context, string transition, System.Web.UI.Control _UIControl) { try { switch (transition) { case "Save": context.State = new AllocationEditing(_UIControl); break; case "Cancel": context.State = new AllocationCanceling(_UIControl); break; default: break; } return(true); } catch (Exception ex) { return(false); } }
public ViewCollection(System.Web.UI.Control owner) : base(default(System.Web.UI.Control)) { }
/// <summary> /// Gets the edit value as the IEntity.Id /// </summary> /// <param name="control">The control.</param> /// <param name="configurationValues">The configuration values.</param> /// <returns></returns> public int?GetEditValueAsEntityId(System.Web.UI.Control control, Dictionary <string, ConfigurationValue> configurationValues) { return(GetEditValue(control, configurationValues).AsIntegerOrNull()); }
public static void SetPersonalizationDirty(System.Web.UI.Control control) { }
public LegalInvoiceArtifact_Editing(System.Web.UI.Control _UIControl) : base(_UIControl) { }
public virtual bool Initialize(bool sortingEnabled, System.Web.UI.Control control) { }
/// <summary> /// Creates the child controls. /// </summary> /// <param name="parentControl"></param> /// <returns></returns> public override System.Web.UI.Control[] CreateChildControls(System.Web.UI.Control parentControl) { return(new System.Web.UI.Control[] { }); }
/// <summary> /// Returns the value using the most appropriate datatype /// </summary> /// <param name="parentControl">The parent control.</param> /// <param name="value">The value.</param> /// <param name="configurationValues">The configuration values.</param> /// <returns></returns> public override object ValueAsFieldType(System.Web.UI.Control parentControl, string value, Dictionary <string, ConfigurationValue> configurationValues) { return(value.AsDecimalOrNull()); }
public void AddTDTitleWin(string attr, System.Web.UI.Control ctl) { this.Add("\n<TD class='TitleWin' " + attr + " nowrap=true >"); this.Controls.Add(ctl); this.Add("</TD>"); }
/// <summary> /// Returns the value that should be used for sorting, using the most appropriate datatype /// </summary> /// <param name="parentControl">The parent control.</param> /// <param name="value">The value.</param> /// <param name="configurationValues">The configuration values.</param> /// <returns></returns> public override object SortValue(System.Web.UI.Control parentControl, string value, Dictionary <string, ConfigurationValue> configurationValues) { // return ValueAsFieldType which returns the value as a Decimal return(this.ValueAsFieldType(parentControl, value, configurationValues)); }
public CodeRuleDefinifionCreatingNumberData(System.Web.UI.Control _UIControl) : base(_UIControl) { }
public override bool Transit(NAS.GUI.Pattern.Context context, string transition, System.Web.UI.Control _UIControl) { switch (transition) { case "EdittingClickCommon": context.State = new PricePolicy.State.PricePolicyClickTabCommonEditting(_UIControl); break; case "EdittingClickCondition": context.State = new PricePolicy.State.PricePolicyClickTabConditionEditting(_UIControl); break; case "EdittingClickException": context.State = new PricePolicy.State.PricePolicyClickTabExceptionEditting(_UIControl); break; case "EdittingClickConfigFormula": context.State = new PricePolicy.State.PricePolicyClickTabConfigPriceEditting(_UIControl); break; case "EdittingClickPriceReference": context.State = new PricePolicy.State.PricePolicyClickTabDemoPriceEditting(_UIControl); break; case "Close": context.State = new PricePolicy.State.PricePolicyPoupClosing(_UIControl); break; case "UpdateMenu": context.State = new PricePolicy.State.PricePolicyConditionMenuEditting(_UIControl); break; case "UpdateExceptionMenu": context.State = new PricePolicy.State.PricePolicyExceptionMenuEditting(_UIControl); break; default: throw new Exception("current compatibility setting is not supported"); } return(true); }
public AllocationEditing(System.Web.UI.Control _UIControl) : base(_UIControl) { }
public static System.Web.Mvc.HtmlHelper GetHtmlHelper(this System.Web.UI.Control c) { var v = new System.Web.Mvc.ViewContext(); var helper = new System.Web.Mvc.HtmlHelper(v, new ViewDataBag()); return helper; }
public virtual void ToUControl(UControl container, WC.GridViewCommandEventHandler handler, WC.GridViewPageEventHandler pagingHandler, WC.GridViewSortEventHandler sortingHandler, string navigateUrl = null) { // take care of all the dependant controls as well WC.GridView grid = new WC.GridView(); string[] DataKeyNames = PKColNames.ToArray(); if (CE.GlobalState == GlobalState.Administer) { // one of our datakeys may have been a FK and its value is now the representative field of the // foreign table, not our key, but in such cases the key will be stored in a prefixed column. for (int i = 0; i < DataKeyNames.Length; i++) { FK fk = FKs.Where(x => x.myColumn == DataKeyNames[i]).FirstOrDefault(); if (fk is FK) { DataKeyNames[i] = CC.TABLE_COLUMN_REAL_VALUE_PREFIX + DataKeyNames[i]; } } } grid.DataKeyNames = DataKeyNames; grid.AutoGenerateColumns = false; WC.TemplateField tf = new WC.TemplateField(); tf.HeaderTemplate = new SummaryGridCommandColumn(WC.ListItemType.Header); tf.FooterTemplate = new SummaryGridCommandColumn(WC.ListItemType.Footer); tf.ItemTemplate = new SummaryGridCommandColumn(WC.ListItemType.Item, actions); grid.Columns.Add(tf); foreach (string col in displayColumns) { WC.BoundField bf = new WC.BoundField(); bf.DataField = col; bf.HeaderText = col + " [-]"; bf.SortExpression = col; grid.Columns.Add(bf); } // must contain the whole PK even if it is not displayed - for the navigator // DataKeyNames are the real ones - including "_" prefixing foreach (string col in DataKeyNames) { if (displayColumns.Contains(col)) continue; WC.BoundField bf = new WC.BoundField(); bf.DataField = col; bf.Visible = false; grid.Columns.Add(bf); bf.HeaderText = col; } grid.AllowSorting = true; //grid.EnableSortingAndPagingCallbacks = true; //grid.PageSize = 15; //grid.PageIndex = 0; container.Controls.Add(grid); grid.PagerStyle.CssClass = "navTablePaging"; grid.CssClass = "navTable"; grid.AllowPaging = true; grid.PageSize = 25; grid.PageIndexChanging += pagingHandler; grid.Sorting += sortingHandler; grid.DataSource = data.DefaultView; grid.DataBind(); /* foreach(WC.DataControlField f in grid.Columns){ if (f is WC.BoundField) { WC.BoundField bf = (WC.BoundField)f; if (!displayColumns.Contains(bf.DataField)) f.Visible = false; } }*/ grid.RowCommand += handler; grid.ID = "Control" + controlId; }
public override void Add(System.Web.UI.Control child) { }
public override void ToUControl(UControl container, WC.CommandEventHandler handler, string navigateUrl = null) { // see Controls TreeNavigatorControl tn = new TreeNavigatorControl(storedHierarchyData, actions); tn.ActionChosen += handler; container.Controls.Add(tn); }
public override void AddAt(int index, System.Web.UI.Control child) { }
public override bool Transit(NAS.GUI.Pattern.Context context, string transition, System.Web.UI.Control _UIControl) { switch (transition) { case "Cancel": context.State = new CancelBookingVoucherState(_UIControl); break; default: throw new Exception("current compatibility setting is not supported"); } return(true); }
public PricePolicyConditionMenuEditting(System.Web.UI.Control _UIControl) : base(_UIControl) { }
public BookedVoucherState(System.Web.UI.Control _UIControl) : base(_UIControl) { }
protected String Resolve(String path) { System.Web.UI.Control resolver = new System.Web.UI.Control(); return resolver.ResolveUrl(path); }