Esempio n. 1
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            UserGroupsInfo userGroupById;
            GroupType      type = (GroupType)Enum.Parse(typeof(GroupType), this.DropGropType.SelectedValue);

            if (this.HdnAction.Value == "Modify")
            {
                userGroupById = UserGroups.GetUserGroupById(DataConverter.CLng(this.HdnGroupId.Value));
            }
            else
            {
                userGroupById = new UserGroupsInfo();
            }
            userGroupById.GroupName   = this.TxtGroupName.Text;
            userGroupById.Description = this.TxtDescription.Text;
            userGroupById.GroupType   = type;
            DataActionState unknown = DataActionState.Unknown;

            if (this.Page.IsValid)
            {
                if (this.HdnAction.Value == "Modify")
                {
                    unknown = DataActionState.Exist;
                    if ((userGroupById.GroupName != this.HdnGroupName.Value) && UserGroups.GroupNameIsExist(userGroupById.GroupName))
                    {
                        this.ShowMessage(unknown);
                    }
                    unknown = UserGroups.Update(userGroupById);
                }
                else
                {
                    unknown        = UserGroups.Add(userGroupById);
                    this.m_groupId = userGroupById.GroupId;
                }
                this.ShowMessage(unknown);
            }
        }