protected void Page_Load(object sender, EventArgs e) { string strResult = ""; if (null == this.Session["userid"]) { strResult = leofun.setvaltag("", "成功", "false"); strResult = leofun.setvaltag(strResult, "提示", "连接超时,请重新登录!"); this.Response.Write(leofun.Escape(strResult)); return; }else this.Response.Write(leofun.Escape(leofun.setvaltag("", "成功", "true"))); WSBits bitsTrans = new WSBits(); bitsTrans.TransFile(); return; }
protected void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 //读取用户参数 string strCommand = "",strDataItem=""; StreamReader streamreader=new StreamReader(this.Request.InputStream,Encoding.UTF8); //if (streamreader.ReadToEnd() == "") return; //try //{ this.xmlDocParam.LoadXml(streamreader.ReadToEnd()); //} //catch //{ // return; //} this.paramlist=BuildParamList.BuildParams(this.xmlDocParam); try { if (null==this.paramlist["UnitName"]) return; if (null==this.paramlist["Command"]) return; string unitName=this.paramlist["UnitName"].ToString(); strCommand = this.paramlist["Command"].ToString(); if (null==this.paramlist["DataItem"]) strDataItem = ""; else strDataItem = this.paramlist["DataItem"].ToString(); unitItem = new UnitItem(DataAccRes.AppSettings("WorkConfig"), unitName); //unitItem = new UnitItem(paramlist, unitName); } catch ( Exception ex ) { ExceptionManager.Publish( ex ); return; } string workItemName=""; if (null != paramlist["WorkItem"]) workItemName=paramlist["WorkItem"].ToString(); for (int i = 0; i < unitItem.WorkItemList.Length; i++) if (workItemName == unitItem.WorkItemList[i].ItemName) { workitem = unitItem.WorkItemList[i]; break; } if (workitem==null) { string strResult = leofun.setvaltag("", "成功", "false"); this.Response.Write(leofun.Escape(strResult)); return; } query = new QueryDataRes(unitItem.DataSrcFile); if (unitItem.DataSrcFile == unitItem.DictColSrcFile) dictQuery = query; else dictQuery = new QueryDataRes(unitItem.DictColSrcFile); switch (strCommand.ToLower()) { case "query": this.QueryData(strDataItem); break; case "queryincserialwatch": //this.QueryIncSerialWatch(); break; case "cmd_cmd": this.ExcutCmd(strDataItem); break; case "cmd_cmdbits": //首先执行命令,然后根据数据库表记录的需要备份文件列表,把列表传送给目地服务器,目地服务器调用后台智能传输服务备份文件。 //WSBits 是WebService对象,调用远程方法 this.ExcutCmd(strDataItem); QueryDataRes querySys = QueryDataRes.CreateQuerySys(); NameObjectList paramBits = new NameObjectList(); string struri = this.Request.Url.AbsoluteUri; paramBits["地址"] = struri.Substring(0, struri.IndexOf(this.Request.Url.LocalPath)); DataTable tabTrans = querySys.getTable("后台文件归档", paramBits); WSBits bitsTrans = new WSBits(); if (bitsTrans.AddFileList(tabTrans)) querySys.ExecuteDelete("后台文件归档", paramBits); break; case "switchmodel": bool bSucc = false; string strResult = ""; if (null != paramlist["WorkItem"] && "SetModel" == paramlist["WorkItem"].ToString()) bSucc = DataAccRes.SwitchModelConfig(strDataItem); else bSucc = DataAccRes.SwitchDefaultModel(); if (bSucc) strResult = leofun.setvaltag("", "成功", "true"); else { strResult = leofun.setvaltag("", "成功", "false"); strResult = leofun.setvaltag(strResult, "提示", "执行命令失败,请查找原因再重试!"); } this.Response.Write(leofun.Escape(strResult)); break; default: break; } }