public void ResponseResult(string funcName, ProcessFileResult pfResult)
        {
            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.ContractResolver = new CamelCasePropertyNamesContractResolver();

            string json = ScriptHelper.CheckScriptString(JsonConvert.SerializeObject(pfResult, settings), false);

            string script = string.Format("{0}(\"{1}\")", funcName, json);

            script = string.Format("<script type=\"text/javascript\">\n    parent.{0}\n</script>", script);

            HttpResponse response = HttpContext.Current.Response;

            response.Write(script);

            response.Flush();
        }
        private static string GetChangeProcessInfoScript(ProcessProgress progress, string funcName, bool addScriptTag)
        {
            string json = JsonConvert.SerializeObject(new
            {
                minStep     = progress.MinStep,
                maxStep     = progress.MaxStep,
                currentStep = progress.CurrentStep,
                statusText  = progress.StatusText
            });

            json = ScriptHelper.CheckScriptString(json);

            string script = string.Format("{0}(\"{1}\")", funcName, json);

            if (addScriptTag)
            {
                script = string.Format("<script type=\"text/javascript\">\n    parent.{0}\n</script>", script);
            }

            return(script);
        }
Example #3
0
        protected void save_Click(object sender, EventArgs e)
        {
            try
            {
                this.bindingControl.CollectData(true);

                AMSEventSqlAdapter.Instance.HaveIntersectEvents(this.Data).TrueThrow(
                    "播放时间段{0:yyyy-MM-dd HH:mm}-{1:yyyy-MM-dd HH:mm}与别的事件重叠",
                    this.Data.StartTime, this.Data.EndTime);

                AMSEditEntityExecutor <AMSEvent> executor = new AMSEditEntityExecutor <AMSEvent>(
                    this.Data,
                    data => AMSEventSqlAdapter.Instance.Update(data),
                    AMSOperationType.EditEvent);

                executor.Execute();

                this.ClientScript.RegisterStartupScript(this.GetType(),
                                                        "back",
                                                        string.Format("top.document.getElementById(\"{0}\").click();", this.backUrl.ClientID),
                                                        true);
            }
            catch (System.Exception ex)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "Exception",
                                                        string.Format("top.$showError('{0}');", ScriptHelper.CheckScriptString(ex.Message, false)),
                                                        true);
            }
        }