Exemple #1
0
 /// <summary>
 /// 根据标准返回的xml判断是否执行成功
 /// </summary>
 /// <param name="doc">XmlDocument对象</param>
 /// <returns>是否成功</returns>
 public static Boolean IsSucceed(XmlDocument doc)
 {
     try
     {
         string strRet = XmlFun.getNodeValue(doc, Common.BAR2 + Common.XDOC_ERRORINFO + Common.BAR + Common.XDOC_ERRORRESULT);
         if (strRet != null)
         {
             if (strRet.Equals(Common.SRT_SUCCESS) || strRet.Equals(Common.RT_QUERY_SUCCESS))
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemple #2
0
 /// <summary>
 /// 获得返回节点的错误描述信息
 /// </summary>
 /// <param name="doc">XmlDocument对象</param>
 /// <returns>错误描述</returns>
 public static string getErrInfo(XmlDocument doc)
 {
     try
     {
         string nodePath = Common.XDOC_ROOT + Common.BAR + Common.XDOC_ERRORINFO + Common.BAR + Common.XDOC_FUNCERROR;
         return(XmlFun.getNodeValue(doc, nodePath));
     }
     catch (Exception e)
     {
         return("");
     }
 }
Exemple #3
0
    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)
            {
            }
        }
    }