Guest User

Untitled

a guest
Oct 22nd, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. array["ATM"] = array(
  2. "PC" => array(
  3. "Processor" => array(
  4. "CompanyName" => "Name",
  5. "Speed" => "2.9 GHz"
  6. ),
  7. "RAM" => array(
  8. "CompanyName" => "GSkill",
  9. "Capacity" => "8GB")
  10. ),
  11. "Others" => array()
  12. );
  13.  
  14. public Dictionary<string, dynamic> _LoadData(int id, Dictionary<string, dynamic> data, FormCollection collection)
  15. {
  16. var childs = inv_db.inv_meta_data_properties.Where(a => a.parentDataPropertyId == id).ToList();
  17. if(childs.Count > 0){
  18. foreach(var child in childs){
  19. data[child.dataPropertyValue] = _LoadData(child.dataPropertyId, data, collection);
  20. }
  21. }else{
  22. var propItemId = (from map in inv_db.inv_item_property_mapping
  23. join prop in inv_db.inv_dic_item_properties on map.itemPropertyId equals prop.itemPropertyId
  24. where map.itemId == id && map.status == 1
  25. select new
  26. {
  27. name = prop.propertyName,
  28. propId = prop.itemPropertyId
  29. }).ToList();
  30. foreach (var value in propItemId) {
  31. var key = id + "_" + value.propId;
  32. data[value.name] = collection[key].ToString();
  33. }
  34. }
  35.  
  36. return data;
  37. }
Add Comment
Please, Sign In to add comment