コード例 #1
0
        public Hashtable sqlToHashtable(string strsql)
        {
            Hashtable hashtable = new Hashtable();

            try
            {
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                Logger.debug("数据集中读出时转换SQL语句:" + strsql);
                IDataReader rs = this.runProc(this.dboperator_0, strsql);
                while (rs.Read())
                {
                    hashtable.Add(SQLTool.getStr(rs, 0, this.string_0).Trim(), SQLTool.getStr(rs, 1, this.string_0));
                }
                rs.Close();
            }
            catch (Exception exception)
            {
                throw new SqlRunException(strsql, exception.Message);
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
            }
            return(hashtable);
        }
コード例 #2
0
        /// <summary>
        /// 密码验证
        /// </summary>
        /// <param name="dicPar"></param>
        public void ValidataPwd(Dictionary <string, object> dicPar)
        {
            ///要检测的参数信息
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID", "pwd"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            sql = "select upwd from WX_members_wx where openid='" + dicPar["USER_ID"].ToString() + "'";
            var pwd = Convert.ToString(SQLTool.ExecuteScalar(sql));

            if (!string.IsNullOrEmpty(pwd))
            {
                if (pwd == Tools.DesEncrypt(Convert.ToString(dicPar["pwd"])))
                {
                    ToCustomerJson("0", "验证成功");
                }
                else
                {
                    ToCustomerJson("2", "密码错误");
                }
            }
            else
            {
                ToCustomerJson("1", "您尚未设置密码");
            }
        }
コード例 #3
0
        /// <summary>
        /// 是否关注
        /// </summary>
        /// <param name="dicPar"></param>
        public void isSubscribe(Dictionary <string, object> dicPar)
        {
            ///要检测的参数信息
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }

            var sql         = "select subscribe from WX_members_wx where openid='" + Tools.SafeSql(Convert.ToString(dicPar["USER_ID"])) + "'";
            var isSubscribe = Convert.ToString(SQLTool.ExecuteScalar(sql));

            if (isSubscribe == "0")
            {
                ToCustomerJson("0", "未关注");
            }
            else
            {
                ToCustomerJson("1", "已关注");
            }
        }
コード例 #4
0
        public string SqlToField(string strsql)
        {
            string str = "";

            try
            {
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                IDataReader rs = this.dboperator_0.exeSql(strsql);
                if (rs.Read())
                {
                    str = SQLTool.getStr(rs, 0, this.string_0);
                }
                rs.Close();
                this.dboperator_0.Close();
            }
            catch (Exception exception)
            {
                throw new SqlRunException(strsql, exception.Message);
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
            }
            return(str);
        }
コード例 #5
0
ファイル: Core.cs プロジェクト: 09130510/Masterlink
        private Core()
        {
            m_SQL = new SQLTool(Utility.Load <string>("SQL", "IP"), Utility.Load <string>("SQL", "DB"), Utility.Load <string>("SQL", "ID"), Utility.Load <string>("SQL", "PASSWORD"));

            m_Price = new CapitalProcessor();
            m_Price.OnOverseaProduct += new OnOverseaProductDelegate(OverseaProduct);
            m_Price.OnPriceChange    += new OnPriceChangeDelegate(PriceChange);
            m_Price.OnError          += OnError;

            m_Order = new OrderProcessor.Capital.CapitalProcessor();
            m_Order.OnMatchReply          += new OrderProcessor.Capital.CapitalProcessor.OnReplyDelegate(OnMatchReply);
            m_Order.OnOverseaOpenInterest += new OrderProcessor.Capital.CapitalProcessor.OnOverseaOpenInterestDelegate(OnOverseaOpenInterest);
        }
コード例 #6
0
        public string doUploadInfo()
        {
            string        str     = this.httpRequest_0.Params["sKeyvalue"];
            string        str2    = this.httpRequest_0.Params["sKeyvalue1"];
            string        str3    = ".doc";
            string        str4    = "";
            string        str5    = "";
            StringBuilder builder = new StringBuilder("<root>");
            string        str6    = "";
            string        str7    = "";
            string        strSql  = "select filename,extend,attachid,bz,filepos from FC_ATTACH where djbh='" + str + "' and djsn='" + str2 + "' ";

            try
            {
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                Logger.debug("upload的SQL语句:" + strSql);
                IDataReader rs = this.dboperator_0.exeSql(strSql);
                while (rs.Read())
                {
                    str5 = SQLTool.getStr(rs, "filename", this.string_0);
                    str3 = SQLTool.getStr(rs, "extend", this.string_0);
                    str4 = SQLTool.getStr(rs, "attachid", this.string_0);
                    str6 = SQLTool.getStr(rs, "bz", this.string_0);
                    str7 = SQLTool.getStr(rs, "filepos", this.string_0);
                    builder.Append("<rec><no>" + str7 + "</no><no>" + str5 + "</no><no>" + str4 + "</no><no>" + str3 + "</no><no>" + str6 + "</no></rec>");
                }
                builder.Append("</root>");
                rs.Close();
                this.dboperator_0.Close();
            }
            catch (Exception exception)
            {
                throw new SqlRunException(strSql, exception.Message);
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
            }
            return(builder.ToString());
        }
コード例 #7
0
ファイル: Other.ashx.cs プロジェクト: hmwenwen/wen
        /// <summary>
        /// 获取地理信息
        /// </summary>
        public void GetLocationInfo(Dictionary <string, object> dicPar)
        {
            var strJson = string.Empty;

            if (Tools.GetCache("locationinfo") == null)
            {
                var sql = "select provinceid,province from provinces";
                var dt  = SQLTool.ExecuteDataTable(sql);
                strJson = "[";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var province = dt.Rows[i]["province"].ToString();
                    province = province.TrimEnd('省');
                    province = province.TrimEnd('市');
                    strJson += "{\"province\":\"" + province + "\",\"city\":[";
                    sql      = "select cityid,city from citys where parentid='" + dt.Rows[i]["provinceid"] + "'";
                    var cityDt = SQLTool.ExecuteDataTable(sql);
                    for (int j = 0; j < cityDt.Rows.Count; j++)
                    {
                        strJson += "{\"city\":\"" + cityDt.Rows[j]["city"] + "\",\"area\":[";
                        sql      = "SELECT areaid,area,letter FROM areas where parentid='" + cityDt.Rows[j]["cityid"] + "'";
                        var areaDt = SQLTool.ExecuteDataTable(sql);
                        for (int x = 0; x < areaDt.Rows.Count; x++)
                        {
                            strJson += "\"" + areaDt.Rows[x]["area"] + "\",";
                        }
                        strJson  = strJson.TrimEnd(',');
                        strJson += "]},";
                    }
                    strJson  = strJson.TrimEnd(',');
                    strJson += "]},";
                }
                strJson  = strJson.TrimEnd(',');
                strJson += "]";
                Tools.AddCacheLasting("locationinfo", strJson);
            }
            else
            {
                strJson = Convert.ToString(Tools.GetCache("locationinfo"));
            }

            HttpContext hc = HttpContext.Current;

            hc.Response.Clear();
            hc.Response.Write(strJson);
            hc.Response.End();
        }
コード例 #8
0
        /// <summary>
        /// 获取用户信息(手机号、身份证号、证件类型)
        /// </summary>
        /// <param name="dicPar"></param>
        public void MpUserInfo(Dictionary <string, object> dicPar)
        {
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID"
            };

            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            var unionid = dicPar["USER_ID"].ToString();
            var sql     = "select top 1 mobile,IDNO,idtype from members where wxaccount='" + Tools.SafeSql(unionid) + "'";
            var dt      = SQLTool.ExecuteDataTable(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                ToJsonStr(ToJson2(dt));
            }
            else
            {
                ToCustomerJson("-1", "暂无数据");
            }
        }
コード例 #9
0
ファイル: DataObjectContext.cs プロジェクト: gsriar/new2
 public string GetInsertQuery()
 {
     WriteLog($"INSERT QUERY [{this.dataObject.Alias}] ");
     return(SQLTool.GetInsertSQL(this.dataObject.Alias, newDataTable));
 }
コード例 #10
0
ファイル: DataObjectContext.cs プロジェクト: gsriar/new2
 public string GetCreateTableQuery()
 {
     WriteLog($"CREATE TABLE QUERY [{this.dataObject.Alias}] ");
     return(SQLTool.GetCreateFromDataTableSQL(this.dataObject.Alias, newDataTable));
 }
