Example #1
0
        /// <summary>
        /// 带事务执行SQL文:例子DataSet loginDS=sysConfig.exeusesql("Login.aspx.cs123",strsql,"DefaultSQL","dt");
        /// </summary>
        /// <param name="sql">SQL文</param>
        /// <param name="connectID">连接取"DefaultSQL","Oracle","Sybase"等值</param>
        /// <returns></returns>
        public static bool ExeuseSQL(string[] sql)
        {
            bool result = true;

            try
            {
                OraDB conspy = new OraDB();
                conspy.Open();
                conspy.BeginTransaction();
                try
                {
                    for (int i = 0; i < sql.Length; i++)
                    {
                        conspy.ExecSqlTrans(sql[i]);
                    }
                    conspy.Commit();
                }
                catch (Exception e)
                {
                    String lsError = e.Message;
                    conspy.Rollback();
                    result = false;
                }
                finally
                {
                    conspy.Close();
                }
            }
            catch (Exception e)
            {
                String lsError = e.Message;
                result = false;
            }
            return(result);
        }
Example #2
0
        /// <summary>
        /// 执行SQL文到DataSet:例子DataSet loginDS=sysConfig.exeusesql("Login.aspx.cs123",strsql,"DefaultSQL","dt");
        /// </summary>
        /// <param name="sql">SQL文</param>
        /// <param name="connectID">连接取"DefaultSQL","Oracle","Sybase"等值</param>
        /// <returns></returns>
        public static int SelectSQL(string strFileName, string sql, ref DataSet ds, ref string ErrorInfo)
        {
            int     iResult    = -1;
            string  strMyError = "";
            DataSet tempds     = new DataSet();

            try
            {
                //查看日志设置级别
                //if (sql.ToLower().StartsWith("select"))
                //{

                //}
                //else
                //{
                //    if (strFileName.StartsWith("UserONline.aspx"))
                //    {

                //    }
                //    else
                //    {
                //        DBlog(strFileName, connectID, sql);//打log
                //    }
                //}

                OraDB conspy = new OraDB();
                conspy.Open();
                iResult = conspy.SelectDataToDataSet(tempds, sql, ref strMyError);
                ds      = tempds.Copy();
                conspy.Close();
            }
            catch (Exception e)
            {
                //重新开始执行3次,如果失败就放弃



                //for (int i = 0; i < 3; i++)
                //{
                //    try
                //    {
                //        OLEDB  conspy = new OLEDB(connectID);
                //        conspy.Open();
                //        iResult = conspy.SelectDataToDataSet(tempds, sql, ref strMyError);
                //        conspy.Close();
                //        ds = tempds.Copy();
                //        break;
                //    }
                //    catch (Exception f)
                //    {
                //        ErrorInfo = f.Message;//设置错误信息
                //    }
                //}

                //DBErrorlog(strFileName, connectID, sql);//打log
                //DBErrorlog(strFileName, connectID, e.Message);
                //DBErrorlog(strFileName, "", "============================================================================================================");
            }
            return(iResult);
        }
Example #3
0
 /// <summary>
 /// 执行SQL文
 /// </summary>
 /// <param name="sql">SQL文</param>
 /// <param name="connectID">连接取"DefaultSQL","Oracle","Sybase"等值</param>
 /// <returns>返回结果,错误返回-1</returns>
 public static int ExecSQL(string strFileName, string sql, ref string ErrorInfo)
 {
     OraDB myol = new OraDB();
     myol.Open();
     int i = myol.ExecSQL(sql,ref  ErrorInfo);
     myol.Close();
     return i;
 }
Example #4
0
 public static int ExecSP(String SPName)
 {
     OraDB oledb = new OraDB();
     oledb.Open();
     int i = oledb.ExecSP(SPName);
     oledb.Close();
     return i;
 }
Example #5
0
        public static int ExecSP(String SPName)
        {
            OraDB oledb = new OraDB();

            oledb.Open();
            int i = oledb.ExecSP(SPName);

            oledb.Close();
            return(i);
        }
Example #6
0
        /// <summary>
        /// 执行SQL文

        /// </summary>
        /// <param name="sql">SQL文</param>
        /// <param name="connectID">连接取"DefaultSQL","Oracle","Sybase"等值</param>
        /// <returns>返回结果,错误返回-1</returns>
        public static int ExecSQL(string strFileName, string sql, ref string ErrorInfo)
        {
            OraDB myol = new OraDB();

            myol.Open();
            int i = myol.ExecSQL(sql, ref ErrorInfo);

            myol.Close();
            return(i);
        }
