public override int InsertOrUpdate <T>(ZLSoft.Pub.StrObjectDict dict) { DBState state = null; T t = System.Activator.CreateInstance <T>(); if (!dict.ContainsKey("ID") || string.IsNullOrEmpty(dict["ID"].ToString())) { dict["ID"] = Utils.getGUID(); dict["RelatID"] = dict["ID"]; state = new DBState { Name = t.MAP_INSERT, Param = dict, Type = ESqlType.INSERT }; } else { state = new DBState { Name = t.MAP_UPDATE, Param = dict, Type = ESqlType.UPDATE }; } return(DB.Execute(state)); }
public static StrObjectDict Union2 <T>(this IDictionary <string, object> dictionary1, T dictionary2) where T : System.Collections.Generic.IDictionary <string, object> { StrObjectDict strObjDict = new StrObjectDict(); foreach (KeyValuePair <string, object> current in dictionary1.Union(dictionary2)) { strObjDict.Add(current.Key, current.Value); } return(strObjDict); }
public static StrObjectDict FindOnlyBy(this IEnumerable <StrObjectDict> objs, string item_name, string value) { if (objs is List <StrObjectDict> ) { StrObjectDict ll = ((List <StrObjectDict>) objs).Find(delegate(StrObjectDict obj) { return("" + obj[item_name] == value || value.Equals(obj[item_name])); }); return(ll); } return(new StrObjectDict()); }
public static string GetString(StrObjectDict dict, string as_str) { string result; if (dict.ContainsKey(as_str)) { result = Utils.GetString(dict[as_str]); } else { result = ""; } return(result); }
public static StrObjectDict FindOnlyBy(this IEnumerable <StrObjectDict> objs, string[] columns, string[] values) { if (objs is List <StrObjectDict> ) { string temp_values = values.ObjectToString(); StrObjectDict ll = ((List <StrObjectDict>) objs).Find(delegate(StrObjectDict obj) { string temp_values2 = obj.GetValues(columns); return(temp_values == temp_values2); }); return(ll); } return(new StrObjectDict()); }
public static StrObjectDict HttpDataToDict(this HttpRequestBase request, bool emptyAsKey) { //return new StrObjectDict().Merger(request.Form); if (request.ContentType.IndexOf("application/json") > -1) { try { StreamReader reader = new StreamReader(request.InputStream, request.ContentEncoding); string req = reader.ReadToEnd(); object oi = JsonAdapter.FromJsonAsDictionary(req); return(StrObjectDict.FromVariable(oi, emptyAsKey)); } catch (Exception) { throw; } } var o = StrObjectDict.FromVariable(request.Form, emptyAsKey); StrObjectDict sod = new StrObjectDict(); sod.Add("Params", o.Merger(request.QueryString)); return(sod); }
public StrObjectDict(StrObjectDict dictionary) : base(dictionary) { }
public static StrObjectDict FromVariable(object o, bool nullValueAsKey) { return(StrObjectDict.FromVariable(o, nullValueAsKey, ECase.NORMAL)); }
public static StrObjectDict FromVariable(object o) { return(StrObjectDict.FromVariable(o, true)); }
public static StrObjectDict toStrObjDict(this object o, bool nullValueAsKey) { //Dictionary<string, object> dictionary = new Dictionary<string, object>(); //return dictionary.Merger(o, nullValueAsKey) ; return(StrObjectDict.FromVariable(o, nullValueAsKey)); }
public static StrObjectDict toStrObjDict(this object o) { return(StrObjectDict.FromVariable(o)); }