コード例 #11
0
ファイル: DbStru.cs プロジェクト: ikvm/test
        private StringBuilder method_4(string string_1, ArrayList arrayList_0)
        {
            string        str      = this.connectionConfig_0.getDbType();
            ArrayList     list     = new ArrayList();
            StringBuilder builder  = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();

            for (int i = 0; i < arrayList_0.Count; i++)
            {
                FieldInfo info = (FieldInfo)arrayList_0[(i)];
                string    str6 = info.realType.ToUpper();
                if ((((str == "sqlserver") && (str6 != "TEXT")) && ((str6 != "NTEXT") && (str6 != "BINARY"))) && ((str6 != "VARBINARY") && (str6 != "IMAGE")))
                {
                    builder2.Append(info.name);
                    builder2.Append(",");
                    list.Add(str6);
                }
                if ((((str == "oracle") && (str6 != "LONG RAW")) && ((str6 != "BLOB") && (str6 != "CLOB"))) && (str6 != "LONG"))
                {
                    builder2.Append(info.name);
                    builder2.Append(",");
                    list.Add(str6);
                }
            }
            if (builder2.Length > 0)
            {
                builder2.Remove(builder2.Length - 1, 1);
            }
            if (builder2.Length != 0)
            {
                string strSql = "select " + builder2.ToString() + " from " + string_1;
                try
                {
                    IDataReader rs = this.dboperator_0.exeSql(strSql);
                    while (rs.Read())
                    {
                        StringBuilder builder3 = new StringBuilder();
                        for (int j = 0; j < list.Count; j++)
                        {
                            string str3     = "";
                            string str4     = "";
                            object dateTime = null;
                            string str5     = (string)list[(j)];
                            switch (str5)
                            {
                            case "CHAR":
                            case "NCHAR":
                            case "NVARCHAR":
                            case "VARCHAR":
                            case "NVARCHAR2":
                            case "VARCHAR2":
                                str3     = "'";
                                str4     = "'";
                                dateTime = SQLTool.getStr(rs, j, this.string_0);
                                break;
                            }
                            if ((str == "sqlserver") && ((str5 == "DATETIME") || (str5 == "SMALLDATETIME")))
                            {
                                dateTime = rs.GetDateTime(j);
                                dateTime = DateTimeTool.formatTimestamp((DateTime)dateTime);
                                str3     = "'";
                                str4     = "'";
                            }
                            if ((str == "oracle") && (str5 == "DATE"))
                            {
                                dateTime = rs.GetDateTime(j);
                                dateTime = DateTimeTool.formatTimestamp((DateTime)dateTime);
                                str3     = "to_date('";
                                str4     = "','yyyy-mm-dd hh24:mi:ss')";
                            }
                            if (dateTime == null)
                            {
                                dateTime = rs.GetString(j);
                            }
                            builder3.Append(str3);
                            builder3.Append(dateTime);
                            builder3.Append(str4);
                            if (j < (list.Count - 1))
                            {
                                builder3.Append(",");
                            }
                        }
                        builder.Append("INSERT INTO " + string_1 + " (");
                        builder.Append(builder2);
                        builder.Append(") values (");
                        builder.Append(builder3);
                        builder.Append(");\r\n");
                    }
                    rs.Close();
                }
                catch (Exception exception)
                {
                    Logger.error(exception);
                }
                return(builder);
            }
            return(builder);
        }
コード例 #12
0
ファイル: DbStru.cs プロジェクト: ikvm/test
        public ArrayList getFieldInfos(string tableName)
        {
            ArrayList list = new ArrayList();

            new ArrayList();
            try
            {
                string    str2;
                FieldInfo info2;
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                string str = this.connectionConfig_0.getDbType();
                if ((!(this.dboperator_0.Connection is OleDbConnection) || (str == "sqlserver")) || (str == "oracle"))
                {
                    goto Label_023C;
                }
                OleDbConnection connection       = (OleDbConnection)this.dboperator_0.Connection;
                DataTable       oleDbSchemaTable = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Provider_Types, new object[0]);
                DataRow[]       rowArray3        = oleDbSchemaTable.Select(null, null, (DataViewRowState)22);
                object[]        objArray2        = new object[4];
                objArray2[1] = this.connectionConfig_0.getSchemaPattern();
                objArray2[2] = tableName.ToUpper();
                DataTable table    = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, objArray2);
                DataRow[] rowArray = table.Select(null, null, (DataViewRowState)22);
                int       index    = 0;
Label_00E5:
                if (index >= rowArray.Length)
                {
                    return(list);
                }
                DataRow row      = rowArray[index];
                string  str5     = (string)row[table.Columns["COLUMN_NAME"]];
                string  sourType = "";
                int     num3     = Convert.ToInt32(row[table.Columns["DATA_TYPE"]]);
                foreach (DataRow row2 in rowArray3)
                {
                    if (num3 == (decimal)row2[oleDbSchemaTable.Columns["DATA_TYPE"]])
                    {
                        sourType = (string)row2[oleDbSchemaTable.Columns["TYPE_NAME"]];
                        goto Label_019D;
                        //goto Label_017E;
                    }
                }
                goto Label_019D;
                //Label_017E:
                //    sourType = row2[oleDbSchemaTable.Columns["TYPE_NAME"]];
Label_019D:
                info2          = new FieldInfo();
                str5           = str5.ToUpper();
                info2.name     = str5;
                info2.realType = sourType;
                info2.type     = PubTool.getDsType(sourType);
                try
                {
                    info2.size = Convert.ToInt32(row[table.Columns["CHARACTER_MAXIMUM_LENGTH"]]);
                }
                catch (Exception)
                {
                    info2.size = 16;
                }
                try
                {
                    info2.decsize = Convert.ToInt32(row[(table.Columns[("NUMERIC_PRECISION")])]);
                }
                catch (Exception)
                {
                }
                list.Add(info2);
                index++;
                goto Label_00E5;
Label_023C:
                str2 = "";
                if ((this.dboperator_0.Connection is SqlConnection) || (str == "sqlserver"))
                {
                    str2 = "select distinct syscolumns.name as fdname,systypes.name as fdtype,syscolumns.length as fdsize, syscolumns.scale as fddec,case when syscolumns.isnullable=1 then 'NULL' when syscolumns.isnullable=0 then 'NOT NULL' end as isnullable, case when syscolumns.cdefault=0 then '' else syscomments.text end as deftext,syscolumns.colorder from ((syscolumns inner join sysobjects on syscolumns.id=sysobjects.id) inner join systypes on syscolumns.xtype=systypes.xtype) left join syscomments on syscomments.id=syscolumns.cdefault or syscolumns.cdefault=0 or syscomments.id is null where sysobjects.xtype='U' and sysobjects.name='" + tableName + "'  order by syscolumns.colorder";
                }
                if ((this.dboperator_0.Connection is OracleConnection) || (str == "oracle"))
                {
                    str2 = "select COLUMN_NAME as fdname,DATA_TYPE AS fdtype,decode(DATA_TYPE,'CHAR',DATA_LENGTH,'NCHAR',DATA_LENGTH,'VARCHAR2',DATA_LENGTH,'NVARCHAR2',DATA_LENGTH,'RAW',DATA_LENGTH,DATA_PRECISION) as fdsize,decode(DATA_TYPE,'NUMBER',DATA_SCALE,DATA_PRECISION) as fddec,decode(NULLABLE,'N','NOT NULL','Y','NULL') as isnullable,DATA_DEFAULT as deftext  from user_tab_columns where table_name='" + tableName + "'";
                }
                IDataReader rs = null;
                try
                {
                    try
                    {
                        rs = this.dboperator_0.exeSql(str2);
                        while (true)
                        {
                            if (!rs.Read())
                            {
                                break;
                            }
                            FieldInfo info = new FieldInfo();
                            string    str3 = SQLTool.getStr(rs, 0, this.string_0).ToUpper();
                            info.name = str3;
                            string str4 = SQLTool.getStr(rs, 1, this.string_0);
                            info.realType = str4;
                            info.type     = PubTool.getDsType(str4);
                            try
                            {
                                info.size = Convert.ToInt32(rs.GetValue(2));
                            }
                            catch (Exception)
                            {
                                info.size = 16;
                            }
                            try
                            {
                                info.decsize = Convert.ToInt32(rs.GetValue(3));
                            }
                            catch (Exception)
                            {
                                info.decsize = 0;
                            }
                            info.isNull       = rs.GetString(4);
                            info.defaultValue = rs.GetString(5);
                            list.Add(info);
                        }
                        rs.Close();
                    }
                    catch (Exception)
                    {
                    }
                    return(list);
                }
                finally
                {
                    try
                    {
                        rs.Close();
                    }
                    catch (Exception)
                    {
                    }
                }
                return(list);
            }
            catch (Exception)
            {
            }
            finally
            {
                try
                {
                }
                catch (Exception)
                {
                }
            }
            return(list);
        }
