public OperacionesIntento2() { oCCUCore = Controladora.CCUCore.ObtenerInstancia(); oCCURPF = Controladora.CCURPF.ObtenerInstancia(); oClientScriptManager = Page.ClientScript; }
private static void ExcludeJavaScript(ClientScriptManager manager, string key) { var type = typeof(JavaScriptLibrary.JavaScriptHelper); var url = manager.GetWebResourceUrl(type, NAME_DUMMY_FILE); manager.RegisterStartupScript(type, key, string.Empty); manager.RegisterClientScriptInclude(type, key, url); }
/// <summary> /// 运行页面JS方法 /// </summary> /// <param name="functionName">方法名 exp: test(1)</param> /// <param name="page">页面类</param> public static void DoPageFunction(string functionName, Page page) { string openScript = "\n\t "; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); _clientScriptManager = this.Page.ClientScript; _clientScriptManager.GetCallbackEventReference(this, "", "", ""); EnsureChildControls(); _extender.CallbackID = this.UniqueID; }
/// <summary> /// 弹出提示并关闭fancybox /// </summary> /// <param name="Url">Url</param> /// <param name="page"></param> public static void AlertAndCloseJumpfancybox(string Url, Page page) { string openScript = "\n\t "; openScript = openScript + "parent.window.location.href ='" + Url + "';parent.$.fancybox.close(1);\n\t"; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true); }
/// <summary> /// 对父窗体内的控件赋值 需回调控件CLICK /// </summary> /// <param name="ControlKey"></param> /// <param name="page"></param> public static void SetValueByParentControl(string ControlKey, string values, string CallBackid, Page page) { string openScript = "\n\t "; openScript = openScript + "parent.$(\"#" + ControlKey + "\").attr(\"value\",\"" + values + "\");\n\t parent.$(\"#" + CallBackid + "\").click();\n\t parent.$.fancybox.close(1);"; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "SetValueByParentControl", openScript, true); }
public static void ClickParentControl(string ProcessResult, string CallBackid, Page page) { string openScript = "\n\t "; openScript = openScript + "alert('" + ProcessResult + "');\n\t parent.$(\"#" + CallBackid + "\").click();\n\t parent.$.fancybox.close(1);"; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "SetValueByParentControl", openScript, true); }
/// <summary> /// 弹出提示并关闭fancybox /// </summary> /// <param name="ProcessResult">提示</param> /// <param name="page"></param> /// <param name="urlPar">url参数</param> public static void AlertAndClosefancybox(string ProcessResult, Page page, string urlPar) { string openScript = "\n\t "; openScript = openScript + "alert('" + ProcessResult + "');parent.$.fancybox.close(1);parent.window.location.href = parent.window.location.href" + urlPar + ";\n\t"; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true); }
/// <summary> /// Includes the specified embedded JavaScript file in the page. /// </summary> /// <param name="manager">Accessible via Page.ClientScript.</param> /// <param name="resourceName">The name used to identify the embedded JavaScript file.</param> private static void IncludeJavaScript(ClientScriptManager manager, string resourceName) { var type = typeof(JavaScriptHelper); if (!manager.IsClientScriptBlockRegistered(resourceName)) { manager.RegisterClientScriptResource(type, resourceName); } }
/// <summary> /// 弹出对话框 /// </summary> /// <param name="ProcessResult">显示的提示文字</param> /// <param name="page">页面类</param> public static void AlertWindow(string ProcessResult, Page page) { string openScript = "\n\t "; openScript = openScript + "alert('" + ProcessResult + "');\n\t"; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true); }
/**/ /// <summary> /// 弹出对话框(弹出对话框后css会失效) /// </summary> /// <param name="message">提示信息</param> public static void ShowMessage(string message) { StringBuilder sb = new StringBuilder(); sb.Append("<script language=\"javascript\"> \n"); sb.Append("alert(\"" + message.Trim() + "\"); \n"); sb.Append("</script>"); System.Web.HttpContext.Current.Response.Write(sb.ToString()); } /**/ /// <summary> /// 弹出对话框(不影响css样式) /// </summary> /// <param name="page">页面指针,一般为this</param> /// <param name="scriptKey">脚本键,唯一</param> /// <param name="message">提示信息</param> public static void ShowMessage(System.Web.UI.Page page, string scriptKey, string message) { System.Web.UI.ClientScriptManager csm = page.ClientScript; if (!csm.IsClientScriptBlockRegistered(scriptKey)) { string strScript = "alert('" + message + "');"; csm.RegisterClientScriptBlock(page.GetType(), scriptKey, strScript, true); } }
/// <summary> /// 打开新窗口 /// </summary> /// <param name="URI"></param> /// <param name="page"></param> public static void OpenWindown(string URI, Page page) { string openScript = string.Empty; //openScript = openScript + "alert('" + ProcessResult + "');\n\t"; openScript = openScript + " window.open('" + URI + "');\n\t"; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "OpenWindown", openScript, true); }
/// <summary> /// 提示信息 并且跳转到指定页面 /// </summary> /// <param name="ProcessResult"></param> /// <param name="URI"></param> /// <param name="page"></param> public static void AlertWindowAndLocation(string ProcessResult, string URI, Page page) { string openScript = "\n\t "; openScript = openScript + "alert('" + ProcessResult + "');\n\t"; openScript = openScript + " window.location.href = '" + URI + "';\n\t"; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "AlertWindowAndLocation", openScript, true); }
public static void AlertWindowAndGoLocationHref(string ProcessResult, Page page) { string openScript = "\n\t "; openScript = openScript + "alert('" + ProcessResult + "');\n\t"; openScript = openScript + " window.location.href = 'OngoingInvite.aspx?NeedPopu=1';\n\t"; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "AlertWindowAndGoLocationHref", openScript, true); }
/// <summary> /// 弹出窗体 /// </summary> /// <param name="PageUrl">窗体的地址</param> /// <param name="Title">显示的标题</param> /// <param name="Width">窗体的宽度</param> /// <param name="Height">窗体的高度</param> /// <param name="page">页面类</param> public static void PopUpWindow(string PageUrl, string Title, int Width, int Height, Page page) { string openScript = ""; openScript = openScript + "\r\n " + "window.open('" + PageUrl + "','" + Title + "','width=" + Width.ToString() + ",height=" + Height.ToString() + ",scrollbars=yes')" + "\r\n "; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true); }
/// <summary> /// 弹出窗体 /// </summary> /// <param name="PageUrl">窗体的地址</param> /// <param name="Title">显示的标题</param> /// <param name="Width">窗体的宽度</param> /// <param name="Height">窗体的高度</param> /// <param name="page">页面类</param> public static void PopUpWindowModalDialog(string PageUrl, string Title, int Width, int Height, Page page) { string openScript = ""; openScript = openScript + "\r\n " + "window.showModalDialog('" + PageUrl + "','" + Title + "','dialogWidth:" + Width.ToString() + "px;dialogHeight:" + Height.ToString() + "px;Scroll=no;status=no')" + "\r\n "; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true); }
/**/ /// <summary> /// 主要实现进度条的功能,这段代码的调用就要实现进度的调度 /// 实现主要过程 /// default.aspx.cs是调用页面 /// 放入page_load事件中 /// UIHelper myUI = new UIHelper(); /// Response.Write(myUI.ShowProgBar(this.Page,"../JS/progressbar.htm")); /// Thread thread = new Thread(new ThreadStart(ThreadProc)); /// thread.Start(); /// LoadData();//load数据 /// thread.Join(); /// Response.Write("OK"); /// /// 其中ThreadProc方法为 /// public void ThreadProc() /// { /// string strScript = "<script>setPgb('pgbMain','{0}');</script>"; /// for (int i = 0; i <= 100; i++) /// { /// System.Threading.Thread.Sleep(10); /// Response.Write(string.Format(strScript, i)); /// Response.Flush(); /// } /// } /// 其中LoadData() /// public void LoadData() /// { /// for (int m = 0; m < 900; m++) /// { /// for (int i = 0; i < 900; i++) /// { /// /// } /// } /// } /// /// </summary> /// <param name="pageCurrent"></param> /// <param name="ShowProgbarScript"></param> /// <returns></returns> public static string ShowProgBar(System.Web.UI.Page pageCurrent, string ShowProgbarScript) { StreamReader sr = new StreamReader(pageCurrent.MapPath(ShowProgbarScript), System.Text.Encoding.Default); StringBuilder sb = new StringBuilder(); string line; try { while ((line = sr.ReadLine()) != null) { sb.AppendLine(line); } sr.Close(); } catch (Exception ex) { throw new Exception(ex.Message); } //pageCurrent.ClientScript.RegisterStartupScript(pageCurrent.GetType(), // System.Guid.NewGuid().ToString(), sb.ToString()); return(sb.ToString()); } #endregion #region fixedHeader public static string fixedHeader() { StringBuilder s = new StringBuilder(); s.Append(@"<table width='100%' border='1' cellspacing='0' style='MARGIN-TOP:-2px'>"); s.Append(@"<TR class='fixedHeaderTr' style='BACKGROUND:navy;COLOR:white'>"); s.Append(@"<TD nowrap>Header A</TD>"); s.Append(@"<TD nowrap>Header B</TD>"); s.Append(@"<TD nowrap>Header C</TD>"); s.Append(@"</TR>"); for (int m = 0; m < 100; m++) { s.Append(@"<TR>"); s.Append(@"<TD>A").Append(m).Append("</TD>"); s.Append(@"<TD>B").Append(m).Append("</TD>"); s.Append(@"<TD>C").Append(m).Append("</TD>"); s.Append(@"</TR>"); } s.Append(@"</table>"); return(s.ToString()); } #endregion #region refreshPage public static void refreshPage(System.Web.UI.Page pageCurrent) { StringBuilder sb = new StringBuilder(); sb.Append("<script language=\"javascript\">"); sb.Append("window.location.reload(true);"); sb.Append("</script>"); pageCurrent.ClientScript.RegisterStartupScript(pageCurrent.GetType(), System.Guid.NewGuid().ToString(), sb.ToString()); } #endregion #region Page_revealTrans //进入页面<meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)"> //推出页面<meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)"> //这个是页面被载入和调出时的一些特效。duration表示特效的持续时间,以秒为单位。transition表示使用哪种特效,取值为1-23: // 0 矩形缩小 // 1 矩形扩大 // 2 圆形缩小 // 3 圆形扩大 // 4 下到上刷新 // 5 上到下刷新 // 6 左到右刷新 // 7 右到左刷新 // 8 竖百叶窗 // 9 横百叶窗 // 10 错位横百叶窗 // 11 错位竖百叶窗 // 12 点扩散 // 13 左右到中间刷新 // 14 中间到左右刷新 // 15 中间到上下 // 16 上下到中间 // 17 右下到左上 // 18 右上到左下 // 19 左上到右下 // 20 左下到右上 // 21 横条 // 22 竖条 // 23 以上22种随机选择一种 public static string Page_revealTrans(System.Web.UI.Page currentPage, string duration, string transition) { StringBuilder sb = new StringBuilder(); sb.Append("<meta http-equiv=\"Page-Enter\""); sb.Append("content=\""); sb.Append("revealTrans(duration=" + duration); sb.Append(",transition=" + transition); sb.Append(")\">"); //currentPage.ClientScript.RegisterStartupScript(currentPage.GetType(), // System.Guid.NewGuid().ToString(), sb.ToString()); return(sb.ToString()); } #endregion /// <summary> /// 显示一段自定义的输出代码 /// </summary> /// <param name="page">页面指针,一般为This</param> public static void RegisterStartupScript(System.Web.UI.Page page, string script) { var sb = new StringBuilder(); sb.Append("<script type=\"text/javascript\"> "); sb.Append(script.Trim()); sb.Append("</script>"); page.ClientScript.RegisterStartupScript(page.GetType(), page.GetType().Name, sb.ToString()); } public static void RegisterClientScriptBlock(System.Web.UI.Page page, string script) { var sb = new StringBuilder(); sb.Append("<script type=\"text/javascript\"> "); sb.Append(script.Trim()); sb.Append("</script>"); page.ClientScript.RegisterClientScriptBlock(page.GetType(), page.GetType().Name, sb.ToString()); } /**/ /// <summary> /// 调用客户端JavaScript函数 /// </summary> /// <param name="page">页面指针,一般为This</param> /// <param name="scriptName">函数名,带参数,如:FunA(1);</param> public static void CallClientScript(System.Web.UI.Page page, string scriptName) { String csname = "PopupScript"; Type cstype = page.GetType(); System.Web.UI.ClientScriptManager cs = page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname)) { String cstext = scriptName; cs.RegisterStartupScript(cstype, csname, cstext, true); } }
/// <summary> /// 弹出对话框,然后关闭当前窗口 /// </summary> /// <param name="ProcessResult">显示的提示文字</param> /// <param name="page">页面类</param> public static void CloseWindow(string ProcessResult, Page page) { string openScript = ""; openScript = openScript + "\r\n " + "alert('" + ProcessResult + "');\r\n" + "window.close();window.opener.location.reload();\r\n"; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "WindowCloseWindow", openScript, true); }
/// <summary> /// 重载弹出对话框 /// </summary> /// <param name="ProcessResult">显示的提示文字</param> /// <param name="cReturnUrl">返回地址</param> /// <param name="page">页面类</param> public static void ConfirmWindow(string ProcessResult, string cReturnUrl, Page page) { string openScript = ""; openScript = openScript + "\r\n " + "if(confirm('" + ProcessResult + "')){" + "\r\n " + "location.href('" + cReturnUrl + "')};" + "\r\n "; System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRow") { var rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; GridView1.EditIndex = rowIndex; BindGridViewData(); } else if (e.CommandName == "DeleteRow") { System.Web.UI.ClientScriptManager cs = Page.ClientScript; EmployeeDataAccessLayer.DeleteEmployee(Convert.ToInt32(e.CommandArgument)); BindGridViewData(); } else if (e.CommandName == "CancelUpdate") { GridView1.EditIndex = -1; BindGridViewData(); } else if (e.CommandName == "UpdateRow") { int rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; int employeeId = Convert.ToInt32(e.CommandArgument); string name = ((TextBox)GridView1.Rows[rowIndex].FindControl("TextBox1")).Text; string gender = ((DropDownList)GridView1.Rows[rowIndex].FindControl("DropDownList1")).SelectedValue; string city = ((TextBox)GridView1.Rows[rowIndex].FindControl("TextBox3")).Text; EmployeeDataAccessLayer.UpdateEmployee(employeeId, name, gender, city); GridView1.EditIndex = -1; BindGridViewData(); } else if (e.CommandName == "InsertRow") { string name = ((TextBox)GridView1.FooterRow.FindControl("txtName")).Text; string gender = ((DropDownList)GridView1.FooterRow.FindControl("ddlInsertGender")).SelectedValue; string city = ((TextBox)GridView1.FooterRow.FindControl("txtCity")).Text; EmployeeDataAccessLayer.InsertEmployee(name, gender, city); BindGridViewData(); } }
private static void IncludeJavaScript(ClientScriptManager manager, string resourceName, bool late) { var type = typeof(JavaScriptLibrary.JavaScriptHelper); if (!manager.IsStartupScriptRegistered(type, resourceName)) { if (late) { var url = manager.GetWebResourceUrl(type, resourceName); var scriptBlock = string.Format(TEMPLATE_SCRIPT, HttpUtility.HtmlEncode(url)); manager.RegisterStartupScript(type, resourceName, scriptBlock); } else { manager.RegisterClientScriptResource(type, resourceName); manager.RegisterStartupScript(type, resourceName, string.Empty); } } //manager.RegisterClientScriptResource(type, resourceName); }
public override void RenderBeginTag (HtmlTextWriter writer) { if (SkipLinkText != "") { System.Web.UI.HtmlControls.HtmlAnchor anchor = new System.Web.UI.HtmlControls.HtmlAnchor (); anchor.HRef = "#" + ClientID + "_SkipLink"; Image img = new Image (); ClientScriptManager csm = new ClientScriptManager (null); img.ImageUrl = csm.GetWebResourceUrl (typeof (SiteMapPath), "transparent.gif"); img.Attributes.Add ("height", "0"); img.Attributes.Add ("width", "0"); img.AlternateText = SkipLinkText; anchor.Controls.Add (img); anchor.Render (writer); } base.RenderBeginTag (writer); }
/// <summary> /// Ensures the script manager. /// </summary> /// <returns></returns> public bool EnsureScriptManager() { if (_scriptManager == null) { var page = (HttpContext.Current.Handler as Page); if (page != null) _scriptManager = page.ClientScript; } return (_scriptManager != null); }
} /// <summary> /// <summary> /// 向页面输出指定的JS代码 /// </summary> /// <param name="Script"></param> public static void ResponseScript(string Script, Page page) { System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "ResponseScript", Script, true); }
public override void PreRender (Page page, HtmlHead head, ClientScriptManager csm, string cmenu, StringBuilder script) { Menu owner = Owner; MenuItemStyle staticMenuItemStyle = owner.StaticMenuItemStyleInternal; SubMenuStyle staticMenuStyle = owner.StaticMenuStyleInternal; MenuItemStyle dynamicMenuItemStyle = owner.DynamicMenuItemStyleInternal; SubMenuStyle dynamicMenuStyle = owner.DynamicMenuStyleInternal; MenuItemStyleCollection levelMenuItemStyles = owner.LevelMenuItemStyles; List<Style> levelMenuItemLinkStyles = owner.LevelMenuItemLinkStyles; SubMenuStyleCollection levelSubMenuStyles = owner.LevelSubMenuStylesInternal; MenuItemStyle staticSelectedStyle = owner.StaticSelectedStyleInternal; MenuItemStyle dynamicSelectedStyle = owner.DynamicSelectedStyleInternal; MenuItemStyleCollection levelSelectedStyles = owner.LevelSelectedStylesInternal; List<Style> levelSelectedLinkStyles = owner.LevelSelectedLinkStyles; Style staticHoverStyle = owner.StaticHoverStyleInternal; Style dynamicHoverStyle = owner.DynamicHoverStyleInternal; if (!csm.IsClientScriptIncludeRegistered (typeof (Menu), "Menu.js")) { string url = csm.GetWebResourceUrl (typeof (Menu), "Menu.js"); csm.RegisterClientScriptInclude (typeof (Menu), "Menu.js", url); } script.AppendFormat (onPreRenderScript, cmenu, page.IsMultiForm ? page.theForm : "window", ClientScriptManager.GetScriptLiteral (owner.DisappearAfter), ClientScriptManager.GetScriptLiteral (owner.Orientation == Orientation.Vertical)); if (owner.DynamicHorizontalOffset != 0) script.Append (String.Concat (cmenu, ".dho = ", ClientScriptManager.GetScriptLiteral (owner.DynamicHorizontalOffset), ";\n")); if (owner.DynamicVerticalOffset != 0) script.Append (String.Concat (cmenu, ".dvo = ", ClientScriptManager.GetScriptLiteral (owner.DynamicVerticalOffset), ";\n")); // The order in which styles are defined matters when more than one class // is assigned to an element RegisterStyle (owner.PopOutBoxStyle, head); RegisterStyle (owner.ControlStyle, owner.ControlLinkStyle, head); if (staticMenuItemStyle != null) RegisterStyle (owner.StaticMenuItemStyle, owner.StaticMenuItemLinkStyle, head); if (staticMenuStyle != null) RegisterStyle (owner.StaticMenuStyle, head); if (dynamicMenuItemStyle != null) RegisterStyle (owner.DynamicMenuItemStyle, owner.DynamicMenuItemLinkStyle, head); if (dynamicMenuStyle != null) RegisterStyle (owner.DynamicMenuStyle, head); if (levelMenuItemStyles != null && levelMenuItemStyles.Count > 0) { levelMenuItemLinkStyles = new List<Style> (levelMenuItemStyles.Count); foreach (Style style in levelMenuItemStyles) { Style linkStyle = new Style (); levelMenuItemLinkStyles.Add (linkStyle); RegisterStyle (style, linkStyle, head); } } if (levelSubMenuStyles != null) foreach (Style style in levelSubMenuStyles) RegisterStyle (style, head); if (staticSelectedStyle != null) RegisterStyle (staticSelectedStyle, owner.StaticSelectedLinkStyle, head); if (dynamicSelectedStyle != null) RegisterStyle (dynamicSelectedStyle, owner.DynamicSelectedLinkStyle, head); if (levelSelectedStyles != null && levelSelectedStyles.Count > 0) { levelSelectedLinkStyles = new List<Style> (levelSelectedStyles.Count); foreach (Style style in levelSelectedStyles) { Style linkStyle = new Style (); levelSelectedLinkStyles.Add (linkStyle); RegisterStyle (style, linkStyle, head); } } if (staticHoverStyle != null) { if (head == null) throw new InvalidOperationException ("Using Menu.StaticHoverStyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />)."); RegisterStyle (staticHoverStyle, owner.StaticHoverLinkStyle, head); script.Append (String.Concat (cmenu, ".staticHover = ", ClientScriptManager.GetScriptLiteral (staticHoverStyle.RegisteredCssClass), ";\n")); script.Append (String.Concat (cmenu, ".staticLinkHover = ", ClientScriptManager.GetScriptLiteral (owner.StaticHoverLinkStyle.RegisteredCssClass), ";\n")); } if (dynamicHoverStyle != null) { if (head == null) throw new InvalidOperationException ("Using Menu.DynamicHoverStyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />)."); RegisterStyle (dynamicHoverStyle, owner.DynamicHoverLinkStyle, head); script.Append (String.Concat (cmenu, ".dynamicHover = ", ClientScriptManager.GetScriptLiteral (dynamicHoverStyle.RegisteredCssClass), ";\n")); script.Append (String.Concat (cmenu, ".dynamicLinkHover = ", ClientScriptManager.GetScriptLiteral (owner.DynamicHoverLinkStyle.RegisteredCssClass), ";\n")); } }
/// <summary>返回默认的reloadForm实现,配合Box.js中的Dialog.CloseAndRefresh</summary> /// <returns></returns> public static bool RegisterReloadFormJs(ClientScriptManager script, bool isPostback) { if (!script.IsClientScriptBlockRegistered(typeof(LinkBox), "ReloadFormJs")) { script.RegisterClientScriptBlock(typeof(LinkBox), "ReloadFormJs", Helper.JsMinSimple(!XControlConfig.Debug, @" function reloadForm(){ if(!" + ("" + isPostback).ToLower() + @"){ location.reload(); return true; } var buttons = document.getElementsByTagName('input'); for(var i=0;i<buttons.length;i++){ var ele = buttons[i]; if((ele.type === 'submit' || ele.type === 'button') && ele.value === '查询'){ if(ele.click){ ele.click(); }else if(document.createEvent && ele.dispatchEvent){ var event = document.createEvent('MouseEvent'); event.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); ele.dispatchEvent(event); }else{ break; } return true; } } return false; }"), true); return true; } return false; }
public static void Include_ShowMessage(ClientScriptManager manager, bool late = true) { IncludeJavaScript(manager, NAME_SHOW_MESSAGE, late); }
public static void Include_GreetUser(ClientScriptManager manager, bool late = true) { Include_ShowMessage(manager, late); IncludeJavaScript(manager, NAME_GREET_USER, late); }
private EventValidationStore _outboundEvents; // events which will be valid on the next postback internal DefaultEventValidationProvider(ClientScriptManager clientScriptManager) { _clientScriptManager = clientScriptManager; }
public static void Message(Type t,ClientScriptManager cs,string msg) { cs.RegisterStartupScript(t,"��ʾ", string.Format("<script>alert('{0}')</script>",msg)); }
/// <summary> /// 将此控件呈现给指定的输出参数。 /// </summary> /// <param name="output"> 要写出到的 HTML 编写器 </param> protected override void Render(HtmlTextWriter output) { if (this.BackColorFocus != "") { base.Attributes.Add("onfocus", "this.style.background='" + this.BackColorFocus + "'"); //if(!HasDropDownList) base.Attributes.Add("onblur", "this.style.background='#ffffff'"); //else // base.Attributes.Add("onblur", "this.style.background='#ffffff';if(!document.getElementById('" + this.ClientID + "List').focused){document.getElementById('" + this.ClientID + "List').style.display='none';}"); } //if (this.CssFocus != "") //{ // base.Attributes.Add("onmousedown", "this.className='" + this.CssFocus + "'"); // base.Attributes.Add("onmouseout", "this.className='" + this.CssClass + "'"); //} if (this.HasDropDownList) { base.Attributes.Add("title", "点击显示下拉框"); base.Attributes.Add("onclick", "ShowList('" + this.ClientID + "');"); } //输出 base.Render(output); output.Write(" "); if (InputExplain.Trim() != "") { this.lblExplain.ID = "lbl" + base.ID; this.lblExplain.RenderControl(output); } if (!this.AllowEmpty) { this.rfvDataInput.ID = "rfv" + base.ID; this.rfvDataInput.ControlToValidate = base.ID; this.rfvDataInput.RenderControl(output); } if (this.ValidType != DataType.Never && this.ValidType != DataType.String) { this.revDataInput.ID = "rev" + base.ID; this.revDataInput.ControlToValidate = base.ID; this.revDataInput.ValidationExpression = this.GetValidRegex(); this.revDataInput.ErrorMessage = error; this.revDataInput.RenderControl(output); } //可调整高度 if (this.IsRegulateHeight) { #region StringBuilder sbscript = new StringBuilder(); sbscript.Append("\n<!--调节输入框高度 begin-->\n"); sbscript.Append(" <script type=\"text/javascript\">\n"); sbscript.Append(" //Plus\n"); sbscript.Append(" function PlusHeight(id)\n"); sbscript.Append(" {\n"); sbscript.Append(" var txtInput = document.getElementById(id);\n"); sbscript.Append(" txtInput.rows = parseInt(txtInput.rows) + "+ this.RegulateRows + ";\n"); //sbscript.Append(" txtInput.style.height = txtInput.style.height+15;\n"); sbscript.Append(" }\n"); sbscript.Append(" //Minus\n"); sbscript.Append(" function MinusHeight(id)\n"); sbscript.Append(" {\n"); sbscript.Append(" var txtInput = document.getElementById(id);\n"); sbscript.Append(" if( parseInt(txtInput.rows) >= "+ (this.RegulateRows + 1) + " )\n"); sbscript.Append(" txtInput.rows = parseInt(txtInput.rows) - "+ this.RegulateRows + ";\n"); sbscript.Append(" }\n"); sbscript.Append(" </script>\n"); sbscript.Append("<!--调节输入框高度 end-->\n"); System.Web.UI.ClientScriptManager client = this.Page.ClientScript; Type cstype = Page.GetType(); if (!client.IsStartupScriptRegistered(cstype, "regulateheight")) { client.RegisterStartupScript(cstype, "regulateheight", sbscript.ToString()); } StringBuilder sbhtml = new StringBuilder(); sbhtml.Append("<div style=\"height:24px;\">"); sbhtml.Append(" " + this.ImageIconMinus + " " + this.ImageIconPlus); sbhtml.Append("</div>"); output.Write(sbhtml.ToString()); #endregion } //下拉框模式 if (this.HasDropDownList) { #region //已经改为点击输入框的时候激发客户端事件 //output.Write("<img id=\"" + this.ClientID + "Icon\" src=\"" + this.ImageIconShowDropDown + "\" border=\"0\" style=\"cursor:hand;\" onclick=\"ShowList('" + this.ClientID + "');\" align=\"absmiddle\" />\n"); int width = Convert.ToInt32(base.Width.Value); width = width == 0 ? 100 : width; output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "display:none;position:absolute;"); output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Id, this.ClientID + "List"); output.RenderBeginTag(HtmlTextWriterTag.Div); output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "margin-left:" + width + "px;"); output.RenderBeginTag(HtmlTextWriterTag.Span); drpList.ID = base.ID + "Items"; drpList.Style.Add("margin-left", "-" + width + "px"); drpList.Attributes.Add("onchange", "document.getElementById('" + this.ClientID + "').value=this.options[this.selectedIndex].text;document.getElementById('" + this.ClientID + "List').style.display='none';"); //drpList.Attributes.Add("onblur", "this.style.display='none'"); if (this.DropDownListDataSource != null && this.DropDownListDataSource.Rows.Count > 0) { drpList.DataTextField = this.DataTextField; drpList.DataValueField = this.DataValueField; drpList.DataSource = this.DropDownListDataSource.DefaultView; drpList.DataBind(); } if (HasDefaultItem) { drpList.Items.Insert(0, new ListItem(this.DefaultItemText, this.DefaultItemValue)); } foreach (ListItem item in drpList.Items) { if (item.Text == base.Text.Trim()) { item.Selected = true; break; } } this.drpList.RenderControl(output); output.RenderEndTag(); output.RenderEndTag(); StringBuilder sbscript = new StringBuilder(); #region js内容 sbscript.Append("\n<script type=\"text/javascript\">\n"); sbscript.Append(" <!--下拉框显示隐藏 begin-->\n"); sbscript.Append(" function ShowList(id)\n"); sbscript.Append(" {\n"); sbscript.Append(" var txtInput = document.getElementById(id);\n"); sbscript.Append(" var drpList = document.getElementById(id+'List');\n"); //sbscript.Append(" var drpIcon = document.getElementById(id+'Icon');\n"); sbscript.Append(" var drpItems = document.getElementById(id+'Items');\n"); //下拉框 sbscript.Append(" if(drpList.style.display == 'block')\n"); sbscript.Append(" {\n"); sbscript.Append(" txtInput.title = '点击显示下拉框';\n"); sbscript.Append(" drpList.style.display = 'none';\n"); //sbscript.Append(" drpIcon.src = '" + this.ImageIconShowDropDown + "';\n"); sbscript.Append(" }\n"); sbscript.Append(" else\n"); sbscript.Append(" {\n"); sbscript.Append(" txtInput.title = '点击关闭下拉框';\n"); sbscript.Append(" drpList.style.display = 'block';\n"); sbscript.Append(" drpList.style.left = GetOffsetLeft(txtInput)+'px';\n"); sbscript.Append(" drpList.style.top = (GetOffsetTop(txtInput)+1)+'px';\n"); sbscript.Append(" drpItems.style.width = txtInput.offsetWidth+'px';\n"); //sbscript.Append(" drpIcon.src = '" + this.ImageIconHideDropDown + "';\n"); sbscript.Append(" }\n"); sbscript.Append(" }\n"); sbscript.Append(" <!--下拉框显示隐藏 end-->\n"); sbscript.Append(" function GetOffsetTop(e) \n"); sbscript.Append(" {\n"); sbscript.Append(" var offsetTop = e.offsetTop;\n"); sbscript.Append(" var offsetParent = e.offsetParent;\n"); sbscript.Append(" while(offsetParent)\n"); sbscript.Append(" {\n"); sbscript.Append(" offsetTop += offsetParent.offsetTop;\n"); sbscript.Append(" offsetParent = offsetParent.offsetParent;\n"); sbscript.Append(" }\n"); sbscript.Append(" return offsetTop+e.offsetHeight;\n"); sbscript.Append(" }\n"); sbscript.Append(" function GetOffsetLeft(e) \n"); sbscript.Append(" {\n"); sbscript.Append(" var offsetLeft = e.offsetLeft;\n"); sbscript.Append(" var offsetParent = e.offsetParent;\n"); sbscript.Append(" while(offsetParent) \n"); sbscript.Append(" {\n"); sbscript.Append(" offsetLeft += offsetParent.offsetLeft;\n"); sbscript.Append(" offsetParent = offsetParent.offsetParent;\n"); sbscript.Append(" }\n"); sbscript.Append(" return offsetLeft;\n"); sbscript.Append(" }\n"); sbscript.Append("</script>\n"); # endregion System.Web.UI.ClientScriptManager client = this.Page.ClientScript; Type cstype = Page.GetType(); if (!client.IsStartupScriptRegistered(cstype, "showlist")) { client.RegisterStartupScript(cstype, "showlist", sbscript.ToString()); } #endregion }
public Page () { scriptManager = new ClientScriptManager (this); Page = this; ID = "__Page"; PagesSection ps = WebConfigurationManager.GetSection ("system.web/pages") as PagesSection; if (ps != null) { asyncTimeout = ps.AsyncTimeout; viewStateEncryptionMode = ps.ViewStateEncryptionMode; _viewState = ps.EnableViewState; _viewStateMac = ps.EnableViewStateMac; } else { asyncTimeout = TimeSpan.FromSeconds (DefaultAsyncTimeout); viewStateEncryptionMode = ViewStateEncryptionMode.Auto; _viewState = true; } #if NET_4_0 this.ViewStateMode = ViewStateMode.Enabled; #endif }
private ClientScriptManagerWrapper(ClientScriptManager scriptManager) { _this = new ReflectedObject(scriptManager); }
internal static ClientScriptManagerWrapper Initialize(ClientScriptManager mgr) { var instance = PerRequestCache.Get("CustomHtmlForm.ClientScriptManagerWrapper") as ClientScriptManagerWrapper; if (instance != null) return instance; instance = new ClientScriptManagerWrapper(mgr); PerRequestCache.Set("CustomHtmlForm.ClientScriptManagerWrapper", instance); return instance; }
/// <summary> /// Injects the specified manager. /// </summary> /// <param name="manager">The manager.</param> /// <param name="validationType">Type of the validation.</param> /// <param name="cssClass">The CSS class.</param> /// <param name="containerControl">The container control.</param> /// <param name="controlToValidate">The control to validate.</param> /// <param name="errorMessage">The error message.</param> /// <param name="selectionLimit">The selection limit.</param> /// <param name="maxLength">Length of the max.</param> public override void RegisterValidator(ClientScriptManager manager, ValidationType validationType, string cssClass, Control containerControl, string controlToValidate, string errorMessage, int selectionLimit, int maxLength) { if (validationType == ValidationType.RequiredField) { containerControl.Controls.Add(new RequiredFieldValidator { Display = ValidatorDisplay.Dynamic, ControlToValidate = controlToValidate, ValidationGroup = this.ValidationGroup, ErrorMessage = "<span class=\"error-text\">" + errorMessage + "</span>", CssClass = cssClass }); } if (validationType == ValidationType.EmailField) { containerControl.Controls.Add(new RegularExpressionValidator { Display = ValidatorDisplay.Dynamic, ControlToValidate = controlToValidate, ValidationGroup = this.ValidationGroup, ValidationExpression = Engage.Utility.EmailsRegEx, ErrorMessage = "<span class=\"error-text\">" + errorMessage + "</span>", CssClass = cssClass }); } if (validationType == ValidationType.LimitedLengthField) { containerControl.Controls.Add(new TextBoxLengthValidator { Display = ValidatorDisplay.Dynamic, ControlToValidate = controlToValidate, ValidationGroup = this.ValidationGroup, ErrorMessage = "<span class=\"error-text\">" + errorMessage + "</span>", MaxLength = maxLength, CssClass = cssClass }); } if (validationType == ValidationType.LimitedSelection) { if (selectionLimit > 0) { var gnarlyScriptBuilder = new StringBuilder(128); gnarlyScriptBuilder.Append("<script type=\"text/javascript\">"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append("var checkBoxesSelected = 0;"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append("var checkBoxLimit = "); gnarlyScriptBuilder.Append(selectionLimit); gnarlyScriptBuilder.Append(";"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append("function CheckSelectedCount(val)"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append("{"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" jQuery('.limit-reached').hide(); "); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" var allowCheck = true;"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" if (val.checked)"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" {"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" if ((checkBoxesSelected + 1) <= checkBoxLimit)"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" {"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" checkBoxesSelected++;"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" }"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" else"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" {"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" jQuery('.limit-reached').show(); "); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" allowCheck = false;"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" }"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" }"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" else "); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" {"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" checkBoxesSelected--;"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" }"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append(" return allowCheck;"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append("}"); gnarlyScriptBuilder.Append(Environment.NewLine); gnarlyScriptBuilder.Append("</script>"); gnarlyScriptBuilder.Append(Environment.NewLine); if (!manager.IsClientScriptBlockRegistered("CheckBoxLimitCheck")) { manager.RegisterClientScriptBlock(this.GetType(), "CheckBoxLimitCheck", gnarlyScriptBuilder.ToString()); } } } }
public static void showAlertMessage(Page p, ClientScriptManager ClientScript, string message) { ClientScript.RegisterStartupScript(p.GetType(),"", "<script>alert('"+message+"');<" + "/script>"); }
/// <summary> /// 运行脚本 /// </summary> /// <param name="script"></param> /// <param name="key"></param> public void RegScript(string script, string key) { System.Web.UI.ClientScriptManager cs = Page.ClientScript; cs.RegisterStartupScript(this.Page.GetType(), key, script, true); }
/// <summary> /// 添加样式脚本。 /// </summary> /// <param name="scriptManger">ClientScriptManager。</param> protected virtual void AddScript(ClientScriptManager scriptManger) { string[] scripts = this.ModulePage.WebScriptPaths; if (scripts != null && scripts.Length > 0 && scriptManger!= null) { foreach (string path in scripts) { if (!string.IsNullOrEmpty(path)) { string strKey = HashCrypto.Hash(path, "md5"); if(!scriptManger.IsClientScriptIncludeRegistered(strKey)) scriptManger.RegisterClientScriptInclude(strKey, this.Page.ResolveUrl(path)); } } } }
/// <summary> /// Injects the specified manager. /// </summary> /// <param name="manager">The manager.</param> /// <param name="validationType">Type of the validation.</param> /// <param name="cssClass">The CSS class.</param> /// <param name="containerControl">The container control.</param> /// <param name="controlToValidate">The control to validate.</param> /// <param name="errorMessage">The error message.</param> /// <param name="selectionLimit">The selection limit.</param> /// <param name="maxLength">Length of the max.</param> public abstract void RegisterValidator(ClientScriptManager manager, ValidationType validationType, string cssClass, Control containerControl, string controlToValidate, string errorMessage, int selectionLimit, int maxLength);
public static void RegisterClientScript(Type t, string key, ClientScriptManager cs, string script) { cs.RegisterStartupScript(t, key, script); }
internal LegacyEventValidationProvider(ClientScriptManager clientScriptManager) { _clientScriptManager = clientScriptManager; }
/// <summary> /// 注册JS代码,并运行 /// </summary> /// <param name="jsString"></param> /// <param name="page"></param> public static void RegisterJsCodeSource(string jsString, Page page) { System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript; OjbClientScript.RegisterStartupScript(page.GetType(), "RegisterJsCodeSource", jsString, true); }
protected internal override void RenderChildren (HtmlTextWriter writer) { if (haveSkipLink) { // <a href="#ID_SkipLink"> writer.AddAttribute (HtmlTextWriterAttribute.Href, "#" + clientId + "_SkipLink"); writer.RenderBeginTag (HtmlTextWriterTag.A); // <img alt="" height="0" width="0" src="" style="border-width:0px;"/> writer.AddAttribute (HtmlTextWriterAttribute.Alt, skipLinkText); writer.AddAttribute (HtmlTextWriterAttribute.Height, "0"); writer.AddAttribute (HtmlTextWriterAttribute.Width, "0"); Page page = Page; ClientScriptManager csm; if (page != null) csm = page.ClientScript; else csm = new ClientScriptManager (null); writer.AddAttribute (HtmlTextWriterAttribute.Src, csm.GetWebResourceUrl (typeof (SiteMapPath), "transparent.gif")); writer.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px"); writer.RenderBeginTag (HtmlTextWriterTag.Img); writer.RenderEndTag (); writer.RenderEndTag (); // </a> } base.RenderChildren (writer); if (haveSkipLink) { writer.AddAttribute (HtmlTextWriterAttribute.Id, "SkipLink"); writer.RenderBeginTag (HtmlTextWriterTag.A); writer.RenderEndTag (); } }
public abstract void PreRender (Page page, HtmlHead head, ClientScriptManager csm, string cmenu, StringBuilder script);
internal ClientScriptManagerWrapper(ClientScriptManager clientScriptManager) { Debug.Assert(clientScriptManager != null); _clientScriptManager = clientScriptManager; }
public static void Exclude_jQuery(ClientScriptManager manager) { ExcludeJavaScript(manager, NAME_JQUERY); }
private static void AddHtmlValidationScript(ClientScriptManager scriptManager) { scriptManager.RegisterStartupScript(typeof(ValidatorUtil), "ValidatorUtil.AddHtml5Validation", @"; var ValidatorUtil_AddHtml5Validation = function(clientId) { var ctrl = document.getElementById(clientId); if (!ctrl) { console.warn('Unable to find element with id ' + clientId + ', ignoring html5 validation for this validator.'); return; } var prev = ctrl.evaluationfunction; if (typeof(prev) == 'string') { ctrl.evaluationfunction = eval(ctrl.evaluationfunction); prev = ctrl.evaluationfunction; } ctrl.evaluationfunction = function(val) { var result = prev(val); if (result) { var prevIsValid = true; for (i = 0; i < Page_Validators.length; i++) { var previousValidator = Page_Validators[i]; if (previousValidator != val && previousValidator.controltovalidate == val.controltovalidate) { prevIsValid = prevIsValid && previousValidator.isvalid; } } if (prevIsValid) { var input = document.getElementById(val.controltovalidate); if (input && input.setCustomValidity) { input.setCustomValidity(''); } if (jQuery) { var field = jQuery(val).parent('.field'); field.removeClass('invalid'); } } } else { var input = document.getElementById(val.controltovalidate); if (input && input.setCustomValidity) { input.setCustomValidity(val.errormessage); } if (jQuery) { var field = jQuery(val).parent('.field'); field.addClass('invalid'); } } return result; }; };", true); }
public static string GetPopupMsgResourceUrl(ClientScriptManager clientScript, string fileName) { return clientScript.GetWebResourceUrl(typeof(PopupMsgResources), string.Format("ChinaCustoms.Framework.DeluxeWorks.Web.Library.Resources.PopupMsg.{0}", fileName)); }
public static void Include_jQueryLocal(ClientScriptManager manager, bool late = true) { IncludeJavaScript(manager, NAME_JQUERY_LOCAL, late); }
/// <summary> /// 获取资源文件url /// </summary> /// <param name="clientScript"></param> /// <param name="fileName"></param> /// <returns></returns> public static string GetClientMsgResourceUrl(ClientScriptManager clientScript, string fileName) { return clientScript.GetWebResourceUrl(typeof(ClientMsgResources), GetFileFullName(fileName)); }
/// <summary> /// Handles the Click event of the btnResendInfotoFulfillmentAPI control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnResendInfotoFulfillmentAPI_Click(object sender, EventArgs e) { string message = AppLogic.GetString("SentFulfillmentAPI.Success", SkinID, ThisCustomer.LocaleSetting.ToString()); try { using (var conn = DB.dbConn()) { conn.Open(); using (var cmd = new SqlCommand("aspdnsf_GetOrderItemsDetail", conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ORDERNUMBER", OrderNumber); reader2 = cmd.ExecuteReader(); int totalRRDRow = 0; while (reader2.Read()) { if ((reader2["DistributorName"].ToString() == AppLogic.GetString("Fullfilment Vendor RRD", SkinID, ThisCustomer.LocaleSetting)) || (reader2["DistributorName"].ToString() == AppLogic.GetString("Fullfilment Vendor CDS Publications", SkinID, ThisCustomer.LocaleSetting)) || (reader2["DistributorName"].ToString() == AppLogic.GetString("Fullfilment Vendor Wetzel Brothers", SkinID, ThisCustomer.LocaleSetting))) { totalRRDRow++; } } reader2.Close(); reader = cmd.ExecuteReader(); orderService.brandstore.ws.orderService os = new orderService.brandstore.ws.orderService(); orderService.brandstore.ws.Credentials c = new orderService.brandstore.ws.Credentials(); orderService.brandstore.ws.BillingAddress Ba = new orderService.brandstore.ws.BillingAddress(); orderService.brandstore.ws.ShippingAddress Sa = new orderService.brandstore.ws.ShippingAddress(); orderService.brandstore.ws.Product p; orderService.brandstore.ws.Product[] pa = new orderService.brandstore.ws.Product[totalRRDRow]; // Set the authentication c.Username = AppLogic.AppConfig("fullfillmentapi_username"); c.Token = AppLogic.AppConfig("fullfillmentapi_password"); SetBillingAndShippingAddresses(ref Ba, ref Sa, OrderNumber); int index = 0; bool hasproducts = false; string shippingMethodCode = string.Empty; string shippingMethod = string.Empty; while (reader.Read()) { if ((reader["DistributorName"].ToString() == AppLogic.GetString("Fullfilment Vendor RRD", SkinID, ThisCustomer.LocaleSetting)) || (reader["DistributorName"].ToString() == AppLogic.GetString("Fullfilment Vendor CDS Publications", SkinID, ThisCustomer.LocaleSetting)) || (reader["DistributorName"].ToString() == AppLogic.GetString("Fullfilment Vendor Wetzel Brothers", SkinID, ThisCustomer.LocaleSetting))) { p = new orderService.brandstore.ws.Product(); // set the product p.ID = reader["ProductID"].ToString(); p.Quantity = reader["Quantity"].ToString(); p.SKU = reader["SKU"].ToString(); p.Description = reader["OrderedProductName"].ToString(); pa[index] = p; index++; hasproducts = true; shippingMethodCode = reader["ShippingMethodCode"].ToString(); shippingMethod = reader["ShippingMethod"].ToString(); } } // call the service after verification if the shopping cart has RRD Product if (hasproducts) { orderService.brandstore.ws.ReturnStatus rs = os.processOrder(c, OrderNumber.ToString(), OrderNumber.ToString(), Ba, Sa, DateTime.Now, pa, AppLogic.GetString("Fullfilment Vendor RRDParam", SkinID, ThisCustomer.LocaleSetting), shippingMethodCode, shippingMethod); bool isok = rs.status.Equals(0) ? false : true; } } } } catch (Exception ex) { message = AppLogic.GetString("SentFulfillmentAPI.Error", SkinID, ThisCustomer.LocaleSetting.ToString()); SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""), MessageTypeEnum.GeneralException, MessageSeverityEnum.Error); } finally { string script = "alert('" + message + "')"; System.Web.UI.ClientScriptManager cs = this.ClientScript; cs.RegisterClientScriptBlock(this.GetType(), "alertMessage", script, true); } }