protected void btnAddGroupRole_Click(object sender, EventArgs e)
        {
            using (var db = new DataAccess.CSSDataContext())
            {
                int groupID = Int32.Parse(ddlGroup.SelectedValue);
                int roleID  = Int32.Parse(ddlRole.SelectedValue);

                if (db.Group_Alias_GroupRoles.FirstOrDefault(p => p.GroupId == groupID && p.AliasId == AliasID) != null)
                {
                    lblErrorMessage.Text = "User is already assigned to this group/role combination.";
                    return;
                }

                DataAccess.Group_Alias_GroupRole newGroupRole = new Allegiance.CommunitySecuritySystem.DataAccess.Group_Alias_GroupRole()
                {
                    AliasId     = AliasID,
                    GroupId     = groupID,
                    GroupRoleId = roleID
                };

                db.Group_Alias_GroupRoles.InsertOnSubmit(newGroupRole);
                db.SubmitChanges();

                if (OnRequiresDataBind != null)
                {
                    OnRequiresDataBind();
                }

                //int loginID = db.Alias.FirstOrDefault(p => p.Id == AliasID).LoginId;

                //Response.Redirect(String.Format("~/User/EditUser.aspx?LoginID={0}&AliasID={1}", loginID, AliasID), true);
            }
        }
        public static void AddAlias(CSSDataContext db, string groupName, string alias)
        {
            var add = new Group_Alias_GroupRole()
            {
                AliasId     = db.Alias.FirstOrDefault(a => a.Callsign == alias).Id,
                GroupId     = db.Groups.FirstOrDefault(g => g.Name == groupName).Id,
                GroupRoleId = db.GroupRoles.FirstOrDefault(gr => gr.Name == "Member").Id //default to member
            };

            //TODO: Check for condition where alias is already in group
            db.Group_Alias_GroupRoles.InsertOnSubmit(add);
            db.SubmitChanges();
        }
		private void detach_Group_Alias_GroupRoles(Group_Alias_GroupRole entity)
		{
			this.SendPropertyChanging();
			entity.Group = null;
		}
		private void attach_Group_Alias_GroupRoles(Group_Alias_GroupRole entity)
		{
			this.SendPropertyChanging();
			entity.Alias = this;
		}
 partial void DeleteGroup_Alias_GroupRole(Group_Alias_GroupRole instance);
 partial void UpdateGroup_Alias_GroupRole(Group_Alias_GroupRole instance);
 partial void InsertGroup_Alias_GroupRole(Group_Alias_GroupRole instance);
        protected void btnAddGroupRole_Click(object sender, EventArgs e)
        {
            using (var db = new DataAccess.CSSDataContext())
            {
                int groupID = Int32.Parse(ddlGroup.SelectedValue);
                int roleID = Int32.Parse(ddlRole.SelectedValue);

                if (db.Group_Alias_GroupRoles.FirstOrDefault(p => p.GroupId == groupID && p.AliasId == AliasID) != null)
                {
                    lblErrorMessage.Text = "User is already assigned to this group/role combination.";
                    return;
                }

                DataAccess.Group_Alias_GroupRole newGroupRole = new Allegiance.CommunitySecuritySystem.DataAccess.Group_Alias_GroupRole()
                {
                    AliasId = AliasID,
                    GroupId = groupID,
                    GroupRoleId = roleID
                };

                db.Group_Alias_GroupRoles.InsertOnSubmit(newGroupRole);
                db.SubmitChanges();

                if(OnRequiresDataBind != null)
                    OnRequiresDataBind();

                //int loginID = db.Alias.FirstOrDefault(p => p.Id == AliasID).LoginId;

                //Response.Redirect(String.Format("~/User/EditUser.aspx?LoginID={0}&AliasID={1}", loginID, AliasID), true);
            }
        }