static void Insert(CEI_10List list) { using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities)) { CEI_10 wCEI_10; try { foreach (CEI_10BE c in list) { //falla i10 wCEI_10 = new CEI_10(); wCEI_10.ParentCode = c.ParentCode.Trim(); wCEI_10.Code = c.Code.Trim(); wCEI_10.Description = c.Description; wCEI_10.HasChilds = c.HasChilds; dc.CEI_10.AddObject(wCEI_10); dc.SaveChanges(); } } catch (Exception ex) { throw ex; } } }
public static void ProcessCEI10() { CEI_10List generatedList = new CEI_10List(); CEI_10BE generatedBE = null; var tempList = Retrive_Temporal_All(); string auxiliar = string.Empty; foreach (CEI10_Temp cei10_temp in tempList.OrderBy(p => p.Id)) { generatedBE = new CEI_10BE(); generatedBE.Description = cei10_temp.Description; generatedBE.Code = cei10_temp.Code.Trim(); if (!string.IsNullOrEmpty(cei10_temp.ParentCode.Trim())) { auxiliar = cei10_temp.Code.Trim(); generatedBE.ParentCode = cei10_temp.ParentCode.Trim(); generatedBE.HasChilds = true; } else { generatedBE.ParentCode = auxiliar; } generatedList.Add(generatedBE); } foreach (CEI_10BE item in generatedList) { item.HasChilds = generatedList.Any(p => p.ParentCode.Equals(item.Code)); } Insert(generatedList); }
public static CEI_10List Retrive_All() { CEI_10List list = new CEI_10List(); using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities)) { foreach (CEI_10BE c in dc.CEI_10) { list.Add((CEI_10BE)c); } } return list; }
public static CEI_10List Retrive_All() { CEI_10List list = new CEI_10List(); using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities)) { foreach (CEI_10BE c in dc.CEI_10) { list.Add((CEI_10BE)c); } } return(list); }
public static CEI_10List Retrive_All_ChildsOnly() { CEI_10List list = new CEI_10List(); using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities)) { CEI_10BE c; foreach (CEI_10 item in dc.CEI_10.Where(p => p.HasChilds.Equals(false))) { //list.Add((CEI_10BE)c); c = new CEI_10BE(); c.Code = item.Code; c.Description = item.Description; list.Add(c); } } return list; }
public static CEI_10List Retrive_All_ChildsOnly() { CEI_10List list = new CEI_10List(); using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities)) { CEI_10BE c; foreach (CEI_10 item in dc.CEI_10.Where(p => p.HasChilds.Equals(false))) { //list.Add((CEI_10BE)c); c = new CEI_10BE(); c.Code = item.Code; c.Description = item.Description; list.Add(c); } } return(list); }
public static void ProcessCEI10() { CEI_10List generatedList = new CEI_10List(); CEI_10BE generatedBE = null; var tempList = Retrive_Temporal_All(); string auxiliar = string.Empty; foreach (CEI10_Temp cei10_temp in tempList.OrderBy(p=>p.Id)) { generatedBE = new CEI_10BE(); generatedBE.Description = cei10_temp.Description; generatedBE.Code = cei10_temp.Code.Trim(); if (!string.IsNullOrEmpty(cei10_temp.ParentCode.Trim())) { auxiliar = cei10_temp.Code.Trim(); generatedBE.ParentCode = cei10_temp.ParentCode.Trim(); generatedBE.HasChilds = true; } else { generatedBE.ParentCode = auxiliar; } generatedList.Add(generatedBE); } foreach (CEI_10BE item in generatedList) { item.HasChilds = generatedList.Any(p => p.ParentCode.Equals(item.Code)); } Insert(generatedList); }