/// ************************************************************************************************* /// <summary> /// 09/22/2015 16:39 version /// Website-Design Xml File is mapped to Object, then passed to WebServices as a JSON string. /// </summary> /// <param name="doc">Imported file content read as an XmlDocument</param> /// <param name="fName">File name (excluding path section)</param> /// <returns>Process status true if procees was completed ok, else false</returns> /// ------------------------------------------------------------------------------------------------- bool IXmlFiles.ProcessWebsiteDesignFiles(XmlDocument doc, string fName, EtlTimer syncRow) { //WebServiceManager wsm = new WebServiceManager(); DAL.SupportServices.SupportServices wsm = new DAL.SupportServices.SupportServices(); WebDesign des = new WebDesign(); ServiceResponse rStatus = new ServiceResponse(); /// ---------------------------------------------------------------------- // Design section /// ---------------------------------------------------------------------- des.OrderType = "nbi"; XmlNode design = doc.DocumentElement.SelectSingleNode("/design"); des.StyleNum = dat.AttributeValidation_String(design, "stylenum", 0); des.DesignID = dat.AttributeValidation_String(design, "designid", 0); des.TimeStamp = dat.AttributeValidation_Date(design, "timestamp"); /// ---------------------------------------------------------------------- // Specs Section /// ---------------------------------------------------------------------- XmlNode specs = doc.DocumentElement.SelectSingleNode("/design/specs"); des.Proof = dat.AttributeValidation_String(specs, "proof", 0); des.lines = dat.AttributeValidation_String(specs, "lines", 0); des.Fitting = dat.AttributeValidation_String(specs, "fitting", 0); des.Bar = dat.AttributeValidation_String(specs, "bar", 0); des.Vinyl = dat.AttributeValidation_String(specs, "vinyl", 0); des.Code = dat.AttributeValidation_String(specs, "code", 0); /// ---------------------------------------------------------------------- // Background Section /// ---------------------------------------------------------------------- XmlNode background = doc.DocumentElement.SelectSingleNode("/design/background"); des.Src = dat.AttributeValidation_String(background, "src", 0); /// ------dat.---------------------------------------------------------------- // Contacdat.t (account) section process /// ---------------------------------------------------------------------- XmlNodeList frag = doc.DocumentElement.SelectNodes("/design/fragments/logo"); WebDesignFragments fragments = new WebDesignFragments(); foreach (XmlNode logo in frag) { fragments.Src = dat.AttributeValidation_String(logo, "src", 0); fragments.Top = dat.AttributeValidation_String(logo, "top", 0); fragments.Left = dat.AttributeValidation_String(logo, "left", 0); fragments.Height = dat.AttributeValidation_String(logo, "height", 0); fragments.Width = dat.AttributeValidation_String(logo, "width", 0); fragments.Index = dat.AttributeValidation_Int(logo, "index"); } des.logo = fragments; /// ---------------------------------------------------------------------- // Address Section Process - (Delivery) /// ---------------------------------------------------------------------- XmlNodeList Text = doc.DocumentElement.SelectNodes("/design/fragments"); List <WebDesignText> texts = new List <WebDesignText>(); foreach (XmlNode txt in Text) { XmlNodeList tNodes = doc.SelectNodes("/design/fragments/text"); foreach (XmlNode tNode in tNodes) { WebDesignText cnt1 = new WebDesignText(); // cnt1.Index = dat.AttributeValidation_Int(tNode, "index"); cnt1.Color = dat.AttributeValidation_String(tNode, "color", 0); cnt1.Size = dat.AttributeValidation_String(tNode, "size", 0); cnt1.Style = dat.AttributeValidation_String(tNode, "style", 0); cnt1.Font = dat.AttributeValidation_String(tNode, "font", 0); cnt1.Y = dat.AttributeValidation_String(tNode, "y", 0); cnt1.X = dat.AttributeValidation_String(tNode, "x", 0); cnt1.Content = dat.AttributeValidation_String(tNode, "content", 0); // texts.Add(cnt1); } } des.texts = texts; des.Filename = fName + ".xml"; string test = Newtonsoft.Json.JsonConvert.SerializeObject(des); /// ****************************************************************************** /// Call Web Service - "WebDesign" /// <param name="json2">Include Header serialized + items seialized info.</param> /// <param name="fname">File to process name </param> /// <param name="type">File Type, determine what service to use (url)</param> /// <returns>"rStatus" true if WebService was processed, else false</returns> /// Web service url is defined in the App.Config file /// ------------------------------------------------------------------------------ rStatus = wsm.ConsumeWebService(test, fName, syncRow.WebServiceDesigns, syncRow); // <============== return(rStatus.IsOk); }
private void Page_Load(object sender, EventArgs e) { string url = null; string str2 = null; XmlDocument xdoc = null; try { string str8; QuerySql sql; SqlToTree tree; str2 = base.Request.Params["key"]; if ((str2 == null) || (str2.Length == 0)) { str2 = base.Request.QueryString.ToString(); } if (str2 == "HelloWorld") { base.Response.ContentType = ("text/html;charset=UTF-8"); base.Response.Write("HelloWorld"); return; } Logger.debug("后台 key=" + str2); if (str2 == "logger") { string src = new StreamReader(base.Request.InputStream).ReadToEnd(); Logger.debug("前台:" + Escape.unescape(src)); return; } this.initConfigFileEbiao(base.Request); ConnectionConfig.initConfigFile(base.Request, this.Session); string str4 = null; string dsName = base.Request.Params["datasourceName"]; ConnectionConfig connConfig = null; connConfig = new ConnectionConfig(dsName); if (str2 == "DbToFile") { new DbStru(connConfig, null, base.Request).DbToFile(base.Response); return; } bool flag = ((((str2 == "loadFileStream") || (str2 == "getTempImage")) || ((str2 == "saveasExcelAll") || (str2 == "saveasExcel"))) || (((str2 == "saveasPdf") || (str2 == "run")) || ((str2 == "calcStr") || (str2 == "importExcel")))) || (str2 == "genHtmlFile"); RunReport report = new RunReport(base.Request, this.Session, connConfig.getDBOperator()); switch (str2) { case "loadFileStream": report.loadFileStream(base.Request, base.Response); return; case "getTempImage": report.getTempImage(base.Request, base.Response); return; case "saveasExcelAll": report.saveasExcel(base.Request, base.Response, false); return; case "saveasExcel": report.saveasExcel(base.Request, base.Response, true); return; case "saveasPdf": report.saveasPdf(base.Request, base.Response); return; case "run": url = report.run(base.Request); break; case "calcStr": url = report.calcStr(base.Request); break; case "importExcel": { string sDest = base.Request["excelfile"]; sDest = PathTool.getRealPath(base.Request, FileAction.basePath + sDest); string str7 = base.Request["spath"]; url = ImportExcel.FileConvert(PathTool.getRealPath(base.Request, FileAction.basePath + str7), sDest); break; } case "genHtmlFile": Logger.debug("开始成批运算报表:"); url = report.genHtmlFile(base.Request); break; } if (flag) { goto Label_0BE9; } if (((((str2 != "setSession") && (str2 != "getSession")) && ((str2 != "uploadFile") && (str2 != "readImage"))) && ((str2 != "readClob") && (str2 != "saveFile"))) && (str2 != "zkLoadMod")) { str4 = new StreamReader(base.Request.InputStream).ReadToEnd(); Logger.debug("XML串: " + str4); if ((str2 != "saveRunInfo") && (str2 != "readDomainRes")) { xdoc = new XmlDocument(); xdoc.LoadXml(str4); } } if (str2 != "loadingBatchAction") { goto Label_05FE; } StringBuilder builder = new StringBuilder("<root>"); int num = 0; Label_041D: if (num >= xdoc.DocumentElement.ChildNodes.Count) { goto Label_05E9; } XmlDocument document2 = new XmlDocument(); document2.LoadXml(xdoc.DocumentElement.ChildNodes.Item(num).OuterXml); try { dsName = xdoc.DocumentElement.ChildNodes.Item(num).Attributes["datasourceName"].Value; } catch (Exception) { } goto Label_0573; Label_048C: builder.Append(sql.fillcombox()); goto Label_055B; Label_04A0: if (str8 == "getDsns") { builder.Append(connConfig.getDsns()); } else if (str8 == "fc_select") { builder.Append(sql.fc_select()); } else if (str8 == "dataset_fields1") { builder.Append(sql.dataset_fields1()); } else if (str8 == "dataset_select") { builder.Append(sql.dataset_select()); } else if (str8 == "sqltotreedata") { builder.Append(tree.sqltotreedata()); } else if (str8 == "getTreeXml") { builder.Append(tree.getTreeXml()); } Label_055B: builder.Append("</root>"); num++; goto Label_041D; Label_0573: str8 = xdoc.DocumentElement.ChildNodes.Item(num).Attributes["key"].Value; connConfig = new ConnectionConfig(dsName); sql = new QuerySql(connConfig, document2, base.Request, this.Session); tree = new SqlToTree(connConfig, document2); builder.Append("<root>"); if (str8 != "fillcombox") { goto Label_04A0; } goto Label_048C; Label_05E9: builder.Append("</root>"); url = builder.ToString(); Label_05FE: if (str2 == "getDsns") { url = connConfig.getDsns(); } if (str2 == "isRunForm") { url = PermitForm.isRunForm(base.Request, this.Session, connConfig.getDBOperator()); } if (str2 == "isRunReport") { url = PermitReport.isRunReport(base.Request, this.Session, connConfig.getDBOperator()); } EbiaoFile file = new EbiaoFile(connConfig.getDBOperator(), xdoc, base.Request); if (str2 == "saveFile") { url = file.saveFile(); } if (str2 == "loadFile") { url = file.loadFile(); } if (str2 == "ToInDs") { url = file.ToInDs(); } QuerySql sql2 = new QuerySql(connConfig, xdoc, base.Request, this.Session); if (str2 == "fillcombox") { url = sql2.fillcombox(); } if (str2 == "sqltoxml") { url = sql2.sqltoxml(); } if (str2 == "SqlToField") { url = sql2.SqlToField(); } if (str2 == "fc_select") { url = sql2.fc_select(); } if (str2 == "dataset_fields1") { url = sql2.dataset_fields1(); } if (str2 == "dataset_select") { url = sql2.dataset_select(); } if (str2 == "doUploadInfo") { url = sql2.doUploadInfo(); } if (str2 == "crosstab") { url = sql2.crosstab(); } ExportData data = new ExportData(xdoc, base.Request, this.Session); if (str2 == "exportData") { data.run(); } ImportData data2 = new ImportData(base.Request, this.Session, connConfig); if (str2 == "importData") { url = data2.run(); } WebDesign design = new WebDesign(connConfig, xdoc, base.Request); if (str2 == "designdjsave") { url = design.designdjsave(); } if (str2 == "loadClob") { url = design.loadClob(); } cn.com.fcsoft.ajax.PathFile file2 = new cn.com.fcsoft.ajax.PathFile(xdoc); if (str2 == "GetUrl") { url = file2.GetUrl(base.Request); } DbStru stru2 = new DbStru(connConfig, xdoc, base.Request); if (str2 == "GetAllTables") { url = stru2.GetAllTables(); } if (str2 == "GetFieldName") { url = stru2.GetFieldName(); } if (str2 == "setDbStru") { url = stru2.setDbStru(); } SubmitData data3 = new SubmitData(connConfig, xdoc, base.Request, this.Session); if (str2 == "doSaveData") { url = data3.doSaveData(); } FileAction action = new FileAction(xdoc, base.Request); if (str2 == "readdesignhtml") { url = action.readdesignhtml(); } if (str2 == "savedesignhtml") { url = action.savedesignhtml(); } if (str2 == "genDjHtmlFile") { url = action.genDjHtmlFile(); } if (str2 == "GetFileContent") { url = action.GetFileContent(); } if (str2 == "DelUploadFile") { url = action.DelUploadFile(); } if (str2 == "uploadFile") { url = action.uploadFile(); } if (str2 == "fileExist") { url = action.fileExist(); } MaxNo no = new MaxNo(connConfig, xdoc, this.Session); if (str2 == "getMaxIntNo") { url = no.getMaxIntNo(); } if (str2 == "getRecnum") { url = no.getRecnum(); } if (str2 == "getAutoNum") { url = no.getAutoNum(); } SqlToTree tree2 = new SqlToTree(connConfig, xdoc); if (str2 == "sqltotreedata") { url = tree2.sqltotreedata(); } if (str2 == "getTreeXml") { url = tree2.getTreeXml(); } DoSession session = new DoSession(base.Request, this.Session); if (str2 == "setSession") { url = session.setSession(); } if (str2 == "getSession") { url = session.getSession(); } cn.com.fcsoft.ajax.ImageField field = new cn.com.fcsoft.ajax.ImageField(connConfig, base.Request); if (str2 == "readImage") { field.readImage(base.Response); } if (str2 == "writeImage") { url = field.writeImage(); } ClobField field2 = new ClobField(connConfig, base.Request); if (str2 == "readClob") { url = field2.readClob(); } if (str2 == "writeClob") { url = field2.writeClob(); } EformRole role = new EformRole { session = this.Session, request = base.Request, xdoc = xdoc, oDb = connConfig.getDBOperator() }; if (str2 == "roleSet") { url = role.roleSet(); } if (str2 == "roleCheckEmployee") { url = role.roleCheckEmployee(); } if (str2 == "getAllPubParamValue") { url = role.getAllPubParamValue(); } if (str2 == "batchExecSql") { if (EformRole.getPubParamValue(this.Session, "用户.ID") != "systemadmin") { throw new Exception("只有用户 admin 才有权做此操作!"); } string str10 = xdoc.DocumentElement.ChildNodes.Item(0).InnerText; DBOperator @operator = null; IDbCommand command = null; IDbTransaction transaction = null; try { @operator = connConfig.getDBOperator(); @operator.Open(); command = @operator.Connection.CreateCommand(); command.Connection = (@operator.Connection); transaction = @operator.Connection.BeginTransaction(); command.Transaction = (transaction); command.CommandText = (str10); command.ExecuteNonQuery(); transaction.Commit(); command.Dispose(); @operator.Close(); } catch (Exception exception) { try { transaction.Rollback(); } catch (Exception) { } throw exception; } finally { try { @operator.Close(); } catch (Exception) { } } } } catch (Exception exception2) { Logger.error(exception2.StackTrace); url = JSON.errInfoToJson(exception2); } Label_0BE9: if ((url != null) || (str2 != "readImage")) { /* * Bill.aspx?key=run&spath=/rpt/s_simplelist.htm&tempfilepath=/tmp/file/&pageno=1&cacheid=&e_paramid= * ebrun.htm?name=s_simplelist */ base.Response.ContentType = ("text/html;charset=UTF-8"); File.WriteAllText(@"E:\DB\PlatForm\FlexCell.NET\ebiao\bin\cleaned\src\Web\" + str2 + "_test.htm", url); base.Response.Write(url); } }