コード例 #13
0
ファイル: SQLDataSetFactory.cs プロジェクト: ikvm/test
        public virtual DataSet getDataSet(Env env)
        {
            DataSet       set3;
            DataSetConfig config     = (DataSetConfig)this.hashtable_0["dsc"];
            CellExt1      cs         = (CellExt1)this.hashtable_0["ecs"];
            string        name       = config.Name;
            IDbCommand    pst        = null;
            IDataReader   rs         = null;
            IDbConnection connection = null;

            try
            {
                bool   flag;
                bool   flag2;
                string dataSourceName = config.DataSourceName;
                if (dataSourceName != null)
                {
                    connection = env.getConnection(dataSourceName);
                    if (connection == null)
                    {
                        connection = env.getConnection();
                    }
                }
                else
                {
                    connection     = env.getConnection();
                    dataSourceName = "";
                }
                if ((connection == null) || (connection.State == null))
                {
                    return(null);
                }
                if ((dataSourceName != null) && (dataSourceName.Trim().Length != 0))
                {
                    flag = env.getIsEncoding(dataSourceName);
                }
                else
                {
                    flag = env.getIsEncoding();
                }
                string dbCharset = env.getDBCharset(dataSourceName);
                if ((dbCharset == null) || (dbCharset.Trim().Length == 0))
                {
                    dbCharset = env.getDBCharset();
                }
                string str = MacroCalc.replaceMacros(config.SQL, env.MacrosMap);
                if ((dataSourceName != null) && (dataSourceName.Trim().Length != 0))
                {
                    flag2 = env.getNeedTransSQLcode(dataSourceName);
                }
                else
                {
                    flag2 = env.getNeedTransSQLcode();
                }
                if (flag2)
                {
                    str = Encoding.GetEncoding(dbCharset).GetString(Encoding.Default.GetBytes(str));
                }
                string[] sqlArguments     = config.SqlArguments;
                string[] sqlArgumentsName = config.SqlArgumentsName;
                int[]    argumentTypes    = config.ArgumentTypes;
                object[] objArray         = null;
                if (sqlArguments != null)
                {
                    objArray = new object[sqlArguments.Length];
                    int num7 = 0;
                    for (int i = 0; i < sqlArguments.Length; i++)
                    {
                        num7 = ExpString.indexOf(str, "?", num7 + 1, 18);
                        if ((sqlArguments[i] != null) && sqlArguments[i].ToLower().Equals("@@result"))
                        {
                            objArray[i] = "@@result";
                        }
                        else
                        {
                            objArray[i] = ConvertTool.getValue(new ExpParse(cs, sqlArguments[i]).calculate());
                            if ((objArray[i] != null) && (objArray[i] is ArrayList))
                            {
                                objArray[i] = ((ArrayList)objArray[i]).ToArray();
                                if (((((object[])objArray[i]).Length > 0) && (((object[])objArray[i])[0] is string)) && flag2)
                                {
                                    for (int j = 0; j < ((object[])objArray[i]).Length; j++)
                                    {
                                        ((object[])objArray[i])[j] = Convert.ToString(Encoding.GetEncoding(dbCharset).GetBytes((string)((object[])objArray[i])[0]));
                                    }
                                }
                            }
                            else if ((objArray[i] is string) && flag2)
                            {
                                objArray[i] = Convert.ToString(Encoding.GetEncoding(dbCharset).GetBytes((string)objArray[i]));
                            }
                            if ((objArray[i] != null) && objArray[i].GetType().IsArray)
                            {
                                int           length  = ((object[])objArray[i]).Length;
                                StringBuilder builder = new StringBuilder(2 * length);
                                for (int k = 0; k < length; k++)
                                {
                                    builder.Append("?,");
                                }
                                if ((builder.Length > 0) && (builder[builder.Length - 1] == ','))
                                {
                                    builder.Remove(builder.Length - 1, 1);
                                }
                                if (builder.Length > 1)
                                {
                                    str = new StringBuilder(str.Substring(0, num7).ToString().ToString()).Append(builder.ToString()).Append(str.Substring(num7 + 1)).ToString().ToString();
                                }
                                num7 += builder.Length;
                            }
                        }
                    }
                }
                Logger.debug("下面开始打出sql");
                int num6 = 0;
                if ((3 != config.SQLType) || (connection is OleDbConnection))
                {
                    try
                    {
                        Logger.debug(new StringBuilder(name.ToString().ToString()).Append("=").Append(str).ToString().ToString());
                        pst = SupportClass.TransactionManager.manager.PrepareStatement(connection, str);
                        goto Label_0472;
                    }
                    catch (Exception exception3)
                    {
                        throw new ReportError(new StringBuilder("数据集").Append(name).Append(" sql异常:").Append(exception3.Message).ToString().ToString(), exception3);
                    }
                }
                try
                {
                    pst = SupportClass.TransactionManager.manager.PrepareCall(connection, str);
                }
                catch (Exception exception4)
                {
                    throw new ReportError(new StringBuilder("数据集").Append(name).Append(" sql异常:").Append(exception4.Message).ToString().ToString(), exception4);
                }
Label_0472:
                if ((objArray == null) || (objArray.Length <= 0))
                {
                    goto Label_06A2;
                }
                int index = 0;
                int num3  = 0;
Label_048F:
                if (num3 >= objArray.Length)
                {
                    goto Label_06A2;
                }
                index++;
                if ((sqlArguments[num3] == null) || !sqlArguments[num3].ToLower().Equals("@@result"))
                {
                    goto Label_050E;
                }
                if (!(pst is OracleCommand))
                {
                    goto Label_0698;
                }
                try
                {
                    OracleParameter parameter = new OracleParameter();
                    parameter.ParameterName = (sqlArgumentsName[num3]);
                    parameter.OracleType    = (OracleType)(5);
                    parameter.Direction     = (ParameterDirection)(2);
                    pst.Parameters.Add(parameter);
                    goto Label_0698;
                }
                catch (Exception)
                {
                    goto Label_0698;
                }
Label_0504:
                num6 = index;
                goto Label_068D;
Label_050E:
                try
                {
                    if ((objArray[num3] != null) && objArray[num3].GetType().IsArray)
                    {
                        string msg = new StringBuilder("第").Append(num3).Append("个参数组: ").ToString().ToString();
                        for (int m = 0; m < ((object[])objArray[num3]).Length; m++)
                        {
                            msg = (msg.ToString() + ((object[])objArray[num3])[m].ToString()).ToString().ToString() + ",";
                            SQLTool.setObject(pst, index, ((object[])objArray[num3])[m], argumentTypes[num3], sqlArgumentsName[num3]);
                            index++;
                        }
                        Logger.debug(msg);
                        index--;
                    }
                    else
                    {
                        Logger.debug(new StringBuilder("第").Append(num3).Append("个参数: ").Append(objArray[num3]).ToString().ToString());
                        if ((6 == argumentTypes[num3]) && (objArray[num3] == null))
                        {
                            objArray[num3] = "";
                        }
                        SQLTool.setObject(pst, index, objArray[num3], argumentTypes[num3], sqlArgumentsName[num3]);
                    }
                }
                catch (Exception exception2)
                {
                    throw new ReportError(new StringBuilder("数据集").Append(name).Append("的sql第").Append(num3 + 1).Append("个参数异常:").Append(exception2.Message).ToString().ToString(), exception2);
                }
Label_068D:
                num3++;
                goto Label_048F;
Label_0698:
                if (num6 == 0)
                {
                    goto Label_0504;
                }
                goto Label_068D;
Label_06A2:
                try
                {
                    rs = pst.ExecuteReader();
                }
                catch (Exception exception)
                {
                    throw new ReportError(new StringBuilder("数据集").Append(name).Append("的 sql异常:").Append(exception.Message).ToString().ToString(), exception);
                }
                string beginRow = config.BeginRow;
                string endRow   = config.EndRow;
                if (((beginRow == null) || (beginRow.Trim().Length == 0)) || beginRow.Trim().ToUpper().Equals("null".ToUpper()))
                {
                    beginRow = "0";
                }
                if (((endRow == null) || (endRow.Trim().Length == 0)) || endRow.Trim().ToUpper().Equals("null".ToUpper()))
                {
                    endRow = "0";
                }
                beginRow = MacroCalc.replaceMacros(beginRow, env.MacrosMap);
                endRow   = MacroCalc.replaceMacros(endRow, env.MacrosMap);
                int num  = 0;
                int num2 = 0;
                try
                {
                    object obj2 = ConvertTool.getValue(new ExpParse(env, beginRow).calculate());
                    object obj3 = ConvertTool.getValue(new ExpParse(env, endRow).calculate());
                    if ((obj2 is int) && (obj3 is int))
                    {
                        num  = (int)obj2;
                        num2 = (int)obj3;
                    }
                }
                catch (Exception)
                {
                    throw new ReportError("数据集的起始行或者结束行设置有误。");
                }
                ArrayList   fieldText    = config.getFieldTextList();
                RecordCheck oRecordCheck = new RecordCheck(new ConnectionConfig().getDBOperator(), env.Request, env.Session);
                DataSet     set          = DataSetTool.populate(null, rs, num, num2, dbCharset, fieldText, false, flag, oRecordCheck);
                if ((config.IndexCols != null) && (config.IndexCols.Length > 0))
                {
                    set.createIndex(config.IndexCols, config.IndexSorted);
                }
                set3 = set;
            }
            catch (ReportError error)
            {
                throw error;
            }
            catch (Exception exception5)
            {
                throw new ReportError(exception5.Message, exception5);
            }
            finally
            {
                try
                {
                    if (rs != null)
                    {
                        rs.Close();
                    }
                    if (pst != null)
                    {
                        pst.Dispose();
                    }
                }
                catch (Exception exception6)
                {
                    throw new ReportError(exception6.Message, exception6);
                }
            }
            return(set3);
        }
コード例 #14
0
        public string sqltoxml()
        {
            string str    = this.xmlDocument_0.DocumentElement.ChildNodes.Item(0).InnerText;
            string strsql = this.xmlDocument_0.DocumentElement.ChildNodes.Item(1).InnerText;
            //this.xmlDocument_0.DocumentElement.ChildNodes[2].InnerText;
            string str3 = this.xmlDocument_0.DocumentElement.ChildNodes.Item(3).InnerText;
            string str4 = this.xmlDocument_0.DocumentElement.ChildNodes.Item(4).InnerText;
            string str5 = this.xmlDocument_0.DocumentElement.ChildNodes.Item(5).InnerText;
            string str6 = this.xmlDocument_0.DocumentElement.ChildNodes.Item(6).InnerText;

            str4 = str4.ToUpper();
            int           num     = int.Parse(str);
            int           num2    = int.Parse(str3);
            StringBuilder builder = new StringBuilder();

            try
            {
                int index = 0;
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                Logger.debug("dropdownlist的SQL语句:" + strsql);
                IDataReader ds    = this.runProc(this.dboperator_0, strsql);
                RecordCheck check = new RecordCheck(this.connectionConfig_0.getDBOperator(), this.httpRequest_0, this.httpSessionState_0);
                check.init(ds);
                string str8 = "";
                for (int i = 0; i < ds.FieldCount; i++)
                {
                    str8 = str8 + ds.GetName(i) + ",";
                }
                if (str8 != "")
                {
                    str8 = str8.Substring(0, str8.Length - 1);
                }
                builder.Append("<root>");
                int num6 = 0;
                int num9 = 0;
                int num5 = 0;
                int num7 = 0;
                int num8 = ds.FieldCount;
                if (str4 == "TRUE")
                {
                    num8++;
                }
                while (ds.Read())
                {
                    if (str6.Equals("是") && (num9 == 0))
                    {
                        builder.Append("<tr height='16'>");
                        index = 0;
                        while (index < num8)
                        {
                            builder.Append("<td align='center' style='font-weight:bold ; cursor:hand ;' >...+...</td>");
                            index++;
                        }
                        builder.Append("</tr>");
                        num9 = 1;
                    }
                    if (str5.Equals("是") && (num7 == 0))
                    {
                        builder.Append("<tr height='16'>");
                        index = 0;
                        while (index < num8)
                        {
                            builder.Append("<td></td>");
                            index++;
                        }
                        builder.Append("</tr>");
                        num7 = 1;
                    }
                    if (check.isRecordCanShow(SQLTool.getStr(ds, (int)(ds.FieldCount - 1), this.string_0)))
                    {
                        if (((num6 >= ((num - 1) * num2)) && (num6 < (num * num2))) || (num2 == -1))
                        {
                            builder.Append("<tr>");
                            for (index = 0; index < ds.FieldCount; index++)
                            {
                                string str9 = SQLTool.getStr(ds, index, this.string_0);
                                if (str9 == null)
                                {
                                    str9 = "";
                                }
                                builder.Append("<td>" + str9 + "</td>");
                            }
                            if (str4 != "TRUE")
                            {
                                builder.Append("</tr>");
                            }
                            else
                            {
                                builder.Append("<td style='width:20px'><input type='checkbox'></input></td></tr>");
                            }
                        }
                        num6++;
                    }
                }
                num6--;
                if (num6 > 0)
                {
                    if ((num6 % num2) > 0)
                    {
                        num5 = (num6 / num2) + 1;
                    }
                    else
                    {
                        num5 = num6 / num2;
                    }
                }
                builder.Append(string.Concat(new object[] { "<pagenumber>", num5, "</pagenumber><intpage>", num, "</intpage><fields>", str8, "</fields></root>" }));
                ds.Close();
                this.dboperator_0.Close();
            }
            catch (Exception exception)
            {
                throw new SqlRunException(strsql, exception.Message);
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
            }
            return(builder.ToString());
        }
