Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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());
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
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("登录名或密码中含有非法字符!");
        }
Exemplo n.º 6
0
Arquivo: DbStru.cs Projeto: 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);
        }
Exemplo n.º 7
0
Arquivo: DbStru.cs Projeto: 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);
        }
Exemplo n.º 8
0
        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());
        }
Exemplo n.º 9
0
        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());
        }
Exemplo n.º 10
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());
        }
Exemplo n.º 11
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());
        }
Exemplo n.º 12
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());
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
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());
        }