public static bool HasSameEntity(Insurance entity) { EntityModelContainer context = entity.Context; if (context.ObjectStateManager.GetObjectStateEntries ((EntityState.Added | EntityState.Modified | EntityState.Unchanged)) .Select(e => e.Entity).OfType<Insurance>() .Any(x => x.Title == entity.Title && (x != entity))) return true; return false; }
private void setInsDef(Insurance ins) { grdFee.DataSource = ins.InsuranceDefs; insuranceBindingSource.DataSource = ins; }
/// <summary> /// Deprecated Method for adding a new object to the Insurances EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToInsurances(Insurance insurance) { base.AddObject("Insurances", insurance); }
private void clear(bool loadFromDB) { grdInsurance.CurrentRow = null; Insurance ins = new Insurance(); ins.Context = DataLayer.GetContext(); ins.InsuranceDefs = new EntityCollection<InsuranceDef>(); Service[] srvs = DataLayer.GetServices(false); for (int i = 0; i < srvs.Count(); i++) { InsuranceDef def = new InsuranceDef(); def.ServiceId = srvs[i].Id; ins.InsuranceDefs.Add(def); } insuranceBindingSource.DataSource = ins; txtInssuranceName.Focus(); btnAdd.Enabled = true; }
/// <summary> /// Create a new Insurance object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="title">Initial value of the Title property.</param> public static Insurance CreateInsurance(global::System.Int32 id, global::System.String title) { Insurance insurance = new Insurance(); insurance.Id = id; insurance.Title = title; return insurance; }