当前位置: 首页>>代码示例>>C#>>正文


C# JavaScriptSerializer.GetEnumerator方法代码示例

本文整理汇总了C#中JavaScriptSerializer.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# JavaScriptSerializer.GetEnumerator方法的具体用法?C# JavaScriptSerializer.GetEnumerator怎么用?C# JavaScriptSerializer.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JavaScriptSerializer的用法示例。


在下文中一共展示了JavaScriptSerializer.GetEnumerator方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: add

    public static Hashtable add(String data, String executor)
    {
        Hashtable t_return = new Hashtable();
        SQLiteConnection conn = tools.getSqliteConn();
        SQLiteCommand comd = new SQLiteCommand();
        comd.Connection = conn;
        SQLiteDataReader rd = null;
        String sql = "";

        Hashtable t_data = new JavaScriptSerializer().Deserialize<Hashtable>(data);

        sql = "select * from basic_parameter where code = '" + t_data["code"] + "' and reference = '" + t_data["reference"] + "' ";
        comd.CommandText = sql;
        rd = comd.ExecuteReader();
        if (rd.Read())
        {
            t_return.Add("status", "2");
            t_return.Add("msg", "used already");
            rd.Close();
            conn.Close();
            return t_return;
        }
        rd.Close();

        IDictionaryEnumerator en = t_data.GetEnumerator();
        Hashtable t_data2 = new Hashtable();
        while (en.MoveNext())
        {
            String value = en.Value.ToString();
            String key = en.Key.ToString();

            t_data2.Add(key, "'" + value + "'");
        }
        t_data = t_data2;

        en = t_data.GetEnumerator();
        sql = "insert into basic_parameter ";
        String keys = "";
        String values = "";
        while (en.MoveNext())
        {
            String value = en.Value.ToString();
            String key = en.Key.ToString();

            keys += key + ",";
            values += value + ",";
        }

        sql = sql + "(" + keys.Substring(0, keys.Length - 1) + ") values (" + values.Substring(0, values.Length - 1) + ");";
        comd.CommandText = sql;
        comd.ExecuteNonQuery();

        conn.Close();
        t_return.Add("status", "1");
        return t_return;
    }
开发者ID:noikiy,项目名称:ligerui-net-demo,代码行数:56,代码来源:basic_parameter.cs

示例2: search

    private static String search(String search, String executor)
    {
        String where = " where 1=1 ";
        Hashtable hshTable = new JavaScriptSerializer().Deserialize<Hashtable>(search);
        IDictionaryEnumerator en = hshTable.GetEnumerator();
        while (en.MoveNext())
        {
            String value = en.Value.ToString();
            String key = en.Key.ToString();

            if (key.Equals("name"))
            {
                where += " and reference like '%" + value + "%'";
            }
        }
        return where;
    }
开发者ID:noikiy,项目名称:ligerui-net-demo,代码行数:17,代码来源:basic_parameter.cs

示例3: add

    public static Hashtable add(String data,String executor)
    {
        Hashtable t_return = new Hashtable();
        SQLiteConnection conn = tools.getSqliteConn();
        SQLiteCommand comd = new SQLiteCommand();
        comd.Connection = conn;
        SQLiteDataReader rd = null;
        String sql = "";

        Hashtable t_data = new JavaScriptSerializer().Deserialize<Hashtable>(data);

        sql = "select * from basic_user where username = '"+t_data["username"]+"'";
        comd.CommandText = sql;
        rd = comd.ExecuteReader();
        if(rd.Read())
        {
            t_return.Add("status","2");
            t_return.Add("msg","username used already");
            rd.Close();
            conn.Close();
            return t_return;
        }
        rd.Close();

        IDictionaryEnumerator en = t_data.GetEnumerator();
        Hashtable t_data2 = new Hashtable();
        while (en.MoveNext())
        {
            String value = en.Value.ToString();
            String key = en.Key.ToString();

            t_data2.Add(key , "'" + value + "'");
        }
        t_data = t_data2;
        int id = tools.getTableId("basic_user")+1;
        t_data.Add("id", id);
        t_data.Add("creater_code", "'" + executor + "'");
        t_data.Add("creater_group_code", "(select group_code from basic_group_2_user where user_code = '" + executor + "' order by group_code limit 1 )");

        en = t_data.GetEnumerator();
        sql = "insert into basic_user ";
        String keys = "";
        String values = "";
        while (en.MoveNext())
        {
            String value = en.Value.ToString();
            String key = en.Key.ToString();

            keys += key + ",";
            values += value + ",";
        }

        sql = sql + "(" + keys.Substring(0, keys.Length - 1) + ") values (" + values.Substring(0,values.Length-1) + ");";
        comd.CommandText = sql;
        comd.ExecuteNonQuery();

        String user_code = (String) t_data["username"];
        String group_code = (String) t_data["group_code"];

        sql = "insert into basic_group_2_user (user_code,group_code) values ("+user_code+","+group_code+");";
        comd.CommandText = sql;
        comd.ExecuteNonQuery();

        conn.Close();
        t_return.Add("status","1");
        t_return.Add("id",id);
        return t_return;
    }
