public Dictionary<string, Dictionary<string, string>> GetData(parallel_import_CarInfo Car) { Dictionary<string, Dictionary<string, string>> List = new Dictionary<string, Dictionary<string, string>>(); var CarObjectValues = new ReflectionManager().GetObjectPropertiesAndValues(Car); var config = new ConfigHandle().ConfigForConfigFilds(); string FirstSplit = "\r\n", SecondSplit = ":", ProetyName = string.Empty, Value = string.Empty; foreach (var str in config) { var Values = (CarObjectValues.ContainsKey(str.Key) ? CarObjectValues[str.Key] == "0" ? "" : CarObjectValues[str.Key] : ""); if (string.IsNullOrEmpty(Values)) { continue; } var splitValues = Values.Split(new string[] { FirstSplit }, StringSplitOptions.RemoveEmptyEntries); ;//.Replace("\r\n", ""); //内容列表 Dictionary<string, string> ConfigProprotyKeyValue = new Dictionary<string, string>(); //属性值 foreach (var content in splitValues) { var NameSplitValue = content.Split(new string[] { SecondSplit }, StringSplitOptions.RemoveEmptyEntries); //属性值 及对应的值 int m = 1; foreach (var p in NameSplitValue) { if (m == 1) { ProetyName = p; } else { Value = p; } m++; } if (!ConfigProprotyKeyValue.ContainsKey(ProetyName)) { ConfigProprotyKeyValue.Add(ProetyName, Value); } } List.Add(str.Key, ConfigProprotyKeyValue); } return List; }
public ActionResult Template(parallel_import_CarInfo Car) { int Result = 1; try { string Json = JsonMnanager.SerializeObject(Car); using (LinqParalleDataContext db = DBManager.GetLinqParalleDataContent()) { db.parallel_import_CarConfigTemplate.InsertOnSubmit(new parallel_import_CarConfigTemplate() { Text = Json }); db.SubmitChanges(); } } catch (Exception) { Result = 0; } ViewBag.Result = Result; var Model = GetCarOrConfigData("0"); return View(ViewForTemplate); }
partial void Updateparallel_import_CarInfo(parallel_import_CarInfo instance);
partial void Deleteparallel_import_CarInfo(parallel_import_CarInfo instance);
partial void Insertparallel_import_CarInfo(parallel_import_CarInfo instance);