コード例 #15
0
ファイル: DbSql.cs プロジェクト: ikvm/test
        public override object calculate()
        {
            object obj3;

            try
            {
                if (base.paramList.Count < 2)
                {
                    throw new ReportError("dbsql函数参数列表至少有2个");
                }
                IDbConnection connection = null;
                string        dsn        = null;
                string        sql        = null;
                string        encoding   = null;
                ExpParse      parse3     = (ExpParse)base.paramList[0];
                if (parse3 != null)
                {
                    object obj7 = ConvertTool.getValue(parse3.calculate());
                    if (!(obj7 is string))
                    {
                        throw new ReportError("dbsql函数参数个数为1时参数应为数据库逻辑名");
                    }
                    dsn = (string)obj7;
                }
                connection = (dsn != null) ? base.env.getConnection(dsn) : base.env.getConnection();
                if ((connection == null) || (connection.State == null))
                {
                    throw new ReportError("dbsql函数执行异常,无有效数据库连接");
                }
                encoding = (dsn != null) ? base.env.getDBCharset(dsn) : base.env.getDBCharset();
                object obj6 = ConvertTool.getValue(((ExpParse)base.paramList[1]).calculate());
                if (!(obj6 is string))
                {
                    throw new ReportError("dbsql函数参数2应为sql串");
                }
                sql = (string)obj6;
                IDbCommand pst = SupportClass.TransactionManager.manager.PrepareStatement(connection, sql);
                for (int i = 2; i < base.paramList.Count; i++)
                {
                    ExpParse parse = (ExpParse)base.paramList[i];
                    if (parse == null)
                    {
                        throw new ReportError("数据库查询函数出现无效参数");
                    }
                    object o = ConvertTool.getValue(parse.calculate());
                    SQLTool.setObject(pst, i - 1, o, 12, "");
                }
                if (pst.ExecuteNonQuery() > 0)
                {
                    pst.Dispose();
                    return(null);
                }
                ArrayList   list = new ArrayList();
                IDataReader rs   = pst.ExecuteReader();
                while (rs.Read())
                {
                    list.Add(SQLTool.getObject(rs, 0, encoding));
                }
                rs.Close();
                pst.Dispose();
                if (list.Count != 1)
                {
                    return(list);
                }
                obj3 = list[0];
            }
            catch (IOException exception)
            {
                throw new ReportError("dbsql函数sql异常:" + exception.Message.ToString().ToString(), exception);
            }
            catch (OleDbException exception2)
            {
                throw new ReportError("dbsql函数sql异常:" + exception2.Message.ToString().ToString(), exception2);
            }
            return(obj3);
        }
コード例 #16
0
ファイル: WxPay.ashx.cs プロジェクト: hmwenwen/wen
        /// <summary>
        /// 改签退款
        /// </summary>
        /// <param name="dicPar"></param>
        public void Refund(Dictionary <string, object> dicPar)
        {
            List <string> pra = new List <string>()
            {
                "GUID", "refund_fee", "orderno"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }

            var refund_fee = dicPar["refund_fee"].ToString(); //退款金额  如果空,则为退所有
            var orderno    = dicPar["orderno"].ToString();

            WxPayData data      = new WxPayData();
            var       sql       = "SELECT money,transaction_id,out_trade_no FROM dbo.Wx_Pay WHERE out_trade_no=(SELECT out_trade_no FROM dbo.WX_orderdetails WHERE orderno='" + orderno + "')";
            var       orderInfo = SQL.SQLTool.ExecuteDataTable(sql);

            if (orderInfo.Rows.Count > 0)                                     //如果数据库返回了数据才进行退款
            {
                var total_fee = Convert.ToString(orderInfo.Rows[0]["money"]); //
                if (refund_fee == "0")
                {
                    refund_fee = total_fee;
                }
                var transaction_id = Convert.ToString(orderInfo.Rows[0]["transaction_id"]);
                var out_trade_no   = Convert.ToString(orderInfo.Rows[0]["out_trade_no"]);

                if (!string.IsNullOrEmpty(transaction_id))//微信订单号存在的条件下,则已微信订单号为准
                {
                    data.SetValue("transaction_id", transaction_id);
                }
                else//微信订单号不存在,才根据商户订单号去退款
                {
                    data.SetValue("out_trade_no", out_trade_no);
                }
                // SetParam.SetParams(stocode);
                var out_refund_no = WxPayApi.GenerateOutTradeNo();  //退款单号
                data.SetValue("total_fee", int.Parse(total_fee));   //订单总金额
                data.SetValue("refund_fee", int.Parse(refund_fee)); //退款金额
                data.SetValue("out_refund_no", out_refund_no);      //随机生成商户退款单号
                data.SetValue("op_user_id", WxPayConfig.MCHID);     //操作员,默认为商户号
                WxPayData result  = WxPayApi.Refund(data);          //提交退款申请给API,接收返回数据
                var       pResult = result.ToPrintStr();

                var v           = pResult.Split('|');
                var strWhere    = string.Empty;
                var result_code = string.Empty;
                for (int i = 0; i < v.Count(); i++)
                {
                    if (v[i].Contains("refund_id"))
                    {
                        strWhere += "refund_id='" + Convert.ToString(v[i].Split('=')[1]) + "',";
                    }
                    else if (v[i].Contains("result_code"))
                    {
                        result_code = Convert.ToString(v[i].Split('=')[1]);
                        strWhere   += "result_code='" + result_code + "',";
                    }
                    else if (v[i].Contains("err_code_des"))
                    {
                        strWhere += "err_code_des='" + Convert.ToString(v[i].Split('=')[1]) + "',";
                    }
                }

                try
                {
                    sql = "update WX_orderdetails SET " + strWhere + " out_refund_no='" + out_refund_no + "',status='7' WHERE orderno='" + Tools.SafeSql(orderno) + "'";
                    SQLTool.ExecuteScalar(sql);
                    ToCustomerJson("0", result_code);
                }
                catch (Exception ex)
                {
                    ToCustomerJson("1", "退款失败");
                }
            }
            else
            {
                ToCustomerJson("2", "未查询到该订单号的付款信息");
            }
        }
コード例 #17
0
        public string dataset_fields1(string strsql, int iPageNo, int iPageSize, XmlNode oFields, bool isExport, XmlNode oFieldAll)
        {
            string[] strArray = new string[oFields.ChildNodes.Count];
            object[] objArray = new object[oFields.ChildNodes.Count];
            for (int i = 0; i < oFields.ChildNodes.Count; i++)
            {
                strArray[i] = oFields.ChildNodes.Item(i).ChildNodes.Item(0).InnerText;
                if (oFields.ChildNodes.Item(i).ChildNodes.Count > 1)
                {
                    string str6 = Escape.unescape(oFields.ChildNodes.Item(i).ChildNodes.Item(1).InnerText);
                    objArray[i] = this.sqlToHashtable(str6);
                }
            }
            StringBuilder builder = new StringBuilder(1000);

            if (!isExport)
            {
                builder.Append("<root>");
            }
            int num2 = 1;

            try
            {
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                Logger.debug("数据集的SQL语句:" + strsql);
                IDataReader ds    = this.runProc(this.dboperator_0, strsql);
                RecordCheck check = new RecordCheck(this.connectionConfig_0.getDBOperator(), this.httpRequest_0, this.httpSessionState_0);
                check.init(ds);
                string str    = "";
                string str2   = "";
                int    num3   = ds.FieldCount;
                int    length = strArray.Length;
                bool   flag   = false;
                for (int j = 0; j < length; j++)
                {
                    flag = false;
                    int num7 = 0;
                    while (num7 < num3)
                    {
                        if (strArray[j].ToLower() == ds.GetName(num7).ToLower())
                        {
                            goto Label_018E;
                        }
                        num7++;
                    }
                    goto Label_021E;
Label_018E:
                    flag = true;
                    string str4 = ds.GetDataTypeName(num7).ToLower();
                    if (((oFieldAll == null) || (oFieldAll.ChildNodes.Item(j).ChildNodes.Item(1).InnerText != "图象")) && (str4 != "image"))
                    {
                        if ((str4 == "clob") && isExport)
                        {
                            str2 = str2 + strArray[j] + ",";
                        }
                    }
                    else if (!isExport)
                    {
                        flag = false;
                    }
                    else
                    {
                        str = str + strArray[j] + ",";
                    }
Label_021E:
                    if (!flag)
                    {
                        strArray[j] = "";
                    }
                }
                while (ds.Read())
                {
                    if (check.isRecordCanShow(SQLTool.getStr(ds, (int)(ds.FieldCount - 1), this.string_0)))
                    {
                        if (((num2 > ((iPageNo - 1) * iPageSize)) && (num2 <= (iPageNo * iPageSize))) || (iPageSize == -1))
                        {
                            builder.Append("<tr>");
                            for (int k = 0; k < strArray.Length; k++)
                            {
                                string str3 = "";
                                if (strArray[k] == "")
                                {
                                    str3 = "";
                                }
                                else if ((isExport && (str.Length > 0)) && (str.IndexOf(strArray[k] + ",") >= 0))
                                {
                                    object obj2 = ds.GetValue(k);
                                    if ((obj2 != DBNull.Value) && (obj2 is Array))
                                    {
                                        byte[] bb = (byte[])obj2;
                                        str3 = Base64.byteArrayToBase64(bb);
                                    }
                                }
                                else
                                {
                                    str3 = SQLTool.getStr(ds, strArray[k], this.string_0);
                                    if (objArray[k] != null)
                                    {
                                        Hashtable hashtable = (Hashtable)objArray[k];
                                        if (((str3 != null) && (str3.Length > 0)) && hashtable.ContainsKey(str3.Trim()))
                                        {
                                            str3 = (string)hashtable[(str3.Trim())];
                                        }
                                    }
                                }
                                if (str3 == null)
                                {
                                    str3 = "";
                                }
                                builder.Append("<td>" + StringTools.repxml(str3) + "</td>");
                            }
                            builder.Append("</tr>");
                        }
                        num2++;
                    }
                }
                num2--;
                if ((num2 >= 0) && !isExport)
                {
                    builder.Append("<set><pages>" + num2 + "</pages><fields></fields></set>");
                }
                if (!isExport)
                {
                    builder.Append("</root>");
                }
                ds.Close();
                this.dboperator_0.Close();
            }
            catch (Exception exception)
            {
                throw new SqlRunException(strsql, exception.Message);
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
            }
            return(builder.ToString());
        }
