/// <summary>
 /// Deprecated Method for adding a new object to the tblUserGroup EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblUserGroup(tblUserGroup tblUserGroup)
 {
     base.AddObject("tblUserGroup", tblUserGroup);
 }
 /// <summary>
 /// Create a new tblUserGroup object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="iM_DateCreated">Initial value of the IM_DateCreated property.</param>
 /// <param name="iM_DateLastUpdated">Initial value of the IM_DateLastUpdated property.</param>
 /// <param name="iM_Status">Initial value of the IM_Status property.</param>
 public static tblUserGroup CreatetblUserGroup(global::System.Guid id, global::System.DateTime iM_DateCreated, global::System.DateTime iM_DateLastUpdated, global::System.Int32 iM_Status)
 {
     tblUserGroup tblUserGroup = new tblUserGroup();
     tblUserGroup.Id = id;
     tblUserGroup.IM_DateCreated = iM_DateCreated;
     tblUserGroup.IM_DateLastUpdated = iM_DateLastUpdated;
     tblUserGroup.IM_Status = iM_Status;
     return tblUserGroup;
 }
     Guid AddUserGroup(string name)
        {
            using (var ctx = new CokeDataContext(Con))
            {
                tblUserGroup group=null;
                group = ctx.tblUserGroup.FirstOrDefault(p => p.Name.ToLower() == name.ToLower());
                if (group == null)
                {
                    group = new tblUserGroup
                                {
                                    Id = Guid.NewGuid(),
                                    Description = name,
                                    Name = name,
                                    IM_DateCreated = DateTime.Now,
                                    IM_DateLastUpdated = DateTime.Now,
                                    IM_Status = (int) EntityStatus.Active
                                };
                    ctx.tblUserGroup.AddObject(group);
                    ctx.SaveChanges();
                    AddUserGroupRoles(group.Id);
                }
                return group.Id;
            }

        }