开发者ID:noikiy,项目名称:ligerui-net-demo,代码行数:68,代码来源:basic_user.cs

示例4: modify

    public static Hashtable modify(String data, String executor)
    {
        Hashtable t_return = new Hashtable();
        SQLiteConnection conn = tools.getSqliteConn();
        SQLiteCommand comd = new SQLiteCommand();
        comd.Connection = conn;
        SQLiteDataReader rd = null;
        String sql = "";

        Hashtable t_data = new JavaScriptSerializer().Deserialize<Hashtable>(data);
        String username = (String)t_data["username"];
        t_data.Remove("username");
        String group_code = (String)t_data["group_code"];

        sql = "delete from basic_group_2_user where user_code = '" + username + "' ;";
        comd.CommandText = sql;
        comd.ExecuteNonQuery();
        sql = "insert into basic_group_2_user (user_code,group_code) values ('" + username + "','" + group_code + "');";
        comd.CommandText = sql;
        comd.ExecuteNonQuery();

        IDictionaryEnumerator en = t_data.GetEnumerator();
        Hashtable t_data2 = new Hashtable();
        while (en.MoveNext())
        {
            String value = en.Value.ToString();
            String key = en.Key.ToString();

            t_data2.Add(key, "'" + value + "'");
        }
        t_data = t_data2;
        t_data.Add("time_lastupdated", "now()");
        t_data.Add("count_updated", "count_updated+1");

        en = t_data.GetEnumerator();
        sql = "update basic_user set ";
        int columns = 0;
        while (en.MoveNext())
        {
            columns++;
            String value = en.Value.ToString();
            String key = en.Key.ToString();

            sql += key+ " = "+value+" ,";
        }
        sql = sql.Substring(0, sql.Length - 1);
        sql += " where username = '"+username+"'";
        comd.CommandText = sql;
        comd.ExecuteNonQuery();

        conn.Close();
        t_return.Add("status","1");
        t_return.Add("columns",columns);
        return t_return;
    }
开发者ID:noikiy,项目名称:ligerui-net-demo,代码行数:55,代码来源:basic_user.cs

示例5: modify

    public static Hashtable modify(String data, String executor)
    {
        Hashtable t_return = new Hashtable();
        SQLiteConnection conn = tools.getSqliteConn();
        SQLiteCommand comd = new SQLiteCommand();
        comd.Connection = conn;
        SQLiteDataReader rd = null;

        String sql = "";
        Hashtable t_data = new JavaScriptSerializer().Deserialize<Hashtable>(data);
        String code = (String)t_data["code"];
        t_data.Remove("code");

        IDictionaryEnumerator en = t_data.GetEnumerator();
        Hashtable t_data2 = new Hashtable();
        while (en.MoveNext())
        {
            String value = en.Value.ToString();
            String key = en.Key.ToString();

            t_data2.Add(key, "'" + value + "'");
        }
        t_data = t_data2;

        en = t_data.GetEnumerator();
        sql = "update basic_group set ";
        int columns = 0;
        while (en.MoveNext())
        {
            columns++;
            String value = en.Value.ToString();
            String key = en.Key.ToString();

            sql += key + " = " + value + " ,";
        }
        sql = sql.Substring(0, sql.Length - 1);
        sql += " where code = '" + code + "'";
        comd.CommandText = sql;
        comd.ExecuteNonQuery();

        conn.Close();
        t_return.Add("status", "1");
        t_return.Add("columns", columns);
        return t_return;
    }
开发者ID:noikiy,项目名称:ligerui-net-demo,代码行数:45,代码来源:basic_group.cs


注:本文中的JavaScriptSerializer.GetEnumerator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。