Example #1
0
 public void Add(Block block)
 {
     using (DefaultCS db = new DefaultCS())
     {
         db.Blocks.MergeOption = MergeOption.NoTracking;
         db.Blocks.AddObject(block);
         db.SaveChanges();
     }
 }
Example #2
0
        public void Update(Block block)
        {
            using (DefaultCS db = new DefaultCS())
            {
                var d = db.Blocks.Where(i => i.Id == block.Id).First();
                d.BlockName = block.BlockName;
                d.SectionId = block.SectionId;
                d.OfficerName = block.OfficerName;
                d.STD = block.STD;
                d.PhoneNo = block.PhoneNo;
                d.FaxNo = block.FaxNo;
                d.MobileNo = block.MobileNo;
                d.UpdatedBy = block.UpdatedBy;
                d.UpdatedDate = block.UpdatedDate;

                db.SaveChanges();
            }
        }
Example #3
0
 /// <summary>
 /// Create a new Block object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="rangeId">Initial value of the RangeId property.</param>
 /// <param name="blockName">Initial value of the BlockName property.</param>
 public static Block CreateBlock(global::System.Int32 id, global::System.Int32 rangeId, global::System.String blockName)
 {
     Block block = new Block();
     block.Id = id;
     block.RangeId = rangeId;
     block.BlockName = blockName;
     return block;
 }
Example #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Blocks EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBlocks(Block block)
 {
     base.AddObject("Blocks", block);
 }
Example #5
0
 public int InsertBlock(Block block)
 {
     using (DefaultCS db = new DefaultCS())
     {
         db.Blocks.MergeOption = MergeOption.NoTracking;
         db.Blocks.AddObject(block);
         db.SaveChanges();
         return block.Id;
     }
 }