protected void Page_Load(object sender, EventArgs e) { base.PageBase_Load(sender, e); /*根据状态和数据获取主档的操作按钮*/ dt_rb = Fun.getdtByJson(Fun.getJson(json, "P5")); req_url = BaseFun.getAllHyperLinks(RequestXml, "<URL>", "</URL>")[0].Value; objid = BaseFun.getAllHyperLinks(RequestXml, "<KEY>", "</KEY>")[0].Value; }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); Stream RequestStream = Request.InputStream; StreamReader RequestStreamReader = new StreamReader(RequestStream); RequestXml = RequestStreamReader.ReadToEnd(); RequestStream.Close(); menu_id = BaseFun.getAllHyperLinks(RequestXml, "<MENU_ID>", "</MENU_ID>")[0].Value; dt_A002 = Fun.getDtBySql("Select * From A002 t Where T.MENU_ID = '" + menu_id + "'"); }
protected void Page_Load(object sender, EventArgs e) { RespXml = "0"; try { Stream RequestStream = Request.InputStream; StreamReader RequestStreamReader = new StreamReader(RequestStream); RequestXml = RequestStreamReader.ReadToEnd(); RequestStream.Close(); try { try { ConnectString = BaseFun.getAllHyperLinks(RequestXml, "<CONNSTR>", "</CONNSTR>")[0].Value; execsql = BaseFun.getAllHyperLinks(RequestXml, "<EXECSQL>", "</EXECSQL>")[0].Value; } catch (Exception ex) { RespXml = "Error Xml"; } if (execsql != string.Empty && execsql.Length > 10) { Udb.Oracle db = new Udb.Oracle(ConnectString, true); db.BeginTransaction(); execsql = execsql.Trim(); int lidb = db.ExecuteNonQuery(execsql, CommandType.Text); if (lidb < 0) { RespXml = db.ErrorMsg; } else { db.Commit(); } } } catch (Exception ex) { RespXml = ex.Message; } } catch (Exception ex) { RespXml = ex.Message; return; } RespXml = RespXml.Replace("\n", ";").Replace("'", "\"").Replace(Environment.NewLine, "\""); Response.Write(RespXml); }
protected void Page_Load(object sender, EventArgs e) { base.PageBase_Load(sender, e); /*根据状态和数据获取主档的操作按钮*/ dt_rb = Fun.getdtByJson(Fun.getJson(json, "P5")); try { dt_print = Fun.getdtByJson(Fun.getJson(json, "P8")); } catch { } req_url = BaseFun.getAllHyperLinks(RequestXml, "<URL>", "</URL>")[0].Value; objid = BaseFun.getAllHyperLinks(RequestXml, "<KEY>", "</KEY>")[0].Value; selectrowlist = BaseFun.getAllHyperLinks(RequestXml, "<ROWID>", "</ROWID>")[0].Value; }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); Stream RequestStream = Request.InputStream; StreamReader RequestStreamReader = new StreamReader(RequestStream); RequestXml = RequestStreamReader.ReadToEnd(); RequestStream.Close(); menu_id = BaseFun.getAllHyperLinks(RequestXml, "<MENU_ID>", "</MENU_ID>")[0].Value; line_no = BaseFun.getAllHyperLinks(RequestXml, "<LINE_NO>", "</LINE_NO>")[0].Value; col_line_no = BaseFun.getAllHyperLinks(RequestXml, "<COL_LINE_NO>", "</COL_LINE_NO>")[0].Value; rowlist = BaseFun.getAllHyperLinks(RequestXml, "<ROWLIST>", "</ROWLIST>")[0].Value; mainrowlist = BaseFun.getAllHyperLinks(RequestXml, "<MAINROWLIST>", "</MAINROWLIST>")[0].Value; colid = BaseFun.getAllHyperLinks(RequestXml, "<COLID>", "</COLID>")[0].Value; dt_A00201 = Fun.getDtBySql("select * from A00201_V01 t Where t.Menu_Id='" + menu_id + "' And t.Line_No=" + line_no); dt_A10001 = Fun.getDtBySql("Select * From a10001 t Where t.table_id='" + dt_A00201.Rows[0]["TABLE_ID"].ToString() + "'"); }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); Stream RequestStream = Request.InputStream; StreamReader RequestStreamReader = new StreamReader(RequestStream); RequestXml = RequestStreamReader.ReadToEnd(); RequestStream.Close(); menu_id = BaseFun.getAllHyperLinks(RequestXml, "<MENU_ID>", "</MENU_ID>")[0].Value; line_no = BaseFun.getAllHyperLinks(RequestXml, "<LINE_NO>", "</LINE_NO>")[0].Value; string key = BaseFun.getAllHyperLinks(RequestXml, "<KEY>", "</KEY>")[0].Value; dt_a002 = Fun.getDtBySql("Select t.* From a002 t Where t.menu_id='" + menu_id + "'"); dt_a00201 = Fun.getDtBySql("Select t.* From a00201 t Where t.menu_id='" + menu_id + "' And t.line_no='" + line_no + "'"); dt_a10001 = Fun.getDtBySql("select * from a10001 where table_id='" + dt_a00201.Rows[0]["TABLE_ID"].ToString() + "' Order By COL_X"); dt_temp = Fun.getDtBySql("select * from " + dt_a00201.Rows[0]["TABLE_ID"].ToString() + " t where t." + dt_a002.Rows[0]["MIAN_KEY"].ToString() + "='" + key + "' " + dt_a00201.Rows[0]["SORT_COL"].ToString()); }
protected void Page_Load(object sender, EventArgs e) { Stream RequestStream = Request.InputStream; StreamReader RequestStreamReader = new StreamReader(RequestStream); RequestXml = RequestStreamReader.ReadToEnd(); RequestStream.Close(); reqtype = BaseFun.getAllHyperLinks(RequestXml, "<REQTYPE>", "</REQTYPE>")[0].Value; if (reqtype == "HEQ_SAVE") { menu_id = BaseFun.getAllHyperLinks(RequestXml, "<MENU_ID>", "</MENU_ID>")[0].Value; dt_a00201 = Fun.getDtBySql("select * from A00201_V01 t Where t.Menu_Id='" + menu_id + "'"); dt_a00210 = Fun.getDtBySql("Select * From A00210 t Where t.menu_id='" + menu_id + "'"); } if (reqtype == "HEQ_NEW") { menu_id = BaseFun.getAllHyperLinks(RequestXml, "<MENU_ID>", "</MENU_ID>")[0].Value; A00201_Key = BaseFun.getAllHyperLinks(RequestXml, "<A00201KEY>", "</A00201KEY>")[0].Value; dt_a00201 = Fun.getDtBySql("select * from A00201_V01 t Where t.A00201_Key='" + A00201_Key + "'"); } }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); Stream RequestStream = Request.InputStream; StreamReader RequestStreamReader = new StreamReader(RequestStream); RequestXml = RequestStreamReader.ReadToEnd(); RequestStream.Close(); menu_id = BaseFun.getAllHyperLinks(RequestXml, "<MENU_ID>", "</MENU_ID>")[0].Value; dt_a00201 = Fun.getDtBySql("Select * From A00201_V01 t Where t.menu_id='" + menu_id + "' order by t.line_no"); pkg_name = dt_a00201.Rows[0]["PKG_NAME"].ToString(); if (pkg_name != "") { dt_btn = Fun.getDtBySql("select " + pkg_name + ".Checkbutton__('BTN_SAVE','','" + GlobeAtt.A007_KEY + "') as save," + pkg_name + ".Checkbutton__('BTN_DEL','','" + GlobeAtt.A007_KEY + "') as del from dual"); if (dt_btn.Rows.Count > 0) { f_save = dt_btn.Rows[0]["save"].ToString(); f_del = dt_btn.Rows[0]["del"].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { try { string u_select_sql = ""; PageRow = int.Parse(GlobeAtt.DetailRowS); MaxRow = int.Parse(GlobeAtt.QueryList_MaxRow); string if_main = dt_a00201.Rows[0]["if_main"].ToString(); string sort_col = dt_a00201.Rows[0]["sort_col"].ToString(); Boolean if_select = false; if (sort_col == null) { sort_col = ""; } ifinsertrow = Request.QueryString["IFINSERT"] == null ? "V" : Request.QueryString["IFINSERT"].ToString(); /*新增*/ main_key_value = BaseFun.getAllHyperLinks(RequestXml, "<KEY>", "</KEY>")[0].Value; option = BaseFun.getAllHyperLinks(RequestXml, "<OPTION>", "</OPTION>")[0].Value; //调整dt_a013010101 的数据 if (dt_a013010101.Rows.Count > 0) { string a016_a016_enable = dt_a013010101.Rows[0]["a016_enable"].ToString(); DataTable dt = dt_a013010101.Clone(); dt.Clear(); //格式化列 for (int i = 0; i < dt_a013010101.Rows.Count; i++) { a016_a016_enable = dt_a013010101.Rows[i]["a016_enable"].ToString(); if (a016_a016_enable == "0" || a016_a016_enable == "1") { string A016_ENABLE = dt_a013010101.Rows[i]["A016_ENABLE"].ToString(); if (A016_ENABLE == "0") { dt_a013010101.Rows[i]["COL_ENABLE"] = "0"; } string A016_VISIBLE = dt_a013010101.Rows[i]["A016_VISIBLE"].ToString(); if (A016_VISIBLE == "0") { dt_a013010101.Rows[i]["COL_VISIBLE"] = "0"; } string A016_NECESSARY = dt_a013010101.Rows[i]["A016_NECESSARY"].ToString(); if (A016_NECESSARY == "1") { dt_a013010101.Rows[i]["COL_NECESSARY"] = "1"; } string a016_col_x = dt_a013010101.Rows[i]["a016_col_x"].ToString(); if (a016_col_x != null && a016_col_x != "") { dt_a013010101.Rows[i]["COL_X"] = decimal.Parse(a016_col_x); } string a016_bs_width = dt_a013010101.Rows[i]["a016_bs_width"].ToString(); string bs_width = dt_a013010101.Rows[i]["bs_width"].ToString(); if (a016_bs_width != null && a016_bs_width != "" && a016_bs_width != bs_width) { dt_a013010101.Rows[i]["bs_width"] = decimal.Parse(a016_bs_width); string bs_edit_width = dt_a013010101.Rows[i]["BS_EDIT_WIDTH"].ToString(); dt_a013010101.Rows[i]["BS_EDIT_WIDTH"] = decimal.Parse(bs_edit_width) + (decimal.Parse(a016_bs_width) - decimal.Parse(bs_width)); string col_width = dt_a013010101.Rows[i]["col_width"].ToString(); dt_a013010101.Rows[i]["col_width"] = decimal.Parse(col_width) + (decimal.Parse(a016_bs_width) - decimal.Parse(bs_width)); } } string col01 = dt_a013010101.Rows[i]["col01"].ToString().ToLower(); if (col01 == "1") { if_select = true; string COLUMN_ID = dt_a013010101.Rows[i]["COLUMN_ID"].ToString(); string line_no = dt_a013010101.Rows[i]["LINE_NO"].ToString(); string select_sql_ = dt_a013010101.Rows[i]["SELECT_SQL"].ToString(); select_sql_ = select_sql_.Replace("[A007_KEY]", GlobeAtt.A007_KEY); select_sql_ = select_sql_.Replace("[A30001_KEY]", GlobeAtt.A30001_KEY); select_sql_ = select_sql_.Replace("[USER_ID]", GlobeAtt.A007_KEY); select_sql_ = select_sql_.Replace("[MAIN_KEY]", main_key_value); dt_temp = Fun.getDtBySql(select_sql_); //sql string BS_HTML_ = dt_a013010101.Rows[i]["BS_HTML"].ToString(); string col10 = dt_a013010101.Rows[i]["col10"].ToString(); string col_X = dt_a013010101.Rows[i]["COL_X"].ToString(); for (int j = 0; j < dt_temp.Rows.Count; j++) { string id = dt_temp.Rows[j][0].ToString(); string name = dt_temp.Rows[j][1].ToString(); DataRow dr = dt_a013010101.NewRow(); dr = dt_a013010101.Rows[i]; dr["COLUMN_ID"] = COLUMN_ID + id; dr["COL_TEXT"] = name; dr["COL_X"] = double.Parse(col_X) + 0.0001 * j; dr["A10001_KEY"] = int.Parse(line_no) * 1000 + j; string BS_HTML = BS_HTML_.Replace("[" + COLUMN_ID + "]", "[" + COLUMN_ID + id + "]"); BS_HTML = BS_HTML.Replace("[" + dt_temp.Columns[0].ToString().ToUpper() + "]", id); dr["BS_HTML"] = BS_HTML; dt.ImportRow(dr); //替换列名称 u_select_sql = u_select_sql + col10.Replace("[" + dt_temp.Columns[0].ToString().ToUpper() + "]", id) + " as " + COLUMN_ID + id + ","; } } else { dt.ImportRow(dt_a013010101.Rows[i]); } } dt_a013010101 = dt; DataRow[] rows = dt_a013010101.Select("", "COL_X asc"); DataTable t = dt_a013010101.Clone(); t.Clear(); foreach (DataRow row in rows) { t.ImportRow(row); } dt_a013010101 = t; } if (option == "Q") { PageRow = int.Parse(GlobeAtt.QueryList_PageRow); string PageRow_ = dt_a00201.Rows[0]["pagerows"].ToString(); if (PageRow_ != null && PageRow_ != "") { PageRow = int.Parse(PageRow_); } } else { string PageRow_ = dt_a00201.Rows[0]["pagerows"].ToString(); if (PageRow_ != null && PageRow_ != "") { PageRow = int.Parse(PageRow_); } } try { PageNum = int.Parse(BaseFun.getAllHyperLinks(RequestXml, "<PageNum>", "</PageNum>")[0].Value); } catch { PageNum = 1; } string data_sql = ""; string con_sql = ""; if (option != "Q") { if (option == "I") { con_sql = con_sql + " AND 1=2"; } else { if (dt_a00201.Rows[0]["if_main"].ToString() != "1") { if (dt_a00201.Rows[0]["MAIN_KEY"].ToString() != "") { con_sql = con_sql + " AND " + dt_a00201.Rows[0]["MAIN_KEY"].ToString() + "='" + main_key_value + "'"; } else { con_sql = con_sql + " AND " + dt_a00201.Rows[0]["TABLE_KEY"].ToString() + "='" + main_key_value + "'"; } } } } else { // showdatasql = replace_getShowDataSql(dt_a013010101, showdatasql, u_select_sql); if (PageNum <= 0) { string RETRIEVE = dt_a00201.Rows[0]["RETRIEVE"].ToString(); if (RETRIEVE != "1") { con_sql = con_sql + " AND 1=2"; } } string A002ID = BaseFun.getAllHyperLinks(RequestXml, "<A002ID>", "</A002ID>")[0].Value; if (a00201_key != A002ID) { option = "V"; con_sql = con_sql + " AND " + dt_a00201.Rows[0]["MAIN_KEY"].ToString() + "='" + main_key_value + "'"; } //if (RequestURL.ToUpper().IndexOf("QUERYDATA.ASPX") > 0 && main_key_value != "") //{ // con_sql = con_sql + " AND " + dt_a00201.Rows[0]["TABLE_KEY"].ToString() + "='" + main_key_value + "'"; //} } if (option == "Q") { con_sql = con_sql + " AND ROWNUM <=" + dt_a00201.Rows[0]["MAXROWS"].ToString(); } int pos = showdatasql.IndexOf("ORDER BY"); string str_order = ""; if (pos > 0) { str_order = " " + showdatasql.Substring(pos); showdatasql = showdatasql.Substring(0, pos - 1); } else { str_order = " " + sort_col; } data_sql = showdatasql + con_sql + str_order; getShowDataCountSql = getShowDataCountSql + con_sql; data_sql = data_sql.Replace("[MAIN_KEY]", main_key_value); getShowDataCountSql = getShowDataCountSql.Replace("[MAIN_KEY]", main_key_value); /*把查询的写日志记录到A00601中*/ if (GlobeAtt.BS_LOG_SELECTSQL == "1") { string log_sql = "pkg_a.saveQuerySql('" + GlobeAtt.A007_KEY + "', '" + a00201_key + "' , '" + data_sql.Replace("'", "''") + "','" + main_key_value + "' ) "; try { Fun.saveQuerySql(a00201_key, data_sql, main_key_value, option); } catch (Exception ex) { log_sql = ex.Message; } } if (option != "Q") { if (if_select) { data_sql = "Select a.* , " + u_select_sql + " rownum as rn from (" + data_sql + ") a where rownum <= " + (PageNum * PageRow).ToString(); } else { data_sql = "Select a.* , rownum as rn from (" + data_sql + ") a where rownum <= " + (PageNum * PageRow).ToString(); } } else { data_sql = "Select a.* , rownum as rn from (" + data_sql + ") a where rownum <= " + (PageNum * PageRow).ToString(); } data_sql = "Select b.* from (" + data_sql + ") b where rn > " + ((PageNum - 1) * PageRow).ToString(); Session["QUERY" + a00201_key] = data_sql; DateTime ld = DateTime.Now; dt_data = Fun.getDtBySql(data_sql); double le = (DateTime.Now - ld).TotalSeconds; string sql_ = "Select pkg_show.geta00204('" + a00201_key + "','" + main_key_value + "','" + GlobeAtt.A007_KEY + "','0','" + option + "','" + status + "') as c from dual "; if (option == "Q") { sql_ = "Select pkg_show.geta00204('" + a00201_key + "','[LIST]','" + GlobeAtt.A007_KEY + "','1','Q') as c from dual "; } dt_a00204 = Fun.getDtBySql(sql_); double GRID_SECONDS = 5; try { GRID_SECONDS = double.Parse(GlobeAtt.GetValue("GRID_SECONDS")); } catch { GRID_SECONDS = 5; } if (le < GRID_SECONDS) { dt_temp = Fun.getDtBySql(getShowDataCountSql); try { rowscount = int.Parse(dt_temp.Rows[0][0].ToString()); } catch { rowscount = 0; } } else { if (dt_data.Rows.Count < PageRow) { rowscount = dt_data.Rows.Count; } else { rowscount = int.Parse(dt_a00201.Rows[0]["MAXROWS"].ToString()); } } pagecount = rowscount / PageRow; if (rowscount % PageRow > 0) { pagecount = pagecount + 1; } } catch (Exception ex) { Response.Write("ERROR URL:" + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { base.PageBase_Load(sender, e); try { IFSHOW = BaseFun.getAllHyperLinks(RequestXml, "<IFSHOW>", "</IFSHOW>")[0].Value; ROWID = BaseFun.getAllHyperLinks(RequestXml, "<ROWID>", "</ROWID>")[0].Value; ROWID = ROWID.Replace(a00201_key + "_", ""); } catch { IFSHOW = "0"; ROWID = "0"; } try { main_key_value = BaseFun.getAllHyperLinks(RequestXml, "<KEY>", "</KEY>")[0].Value; if (IFSHOW == "1") { rowlist = main_key_value; main_key_value = ""; } option = BaseFun.getAllHyperLinks(RequestXml, "<OPTION>", "</OPTION>")[0].Value; /*新增*/ string data_sql = ""; if (option == "I") { data_sql = showdatasql + " AND 1=2"; } else { string nullhead = "0"; try { nullhead = dt_a00201.Rows[0]["nullhead"].ToString(); } catch { nullhead = "0"; } if (nullhead != "1") { if (dt_a00201.Rows[0]["MAIN_KEY"].ToString() != "") { data_sql = showdatasql + " AND " + dt_a00201.Rows[0]["MAIN_KEY"].ToString() + "='" + main_key_value + "'"; } else { data_sql = showdatasql + " AND " + dt_a00201.Rows[0]["TABLE_KEY"].ToString() + "='" + main_key_value + "'"; } } else { data_sql = showdatasql; } //判断用户有没有菜单的权限 string show_condition = dt_a00201.Rows[0]["SHOW_CONDITION"].ToString(); if (show_condition == null) { show_condition = ""; } if (show_condition.Length > 1) { show_condition = show_condition.Replace("[MAIN_KEY]", main_key_value); if (show_condition.Trim().ToLower().IndexOf("and") != 0) { show_condition = " AND " + show_condition; } data_sql = data_sql + show_condition; } } if (IFSHOW == "1") { data_sql = data_sql + " AND 1=2"; } /*把查询的写日志记录到A00601中*/ if (GlobeAtt.BS_LOG_SELECTSQL == "1") { string log_sql = "pkg_a.saveQuerySql('" + GlobeAtt.A007_KEY + "', '" + a00201_key + "' , '" + data_sql.Replace("'", "''") + "','" + main_key_value + "' ) "; // Fun.execSqlOnly(log_sql); try { Fun.saveQuerySql(a00201_key, data_sql, main_key_value, option); } catch { } } Session["QUERY" + a00201_key] = data_sql; dt_data = Fun.getDtBySql(data_sql); if (dt_data.Rows.Count == 0) { DataRow dr = dt_data.NewRow(); dt_data.Rows.Add(dr); } } catch (Exception ex) { Response.Write("ERROR URL"); } }
public void PageBase_Load(object sender, System.EventArgs e) { if (GlobeAtt.A007_KEY == "") { Response.Write("showlogin();"); return; } try { Stream RequestStream = Request.InputStream; StreamReader RequestStreamReader = new StreamReader(RequestStream); RequestXml = RequestStreamReader.ReadToEnd(); RequestStream.Close(); a00201_key = BaseFun.getAllHyperLinks(RequestXml, "<A00201KEY>", "</A00201KEY>")[0].Value; try { RequestURL = BaseFun.getAllHyperLinks(RequestXml, "<URL>", "</URL>")[0].Value; } catch { RequestURL = ""; } } catch (Exception ex) { a00201_key = "-1"; return; } // a00201_key = Request.QueryString["A00201KEY"] == null ? "-1" : Request.QueryString["A00201KEY"].ToString(); if (a00201_key == "-1") { return; } try { json = Session["JSON_" + a00201_key].ToString(); } catch { json = ""; } if (GlobeAtt.SYS_MODE == "K") { json = ""; } if (json == "") { Hashtable ht = new Hashtable(); dt_a013010101 = Fun.getA013010101(a00201_key); dt_a00201 = Fun.getDtBySql("Select t.* from A00201_V01 t where a00201_key = '" + a00201_key + "' order by line_no "); //列属性 ht.Add("P1", Fun.DataTable2Json(dt_a013010101)); //菜单属性 ht.Add("P2", Fun.DataTable2Json(dt_a00201)); //数据检测属性 if (dt_a00201.Rows[0]["IF_MAIN"].ToString() == "1") { ht.Add("P3", Fun.DataTable2Json(Fun.getDtBySql("select t.* from A00210_V01 t where menu_id ='" + dt_a00201.Rows[0]["MENU_ID"].ToString() + "' and rb_type='C'"))); ht.Add("P4", Fun.DataTable2Json(Fun.getDtBySql("select t.* from A00210_V01 t where menu_id ='" + dt_a00201.Rows[0]["MENU_ID"].ToString() + "' and rb_type='U'"))); ht.Add("P9", Fun.DataTable2Json(Fun.getDtBySql("select t.* from A00201_V01 t where menu_id ='" + dt_a00201.Rows[0]["MENU_ID"].ToString() + "' order by line_no"))); } //右键属性 ht.Add("P5", Fun.DataTable2Json(Fun.getDtBySql("select t.* from a00201_v02 t where a00201_key ='" + a00201_key + "' order by sort_by"))); //查询数据的SQL showdatasql = Fun.getShowDataSql(a00201_key); ht.Add("P6", showdatasql); //查询数据数量的SQL getShowDataCountSql = Fun.getShowDataCountSql(a00201_key); ht.Add("P7", getShowDataCountSql); //打印列表 if (dt_a00201.Rows[0]["if_main"].ToString() == "1") { ht.Add("P8", Fun.DataTable2Json(Fun.getDtBySql("select t.* from A00205 t where menu_id ='" + dt_a00201.Rows[0]["menu_id"].ToString() + "' order by sort_by"))); } else { ht.Add("P8", ""); } string form_init = dt_a00201.Rows[0]["FORM_INIT"].ToString(); ht.Add("P10", form_init); string jsonText = JsonConvert.SerializeObject(ht); Session["JSON_" + a00201_key] = jsonText; json = jsonText; } else { dt_a013010101 = Fun.getdtByJson(Fun.getJson(json, "P1")); dt_a00201 = Fun.getdtByJson(Fun.getJson(json, "P2")); showdatasql = Fun.getJson(json, "P6"); getShowDataCountSql = Fun.getJson(json, "P7"); } try { QUERYID = BaseFun.getAllHyperLinks(RequestXml, "<QUERYID>", "</QUERYID>")[0].Value; } catch { QUERYID = ""; } string condition = ""; if (QUERYID != "") { condition = Fun.getQueryCondition(dt_a00201, QUERYID); int pos = condition.IndexOf("ORDER BY"); string str_order = ""; if (pos > 0) { str_order = condition.Substring(pos); condition = condition.Substring(0, pos - 1); } showdatasql = showdatasql + condition + " " + str_order; getShowDataCountSql = getShowDataCountSql + condition; } string url = ""; try { url = BaseFun.getAllHyperLinks(RequestXml, "<URL>", "</URL>")[0].Value; } catch { url = ""; } if (url.IndexOf("?") > 0) { int pos = url.IndexOf("?"); url = url.Substring(pos + 1); string[] data_ = url.Split('&'); for (int i = 0; i < data_.Length; i++) { string[] data1_ = data_[i].Split('='); showdatasql = showdatasql.Replace("[REQUEST_" + data1_[0] + "]", data1_[1]); getShowDataCountSql = getShowDataCountSql.Replace("[REQUEST_" + data1_[0] + "]", data1_[1]); } } }
protected void Page_Load(object sender, EventArgs e) { ReturnCode = "0"; try { Stream RequestStream = Request.InputStream; StreamReader RequestStreamReader = new StreamReader(RequestStream); RequestXml = RequestStreamReader.ReadToEnd(); RequestStream.Close(); } catch (Exception ex) { ReturnCode = "-1"; ReturnMessage = "错误报文格式!"; Error_Resp("0", "errorresp"); return; } string clientip = Fun.getClientIp(); // '&' (ampersand) becomes '&' RequestXml = RequestXml.Replace("&", "&"); //'"' (double quote) becomes '"' when ENT_NOQUOTES is not set. RequestXml = RequestXml.Replace(""", "\""); //''' (single quote) becomes ''' only when ENT_QUOTES is set. RequestXml = RequestXml.Replace("'", "'"); //'<' (less than) becomes '<' RequestXml = RequestXml.Replace("<", "<"); //'>' (greater than) becomes '>' RequestXml = RequestXml.Replace(">", ">"); SaveLog.Verification(clientip + ":" + RequestXml); //获取MessageName try { MessageName = BaseFun.getAllHyperLinks(RequestXml, "<messagename>", "</messagename>")[0].Value; MessageName = MessageName.Substring(0, MessageName.Length - 3); } catch (Exception ex) { ReturnCode = "-1"; ReturnMessage = "错误报文格式(-1)!"; Error_Resp("0", "errorresp"); return; } try { //检测报文消息的有效性 string sql = "Select t.* from A319 t where a319_id='" + MessageName + "'"; DataTable dt_a319 = new DataTable(); dt_a319 = Fun.getDtBySql(sql); if (dt_a319.Rows.Count == 0) { ReturnCode = "-1"; ReturnMessage = "错误报文格式(-2)!" + MessageName + sql; Error_Resp("0", MessageName); return; } if (dt_a319.Rows[0]["A319_TYPE"].ToString() == "0") { ReturnCode = "-1"; ReturnMessage = "错误报文格式(-3)!" + MessageName; Error_Resp("0", MessageName); return; } //检测报文状态失败有效 if (dt_a319.Rows[0]["STATE"].ToString() != "1") { ReturnCode = "-1"; ReturnMessage = "错误报文格式(-4)!" + MessageName; Error_Resp("0", MessageName); return; } //检测客户端的有效性 sql = dt_a319.Rows[0]["REQSQL"].ToString(); if (sql.Length > 10) { sql = sql.Replace("[CLIENTIP]", clientip); DataTable dt_temp = new DataTable(); dt_temp = Fun.getDtBySql(sql); if (dt_temp.Rows.Count <= 0) { ReturnCode = "-1"; ReturnMessage = "错误的客户端地址!" + MessageName; Error_Resp("0", MessageName); return; } } sql = "Select s_a31902 .nextval as c from dual"; DataTable dt = new DataTable(); dt = Fun.getDtBySql(sql); if (dt.Rows.Count <= 0) { ReturnCode = "-1"; ReturnMessage = "获取日志编码失败!" + MessageName; Error_Resp("0", MessageName); return; } log_key = dt.Rows[0][0].ToString(); //开始写日志 OracleParameter[] parmeters = { new OracleParameter("Messagename_", OracleType.NVarChar, 200), new OracleParameter("A31902_Line_", OracleType.NVarChar, 200), new OracleParameter("User_Id_", OracleType.NVarChar, 200), new OracleParameter("Requestxml_", OracleType.Clob) }; parmeters[0].Direction = ParameterDirection.Input; parmeters[1].Direction = ParameterDirection.Input; parmeters[2].Direction = ParameterDirection.Input; parmeters[0].Value = MessageName; parmeters[1].Value = log_key; parmeters[2].Value = clientip; parmeters[3].Value = RequestXml; //写日志 int li_db = 0; Fun.db.db_oracle.BeginTransaction(); try { li_db = Fun.db.db_oracle.ExecuteNonQuery("Pkg_a319_api.Save_Xml_", parmeters); //db.ExecuteNonQuery(str_sql, CommandType.Text); if (li_db < 0) { Fun.db.db_oracle.Rollback(); ReturnCode = "-1"; ReturnMessage = "记录日志失败!" + MessageName; Error_Resp("0", MessageName); return; } } catch (Exception ex) { Fun.db.db_oracle.Rollback(); ReturnCode = "-1"; ReturnMessage = BaseFun.GetOracleMsg(ex.Message); Error_Resp("0", MessageName); return; } Fun.db.db_oracle.Commit(); //处理报文 OracleParameter[] parm = { new OracleParameter("A31902_Line_", OracleType.NVarChar, 200) }; parm[0].Direction = ParameterDirection.Input; parm[0].Value = log_key; //写日志 Fun.db.db_oracle.BeginTransaction(); try { li_db = Fun.db.db_oracle.ExecuteNonQuery("Pkg_a319_api.Req_xml_", parm); //db.ExecuteNonQuery(str_sql, CommandType.Text); if (li_db < 0) { Fun.db.db_oracle.Rollback(); ReturnCode = "-1"; ReturnMessage = "处理失败!" + MessageName; Error_Resp("0", MessageName); return; } } catch (Exception ex) { Fun.db.db_oracle.Rollback(); ReturnCode = "-1"; ReturnMessage = BaseFun.GetOracleMsg(ex.Message); Error_Resp("0", MessageName); return; } Fun.db.db_oracle.Commit(); // responsexml = parmeters[1].Value.ToString(); try { DataTable dt_send = new DataTable(); dt_send = Fun.getDtBySql("select t.sendxml from a31902 t where line_no=" + log_key); Response.Write(dt_send.Rows[0][0].ToString()); } catch { ReturnCode = "-1"; ReturnMessage = "处理失败!" + MessageName; Error_Resp("0", MessageName); } } catch { ReturnCode = "-1"; ReturnMessage = "处理失败!" + MessageName; Error_Resp("0", MessageName); } }