コード例 #18
0
        public string loginPassword()
        {
            string str    = "";
            string userId = "";
            string str3   = this.xdoc.DocumentElement.ChildNodes.Item(0).InnerText;
            string str4   = this.xdoc.DocumentElement.ChildNodes.Item(1).InnerText;

            if ((str3.IndexOf("'") <= -1) && (str4.IndexOf("'") <= -1))
            {
                string strSql = "select userid,username,profileid,roleid,skin from fcq_user where  loginname='" + str3 + "' and password='******'";
                this.oDb = this.connConfig.getDBOperator();
                this.oDb.Open();
                try
                {
                    IDataReader rs = this.oDb.exeSql(strSql);
                    if (rs.Read())
                    {
                        string userMessage = "";
                        userId      = SQLTool.getStr(rs, 0);
                        userMessage = (userMessage + "用户.ID=" + userId) + ",";
                        string str8 = SQLTool.getStr(rs, 1);
                        userMessage = (userMessage + "用户.名称=" + str8) + ",";
                        string str9 = SQLTool.getStr(rs, 2);
                        userMessage = ((((((userMessage + "用户简档.ID=" + str9) + ",") + "角色.ID=" + SQLTool.getStr(rs, 3)) + ",") + "系统.皮肤颜色=" + SQLTool.getStr(rs, 4)) + ",系统.单位名称=" + EformRole.orgName) + ",系统.项目名称=" + EformRole.itemName;
                        rs.Close();
                        this.oDb.Close();
                        new EformRole().loginAfter(userMessage, this.session);
                        this.writeLog(userId, "login");
                        new EformRole().htLoginUserRecord(EformRole.orgName + userId, this.session.SessionID);
                        str = "ok";
                        if ((EformRole.orgName == ConfigFix.fc_org_name) || ((EformRole.orgName != ConfigFix.fc_org_name) && (str9 == "systemadmin")))
                        {
                            DateTime time  = DateTime.Now;
                            TimeSpan span  = new TimeSpan(4, 0, 0);
                            DateTime time2 = time.Add(span);
                            string   src   = userId + "," + str8;
                            if (EformRole.orgName != ConfigFix.fc_org_name)
                            {
                                src = EformRole.orgName + "," + userId;
                            }
                            src = ((src + "," + str9) + "," + time2.ToString("yyyy-MM-dd HH:mm:ss")) + "," + EformRole.itemName;
                            string str11 = FormsAuthentication.HashPasswordForStoringInConfigFile(src, "MD5");
                            src = src + "," + str11;
                            HttpCookie cookie = new HttpCookie("fc_user_id");
                            cookie.Expires = (time2);
                            cookie.Value   = (Escape.escape(Escape.escape(src)));
                            if (EformRole.inVer == "fcsoft")
                            {
                                cookie.Domain = ("fcsoft.com.cn");
                            }
                            HttpContext.Current.Response.Cookies.Add(cookie);
                        }
                        return(str);
                    }
                    rs.Close();
                    this.oDb.Close();
                    return("登录名或密码错误!");
                }
                catch (Exception exception)
                {
                    throw new SqlRunException(strSql, exception.Message);
                }
                finally
                {
                    try
                    {
                        this.oDb.Close();
                    }
                    catch (Exception)
                    {
                    }
                }
                return(str);
            }
            return("登录名或密码中含有非法字符!");
        }
