Poistovne GetPoistovnaForVysetrenieImport(string poistovnaNazov) { Poistovne res = null; try { res = (from a in ObjectContext.Poistovnes where a.nazov.ToUpper() == poistovnaNazov.ToUpper() select a).First(); } catch (InvalidOperationException) { } if (res != null) { return res; } else { Poistovne poistovna = new Poistovne(); poistovna.nazov = poistovnaNazov; InsertPoistovne(poistovna); ObjectContext.SaveChanges(); return poistovna; } }
/// <summary> /// /// </summary> public Poistovne TransformPoToEntity() { Poistovne pois = new Poistovne(); pois.nazov = this.nazov; pois.kod = kod; return pois; }
private bool FilterPoistovne(Poistovne entity) { return (entity.id_poistovna == this.id_poistovna); }
/// <summary> /// Deprecated Method for adding a new object to the Poistovnes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPoistovnes(Poistovne poistovne) { base.AddObject("Poistovnes", poistovne); }
/// <summary> /// Create a new Poistovne object. /// </summary> /// <param name="id_poistovna">Initial value of the id_poistovna property.</param> /// <param name="nazov">Initial value of the nazov property.</param> /// <param name="tombstone">Initial value of the tombstone property.</param> public static Poistovne CreatePoistovne(global::System.Int32 id_poistovna, global::System.String nazov, global::System.Boolean tombstone) { Poistovne poistovne = new Poistovne(); poistovne.id_poistovna = id_poistovna; poistovne.nazov = nazov; poistovne.tombstone = tombstone; return poistovne; }
/// <summary> /// button evet click handler, handles Poistovne synchronization /// </summary> public void SynchronizePoistovne() { ambulancePoistovne = new BindableCollection<Cis_Poistovne>(); AmbulanceSynchronizationDomainContext ambulance = _serviceLocator.GetInstance<AmbulanceSynchronizationDomainContext>(); EntityQuery<Cis_Poistovne> query = ambulance.GetCis_PoistovneQuery(); EntityQuery<Poistovne> query2 = _laboratoryDomainContext.GetAllPoistovneQuery(); List<IResult> results = new List<IResult>(); results.Add(Show.Busy()); LoadData<Cis_Poistovne> loadResult = new LoadData<Cis_Poistovne>(ambulance, query, LoadBehavior.RefreshCurrent, (sender) => { ambulancePoistovne.Clear(); ambulancePoistovne.AddRange(((LoadOperation<Cis_Poistovne>)sender).Entities); } ); LoadData<Poistovne> loadResult2 = new LoadData<Poistovne>(_laboratoryDomainContext, query2, LoadBehavior.RefreshCurrent, (sender) => { laboratoryPoistovne.Clear(); laboratoryPoistovne.AddRange(((LoadOperation<Poistovne>)sender).Entities); bool found = false; foreach (var item in ambulancePoistovne) { for (int i = 0; i < laboratoryPoistovne.Count; i++) { found = false; if (item.Nazov == laboratoryPoistovne[i].nazov) { laboratoryPoistovne.RemoveAt(i); found = true; break; } } if (found == false) { Poistovne novaPoistovna = new Poistovne(); novaPoistovna.nazov = item.Nazov; _laboratoryDomainContext.Poistovnes.Add(novaPoistovna); } } _laboratoryDomainContext.SubmitChanges(); Coroutine.BeginExecuteFor(Show.NotBusy(), this); } ); results.Add(loadResult); results.Add(loadResult2); Coroutine.BeginExecuteFor(results, this); }
public void DeletePoistovne(Poistovne poistovne) { if ((poistovne.EntityState != EntityState.Detached)) { this.ObjectContext.ObjectStateManager.ChangeObjectState(poistovne, EntityState.Deleted); } else { this.ObjectContext.Poistovnes.Attach(poistovne); this.ObjectContext.Poistovnes.DeleteObject(poistovne); } }
public void UpdatePoistovne(Poistovne currentPoistovne) { this.ObjectContext.Poistovnes.AttachAsModified(currentPoistovne, this.ChangeSet.GetOriginal(currentPoistovne)); }
public void InsertPoistovne(Poistovne poistovne) { if ((poistovne.EntityState != EntityState.Detached)) { this.ObjectContext.ObjectStateManager.ChangeObjectState(poistovne, EntityState.Added); } else { this.ObjectContext.Poistovnes.AddObject(poistovne); } }