예제 #1
0
 /// <summary>
 /// 
 /// </summary>
 public Materialy TransformPoToEntity()
 {
     Materialy material = new Materialy();
     material.nazov = nazov;
     material.popis = popis;
     return material;
 }
 private bool FilterMaterialy(Materialy entity)
 {
     return (entity.id_material == this.id_material);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Materialies EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMaterialies(Materialy materialy)
 {
     base.AddObject("Materialies", materialy);
 }
 /// <summary>
 /// Create a new Materialy object.
 /// </summary>
 /// <param name="id_material">Initial value of the id_material property.</param>
 /// <param name="nazov">Initial value of the nazov property.</param>
 /// <param name="tombstone">Initial value of the tombstone property.</param>
 public static Materialy CreateMaterialy(global::System.Int32 id_material, global::System.String nazov, global::System.Boolean tombstone)
 {
     Materialy materialy = new Materialy();
     materialy.id_material = id_material;
     materialy.nazov = nazov;
     materialy.tombstone = tombstone;
     return materialy;
 }
예제 #5
0
 /// <summary>
 /// 
 /// </summary>
 public void TransformEntityToPo(Materialy material)
 {
     this.nazov = material.nazov;
     this.popis = material.popis;
 }
        public Materialy GetMaterialForImport(string nazov,string popis)
        {
            if ((nazov == null || nazov == "")
                && (popis == null || popis == ""))
            {
                return null;
            }
            else 
            {
                Materialy res = null;
                try
                {
                    res = (from a in ObjectContext.Materialies
                           where a.nazov == nazov
                           select a).First();
                }
                catch (Exception ex)
                {

                }
                if (res != null)
                {
                    return res;
                }
                else 
                {
                    res = new Materialy();
                    res.nazov = nazov;
                    res.popis = popis;
                    InsertMaterialy(res);
                    ObjectContext.SaveChanges();
                    return res;
                }
            }
        }
 public void UpdateMaterialy(Materialy currentMaterialy)
 {
     this.ObjectContext.Materialies.AttachAsModified(currentMaterialy, this.ChangeSet.GetOriginal(currentMaterialy));
 }
 public void InsertMaterialy(Materialy materialy)
 {
     if ((materialy.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(materialy, EntityState.Added);
     }
     else
     {
         this.ObjectContext.Materialies.AddObject(materialy);
     }
 }