Наследование: System.Web.UI.TemplateControl, System.Web.IHttpHandler
Пример #1
1
        protected void Boton_Excel_Dios_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            Page page = new Page();
            HtmlForm form = new HtmlForm();
            GridView_Dios.DataSourceID = string.Empty;
            GridView_Dios.EnableViewState = false;
            GridView_Dios.AllowPaging = false;
            GridView_Dios.DataSource = LBPD.Logica_Mostrar_Precios();
            GridView_Dios.DataBind();
            page.EnableEventValidation = false;
            page.DesignerInitialize();
            page.Controls.Add(form);
            form.Controls.Add(GridView_Dios);
            page.RenderControl(htw);
            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "applicattion/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment;filename=data.xls");
            Response.Charset = "UTF-8";
            Response.ContentEncoding = Encoding.Default;
            Response.Write(sb.ToString());
            Response.End();
        }
Пример #2
0
 //FLASH
 public string genera_chart_Pie_Flash(string DivId, string Sdatos, string sTitulo, Page pagina, Int32 ancho = 600, Int32 alto = 400, string sColors = "FF0F00,FF6600,FF9E01,FCD202,F8FF01,B0DE09,04D215,0D8ECF,0D52D1,2A0CD0,8A0CCF,CD0D74,754DEB,DDDDDD,999999,333333,990000")
 {
     try
     {
         Type cstype = pagina.GetType();
         ClientScriptManager cs = pagina.ClientScript;
         StringBuilder sb = new StringBuilder();
         sb.AppendLine("var params ={bgcolor: \"#FFFFFF\"}");
         sb.AppendLine("var flashVars = { path: \"amcharts/flash/\", chart_settings: encodeURIComponent(\"<settings><redraw>1</redraw><background><alpha>100</alpha></background><balloon><alpha>77</alpha><border_width>3</border_width><border_color>000000</border_color><corner_radius>5</corner_radius></balloon><legend><enabled>0</enabled><align>center</align></legend><pie><colors>" + sColors + "</colors><y>50%</y><radius>30%</radius><inner_radius>40</inner_radius><height>40</height><angle>20</angle><start_angle>27</start_angle><outline_alpha>13</outline_alpha><brightness_step>24</brightness_step><gradient>radial</gradient></pie><animation><start_time>1.8</start_time><start_radius>251%</start_radius><start_alpha>8</start_alpha><pull_out_time>0.3</pull_out_time></animation><data_labels><show>{title}: {value} %</show><radius>40%</radius><text_size>14</text_size><max_width>160</max_width><line_alpha>7</line_alpha></data_labels><export_as_image><file>amcharts/flash/export.aspx</file><color>#CC0000</color><alpha>50</alpha></export_as_image><labels><label><x>0</x><y>40</y><align>center</align><text_size>12</text_size><text><![CDATA[<b>" + sTitulo + "</b>]]></text></label></labels></settings>\") ");
         sb.AppendLine(", chart_data: encodeURIComponent(\"" + Sdatos + "\") };");
         sb.AppendLine("window.onload = function () {");
         sb.AppendLine(" if (swfobject.hasFlashPlayerVersion(\"8\")) {swfobject.embedSWF(\"amcharts/flash/ampie.swf?cache=0\", \"" + DivId + "\", \"" + ancho + "\", \"" + alto + "\", \"8.0.0\", \"amcharts/flash/expressInstall.swf\", flashVars, params);");
         sb.AppendLine(" }else {");
         sb.AppendLine(" var amFallback = new AmCharts.AmFallback();");
         sb.AppendLine(" amFallback.type = \"pie\";");
         sb.AppendLine("  amFallback.write(\"" + DivId + "\");");
         sb.AppendLine(" }");
         sb.AppendLine("}");
         if ((cs.IsStartupScriptRegistered(DivId) == false))
         {
             cs.RegisterStartupScript(cstype, DivId, sb.ToString(), true);
         }
         return "";
     }
     catch (Exception ex)
     {
         return "<span>" + ex.Message + "</span>";
     }
 }
Пример #3
0
        public static void RenderCSSPath(Page page, string name, string cssFilePath, bool OverwriteExisting)
        {
            if (page == null || page.Header == null)
                return;

            if (cssFilePath == null)
                cssFilePath = string.Empty;
            HtmlLink link = (HtmlLink)page.FindControl(name);
            //foreach (Control control in page.Header.Controls)
            //    if (control is HtmlLink)
            //    {
            //        HtmlLink link = (HtmlLink)control; 
            if (link != null)
            {
                if (link.ID.ToLower().Equals(name.ToLower()) && !string.IsNullOrEmpty(cssFilePath))
                {
                    if (OverwriteExisting)
                        link.Href = cssFilePath;
                    else
                    {
                        if (String.IsNullOrEmpty(link.Href))
                            link.Href = cssFilePath;
                    }
                    //    }
                }
            }
        }
        // Format will be <%$ RouteValue: Key %>, controlType,propertyName are used to figure out what typeconverter to use
        public static object GetRouteValue(Page page, string key, Type controlType, string propertyName) {
            if (page == null || String.IsNullOrEmpty(key) || page.RouteData == null) {
                return null;
            }

            return ConvertRouteValue(page.RouteData.Values[key], controlType, propertyName);
        }
Пример #5
0
        /// <summary>
        /// Returns the proper edit ascx Control. Uses the current Page to load the Control.
        /// If the user has no right a error control is returned
        /// </summary>
        /// <param name="p">The current Page</param>
        /// <returns>Edit ascx Control</returns>
        internal static Control GetEditControl(Page p)
        {
            PortalDefinition.Tab tab = PortalDefinition.GetCurrentTab();
            PortalDefinition.Module m = tab.GetModule(p.Request["ModuleRef"]);

            if(!UserManagement.HasEditRights(HttpContext.Current.User, m.roles))
            {
                // No rights, return a error Control
                Label l = new Label();
                l.CssClass = "Error";
                l.Text = "Access denied!";
                return l;
            }
            m.LoadModuleSettings();
            Module em = null;
            if(m.moduleSettings != null)
            {
                // Module Settings are present, use custom ascx Control
                em = (Module)p.LoadControl(Config.GetModuleVirtualPath(m.type) + m.moduleSettings.editCtrl);
            }
            else
            {
                // Use default ascx control (Edit[type].ascx)
                em = (Module)p.LoadControl(Config.GetModuleVirtualPath(m.type) + "Edit" + m.type + ".ascx");
            }

            // Initialize the control
            em.InitModule(
                tab.reference,
                m.reference,
                Config.GetModuleVirtualPath(m.type),
                true);

            return em;
        }
