本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}