internal void Add(string ExternalLocation, string categoryName) { DEntity d = new DEntity(); d.TargetLocation = ExternalLocation; d = e.Before(new ECategory(), d); e.CreateIfNotThere(d); UpdateList(ExternalLocation); if (!IsThereAny(categoryName)) { ECategory c = new ECategory(); c.Name = categoryName; if (s.Count > 0) { c.Id = s[s.Count - 1].Id + 1; } else { c.Id = 1; } DataAccess.Insert insert = new DataAccess.Insert (c, d); } }
internal void Create(string ExternalLocation, Type t) { DEntity d = new DEntity(); d.TargetLocation = ExternalLocation; // d = e.Before(new EStatus(), d); e.CreateIfNotThere(d); UpdateList(ExternalLocation); EStatus state = IsThereAny(t.Name); if (state is null) { EStatus status = new EStatus(); status.Entity = t.Name; status.Recent = 0; if (s.Count > 0) { status.Id = s[s.Count - 1].Id + 1; } else { status.Id = 1; } DataAccess.Insert add = new DataAccess.Insert(status, d); } }
public List <TEntity> GetAll() { if (WorkOnTheMap == true) { BringInstruction(); } if (CategoryMapOption == true) { ca.UpdateList(ExternalLocation); DEntity d = new DEntity(); Envoy envoy = new Envoy(); d.Name = SetName; d.Root = SetRoot; d.TargetLocation = ExternalLocation; TEntity t = new TEntity(); List <TEntity> allList = new List <TEntity>(); if (ca.s.Count > 0) { foreach (var item in ca.s) { d.CategorizeName = item.Name; d = envoy.Before(t, d); foreach (var item2 in envoy.DataToList <TEntity>(d)) { allList.Add(item2); } } } else // Tekil dosyalar için önemli { d = envoy.Before(t, d); foreach (var item2 in envoy.DataToList <TEntity>(d)) { allList.Add(item2); } } return(allList); } else { return(null); } }
internal void Create(EMap m) { // Name ve Root bilgileri Before üzerinden yükleniyor. // Güncelleme bu bilgiler Instruction kısmı için düzenleniyor. // Kullandığımız entity'in Name ve Root bilgileri alınmalı. DEntity d = new DEntity(); Envoy e = new Envoy(); d.TargetLocation = m.ExternalLocation; d = e.Before(new EMap(), d); e.CreateIfNotThere(d); UpdateList(d.TargetLocation); if (!IsThereAny(m.Entity)) { if (l.Count > 0) { m.Id = l[l.Count - 1].Id + 1; } else { m.Id = 1; } DataAccess.Insert insert = new DataAccess.Insert (m, d); } }
private void UpdateList(string ExternalLocation) { l.Clear(); DEntity d = new DEntity(); Envoy e = new Envoy(); d.TargetLocation = ExternalLocation; d = e.Before(new EMap(), d); l = e.DataToList <EMap>(d); }
public List <TEntity> GetCategorized(string categorizedName) { if (WorkOnTheMap == true) { BringInstruction(); } DEntity d = new DEntity(); Envoy envoy = new Envoy(); d.Name = SetName; d.Root = SetRoot; d.CategorizeName = categorizedName; d.TargetLocation = ExternalLocation; TEntity t = new TEntity(); d = envoy.Before(t, d); return(envoy.DataToList <TEntity>(d)); }
public void Delete(TEntity e) { if (WorkOnTheMap == true) { BringInstruction(); } DEntity d = new DEntity(); Envoy envoy = new Envoy(); if (!(_categoryProperty is null)) { d.CategorizeName = CategoryProperty; } d.Name = SetName; d.Root = SetRoot; d.TargetLocation = ExternalLocation; d = envoy.Before(e, d); envoy.DataDelete(e, d); }
internal void Delete(EMap map) { // Name ve Root bilgileri Before üzerinden yükleniyor. // Güncelleme bu bilgiler Instruction kısmı için düzenleniyor. // Kullandığımız entity'in Name ve Root bilgileri alınmalı. DEntity d = new DEntity(); Envoy e = new Envoy(); d.TargetLocation = map.ExternalLocation; d = e.Before(new EMap(), d); UpdateList(d.TargetLocation); EMap m = new EMap(); if (IsThereAny(map.Entity)) { m = l.FirstOrDefault(x => x.Entity == map.Entity); } DataAccess.Reduce delete = new DataAccess.Reduce(m, d); }
public void Add(TEntity e) { if (WorkOnTheMap == true) { BringInstruction(); } Envoy envoy = new Envoy(); DEntity d = new DEntity(); if (!(_categoryProperty is null)) { d.CategorizeName = CategoryProperty; } d.Name = SetName; d.Root = SetRoot; d.TargetLocation = ExternalLocation; sa.Create(ExternalLocation, e.GetType()); sa.UpdateList(ExternalLocation); EStatus st = sa.IsThereAny(e.GetType().Name); if (AutomaticIdOnAdd) { e.GetType().GetProperty(envoy.FindKey(e)).SetValue(e, st.Recent + 1); } bool IsAdded = false; bool IsDefine = false; if (CheckBeforeAdding) // Eklemeden önce kategori kontrol etme durumu { ca.UpdateList(ExternalLocation); if (ca.IsThereAny(d.CategorizeName) == true) { d = envoy.Before(e, d); envoy.CreateIfNotThere(d); envoy.DataInsert(e, d); IsAdded = true; IsDefine = true; } else { // Şarta bağlı kılınarak ekleme durumu tanımlanmış. // Ancak hangi property üzerinden çalışılacağı söylenmediğinde, // Ekleme yapılmaz. Çünkü seçenek açıktır ve durum verilmemiştir. } } else { d = envoy.Before(e, d); envoy.CreateIfNotThere(d); envoy.DataInsert(e, d); IsAdded = true; IsDefine = true; } if (CategoryMapOption && IsDefine) // Haritaya kategorileri ekleyen kısım { if (!string.IsNullOrWhiteSpace(d.CategorizeName)) { ca.Add(ExternalLocation, d.CategorizeName); } } // Define hakkında; // CheckBeforeAdding açık olmasına rağmen, listede bulunamadığında, CategoryMapOption açık olduğunda // Yine de Map'e ekleme oluşuyor. Kısaca; CBE bloğunda ki else kısmı burayı etkilemiyor. // Bunu düzeltmek için, // Kontrol kapalıysa ve kontrol sonrasında kategori listede bulunmuşsa, map'e ekleme işlemi gerçekleşiyor. if (IsAdded && AutomaticIdOnAdd) { sa.Add(ExternalLocation, e.GetType()); } }