コード例 #19
0
        public string dataset_select()
        {
            string strsql = this.xmlDocument_0.DocumentElement.ChildNodes.Item(0).InnerText;
            int    num    = int.Parse(this.xmlDocument_0.DocumentElement.ChildNodes.Item(1).InnerText);
            int    num2   = int.Parse(this.xmlDocument_0.DocumentElement.ChildNodes.Item(2).InnerText);
            string str4   = "";

            try
            {
                str4 = this.xmlDocument_0.DocumentElement.ChildNodes.Item(3).InnerText;
            }
            catch (Exception exception3)
            {
                Console.WriteLine(exception3.Message);
            }
            string str15 = "";

            try
            {
                str15 = this.xmlDocument_0.DocumentElement.ChildNodes.Item(4).InnerText;
            }
            catch (Exception exception2)
            {
                Console.WriteLine(exception2.Message);
            }
            string[] strArray2 = null;
            if (!str4.Equals(""))
            {
                strArray2 = str4.Split(new char[] { ',' });
            }
            StringBuilder builder2 = new StringBuilder();

            builder2.Append("<root>");
            string      str7  = "";
            string      name  = "";
            int         index = 1;
            int         num5  = 1;
            int         num4  = 1;
            bool        flag  = false;
            DBOperator  oDb   = null;
            IDataReader rs    = null;

            try
            {
                oDb = this.connectionConfig_0.getDBOperator();
                oDb.Open();
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                Logger.debug("dataset的SQL语句:" + strsql);
                IDataReader ds    = this.runProc(this.dboperator_0, strsql);
                RecordCheck check = new RecordCheck(this.connectionConfig_0.getDBOperator(), this.httpRequest_0, this.httpSessionState_0);
                check.init(ds);
                StringBuilder builder = new StringBuilder();
                index = 0;
                while (index < ds.FieldCount)
                {
                    name = ds.GetName(index);
                    string str12 = null;
                    string str13 = null;
                    string str14 = null;
                    if (str15 != "")
                    {
                        try
                        {
                            try
                            {
                                rs = this.runProc(oDb, str15.Replace("GET_FIELD_NAME_FLAG", name.ToUpper()));
                                if (!rs.Read())
                                {
                                    flag = true;
                                }
                                else
                                {
                                    str12 = SQLTool.getStr(rs, 0, this.string_0);
                                    if (str12 == null)
                                    {
                                        str12 = name;
                                    }
                                    str13 = SQLTool.getStr(rs, 1, this.string_0);
                                    str14 = SQLTool.getStr(rs, 2, this.string_0);
                                }
                            }
                            catch (Exception)
                            {
                                flag = true;
                            }
                            goto Label_0251;
                        }
                        finally
                        {
                            try
                            {
                                rs.Close();
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                    flag = true;
Label_0251:
                    if (flag)
                    {
                        str12 = name;
                        str13 = "15";
                        str14 = "0";
                    }
                    name = name.ToLower();
                    string str11 = name;
                    builder.Append("<field><fieldname>" + name + "</fieldname>");
                    name = cn.com.fcsoft.util.Tools.getDsType(Convert.ToString(ds.GetFieldType(index)));
                    builder.Append("<datatype>" + name + "</datatype><displaylabel>" + str12 + "</displaylabel><size>" + str13 + "</size><precision>" + str14 + "</precision><fieldkind>数据项</fieldkind><defaultvalue></defaultvalue><displayformat></displayformat><isnull>否</isnull><iskey>否</iskey><valid>否</valid><procvalid>否</procvalid><link>否</link><target>_blank</target><href></href><visible>" + this.method_0(strArray2, str11) + "</visible><primarykey>否</primarykey></field>");
                    index++;
                }
                while (ds.Read())
                {
                    if (check.isRecordCanShow(SQLTool.getStr(ds, (int)(ds.FieldCount - 1), this.string_0)))
                    {
                        if (((num4 > ((num - 1) * num2)) && (num4 <= (num * num2))) || (num2 == -1))
                        {
                            builder2.Append("<tr>");
                            num5 = ds.FieldCount;
                            for (index = 0; index < num5; index++)
                            {
                                if (ds.GetName(index) != null)
                                {
                                    string str8 = SQLTool.getStr(ds, index, this.string_0);
                                    if (str8 == null)
                                    {
                                        str8 = "";
                                    }
                                    builder2.Append("<td>" + StringTools.repxml(str8) + "</td>");
                                }
                                else
                                {
                                    builder2.Append("<fcnull></fcnull>");
                                }
                            }
                            builder2.Append("</tr>");
                        }
                        num4++;
                    }
                }
                num4--;
                if (num4 >= 0)
                {
                    builder2.Append("<set><pages>" + num4 + "</pages><fields>");
                    builder2.Append(builder);
                    builder2.Append("</fields></set>");
                }
                builder2.Append("</root>");
                ds.Close();
                this.dboperator_0.Close();
                oDb.Close();
            }
            catch (Exception exception)
            {
                throw new SqlRunException(strsql, exception.Message);
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
                try
                {
                    oDb.Close();
                }
                catch (Exception)
                {
                }
            }
            string str5 = builder2.ToString();

            if (str5 == "<root>")
            {
                str5 = str7;
            }
            return(str5);
        }
コード例 #20
0
        public string fc_select()
        {
            string        strsql  = this.xmlDocument_0.DocumentElement.ChildNodes.Item(0).InnerText;
            string        str2    = this.xmlDocument_0.DocumentElement.ChildNodes.Item(1).InnerText;
            string        str3    = this.xmlDocument_0.DocumentElement.ChildNodes.Item(2).InnerText;
            int           num     = int.Parse(str2);
            int           num2    = int.Parse(str3);
            StringBuilder builder = new StringBuilder("<root>");
            int           num3    = 1;

            try
            {
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                IDataReader ds    = this.runProc(this.dboperator_0, strsql);
                RecordCheck check = new RecordCheck(this.connectionConfig_0.getDBOperator(), this.httpRequest_0, this.httpSessionState_0);
                check.init(ds);
                while (ds.Read())
                {
                    if (check.isRecordCanShow(SQLTool.getStr(ds, (int)(ds.FieldCount - 1), this.string_0)))
                    {
                        if (((num3 > ((num - 1) * num2)) && (num3 <= (num * num2))) || (num2 == -1))
                        {
                            builder.Append("<record>");
                            for (int i = 0; i < ds.FieldCount; i++)
                            {
                                string str4 = ds.GetName(i).ToString();
                                if (str4 != null)
                                {
                                    string str5 = SQLTool.getStr(ds, i, this.string_0);
                                    if (str5 == null)
                                    {
                                        str5 = "";
                                    }
                                    str5 = StringTools.repxml(str5);
                                    if (str4.Trim().Length == 0)
                                    {
                                        str4 = "fc";
                                    }
                                    builder.Append("<" + str4 + ">" + str5 + "</" + str4 + ">");
                                }
                                else
                                {
                                    builder.Append("<fcnull></fcnull>");
                                }
                            }
                            builder.Append("</record>");
                        }
                        num3++;
                    }
                }
                num3--;
                if (num3 > 0)
                {
                    builder.Append("<pages>" + num3 + "</pages>");
                }
                builder.Append("</root>");
                ds.Close();
                this.dboperator_0.Close();
            }
            catch (Exception exception)
            {
                throw new SqlRunException(strsql, exception.Message);
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
            }
            return(builder.ToString());
        }
コード例 #21
0
        /// <summary>
        /// 获取微信用户信息
        /// </summary>
        /// <param name="dicPar"></param>
        public void GetUserInfo(Dictionary <string, object> dicPar)
        {
            ///要检测的参数信息
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }

            string GUID    = dicPar["GUID"].ToString();
            string USER_ID = dicPar["USER_ID"].ToString();

            var sql = string.Format(@"declare @mobile varchar(12) set @mobile='';select @mobile=mobile from wx_members_wx where openid='{0}';select isnull(provinceid,'') as proname,isnull(cityid,'') as cityname,isnull(area,'') as areaname,nickname,sex,isnull(Convert(varchar(10),birthday,120),'') as birthday,isnull(addressdetails,'') as addressdetails,isnull(notpwd,'0') as notpwd,isnull(amount,0) as amount,mobile,headimgurl,memcode from WX_members_wx where openid='{0}';select COUNT(ID) from WX_busDestine where tel=@mobile and status in('0','4') union all select COUNT(bwid) from WX_busWait where tel=@mobile and status in('0') union all select COUNT(memid) from WX_orderdetails where openid='{0}' and payType in('0') and status in('0','1') union all select count(id) from wx_cardinfo where openid='{0}' and isecard='0' union all select count(id) from membercoupon where cardcode in (select cardcode from wx_cardinfo where openid='{0}' and status='1') and cid in (select c.cid from coupon c left join N_sumcoupon sc on c.sumcode=sc.sumcode where sc.ctype not in ('2') and c.status in('','0')) union all select COUNT(id) from WX_usermessage where openid='{0}' and status='0' and isdelete='0' union all select COUNT(actId) from WX_Complaints where openid='{0}' and len(opinion)>0 and isread='0' and status='1' and isdelete='0';select cardcode,erqimg from wx_cardinfo where openid='{0}' and isecard='1';", USER_ID);

            DataSet ds = SQLTool.ExecuteDataset(sql);

            if (ds.Tables.Count == 3)
            {
                string jsonStr = "{\"status\":\"0\",\"mes\":\"获取数据成功\",\"data\":[";
                dt = ds.Tables[0];                //用户基本信息
                DataTable dtCount = ds.Tables[1];
                DataTable dtECard = ds.Tables[2]; //电子卡信息
                if (dt != null && dt.Rows.Count > 0)
                {
                    jsonStr += "{\"proname\":\"" + dt.Rows[0]["proname"].ToString() + "\",\"cityname\":\"" + dt.Rows[0]["cityname"].ToString() + "\",\"areaname\":\"" + dt.Rows[0]["areaname"].ToString() + "\",\"nickname\":\"" + dt.Rows[0]["nickname"].ToString() + "\",\"sex\":\"" + dt.Rows[0]["sex"].ToString() + "\",\"birthday\":\"" + dt.Rows[0]["birthday"].ToString() + "\",\"addressdetails\":\"" + dt.Rows[0]["addressdetails"].ToString() + "\",\"notpwd\":\"" + dt.Rows[0]["notpwd"].ToString() + "\",\"amount\":\"" + dt.Rows[0]["amount"].ToString() + "\",\"mobile\":\"" + dt.Rows[0]["mobile"].ToString() + "\",\"headimgurl\":\"" + dt.Rows[0]["headimgurl"].ToString() + "\",\"memcode\":\"" + dt.Rows[0]["memcode"].ToString() + "\"";
                    if (dtCount != null && dtCount.Rows.Count > 0)
                    {
                        jsonStr += ",\"yycount\":\"" + dtCount.Rows[0][0].ToString() + "\",\"pdcount\":\"" + dtCount.Rows[1][0].ToString() + "\",\"dccount\":\"" + dtCount.Rows[2][0].ToString() + "\",\"cardcount\":\"" + dtCount.Rows[3][0].ToString() + "\",\"yhcount\":\"" + dtCount.Rows[4][0].ToString() + "\",\"messcount\":\"" + dtCount.Rows[5][0].ToString() + "\",\"tscount\":\"" + dtCount.Rows[6][0].ToString() + "\"";
                    }
                    else
                    {
                        //(预约记录,排队记录,点餐记录,会员卡数量,优惠券数量,消息数量,投诉建议数量)
                        jsonStr += ",\"yycount\":\"0\",\"pdcount\":\"0\",\"dccount\":\"0\",\"cardcount\":\"0\",\"yhcount\":\"0\",\"messcount\":\"0\",\"tscount\":\"0\"";
                    }

                    if (dtECard != null && dtECard.Rows.Count > 0)
                    {
                        string cardcode = dtECard.Rows[0]["cardcode"].ToString();
                        string erqimg   = dtECard.Rows[0]["erqimg"].ToString();
                        //生成二维码保存
                        if (string.IsNullOrEmpty(erqimg))
                        {
                            erqimg = DoWaitProcess(cardcode);

                            new bllPaging().ExecuteNonQueryBySQL("update wx_cardinfo set erqimg='" + erqimg + "' where openid='" + USER_ID + "' and cardcode='" + cardcode + "' and isecard='1';");
                        }

                        jsonStr += ",\"ecardcode\":\"" + cardcode + "\",\"erqimg\":\"" + imgurl + erqimg + "\"";
                    }

                    jsonStr += "}]}";
                    ToJsonStr(jsonStr);
                }
                else
                {
                    ToCustomerJson("1", "未找到用户信息");
                }
            }
            else
            {
                ToCustomerJson("1", "未找到用户信息");
            }
        }
コード例 #22
0
ファイル: Parse.cs プロジェクト: 09130510/Masterlink
 public static void Init(string ip, string db, string user = "", string pwd = "")
 {
     m_SQL = new SQLTool(ip, db, user, pwd);
 }
コード例 #23
0
ファイル: WxPay.ashx.cs プロジェクト: hmwenwen/wen
        /// <summary>
        /// 给微信支付做准备,更新相应的数据表
        /// </summary>
        /// <param name="dicPar"></param>
        public void GetPayParamsRecharge(Dictionary <string, object> dicPar)
        {
            var wxJsApiParam = string.Empty;
            ///要检测的参数信息 money:单位为分
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID", "money", "stocode", "strJson", "cardID", "memcode"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }

            var openid = dicPar["USER_ID"].ToString();
            //var wxopenid = Convert.ToString(SQLTool.ExecuteScalar("SELECT wxopenid FROM WX_members_wx WHERE openid='" + openid + "'"));
            var total_fee = Convert.ToDecimal(dicPar["money"].ToString());
            var stocode   = dicPar["stocode"].ToString();
            var strJson   = Convert.ToString(dicPar["strJson"]).Replace('\'', '"');
            var cardId    = dicPar["cardID"].ToString();
            var memcode   = dicPar["memcode"].ToString();

            System.Web.UI.Page page = new System.Web.UI.Page();
            //若传递了相关参数,则调统一下单接口,获得后续相关接口的入口参数
            JsApiPay jsApiPay = new JsApiPay(page);

            jsApiPay.openid    = openid;
            jsApiPay.total_fee = Convert.ToInt32(total_fee * 100);  //*100
            //JSAPI支付预处理
            try
            {
                SetParam.SetParams(stocode);
                WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult();
                wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数
                try
                {
                    var detailcode = Convert.ToString(SQLTool.ExecuteScalar("declare @ordcode varchar(32); exec [dbo].[p_GetOrderCode] @ordcode output;select 'WX'+@ordcode;"));
                    var sql        = "insert into WX_orderdetails(source,buscode,stocode,openid,orderno,sumprice,money,discountprice,status,payType,out_trade_no,postJson) values ('wechat','88888888','" + stocode + "','" + openid + "','" + detailcode + "','" + total_fee + "','" + total_fee + "','" + total_fee + "','0','3','" + jsApiPay.out_trade_no + "','" + strJson + "');";
                    if (!string.IsNullOrEmpty(cardId))
                    {
                        sql += "update members set IDNO='" + Tools.SafeSql(cardId) + "' where ISNULL(IDNO,'')='' and memcode='" + memcode + "';";
                    }
                    SQLTool.ExecuteNonQuery(sql);
                }
                catch (Exception ex)
                {
                    ErrorLog.WriteErrorMessage(ex.ToString());
                }
            }
            catch (Exception ex)
            {
                //  wxJsApiParam = "";
                ErrorLog.WriteErrorMessage("ex:" + ex.ToString());
            }

            try
            {
                Pagcontext.Response.Clear();
                Pagcontext.Response.Write(wxJsApiParam);
            }
            catch (Exception)
            {
            }
            finally
            {
                Pagcontext.Response.End();
            }
        }
コード例 #24
0
ファイル: DbCall.cs プロジェクト: ikvm/test
        public override object calculate()
        {
            object obj2;

            try
            {
                if (base.paramList.Count < 2)
                {
                    throw new ReportError("dbcall函数参数列表至少有2个");
                }
                IDbConnection connection = null;
                string        dsn        = null;
                string        sql        = null;
                string        encoding   = null;
                ExpParse      parse4     = (ExpParse)base.paramList[0];
                if (parse4 != null)
                {
                    object obj8 = ConvertTool.getValue(parse4.calculate());
                    if (!(obj8 is string))
                    {
                        throw new ReportError("dbcall函数参数个数为1时参数应为数据库逻辑名");
                    }
                    dsn = (string)obj8;
                }
                connection = (dsn == null) ? base.env.getConnection() : base.env.getConnection(dsn);
                if ((connection == null) || (connection.State == null))
                {
                    throw new ReportError("过程调用函数执行异常,无有效数据库连接");
                }
                encoding = (dsn != null) ? base.env.getDBCharset(dsn) : base.env.getDBCharset();
                object obj7 = ConvertTool.getValue(((ExpParse)base.paramList[1]).calculate());
                if (!(obj7 is string))
                {
                    throw new ReportError("过程调用函数参数1应为字符串");
                }
                sql = (string)obj7;
                IDbCommand pst      = SupportClass.TransactionManager.manager.PrepareCall(connection, sql);
                string[]   strArray = null;
                int        num3     = 2;
                if ((pst is OracleCommand) || (pst is SqlCommand))
                {
                    num3 = 3;
                    if (base.paramList.Count > 2)
                    {
                        object obj6 = ConvertTool.getValue(((ExpParse)base.paramList[2]).calculate());
                        if (!(obj6 is string))
                        {
                            throw new ReportError("过程调用函数参数3应为字符串");
                        }
                        strArray = ((string)obj6).Split(new char[] { ',' });
                        if (strArray.Length != (base.paramList.Count - num3))
                        {
                            throw new ReportError("dbcall函数中的参数名称个数与参数值个数不一致!");
                        }
                    }
                }
                OracleParameter parameter2 = null;
                SqlParameter    parameter3 = null;
                OleDbParameter  parameter  = null;
                int             num4       = 0;
                int             num2       = num3;
Label_01BC:
                if (num2 < base.paramList.Count)
                {
                    ExpParse parse = (ExpParse)base.paramList[num2];
                    if (parse == null)
                    {
                        throw new ReportError("过程调用函数出现无效参数");
                    }
                    string argName = "";
                    if (num3 == 2)
                    {
                        argName = strArray[num2 - num3];
                    }
                    object obj5 = ConvertTool.getValue(parse.calculate());
                    if ((obj5 == null) || !obj5.ToString().ToUpper().Equals("@@result".ToUpper()))
                    {
                        //goto Label_0318;
                        //Label_0318:
                        SQLTool.setObject(pst, (num2 - num3) + 1, obj5, encoding, argName);
                        //Label_032C:
                        num2++;
                        goto Label_01BC;
                    }
                    if (pst is OracleCommand)
                    {
                        try
                        {
                            parameter2 = new OracleParameter();
                            parameter2.ParameterName = (argName);
                            parameter2.OracleType    = (OracleType)(22);
                            parameter2.Size          = (4000);
                            parameter2.Direction     = (ParameterDirection)(6);
                            pst.Parameters.Add(parameter2);
                        }
                        catch (Exception)
                        {
                        }
                    }
                    while (pst is SqlCommand)
                    {
                        try
                        {
                            parameter3 = new SqlParameter();
                            parameter3.ParameterName = (argName);
                            parameter3.Size          = (4000);
                            parameter3.SqlDbType     = (SqlDbType)(22);
                            parameter3.Direction     = (ParameterDirection)(2);
                            pst.Parameters.Add(parameter3);
                        }
                        catch (Exception)
                        {
                        }
Label_02CA:
                        if (pst is OleDbCommand)
                        {
                            try
                            {
                                parameter           = new OleDbParameter();
                                parameter.Size      = (4000);
                                parameter.OleDbType = (OleDbType)(200);
                                parameter.Direction = (ParameterDirection)(2);
                                pst.Parameters.Add(parameter);
                            }
                            catch (Exception)
                            {
                            }
                        }
                        if (num4 == 0)
                        {
                            num4 = num2;
                        }
                        goto Label_032C;
Label_0318:
                        SQLTool.setObject(pst, (num2 - num3) + 1, obj5, encoding, argName);
Label_032C:
                        num2++;
                        goto Label_01BC;
                    }
                    // TODO: 错误,暂时注释
                    // goto Label_02CA;
                }
                if (((parameter2 != null) || (parameter3 != null)) || (parameter != null))
                {
                    pst.ExecuteNonQuery();
                    pst.Dispose();
                }
                if (parameter2 == null)
                {
                    if (parameter3 != null)
                    {
                        return(parameter3.Value.ToString());
                    }
                    if (parameter != null)
                    {
                        return(parameter.Value.ToString());
                    }
                    IDataReader rs = null;
                    rs = pst.ExecuteReader();
                    if (rs != null)
                    {
                        ArrayList list = new ArrayList();
                        while (rs.Read())
                        {
                            list.Add(SQLTool.getObject(rs, 0, encoding));
                        }
                        rs.Close();
                        pst.Dispose();
                        if (list.Count == 1)
                        {
                            return(list[0]);
                        }
                        return(list);
                    }
                    pst.Dispose();
                    return(null);
                }
                obj2 = parameter2.Value.ToString();
            }
            catch (Exception exception)
            {
                throw new ReportError("过程调用函数sql异常:" + exception.Message.ToString().ToString(), exception);
            }
            return(obj2);
        }
コード例 #25
0
ファイル: WxPay.ashx.cs プロジェクト: hmwenwen/wen
        /// <summary>
        /// 给微信支付做准备,更新相应的数据表
        /// </summary>
        /// <param name="dicPar"></param>
        public void GetPayParams(Dictionary <string, object> dicPar)
        {
            var wxJsApiParam = string.Empty;
            ///要检测的参数信息 money:单位为分
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID", "money", "stocode", "orderno", "type", "zkje", "zkcode", "zkname", "yhje", "yhcode", "yhname", "strJson"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            try
            {
                var openid    = dicPar["USER_ID"].ToString();
                var wxopenid  = Convert.ToString(SQL.SQLTool.ExecuteScalar("SELECT wxopenid FROM WX_members_wx WHERE openid='" + openid + "'"));
                var total_fee = Convert.ToDecimal(dicPar["money"].ToString());
                var stocode   = dicPar["stocode"].ToString();
                var orderno   = dicPar["orderno"].ToString();
                var strJson   = Convert.ToString(dicPar["strJson"]).Replace('\'', '"');

                var sresult = Dishes.GetSoldResult(stocode, strJson);
                if (!string.IsNullOrEmpty(sresult))
                {
                    ToCustomerJson("1", "菜品【" + sresult + "】已售罄");
                    return;
                }

                System.Web.UI.Page page = new System.Web.UI.Page();
                //若传递了相关参数,则调统一下单接口,获得后续相关接口的入口参数
                JsApiPay jsApiPay = new JsApiPay(page);
                jsApiPay.openid    = wxopenid;
                jsApiPay.total_fee = Convert.ToInt32(total_fee * 100);  //*100
                //JSAPI支付预处理

                //查询该订单是否已有商户订单号
                var otn = "select out_trade_no from WX_orderdetails where orderno='" + orderno + "' AND openid='" + openid + "'";

                //查询是否已支付,如果已经支付过,返回错误信息给前端
                var existSql = "select trade_state from wx_pay where out_trade_no=(" + otn + ")";
                var result   = Convert.ToString(SQL.SQLTool.ExecuteScalar(existSql));

                if (result == "SUCCESS")
                {
                    wxJsApiParam = "paid";
                }
                else
                {
                    SetParam.SetParams(stocode);
                    WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult();
                    wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数

                    var zkmoney = dicPar["zkje"].ToString();
                    var yhmoney = dicPar["yhje"].ToString();

                    try
                    {
                        //此处更新订单及支付相关的表
                        var sql = "update WX_orderdetails set postJson='" + strJson + "',out_trade_no='" + jsApiPay.out_trade_no + "',discountprice='" + total_fee + "',privilegepre='" + zkmoney + "',singlemoney='" + yhmoney + "'  where orderno='" + orderno + "' AND openid='" + openid + "';UPDATE WX_choorderdetail SET conmoney='" + total_fee + "' WHERE detailcode='" + orderno + "';UPDATE dbo.choorderdetailBreakhistory SET yhqmoney='" + yhmoney + "',zkmoney='" + zkmoney + "',disratemoney='" + yhmoney + "',cardCode='" + dicPar["zkcode"].ToString() + "',cschemediscmoney='" + zkmoney + "',dispname='" + dicPar["zkname"].ToString() + "',disccardCode='" + dicPar["zkcode"].ToString() + "' where detailcodes='" + orderno + "';UPDATE dbo.chopayhistory SET couponmoney='" + yhmoney + "',accountcode='" + dicPar["zkcode"].ToString() + "',paymoney='" + total_fee + "',rmmoney='" + total_fee + "' where detailcode='" + orderno + "'";

                        var type = Convert.ToString(dicPar["type"]);
                        if (type == "3") //0后支付,1先支付,2打赏,3充值
                        {
                            var detailcode = Convert.ToString(SQLTool.ExecuteScalar("SELECT dbo.f_GetChoorderNo()"));
                            sql = "insert into WX_orderdetails(source,buscode,stocode,openid,orderno,sumprice,money,discountprice,status,payType,out_trade_no,cardCode,postJson) values ('wechat','88888888','" + stocode + "','" + openid + "','" + detailcode + "','" + total_fee + "','" + total_fee + "','" + total_fee + "','0','" + type + "','" + jsApiPay.out_trade_no + "','" + orderno + "','" + strJson + "')";
                        }

                        SQLTool.ExecuteNonQuery(sql);
                    }
                    catch (Exception ex)
                    {
                        ErrorLog.WriteErrorMessage(ex.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                wxJsApiParam = "";
                ErrorLog.WriteErrorMessage(ex.ToString());
            }

            Pagcontext.Response.Clear();
            Pagcontext.Response.Write(wxJsApiParam);
            Pagcontext.Response.End();
        }
コード例 #26
0
ファイル: SqlToTree.cs プロジェクト: ikvm/test
        public string sqltotreedata()
        {
            string        strSql  = this.xmlDocument_0.DocumentElement.ChildNodes.Item(0).InnerText;
            StringBuilder builder = new StringBuilder("<root>");
            int           num     = 1;

            try
            {
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                Logger.debug("tree2的SQL语句:" + strSql);
                IDataReader rs = this.dboperator_0.exeSql(strSql);
                num = rs.FieldCount;
                string str2 = "";
                while (rs.Read())
                {
                    builder.Append("<tr>");
                    str2 = SQLTool.getStr(rs, 0, this.string_0);
                    if (str2 == null)
                    {
                        str2 = "";
                    }
                    builder.Append("<code>" + str2.Trim() + "</code>");
                    str2 = SQLTool.getStr(rs, 1, this.string_0);
                    if (str2 == null)
                    {
                        str2 = "";
                    }
                    builder.Append("<fathercode>" + str2.Trim() + "</fathercode>");
                    str2 = SQLTool.getStr(rs, 2, this.string_0);
                    if (str2 == null)
                    {
                        str2 = "";
                    }
                    builder.Append("<name>" + str2 + "</name>");
                    if (num > 3)
                    {
                        str2 = SQLTool.getStr(rs, 3, this.string_0);
                        if (str2 == null)
                        {
                            str2 = "";
                        }
                        builder.Append("<id>" + str2 + "</id>");
                    }
                    builder.Append("</tr>");
                }
                builder.Append("</root>");
                rs.Close();
                this.dboperator_0.Close();
            }
            catch (Exception exception)
            {
                throw exception;
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
            }
            return(builder.ToString());
        }
コード例 #27
0
        public string fillcombox()
        {
            string        strsql  = this.xmlDocument_0.DocumentElement.ChildNodes.Item(0).InnerText;
            StringBuilder builder = new StringBuilder();
            int           num     = 1;

            try
            {
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                Logger.debug("combobox的SQL语句:" + strsql);
                IDataReader ds    = this.runProc(this.dboperator_0, strsql);
                RecordCheck check = new RecordCheck(this.connectionConfig_0.getDBOperator(), this.httpRequest_0, this.httpSessionState_0);
                check.init(ds);
                num = ds.FieldCount;
                string str2 = "";
                while (ds.Read())
                {
                    if (check.isRecordCanShow(SQLTool.getStr(ds, (int)(ds.FieldCount - 1), this.string_0)))
                    {
                        if (num <= 1)
                        {
                            str2 = SQLTool.getStr(ds, 0, this.string_0);
                            if (str2 == null)
                            {
                                str2 = "";
                            }
                            builder.Append("<option value='" + str2);
                            builder.Append("' >" + str2 + "</option>");
                        }
                        else
                        {
                            str2 = SQLTool.getStr(ds, 0, this.string_0);
                            if (str2 == null)
                            {
                                str2 = "";
                            }
                            builder.Append("<option value='" + str2);
                            str2 = SQLTool.getStr(ds, 1, this.string_0);
                            if (str2 == null)
                            {
                                str2 = "";
                            }
                            builder.Append("' >" + str2 + "</option>");
                        }
                    }
                }
                ds.Close();
                this.dboperator_0.Close();
            }
            catch (Exception exception)
            {
                throw new SqlRunException(strsql, exception.Message);
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
            }
            return(builder.ToString());
        }
コード例 #28
0
ファイル: DataSetTool.cs プロジェクト: ikvm/test
        public static DataSet populate(DataSet ds, IDataReader rs, int beginRow, int endRow, string dbCharset, ArrayList fieldText, bool type_forward_only, bool isEncoding, RecordCheck oRecordCheck)
        {
            bool flag;

            if (rs == null)
            {
                return(null);
            }
            if (beginRow > 0)
            {
                for (int j = 0; j < beginRow; j++)
                {
                    rs.Read();
                }
            }
            DataTable schemaTable = rs.GetSchemaTable();

            if (ds == null)
            {
                ds = new DataSet();
            }
            for (int i = 0; i < schemaTable.Rows.Count; i++)
            {
                if ((fieldText != null) && (fieldText.Count > i))
                {
                    ds.addColumn((string)fieldText[i]);
                }
                else
                {
                    ds.addColumn(Convert.ToString(schemaTable.Rows[(i + 1) - 1]["ColumnName"]));
                }
            }
            int num2 = beginRow;

            if (!(flag = dbCharset == null))
            {
                flag = "GBK".ToUpper().Equals(dbCharset.ToUpper());
            }
            if (!flag)
            {
                flag = !isEncoding;
            }
            oRecordCheck.init(rs);
            while (rs.Read())
            {
                if ((endRow > 0) && (num2 > endRow))
                {
                    return(ds);
                }
                if (oRecordCheck.isRecordCanShow(SQLTool.getStr(rs, rs.FieldCount - 1)))
                {
                    Row row = ds.addRow();
                    for (int k = 1; k <= ds.ColumnCount; k++)
                    {
                        object data = rs.GetValue(k - 1);
                        if (data == DBNull.Value)
                        {
                            data = null;
                        }
                        if (((data != null) && (data is string)) && !flag)
                        {
                            try
                            {
                                data = Encoding.GetEncoding("GBK").GetString(Encoding.GetEncoding(dbCharset).GetBytes((string)data));
                            }
                            catch (Exception exception)
                            {
                                throw new ReportError(new StringBuilder("数据编码:").Append(dbCharset).Append(" 不正确,请检查数据源的数据编码配置").ToString().ToString(), exception);
                            }
                        }
                        row.setData(k, data);
                    }
                }
                num2++;
            }
            return(ds);
        }
コード例 #29
0
ファイル: SqlToTree.cs プロジェクト: ikvm/test
        public string getTreeXml()
        {
            StringBuilder builder = new StringBuilder();
            string        str     = "";
            string        str2    = "";
            string        str3    = "";
            bool          flag    = true;
            int           num     = 0;
            int           num2    = 0;
            int           num3    = 0;
            ArrayList     list    = new ArrayList();
            string        strSql  = this.xmlDocument_0.DocumentElement.ChildNodes.Item(0).InnerText;

            try
            {
                this.dboperator_0 = this.connectionConfig_0.getDBOperator();
                this.dboperator_0.Open();
                Logger.debug("tree1的SQL语句:" + strSql);
                IDataReader rs = this.dboperator_0.exeSql(strSql);
                flag = rs.FieldCount > 2;
                while (rs.Read())
                {
                    num2 = num3;
                    str  = SQLTool.getStr(rs, 0, this.string_0).Trim();
                    str2 = SQLTool.getStr(rs, 1, this.string_0).Trim();
                    if (flag)
                    {
                        str3 = SQLTool.getStr(rs, 2, this.string_0).Trim();
                    }
                    num = str.Length;
                    if (list.Count != 0)
                    {
                        if (Convert.ToInt32(list[(list.Count - 1)]) < num)
                        {
                            list.Add(num);
                        }
                        int num6 = this.method_0(list, num);
                        if (num6 == -1)
                        {
                            continue;
                        }
                        num3 = num6;
                        if (num2 >= num3)
                        {
                            builder.Append("/>");
                            for (int i = 0; i < (num2 - num3); i++)
                            {
                                builder.Append("</TreeNode>");
                            }
                        }
                        else
                        {
                            builder.Append(">");
                        }
                    }
                    else
                    {
                        list.Add(num);
                        num3 = 1;
                    }
                    builder.Append("<TreeNode text=\"" + str2 + "\" ");
                    if (flag)
                    {
                        builder.Append("code=\"" + str3 + "\" ");
                    }
                }
                if (builder.Length > 0)
                {
                    builder.Append("/>");
                    for (int j = 1; j < num3; j++)
                    {
                        builder.Append("</TreeNode>");
                    }
                }
                rs.Close();
                this.dboperator_0.Close();
            }
            catch (Exception exception)
            {
                throw exception;
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
            }
            return(builder.ToString());
        }