public SysDataDictionaryExt GetExtModel(int id, int psn) { var query = DictionaryRepository.GetQuery(); var q = from x in query where x.Id == id select new { x.Id, x.DicSN, x.DicPSN, x.Title, x.Depth, x.Status, x.CreateDT, x.CreateUID, PTitle = query.Where(o => o.DicSN == x.DicPSN).Select(o => o.Title).FirstOrDefault() }; var source = q.FirstOrDefault(); var obj = new SysDataDictionaryExt(); if (source == null) { var pobj = query.FirstOrDefault(o => o.DicSN == psn); obj.DicPSN = psn; obj.PTitle = pobj.Title; } else { source.ToCopyProperty(obj); } return(obj); }
/// <summary> /// 根据Id获得数据字典 /// </summary> /// <param name="sn"></param> /// <returns></returns> public SysDataDictionaryExt GetExtModel(int id, int psn) { var obj = _dal.GetExtModel(id); if (obj == null) { obj = new SysDataDictionaryExt(); var pobj = _dal.GetByColumn(psn, "DicSN"); obj.DicPSN = psn; obj.PTitle = pobj.Title; } else { } return(obj); }
public ActionResult Save(int?sn, int?psn) { var obj = new SysDataDictionaryExt(); if (sn.HasValue) { var dict = DictService.Get(sn.Value); dict.ToCopyProperty(obj); } if (psn.HasValue) { var dict = DictService.Get(psn.Value); obj.PTitle = dict.Title; obj.DicPSN = psn.Value; } return(View(obj)); }