protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { try{ string strXml = Request["txtXML"]; // strXml = XmlFun.addXDocHead(strXml); XmlDocument doc = XmlFun.CreateNewDoc(strXml); string strUsertitle = XmlFun.getNodeValue(doc, Common.BAR2 + Common.XDOC_LOGININFO + Common.BAR + Field.USERTITLE); string strPassWord = XmlFun.getNodeValue(doc, Common.BAR2 + Common.XDOC_LOGININFO + Common.BAR + Field.USERPASSWORD); string strIP = XmlFun.getNodeValue(doc, Common.BAR2 + Common.XDOC_LOGININFO + Common.BAR + Field.LOGINIP); string strMac = XmlFun.getNodeValue(doc, Common.BAR2 + Common.XDOC_LOGININFO + Common.BAR + Field.MAC); string str_SQL = "SELECT * FROM VW_USERLIST WHERE USERTITLE='" + strUsertitle + "'"; string strErr = ""; ReturnDoc Rtdoc = new ReturnDoc(); OleDbDataReader rst = null; string strRet = CommonQuery.qryRst(str_SQL, ref rst); if (strRet == "0") { Rtdoc.getQueryInfo(rst); if (strPassWord != Rtdoc.getNodeValue(Common.BAR2 + Field.USERPASSWORD)) { strErr = "密码错误"; } } else { strErr = "查询用户信息为空"; } rst.Close(); if (strErr == "") { UserSession user = new UserSession(Rtdoc.getXml()); string[] arrSys = { user.getUserID(), user.getUserTitle(), user.getUserName(), "", user.getUnitID(), user.getUnitName(), strIP, strMac }; string logid = SystemLog.addSysLog(arrSys); user.setLogID(logid); Session.Add("RoleUser", user); Response.Redirect("Login.aspx"); Response.End(); } else { Response.Write("<script language=\"javascript\">"); Response.Write("alert('" + strErr + "');"); Response.Write("history.back();"); Response.Write("</script>"); } } catch (Exception ex) { } } }
public static string getQueryXml(OleDbDataReader rst, string[] strDicFieldList, string[] strDicNameList, string[] strDateFieldList, int int_TotalRecords, int int_TotalPages, Boolean blnDicInSv, string strListName) { strListName = strListName == null ? Common.XDOC_ROW : strListName; ReturnDoc docReturn = new ReturnDoc(); try { if (docReturn.getQueryInfo(rst, strListName)) { XmlDocument doc = docReturn.getDocument(); XmlNodeList nodeList = doc.SelectNodes(Common.BAR2 + strListName); for (int k = 0; k < nodeList.Count; k++) { XmlNode node = (XmlElement)nodeList.Item(k); XmlElement node_Temp; /// 处理字典的翻译 DicCache obj_DicCache = DicCache.getInstance(); if (strDicFieldList != null) { for (int i = 0; i < strDicFieldList.Length; i++) { node_Temp = (XmlElement)node.SelectSingleNode(strDicFieldList[i]); string str_Text = node_Temp.InnerText; if (General.empty(str_Text)) { continue; } string str_SV = obj_DicCache.getText(strDicNameList[i], str_Text); if (!blnDicInSv) { if (str_SV != null) { node_Temp.InnerText = str_SV; } } else { if (str_SV != null) { node_Temp.SetAttribute(Common.XML_PROP_SV, str_SV); } } } } /// 处理日期类型的字段 if (strDateFieldList != null) { for (int i = 0; i < strDateFieldList.Length; i++) { node_Temp = (XmlElement)node.SelectSingleNode(strDateFieldList[i]); string str_Text = node_Temp.InnerText; if (General.empty(str_Text)) { continue; } string str_SV = General.cDateStr(str_Text); str_Text = General.strToDate(str_SV); node_Temp.InnerText = str_Text; if (blnDicInSv) { if (str_SV != null) { node_Temp.SetAttribute(Common.XML_PROP_SV, str_SV); } } } } } docReturn.addErrorResult(Common.RT_QUERY_SUCCESS); } else { docReturn.addErrorResult(Common.RT_QUERY_NOTHING); } docReturn.addPropToQueryInfo(Common.XML_PROP_TOTALPAGES, int_TotalPages.ToString()); docReturn.addPropToQueryInfo(Common.XML_PROP_RECORDS, int_TotalRecords.ToString()); } catch (Exception e) { } return(docReturn.getXml()); }