Example #7
0
        /// <summary>
        /// 执行SQL文到DataSet:例子DataSet loginDS=sysConfig.exeusesql("Login.aspx.cs123",strsql,"DefaultSQL","dt");
        /// </summary>
        /// <param name="strFileName"></param>
        /// <param name="sql"></param>
        /// <param name="ds"></param>
        /// <param name="ErrorInfo"></param>
        /// <returns></returns>
        public static int SelectSQL(string strFileName, string sql, ref DataSet ds, ref string ErrorInfo)
        {
            int     iResult    = -1;
            string  strMyError = "";
            DataSet tempds     = new DataSet();
            OraDB   conspy     = new OraDB();

            conspy.Open();
            try
            {
                iResult = conspy.SelectDataToDataSet(tempds, sql, ref strMyError);
                ds      = tempds.Copy();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                conspy.Close();
            }
            return(iResult);
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url           = @"http://autoever.hyundai.net/Webservices/SSO/SitemapWS.asmx";
            string enccode       = Request.Params["Encode"];
            string companycode   = Request.Params["CompanyCode"];
            string strHKMCENC_ID = "RIDS";
            string param         = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><GetPlainText xmlns=\"http://tempuri.org/\">"
                                   + "<strEncID>" + strHKMCENC_ID + "</strEncID>"
                                   + "<strCompanyCode>" + companycode + "</strCompanyCode>"
                                   + "<strEncText>" + enccode + "</strEncText>"
                                   + "</GetPlainText></soap:Body></soap:Envelope>";

            System.Diagnostics.Debug.WriteLine("----------22");

            ServerXMLHTTP srv = new ServerXMLHTTP();

            srv.open("POST", url, false, null, null);
            srv.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
            srv.setRequestHeader("SOAPAction", "http://tempuri.org/GetPlainText");

            srv.send(param);
            Response.Clear();
            string __res__ = srv.responseText;


            bool isLogin = false;

            try{
                int val1 = __res__.IndexOf("<GetPlainTextResult>");
                int val2 = __res__.IndexOf("</GetPlainTextResult>");

                if (val1 <= 0 || val2 <= 0)
                {
                    return;
                }
                string result = __res__.Substring(val1, (val2 - val1));

                string[] token = System.Text.RegularExpressions.Regex.Split(result, "___");

                for (int i = 0; i < token.Length; i++)
                {
                    string[] value = System.Text.RegularExpressions.Regex.Split(token[i], "\\|\\|");

                    Session[value[0]] = value[1];

                    if ("User_ID".EndsWith(value[0]))
                    {
                        //Session["USERID"] = value[1];

                        string user = value[1];
                        // 그리고 사번..
                        OraDB DB = new OraDB();
                        DB.Connect();
                        try
                        {
                            string user_name = "";
                            string dept_code = "";
                            string login_sql = "select * from tb_person where user_id = '" + user + "'";
                            string object_id = DB.GetQueryResult <string>(login_sql, delegate(OracleDataReader reader)
                            {
                                string val = reader[0].ToString();
                                user_name  = reader[1].ToString();
                                dept_code  = reader[3].ToString();
                                return(val);
                            });

                            if (object_id == null || "".Equals(object_id))
                            {
                                isLogin = false;
                            }
                            else
                            {
                                Session["USERID"]   = object_id;
                                Session["USERNAME"] = user_name;
                                Session["DEPTCODE"] = dept_code;
                                isLogin             = true;
                            }

                            DB.Close();
                        }
                        catch (Exception eee)
                        {
                            System.Diagnostics.Debug.WriteLine(eee.Message);
                            isLogin = false;
                        }
                        finally
                        {
                            DB.Close();
                        }
                    }

                    /*
                     * if ("Dept_Code".EndsWith(value[0]))
                     * {
                     *  Session["DEPTCODE"] = value[1];
                     * }
                     *
                     * if ("User_Name".EndsWith(value[0]))
                     * {
                     *  Session["USERNAME"] = value[1];
                     * } */
                }
            }catch (Exception ex) {
                Response.Write(ex.Message);
            }

            if (isLogin == false)
            {
                Response.Clear();
                string res = "<script>alert('Access Dinied....');</script>";
                Response.Write(res);

                return;
            }

            Response.Clear();
            string res1 = "<script>this.location.href='/extjs/top.html';</script>";

            Response.Write(res1);
            return;
        }
Example #9
0
 /// <summary>
 /// 执行SQL文到DataSet:例子DataSet loginDS=sysConfig.exeusesql("Login.aspx.cs123",strsql,"DefaultSQL","dt");
 /// </summary>
 /// <param name="strFileName"></param>
 /// <param name="sql"></param>
 /// <param name="ds"></param>
 /// <param name="ErrorInfo"></param>
 /// <returns></returns>
 public static int SelectSQL(string strFileName, string sql, ref  DataSet ds, ref string ErrorInfo)
 {
     int iResult = -1;
     string strMyError = "";
     DataSet tempds = new DataSet();
     OraDB conspy = new OraDB();
     conspy.Open();
     try
     {
         iResult = conspy.SelectDataToDataSet(tempds, sql, ref strMyError);
         ds = tempds.Copy();
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         conspy.Close();
     }
     return iResult;
 }
Example #10
0
        /// <summary>
        /// 带事务执行SQL文:例子DataSet loginDS=sysConfig.exeusesql("Login.aspx.cs123",strsql,"DefaultSQL","dt");
        /// </summary>
        /// <param name="sql">SQL文</param>
        /// <param name="connectID">连接取"DefaultSQL","Oracle","Sybase"等值</param>
        /// <returns></returns>
        public static bool ExeuseSQL(string[] sql)
        {
            bool result = true;
            try
            {
                OraDB conspy = new OraDB();
                conspy.Open();
                conspy.BeginTransaction();
                try
                {
                    for (int i = 0; i < sql.Length; i++)
                    {
                        conspy.ExecSqlTrans(sql[i]);
                    }
                    conspy.Commit();

                }
                catch (Exception e)
                {
                    String lsError = e.Message;
                    conspy.Rollback();
                    result = false;
                }
                finally
                {
                    conspy.Close();
                }

            }
            catch (Exception e)
            {
                String lsError = e.Message;
                result = false;
            }
            return result;
        }