Пример #6
0
        public static bool ControlWasPostedBack(Page page, Control target)
        {
            bool result = false;

            string ctlName = page.Request.Params.Get("__EVENTTARGET");

            if (ctlName != null && ctlName != string.Empty)
            {
                if (ctlName.Contains(target.ID))
                {
                    result = true;
                }
            }
            else
            {
                foreach (string ctl in page.Request.Form)
                {
                    if (ctl.Contains(target.ID))
                    {
                        result = true;
                        break;
                    }
                }
            }

            return result;
        }
Пример #7
0
        public static bool IsClientScriptRegisteredInHeader(Page page, string key)
        {
            bool result = false;

            if (page.Header != null)
            {
                foreach (Control ctl in page.Header.Controls)
                {
                    if (ctl is HtmlGenericControl)
                    {
                        if (ctl.ID != null)
                        {
                            if (ctl.ID.Trim().Length != 0)
                            {
                                if (ctl.ID.Equals(key, StringComparison.OrdinalIgnoreCase))
                                {
                                    result = true;
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            return result;
        }
Пример #8
0
        /// <summary>
        /// 绑定菜单下拉列表——只显示所有可以显示的菜单(IsMenu)
        /// </summary>
        public void BandDropDownListShowMenu(Page page, FineUI.DropDownList ddl)
        {
            //在内存中筛选记录
            var dt = DataTableHelper.GetFilterData(GetDataTable(), string.Format("{0}={1}", MenuInfoTable.IsMenu, 0), MenuInfoTable.Depth + ", " + MenuInfoTable.Sort);

            try
            {
                //整理出有层次感的数据
                dt = DataTableHelper.DataTableTidyUp(dt, MenuInfoTable.Id, MenuInfoTable.ParentId, 0);

                ddl.EnableSimulateTree = true;

                //显示值
                ddl.DataTextField = MenuInfoTable.Name;
                //显示key
                ddl.DataValueField = MenuInfoTable.Id;
                //数据层次
                ddl.DataSimulateTreeLevelField = MenuInfoTable.Depth;
                //绑定数据源
                ddl.DataSource = dt;
                ddl.DataBind();
                ddl.SelectedIndex = 0;

                ddl.Items.Insert(0, new FineUI.ListItem("请选择菜单", "0"));
                ddl.SelectedValue = "0";
            }
            catch (Exception e)
            {
                // 记录日志
                CommonBll.WriteLog("", e);
            }
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sm"></param>
		/// <param name="page"></param>
		public static void EnsureScriptManager(ref ScriptManager sm, Page page)
		{
			if (sm == null)
			{
				sm = ScriptManager.GetCurrent(page);
				if (sm == null)
				{
					ExceptionHelper.TrueThrow(page.Form.Controls.IsReadOnly, Resources.DeluxeWebResource.E_NoScriptManager);

					sm = new ScriptManager();

					//根据应用的Debug状态来决定ScriptManager的状态 2008-9-18
					bool debug = WebAppSettings.IsWebApplicationCompilationDebug();
					sm.ScriptMode = debug ? ScriptMode.Debug : ScriptMode.Release;

					sm.EnableScriptGlobalization = true;
					page.Form.Controls.Add(sm);
				}
			}
			else
			{
				ExceptionHelper.FalseThrow(sm.EnableScriptGlobalization, "页面中ScriptManger对象中属性EnableScriptGlobalization值应该设置为True!");
			}

			if (sm != null)
			{
				sm.AsyncPostBackError -= sm_AsyncPostBackError;
				sm.AsyncPostBackError += new EventHandler<AsyncPostBackErrorEventArgs>(sm_AsyncPostBackError);
			}
		}
Пример #10
0
 /// <summary>
 /// файл javascript в header
 /// </summary>
 public static void AddJavaScriptInclude(string url, Page page)
 {
     var script = new HtmlGenericControl("script");
     script.Attributes["type"] = "text/javascript";
     script.Attributes["src"] = url;
     page.Header.Controls.Add(script);
 }
Пример #11
0
 /// <summary>
 /// текст javascript в header
 /// </summary>
 /// <param name="jsText"></param>
 /// <param name="?"></param>
 public static void AddJavaScriptText(string jsText, Page page)
 {
     var script = new HtmlGenericControl("script");
     script.Attributes["type"] = "text/javascript";
     script.InnerText = jsText;
     page.Header.Controls.Add(script);
 }
Пример #12
0
        /// <summary>
        /// 导出数据到excel
        /// </summary>
        /// <param name="dt">数据表</param>
        /// <param name="page">返回(当前)页</param>
        /// <param name="titlelist">标题列表</param>
        /// <param name="title">文件名称</param>
        public void Download2Excel(DataTable dt, Page page, List<string> titlelist, string filename)
        {
            if (dt.Rows.Count < 1) return;
            var resp = page.Response;
            resp.ContentType = "application/vnd.ms-excel";
            resp.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", filename));
            resp.Clear();

            InitializeWorkbook();

            #region generate data
            ISheet sheet1 = hssfworkbook.CreateSheet("Sheet1");
            var row0=sheet1.CreateRow(0);
            for (int i = 0; i < titlelist.Count; i++)
            {
                row0.CreateCell(i).SetCellValue(titlelist[i]);
            }
            for (int j = 0; j < dt.Rows.Count; j++)
            {
                IRow row = sheet1.CreateRow(j + 1);
                for (int k = 0; k < dt.Columns.Count; k++)
                {
                    row.CreateCell(k).SetCellValue(dt.Rows[j].ItemArray[k].ToString());
                }
            }
            #endregion

            resp.BinaryWrite(WriteToStream().GetBuffer());
            //写缓冲区中的数据到HTTP头文档中
            resp.End();
        }
Пример #13
0
 /// <summary>
 /// референс на webresource
 /// </summary>
 /// <param name="scriptname"></param>
 /// <param name="page"></param>
 /// <returns></returns>
 public static void AddScriptToPage(string scriptname, Page page, Type t)
 {
     string s = page.ClientScript.GetWebResourceUrl(t,
                                                    "RutokenWebPlugin.javascript." + scriptname);
     page.ClientScript.RegisterClientScriptInclude(scriptname,
                                                   s);
 }
        private static bool FileExists(Page page, string filePath)
        {
            // remove query string for the file exists check, won't impact the absoluteness, so just do it either way.
            filePath = RemoveQueryString(filePath);

            return IsAbsoluteUrl(filePath) || File.Exists(page.Server.MapPath(filePath));
        }
Пример #15
0
        public BasicControlUtils()
        {
            bFoundPage = false;
            _page2 = null;

            _page = GetContainerPage(this);
        }
        private static void ComputerMove()
        {
            Random rand = new Random();
            int positionIndex = rand.Next(0, freePositions.Count);
            Position position = freePositions[positionIndex];
            int row = position.X;
            int col = position.Y;

            if (game[row, col] == '*')
            {
                game[row, col] = computerCharacter;
                freePositions.Remove(position);
                Button btn = new Button();
                Page page = new Page();
                if (HttpContext.Current != null)
                {
                    page = (Page)HttpContext.Current.Handler;
                    btn = (Button)page.FindControl("Btn" + row + col);
                    btn.Text = computerCharacter.ToString();
                }
                if (Win(computerCharacter))
                {
                    Label lbWinner = (Label)page.FindControl("Winner");
                    lbWinner.Text = "You win!";
                    lbWinner.Visible = true;
                    computerScores++;
                    UpdateScores(page);
                    return;
                }
            }
            else
            {
                ComputerMove();
            }
        }
Пример #17
0
 public static void CheckEhrLogin(Page objPage)
 {
     if (CookieManager.EhrMemId(objPage)==String.Empty)
     {
         PageTureMgr.TurnEhrLoginPage(objPage, EhrLoginUrl);
     }
 }
Пример #18
0
        /// <summary>
        /// Sets the pager button states.
        /// </summary>
        /// <param name="gridView">The grid view.</param>
        /// <param name="gvPagerRow">The gv pager row.</param>
        /// <param name="page">The page.</param>
        public static void SetPagerButtonStates(GridView gridView, GridViewRow gvPagerRow, Page page)
        {
            int pageIndex = gridView.PageIndex;
            int pageCount = gridView.PageCount;

            ImageButton btnFirst = (ImageButton)gvPagerRow.FindControl("btnFirst");
            ImageButton btnPrevious = (ImageButton)gvPagerRow.FindControl("btnPrevious");
            ImageButton btnNext = (ImageButton)gvPagerRow.FindControl("btnNext");
            ImageButton btnLast = (ImageButton)gvPagerRow.FindControl("btnLast");

            btnFirst.Enabled = btnPrevious.Enabled = (pageIndex != 0);
            btnNext.Enabled = btnLast.Enabled = (pageIndex < (pageCount - 1));

            DropDownList ddlPageSelector = (DropDownList)gvPagerRow.FindControl("ddlPages");
            ddlPageSelector.Items.Clear();
            for (int i = 1; i <= gridView.PageCount; i++)
            {
                ddlPageSelector.Items.Add(i.ToString());
            }

            ddlPageSelector.SelectedIndex = pageIndex;

            Label lblPageCount = (Label)gvPagerRow.FindControl("lblPageCount");
            lblPageCount.Text = pageCount.ToString();

            //ddlPageSelector.SelectedIndexChanged += delegate
            //{
            //    gridView.PageIndex = ddlPageSelector.SelectedIndex;
            //    gridView.DataBind();
            //};
        }
 internal PageAsyncTaskManager(Page page)
 {
     this._page = page;
     this._app = page.Context.ApplicationInstance;
     this._tasks = new ArrayList();
     this._resumeTasksCallback = new WaitCallback(this.ResumeTasksThreadpoolThread);
 }
        protected void imgBtnExportarExcelArchivos_Click(object sender, ImageClickEventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            Page page = new Page();
            HtmlForm form = new HtmlForm();

            gvJobCancelacioneXTicket.AllowPaging = false;
            gvJobCancelacioneXTicket.DataBind();
            gvJobCancelacioneXTicket.EnableViewState = false;

            page.EnableEventValidation = false;

            page.DesignerInitialize();
            page.Controls.Add(form);
            form.Controls.Add(gvJobCancelacioneXTicket);

            page.RenderControl(htw);

            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment;filename=ArchivosDeProcedimiento.xls");
            Response.Charset = "UTF-8";

            //Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentEncoding = System.Text.Encoding.Default;

            Response.Write(sb.ToString());
            Response.End();
        }
Пример #21
0
        public static void RegisterLocationScript(Page page, string title)
        {
            string pageUrl = page.ResolveUrl("~/Apps/Shell/Pages/default.aspx");

            StringBuilder builder = new StringBuilder();

            builder.AppendLine("	//<![CDATA[");
            builder.AppendLine("	if (parent == window) {");
            builder.AppendLine("		if (location.replace)");
            builder.AppendLine("			location.replace('" + pageUrl + "#right=' + escapeWithAmp(location.href));");
            builder.AppendLine("		else");
            builder.AppendLine("			location.href = '" + pageUrl + "#right=' + escapeWithAmp(location.href);");
            builder.AppendLine("	}");
            builder.AppendLine("	else {");
            builder.AppendLine("		if (parent && parent.document) {");
            builder.AppendLine("			var td = parent.document.getElementById(\"onetidPageTitle\");");
            builder.AppendLine("			if (td)");
            builder.AppendLine("				td.innerHTML = self.document.title;");
            builder.AppendLine("		}");
            builder.AppendLine("		top.document.title = self.document.title + '" + title + "';");
            builder.AppendLine("	}");
            builder.AppendLine("	function escapeWithAmp(str) {");
            builder.AppendLine("		var re = /&/gi;");
            builder.AppendLine("		var ampEncoded = \"%26\";");
            builder.AppendLine("		return escape(str).replace(re, ampEncoded);");
            builder.AppendLine("	}");
            builder.AppendLine("	//]]>");

            UtilHelper.RegisterScriptBlock(page, builder.ToString(), true);
        }
        protected void imgBtnExportarExcelEjecucion_Click(object sender, ImageClickEventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            Page page = new Page();
            HtmlForm form = new HtmlForm();

            gvIncidenciasBatch.AllowPaging = false;
            gvIncidenciasBatch.DataBind();
            gvIncidenciasBatch.EnableViewState = false;

            page.EnableEventValidation = false;

            page.DesignerInitialize();
            page.Controls.Add(form);
            form.Controls.Add(gvIncidenciasBatch);

            page.RenderControl(htw);

            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment;filename=ReporteIncidenciasBatch" + DateTime.Now.ToShortDateString() + ".xls");
            Response.Charset = "UTF-8";

            Response.ContentEncoding = System.Text.Encoding.Default;

            Response.Write(sb.ToString());
            Response.End();
        }
        private void ProcessCancellation(
            Cart cart,
            Store store,
            WorldPayPaymentResponse wpResponse,
            PayPalLog worldPayLog,
            Page page)
        {
            //string serializedResponse = SerializationHelper.SerializeToString(wpResponse);
            //log.Info("received cancellation worldpay postback, xml to follow");
            //log.Info(serializedResponse);

            // return an html order cancelled template for use at world pay
            if (config.WorldPayProduceShopperCancellationResponse)
            {
                string htmlTemplate = ResourceHelper.GetMessageTemplate(CultureInfo.CurrentUICulture, config.WorldPayShopperCancellationResponseTemplate);
                StringBuilder finalOutput = new StringBuilder();
                finalOutput.Append(htmlTemplate);
                finalOutput.Replace("#WorldPayBannerToken", "<WPDISPLAY ITEM=banner>"); //required by worldpay
                finalOutput.Replace("#CustomerName", wpResponse.Name);
                finalOutput.Replace("#StoreName", store.Name);

                string storePageUrl = worldPayLog.RawResponse;

                finalOutput.Replace("#StorePageLink", "<a href='" + storePageUrl + "'>" + storePageUrl + "</a>");

                page.Response.Write(finalOutput.ToString());
                page.Response.Flush();

            }
        }
        public static void TieButton(Page page, Control TextBoxToTie, Control ButtonToTie)
        {
            // 初始化Jscript,实现原理是向客户端发送特定Jscript
            string jsString = "";
            // 检查输入框对应的事件按纽
            if (ButtonToTie is LinkButton)
            {
                jsString = "if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {" + page.ClientScript.GetPostBackEventReference(ButtonToTie, "").Replace(":", "$") + ";return false;} else return true;";
            }
            else if (ButtonToTie is ImageButton)
            {
                jsString = "if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {" + page.ClientScript.GetPostBackEventReference(ButtonToTie, "").Replace(":", "$") + ";return false;} else return true;";
            }
            else
            {
                jsString = "if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {document." + "forms[0].elements['" + ButtonToTie.UniqueID.Replace(":", "_") + "'].click();return false;} else return true; ";
            }
            // 把 jscript 附加到输入框的onkeydown属性

            if (TextBoxToTie is HtmlControl)
            {
                ((HtmlControl)TextBoxToTie).Attributes.Add("onkeydown", jsString);
            }
            else if (TextBoxToTie is WebControl)
            {
                ((WebControl)TextBoxToTie).Attributes.Add("onkeydown", jsString);
            }
        }
        public override bool HandleRequest(
            WorldPayPaymentResponse wpResponse,
            PayPalLog worldPayLog,
            Page page)
        {
            bool result = false;

            if (worldPayLog.SerializedObject.Length == 0) { return result; }

            Cart cart = (Cart)SerializationHelper.DeserializeFromString(typeof(Cart), worldPayLog.SerializedObject);

            Store store = new Store(cart.StoreGuid);
            //SiteSettings siteSettings = new SiteSettings(store.SiteGuid);
            config = SiteUtils.GetCommerceConfig();

            switch (wpResponse.TransStatus)
            {
                case "Y": //success
                    ProcessOrder(cart, store, wpResponse, worldPayLog, page);

                    result = true;
                    break;

                case "C": // cancelled
                default:
                    ProcessCancellation(cart, store, wpResponse, worldPayLog, page);
                    break;

            }

            return result;
        }
        /// <summary>
        /// Loads a Javascript file reference onto the page
        /// to the file at the given url.
        /// 
        /// The url may be:
        /// 
        ///   1. An absolute url "http://" or "https://"
        ///   2. A tilde url "~/"
        ///   3. A url relative to the given page
        ///   
        /// </summary>
        /// <param name="page">The page on which to load</param>
        /// <param name="url">The url of the file</param>
        public static void LoadFileReference(Page page, string url)
        {
            ClientScriptManager clientscriptmanager = page.ClientScript;
            Type type = page.GetType();

            if (!clientscriptmanager.IsClientScriptBlockRegistered(type, url))
            {
                string pageTildePath =
                    FileTools.GetTildePath(page);

                string resolvedUrl =
                    FileTools.GetResolvedUrl(pageTildePath, url);

                StringBuilder builder = new StringBuilder();

                builder.Append(script_file_1);
                builder.Append(resolvedUrl);
                builder.Append(script_file_2);

                string contents = builder.ToString();

                clientscriptmanager.RegisterClientScriptBlock
                    (type, url, contents, false);
            }
        }
Пример #27
0
        public void AttachToPage(Page aspnetPage, PageContentToRender contentToRender)
        {
            Verify.ArgumentNotNull(aspnetPage, "aspnetPage");
            Verify.ArgumentNotNull(contentToRender, "contentToRender");

            aspnetPage.Items.Add(PageRenderingJob_Key, contentToRender);

            Guid templateId = contentToRender.Page.TemplateId;
            var rendering = _renderingInfo[templateId];

            if(rendering == null)
            {
                Exception loadingException = _loadingExceptions[templateId];
                if(loadingException != null)
                {
                    throw loadingException;
                }

                Verify.ThrowInvalidOperationException("Failed to get master page by template ID '{0}'. Check for compilation errors".FormatWith(templateId));
            }

            aspnetPage.MasterPageFile = rendering.VirtualPath;
            aspnetPage.PreRender += (e, args) => PageOnPreRender(aspnetPage, contentToRender.Page);

            var master = aspnetPage.Master as MasterPagePageTemplate;
            TemplateDefinitionHelper.BindPlaceholders(master, contentToRender, rendering.PlaceholderProperties, null);
        }
Пример #28
0
        public void JudgeOperate(Page page, int menuId, List<OperateEnum> operateTypes)
        {
            UserModel user = UserUtility.CurrentUser;

            try
            {
                AuthOperateBLL bll = new AuthOperateBLL();
                ResultModel result = bll.JudgeOperate(user, menuId, operateTypes);
                if (result.ResultStatus != 0)
                {
                    string oids = operateTypes.Aggregate(string.Empty, (current, operate) => current + (operate.ToString() + ","));

                    if (!string.IsNullOrEmpty(oids) && oids.IndexOf(',') > -1)
                        oids = oids.Substring(0, oids.Length - 1);

                    MenuBLL menuBLL = new MenuBLL();
                    result = menuBLL.Get(user, menuId);
                    if (result.ResultStatus != 0)
                        throw new Exception("获取菜单失败");

                    Menu menu = result.ReturnValue as Menu;

                    if (menu != null)
                    {
                        string redirectUrl = string.Format("{0}/ErrorPage.aspx?t={1}&r={2}", DefaultValue.NfmtSiteName, string.Format("用户无{0}-{1}权限", menu.MenuName, oids), string.Format("{0}MainForm.aspx",NFMT.Common.DefaultValue.NfmtSiteName));
                        page.Response.Redirect(redirectUrl,false);
                    }
                }
            }
            catch (Exception e)
            {
                log.ErrorFormat("用户{0},错误:{1}", user.EmpName, e.Message);
                page.Response.Redirect("/MainForm.aspx");
            }
        }
Пример #29
0
 /// <summary>
 /// 解除锁定页面上的一些组件
 /// </summary>
 /// <param name="page"></param>
 /// <param name="obj">继续保持锁定的控件</param>
 public static void UnLockPage(Page page, object[] obj)
 {
     Control htmlForm = null;
     foreach (Control ctl in page.Controls)
     {
         if (ctl is HtmlForm)
         {
             htmlForm = ctl;
             break;
         }
     }
     //foreach (Control ctl in page.Controls[1].Controls)
     foreach (Control ctl in htmlForm.Controls)
     {
         if (IsContains(obj, ctl) == false)
         {
             //解除锁定
             UnLockControl(page, ctl);
         }
         else
         {
             //锁定
             LockControl(page, ctl);
         }
     }
 }
Пример #30
0
        public WebPartChrome(WebPartZoneBase zone, WebPartManager manager) {
            if (zone == null) {
                throw new ArgumentNullException("zone");
            }
            _zone = zone;
            _page = zone.Page;
            _designMode = zone.DesignMode;
            _manager = manager;

            if (_designMode) {
                // Consider personalization to be enabled at design-time
                _personalizationEnabled = true;
            }
            else {
                _personalizationEnabled = (manager != null && manager.Personalization.IsModifiable);
            }

            if (manager != null) {
                _personalizationScope = manager.Personalization.Scope;
            }
            else {
                // Consider scope to be shared at design-time
                _personalizationScope = PersonalizationScope.Shared;
            }
        }
Пример #31
0
 public ButtonHelper(System.Web.UI.Page page)
 {
     this.FindButtons(page);
 }
Пример #32
0
 /// <summary>
 /// 注册脚本块
 /// </summary>
 public static void RegisterScriptBlock(System.Web.UI.Page page, string _ScriptString)
 {
     page.ClientScript.RegisterStartupScript(page.GetType(), "scriptblock", "<script type='text/javascript'>" + _ScriptString + "</script>");
 }
Пример #33
0
    protected void CloseUploadProgress(System.Web.UI.Page page)
    {
        string scriptContent = "<script>document.getElementById('divBg11').style.display='none';document.getElementById('divProcessing11').style.display='none';</script>";

        page.RegisterStartupScript("errscript", scriptContent);
    }
Пример #34
0
    protected void AlertInformation(System.Web.UI.Page page, string alertInformation)
    {
        string scriptContent = "<script>alert('" + alertInformation + "');</script>";

        page.RegisterStartupScript("errscript", scriptContent);
    }
Пример #35
0
 public static void Show(System.Web.UI.Page page, string msg)
 {
     page.ClientScript.RegisterStartupScript(page.GetType(), "message", "<script language='javascript' defer>alert('" + msg.ToString() + "');</script>");
 }
Пример #36
0
 // contructeur obligatoire auquel il faut fournir la chaine de connection et l'objet Page
 public SqlExpressWrapper(String connexionString, System.Web.UI.Page Page)
 {
     this.Page            = Page;
     this.connexionString = connexionString;
 }
Пример #37
0
 public static void LogError(System.Web.UI.Page source, string user, Exception ex)
 {
 }
Пример #38
0
 public static TModel GetModel <TModel>(this System.Web.UI.Page pg) where TModel : new()
 {
     return(GetModel <TModel>(FindForm(pg)));
 }
Пример #39
0
        public bool StreamExport(DataTable dt, string[] columns, string fileName, System.Web.UI.Page pages)
        {
            if (dt.Rows.Count > 65535) //总行数大于Excel的行数
            {
                throw new Exception("预导出的数据总行数大于excel的行数");
            }
            if (string.IsNullOrEmpty(fileName))
            {
                return(false);
            }

            StringBuilder content  = new StringBuilder();
            StringBuilder strtitle = new StringBuilder();

            content.Append("<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'>");
            content.Append("<head><title></title><meta http-equiv='Content-Type' content=\"text/html; charset=utf-8\">");
            //注意:[if gte mso 9]到[endif]之间的代码,用于显示Excel的网格线,若不想显示Excel的网格线,可以去掉此代码
            //content.Append("<!--[if gte mso 9]>");
            //content.Append("<xml>");
            //content.Append(" <x:ExcelWorkbook>");
            //content.Append("  <x:ExcelWorksheets>");
            //content.Append("   <x:ExcelWorksheet>");
            //content.Append("    <x:Name>Sheet1</x:Name>");
            //content.Append("    <x:WorksheetOptions>");
            //content.Append("      <x:Print>");
            //content.Append("       <x:ValidPrinterInfo />");
            //content.Append("      </x:Print>");
            //content.Append("    </x:WorksheetOptions>");
            //content.Append("   </x:ExcelWorksheet>");
            //content.Append("  </x:ExcelWorksheets>");
            //content.Append("</x:ExcelWorkbook>");
            //content.Append("</xml>");
            //content.Append("<![endif]-->");
            content.Append("</head><body><table style='border-collapse:collapse;table-layout:fixed;'><tr>");

            if (columns != null)
            {
                for (int i = 0; i < columns.Length; i++)
                {
                    if (columns[i] != null && columns[i] != "")
                    {
                        content.Append("<td><b>" + columns[i] + "</b></td>");
                    }
                    else
                    {
                        content.Append("<td><b>" + dt.Columns[i].ColumnName + "</b></td>");
                    }
                }
            }
            else
            {
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    content.Append("<td><b>" + dt.Columns[j].ColumnName + "</b></td>");
                }
            }
            content.Append("</tr>\n");

            for (int j = 0; j < dt.Rows.Count; j++)
            {
                content.Append("<tr>");
                for (int k = 0; k < dt.Columns.Count; k++)
                {
                    object obj  = dt.Rows[j][k];
                    Type   type = obj.GetType();
                    if (type.Name == "Int32" || type.Name == "Single" || type.Name == "Double" || type.Name == "Decimal")
                    {
                        double d = obj == DBNull.Value ? 0.0d : Convert.ToDouble(obj);
                        if (type.Name == "Int32" || (d - Math.Truncate(d) == 0))
                        {
                            content.AppendFormat("<td style='vnd.ms-excel.numberformat:#,##0'>{0}</td>", obj);
                        }
                        else
                        {
                            content.AppendFormat("<td style='vnd.ms-excel.numberformat:#,##0.00'>{0}</td>", obj);
                        }
                    }
                    else
                    {
                        content.AppendFormat("<td style='vnd.ms-excel.numberformat:@'>{0}</td>", obj);
                    }
                }
                content.Append("</tr>\n");
            }
            content.Append("</table></body></html>");
            content.Replace("&nbsp;", "");

            pages.Response.Clear();
            pages.Response.Buffer      = false;
            pages.Response.ContentType = "application/ms-excel";  //"application/ms-excel";
            fileName = System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);
            pages.Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName + ".xls");
            pages.Response.Write(content.ToString());
            pages.Response.End();  //注意,若使用此代码结束响应可能会出现“由于代码已经过优化或者本机框架位于调用堆栈之上,无法计算表达式的值。”的异常。
            //HttpContext.Current.ApplicationInstance.CompleteRequest(); //用此行代码代替上一行代码,则不会出现上面所说的异常。
            return(true);
        }
Пример #40
0
        //创建饼状专题图
        public void CreatePieTheme(System.Web.UI.Page page, int nLayerID, string[] fields)
        {
            if (page == null)
            {
                return;
            }
            // 得到地图服务下的ArcObjects map对象
            ESRI.ArcGIS.Server.IServerContext pServerContext = GetServerContext();

            ESRI.ArcGIS.Carto.IMapServer         mapServer        = (ESRI.ArcGIS.Carto.IMapServer)pServerContext.ServerObject;
            ESRI.ArcGIS.Carto.IMapServerObjects2 mapServerObjects = (ESRI.ArcGIS.Carto.IMapServerObjects2)mapServer;
            string mapName = mapServer.DefaultMapName;

            ESRI.ArcGIS.Carto.IMap aoMap = mapServerObjects.get_Map(mapName);

            ESRI.ArcGIS.Carto.ILayer           pLayer    = aoMap.get_Layer(nLayerID);//得到图层
            ESRI.ArcGIS.Carto.IGeoFeatureLayer pGeoLayer = pLayer as IGeoFeatureLayer;

            //设置专题图的属性列表
            ESRI.ArcGIS.Carto.IChartRenderer  pCharRenderer = pServerContext.CreateObject("esriCarto.ChartRenderer") as IChartRenderer;
            ESRI.ArcGIS.Carto.IRendererFields pRenderFields = pCharRenderer as IRendererFields;
            foreach (string var in fields)
            {
                pRenderFields.AddField(var, var);
            }

            //实例化图表对象并取得元素指定属性的最大值
            ESRI.ArcGIS.Display.IPieChartSymbol pPieSym  = pServerContext.CreateObject("esriDisplay.PieChartSymbol") as ESRI.ArcGIS.Display.IPieChartSymbol;
            ESRI.ArcGIS.Display.IChartSymbol    pCharSym = pPieSym as ESRI.ArcGIS.Display.IChartSymbol;
            pPieSym.Clockwise  = true;
            pPieSym.UseOutline = true;

            pCharSym.MaxValue = GetStaMaxMin(fields, pGeoLayer)[0];

            //设置饼图外围线
            ISimpleLineSymbol pOutLine = pServerContext.CreateObject("esriDisplay.SimpleLineSymbol") as ISimpleLineSymbol;

            pOutLine.Color = GetRGB(255, 0, 128, pServerContext);
            pOutLine.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid;
            pOutLine.Width = 1;

            pPieSym.Outline = pOutLine;
            IMarkerSymbol pMarkSym = pPieSym as IMarkerSymbol;

            pMarkSym.Size = 5;


            //设置饼状图填充效果
            ESRI.ArcGIS.Display.ISymbolArray pSymArr = pPieSym as ISymbolArray;
            ISimpleFillSymbol pSimFillSym            = pServerContext.CreateObject("esriDisplay.SimpleFillSymbol") as ESRI.ArcGIS.Display.SimpleFillSymbol;

            pSimFillSym.Color   = GetRGB(128, 128, 128, pServerContext);
            pSimFillSym.Outline = pOutLine;

            Random randColor = new Random();

            for (int i = 0; i < fields.Length; i++)
            {
                IFillSymbol pFillSym = pServerContext.CreateObject("esriDisplay.SimpleFillSymbol") as IFillSymbol;
                pFillSym.Color = GetRGB(randColor.Next(255), randColor.Next(255), randColor.Next(255), pServerContext);
                pSymArr.AddSymbol((ISymbol)pFillSym);
            }

            //设置地图图层背景
            pSimFillSym              = pServerContext.CreateObject("esriDisplay.SimpleFillSymbol") as ESRI.ArcGIS.Display.SimpleFillSymbol;
            pSimFillSym.Color        = GetRGB(255, 128, 255, pServerContext);
            pCharRenderer.BaseSymbol = pSimFillSym as ISymbol;


            //设置饼状图表属性
            IPieChartRenderer pPieChartRenderer = pCharRenderer as IPieChartRenderer;

            pPieChartRenderer.MinValue             = 0.1;
            pPieChartRenderer.MinSize              = 1;
            pPieChartRenderer.FlanneryCompensation = false;
            pPieChartRenderer.ProportionalBySum    = true;
            pPieChartRenderer.ProportionalField    = fields[0];
            pCharRenderer.ChartSymbol              = pPieSym as IChartSymbol;
            pCharRenderer.Label = "面积";

            //应用饼状专题到指定图层
            pCharRenderer.UseOverposter = false;
            pCharRenderer.CreateLegend();
            pGeoLayer.Renderer = pCharRenderer as IFeatureRenderer;

            //刷新地图显示图表及图例
            mapServerObjects.RefreshServerObjects();
            // Map1.RefreshResource("MapResourceItem0");
            pServerContext.ReleaseContext();
        }
Пример #41
0
 /// <summary>
 /// 注册页面的默认Body ID名称(防脚本错误)
 /// </summary>
 /// <param name="myPage"></param>
 /// <param name="strBodyName"></param>
 /// <remarks></remarks>
 public static void RegisterSetBodyID(System.Web.UI.Page myPage, string strBodyName)
 {
     myPage.ClientScript.RegisterStartupScript(typeof(Page), "SetBodyID", "<script language='javascript'>document.body.id = '" + strBodyName + "'</script>");
 }
Пример #42
0
 /// <summary>
 /// 将值绑定到控件上
 /// </summary>
 /// <param name="pg"></param>
 /// <param name="model"></param>
 public static void BindModel(this System.Web.UI.Page pg, object model)
 {
     BindModel(FindForm(pg), model);
 }
Пример #43
0
 /// <summary>
 /// Ajax启动脚本 For 引用AJAX组件的页
 /// 转向到新的URL
 /// </summary>
 /// <param name="page">一般是this</param>
 /// <param name="toURL">连接地址</param>
 public static void AjaxRedirect(System.Web.UI.Page page, string toURL)
 {
     #region
     page.ClientScript.RegisterStartupScript(page.GetType(), "ajaxjs", string.Format("window.location.replace('{0}');", toURL), true);
     #endregion
 }
Пример #44
0
 public void DisplayAlert(string titulo, string mensagem, System.Web.UI.Page page)
 {
     h1.InnerText          = titulo;
     lblMsgPopup.InnerText = mensagem;
     ClientScript.RegisterStartupScript(typeof(Page), Guid.NewGuid().ToString(), "MostrarPopupMensagem();", true);
 }
Пример #45
0
 /// <summary>
 /// Ajax启动脚本 For 引用AJAX组件的页
 /// 弹出对话框并跳转到URL页
 /// </summary>
 /// <param name="page">一般是this</param>
 /// <param name="msg">对话框提示串</param>
 /// <param name="url">跳往的地址</param>
 public static void AjaxAlertAndLocationHref(System.Web.UI.Page page, string msg, string url)
 {
     page.ClientScript.RegisterStartupScript(page.GetType(), "ajaxjs", string.Format("alert('{0}!');location.href='{1}';", msg, url), true);
 }
Пример #46
0
 /// <summary>
 /// 发生错误页面
 /// </summary>
 /// <param name="errStr">错误代码</param>
 public static void ToError(System.Web.UI.Page page, string errStr)
 {
     page.Response.Redirect(string.Format("Error.aspx?ErrStr={0}", errStr));
 }
Пример #47
0
 public static void Display(string str, System.Web.UI.Page currPg)
 {
     currPg.Response.Write(("<script language=javascript>alert(\' "
                            + (str + " \')</script>")));
 }
Пример #48
0
 /// <summary>
 /// Ajax启动脚本 For 引用AJAX组件的页
 /// JS语句
 /// </summary>
 /// <param name="page">一般是this</param>
 /// <param name="js">如alert('test');</param>
 public static void AjaxEndRunJs(System.Web.UI.Page page, string js)
 {
     page.ClientScript.RegisterClientScriptBlock(page.GetType(), "ajaxjs", string.Format("{0}", js), true);
 }
Пример #49
0
        /// <summary>
        /// 输出jbox效果
        /// </summary>
        /// <param name="page">页面对象</param>
        /// <param name="msg">信息提示</param>
        /// <param name="url">跳转地址</param>
        /// <param name="target">页面跳转框架</param>
        protected static void JboxShow(System.Web.UI.Page page, string msg, string url, string target)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            sb.AppendLine("");

            bool isjquey = false;

            //是否存在 jquery ,不需要重复导入
            for (int i = 0; i < page.Header.Controls.Count; i++)
            {
                System.IO.StringWriter sw         = new System.IO.StringWriter();
                HtmlTextWriter         html_write = new HtmlTextWriter(sw);
                page.Header.Controls[i].RenderControl(html_write);
                if (sw.ToString().ToLower().Contains("jquery"))
                {
                    isjquey = true;
                }
            }

            //加载需要的库
            string adminpath = "/" + MS_ConfigBLL.AdminPath;
            string str_res   = "<link rel=\"stylesheet\" href=\"" + adminpath + "/tool/JBox/Skins/Blue/jbox.css\" />\n";

            if (!isjquey)
            {
                str_res += "<script type=\"text/javascript\" src=\"" + adminpath + "/js/jquery1.4.js\"></script>\n";
            }
            str_res += "<script type=\"text/javascript\" src=\"" + adminpath + "/tool/JBox/jquery.jBox-2.3.min.js\"></script>\n";
            sb.AppendLine(str_res);


            sb.AppendLine("<script type=\"text/javascript\">");
            sb.AppendLine("var fun_submit = function (v, h, f) {");
            if (url != "")
            {
                sb.AppendLine("" + target + ".location.href='" + url + "';");
            }
            sb.AppendLine("return true;");
            sb.AppendLine("};");

            sb.AppendLine("var fun_close = function () {");
            if (url != "")
            {
                //关闭留在本页
                sb.AppendLine("/*" + target + ".location.href='" + url + "';*/");
            }
            sb.AppendLine("return true;");
            sb.AppendLine("};");

            sb.AppendLine("function jboxMsg(msg) {");
            sb.AppendLine("     $.jBox.info(msg , \"信息提示\", { submit : fun_submit ,closed : fun_close , top: '30%' });");

            /*
             * sb.AppendLine("$.jBox(msg, {");
             * sb.AppendLine(" title: \"信息提示\",");
             * sb.AppendLine("  width: 500,");
             * sb.AppendLine(" height: 350,");
             * sb.AppendLine(" buttons: { '关闭': true }");
             * sb.AppendLine("});");*/
            sb.AppendLine("}");
            sb.AppendLine("</script>");

            sb.AppendLine("<script language='javascript'>$(document).ready(function () {jboxMsg('" + msg + "');});</script>");
            sb.AppendLine("");

            page.Header.Controls.Add(new LiteralControl(sb.ToString()));
            //page.ClientScript.RegisterClientScriptBlock(page.GetType(), "jbox", sb.ToString());
        }
Пример #50
0
 /// <summary>
 /// Ajax启动脚本 For 引用AJAX组件的页
 /// AjaxAlert:弹出对话框
 /// </summary>
 /// <param name="page">一般是this</param>
 /// <param name="msg">对话框提示串</param>
 public static void AjaxAlert(System.Web.UI.Page page, string msg)
 {
     page.ClientScript.RegisterStartupScript(page.GetType(), "ajaxjs", string.Format("alert('{0}')", msg), true);
 }
Пример #51
0
 /// <summary>
 /// 输出自定义脚本信息
 /// </summary>
 /// <param name="script">输出脚本</param>
 public static void RegisterScript(System.Web.UI.Page page, string script)
 {
     page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script  language='javascript'>" + script + "</script>");
 }
Пример #52
0
 /// <summary>
 /// 信息询问
 /// </summary>
 /// <param name="msg">信息内容</param>
 /// <param name="urla">确定后跳页面</param>
 /// <param name="urlb">取消后跳页面</param>
 /// <param name="target">页面跳转框架</param>
 protected static void JboxShowConfirm(System.Web.UI.Page page, string msg, string urla, string urlb)
 {
     JboxShowConfirm(page, msg, urla, urlb, "window");
 }
Пример #53
0
    /// <summary>
    /// 提供訊息,For AJAX ,只能在aspx.cs中使用

    /// </summary>
    /// <param name="webPage">傳 this</param>
    /// <param name="key">Key</param>
    /// <param name="AlertMessage">Message</param>
    protected void DoAlertinAjax(System.Web.UI.Page webPage, string key, string AlertMessage)
    {
        ScriptManager.RegisterStartupScript(webPage, GetType(), key, "alert('" + AlertMessage.Replace("'", "\\'").Replace("\r\n", "") + "');", true);
    }
Пример #54
0
 /// <summary>
 /// 输出jbox效果
 /// </summary>
 /// <param name="page">页面对象</param>
 /// <param name="msg">信息提示</param>
 /// <param name="url">跳转地址</param>
 protected static void JboxShow(System.Web.UI.Page page, string msg, string url)
 {
     JboxShow(page, msg, url, "window");
 }
Пример #55
0
        public static bool SaveExcel_Fb1(string fileName, DataSet oDS, System.Web.UI.Page PG, string path)
        {
            try
            {
                Aspose.Cells.License li = new Aspose.Cells.License();
                string _path            = PG.Server.MapPath("Common/scripts/License.lic");
                li.SetLicense(_path);
                Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();

                Aspose.Cells.Style style2 = workbook.Styles[workbook.Styles.Add()]; //新增样式
                style2.HorizontalAlignment = TextAlignmentType.Center;              //文字居中
                style2.Font.Name           = "宋体";                                  //文字字体
                style2.Font.Size           = 14;                                    //文字大小
                style2.Font.IsBold         = true;                                  //粗体
                style2.IsTextWrapped       = true;                                  //单元格内容自动换行
                style2.Borders[BorderType.LeftBorder].LineStyle   = CellBorderType.Thin;
                style2.Borders[BorderType.RightBorder].LineStyle  = CellBorderType.Thin;
                style2.Borders[BorderType.TopBorder].LineStyle    = CellBorderType.Thin;
                style2.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;

                Aspose.Cells.Style style3 = workbook.Styles[workbook.Styles.Add()]; //新增样式
                style3.HorizontalAlignment = TextAlignmentType.Center;              //文字居中
                style3.Font.Name           = "宋体";                                  //文字字体
                style3.Font.Size           = 12;                                    //文字大小
                style3.Borders[BorderType.LeftBorder].LineStyle   = CellBorderType.Thin;
                style3.Borders[BorderType.RightBorder].LineStyle  = CellBorderType.Thin;
                style3.Borders[BorderType.TopBorder].LineStyle    = CellBorderType.Thin;
                style3.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;


                for (int k = 0; k < oDS.Tables.Count; k++)
                {
                    Aspose.Cells.Worksheet cellSheet = workbook.Worksheets.Add(oDS.Tables[k].TableName);

                    for (int i = 0; i < oDS.Tables[k].Columns.Count; i++)
                    {
                        cellSheet.Cells[0, i].PutValue(oDS.Tables[k].Columns[i].ColumnName);
                        cellSheet.Cells[0, i].SetStyle(style2);
                    }


                    if (oDS.Tables[k].Rows.Count > 0)
                    {
                        for (int i = 0; i < oDS.Tables[k].Rows.Count; i++)
                        {
                            for (int j = 0; j < oDS.Tables[k].Columns.Count; j++)
                            {
                                cellSheet.Cells[1 + i, j].PutValue(oDS.Tables[k].Rows[i][j].ToString());
                                cellSheet.Cells[1 + i, j].SetStyle(style3);
                            }
                        }
                    }
                }

                workbook.Save(path);

                return(true);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
 public static void MostrarModal(System.Web.UI.Page page, string NombreModal, string Titulo)
 {
     ScriptManager.RegisterStartupScript(page, page.GetType(), "Popup", $"{NombreModal}('{ Titulo }');", true);
 }
Пример #57
0
 public static void ClientAlert(System.Web.UI.Page page, string message)
 {
     page.ClientScript.RegisterStartupScript(page.GetType(), "alert", "alert('" + message + "');", true);
 }
Пример #58
0
 public void DisableWebFormsScriptRendering(System.Web.UI.Page page)
 {
     _action(page);
 }
Пример #59
0
 /// <summary>
 /// Init
 /// </summary>
 /// <param name="page"></param>
 protected override void Init(System.Web.UI.Page page)
 {
     page.Load += new EventHandler(PageLoadHandler);
     page.PreRenderComplete += new EventHandler(page_PreRenderComplete);
 }
Пример #60
0
 /// <summary>
 /// 信息提示
 /// </summary>
 /// <returns></returns>
 public static bool ShowMessage(System.Web.UI.Page page, Type type, string message)
 {
     page.ClientScript.RegisterStartupScript(type, "message", "<script defer>alert('" + message + "')</script>");
     return(true);
 }