Example #1
0
        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;
        }
Example #2
0
 private void setInsDef(Insurance ins)
 {
     grdFee.DataSource = ins.InsuranceDefs;
     insuranceBindingSource.DataSource = ins;
 }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Insurances EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToInsurances(Insurance insurance)
 {
     base.AddObject("Insurances", insurance);
 }
Example #4
0
        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;
        }
Example #5
0
 /// <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;
 }