protected void BtnConfirm_Click(object sender, EventArgs e)
    {
        ClassUserGroup oGrp = new ClassUserGroup();

        oGrp.Delete(Convert.ToInt32(ViewState["UserGroupId"].ToString()));
        Response.Redirect("GroupMenu.aspx?UserGroupId=0", true);
    }
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        //	Submit button.

        int GroupId = 0;

        try
        {
            ClassUserGroup oGrp = new ClassUserGroup();

            oGrp.UserGroupName = this.TxtGroupName.Text;
            oGrp.UserGroupPermissions = 0;

            if (this.ChkAdmin.Checked)
                oGrp.UserGroupPermissions += (Int32)Enum.Permissions.Administration;

            if (this.ChkProjects.Checked)
                oGrp.UserGroupPermissions += (Int32)Enum.Permissions.Project;

            if (this.ChkReports.Checked)
                oGrp.UserGroupPermissions += (Int32)Enum.Permissions.Report;

            if (this.ChkUsers.Checked)
                oGrp.UserGroupPermissions += (Int32)Enum.Permissions.Team;

            if (this.ChkLocks.Checked)
                oGrp.UserGroupPermissions += (Int32)Enum.Permissions.Lock;

            if (this.ChkTimesheet.Checked)
                oGrp.UserGroupPermissions += (Int32)Enum.Permissions.Timesheet;

            if (this.ChkJobAdmin.Checked)
                oGrp.UserGroupPermissions += (Int32)Enum.Permissions.JobMaintenance;

            if (this.ChkManager.Checked)
                oGrp.UserGroupPermissions += (Int32)Enum.Permissions.ManagerOnly;

            GroupId = oGrp.Save(Convert.ToInt32(ViewState["UserGroupId"].ToString()));
        }

        catch (Exception ex)
        {
            Log.LogMsg(ex.Message);
        }

        Response.Redirect(string.Format("GroupMenu.aspx?UserGroupId={0}", GroupId), true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            //	First time initialisation.

            Page.Title = TXT_PAGETITLE;
            this.LblPageTitle.Text = TXT_PAGETITLE;

            if (Request.QueryString["UserGroupId"] == null)
                Response.Redirect("UserGroupMenu.aspx", true);

            ViewState["UserGroupId"] = Request.QueryString["UserGroupId"].ToString();

            ClassUserGroup oGrp = new ClassUserGroup(Convert.ToInt32(ViewState["UserGroupId"].ToString()));

            this.LblMsg.Text = oGrp.UserGroupName;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            //	First time initialisation.

            Page.Title = TXT_PAGETITLE;
            this.LblPageTitle.Text = TXT_PAGETITLE;

            ClassUserGroup oGrp = new ClassUserGroup();

            this.DdlGroups.DataSource = oGrp.ShowUserGroups();
            this.DdlGroups.DataTextField = "UserGroupName";
            this.DdlGroups.DataValueField = "UserGroupId";
            this.DdlGroups.DataBind();

            if (Request.QueryString["UserGroupId"] != null)
            {
                try
                {
                    this.DdlGroups.SelectedValue = Request.QueryString["UserGroupId"].ToString();
                }

                catch (Exception)
                {
                    //	Do nothing. This isn't an error. It just means that the requested
                    //	GroupId isn't in the dropdown listbox.
                }
            }

            if (this.DdlGroups.Items.Count == 0)
            {
                this.BtnDeleteGroup.Enabled = false;
                this.BtnEditGroup.Enabled = false;
                this.DdlGroups.Enabled = false;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            //	First time initialisation.

            Page.Title = TXT_PAGETITLE;
            this.LblPageTitle.Text = TXT_PAGETITLE;

            if (Request.QueryString["UserId"] == null)
                Response.Redirect("UserMenu.aspx", true);

            ViewState["UserId"] = Request.QueryString["UserId"].ToString();

            ClassTeam oTm = new ClassTeam();

            this.DdlTeam.DataSource = oTm.ShowTeams1();
            this.DdlTeam.DataTextField = "TeamName";
            this.DdlTeam.DataValueField = "TeamId";
            this.DdlTeam.DataBind();

            this.DdlTeam.Items.Insert(0, new ListItem("-- Choose team --", "0"));

            ClassUser oUsr = new ClassUser(Convert.ToInt32(Request.QueryString["UserId"]));

            this.TxtUserName.Text = oUsr.UserName;

            string TxtStr = oUsr.Password;

            if (TxtStr.Length < 8)
                TxtStr = TxtStr.PadRight(8);

            this.TxtPassword.Text = TxtStr;
            this.TxtPassword.TextMode = TextBoxMode.Password;
            this.TxtPassword.Attributes.Add("value", TxtStr);

            this.TxtSurname.Text = oUsr.Surname;
            this.TxtForename.Text = oUsr.Forename;
            this.TxtEmailAddress.Text = oUsr.EmailAddress;
            this.TxtHourlyRate.Text = string.Format("{0:f}", oUsr.HourlyRate);
            ClassUserGroup oGrp = new ClassUserGroup();

            this.DdlUserGroup.DataSource = oGrp.ShowUserGroups();
            this.DdlUserGroup.DataTextField = "UserGroupName";
            this.DdlUserGroup.DataValueField = "UserGroupId";
            this.DdlUserGroup.DataBind();

            this.DdlUserGroup.Items.Insert(0, new ListItem("-- Choose user group --", "0"));

            try
            {
                this.DdlTeam.SelectedValue = oUsr.TeamId.ToString();
            }

            catch (Exception)
            {
                //	Do nothing - we don't need to worry about a team which
                //	can't be selected.
            }

            try
            {
                this.DdlUserGroup.SelectedValue = oUsr.UserGroupId.ToString();
            }

            catch (Exception)
            {
                //	Okay to error. The supplied user group id isn't in the
                //	dropdown listbox.
            }

            ClassProject oPrj = new ClassProject();
            DataSet oDs = oPrj.ShowProjectsWithUserMap(oUsr.UserId);

            this.ClstProjects.DataSource = oDs;
            this.ClstProjects.DataTextField = "ProjectName";
            this.ClstProjects.DataValueField = "ProjectId";
            this.ClstProjects.DataBind();

            foreach (DataRow oDr in oDs.Tables[0].Rows)
            {
                if (Convert.ToInt32(oDr["Selected"].ToString()) != 0)
                {
                    ListItem oChk = this.ClstProjects.Items.FindByValue(oDr["ProjectId"].ToString());

                    if (oChk != null)
                    {
                        oChk.Selected = true;
                    }
                }
            }

            this.TxtUserName.Focus();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            //	First time initialisation.

            Page.Title = TXT_PAGETITLE;
            this.LblPageTitle.Text = TXT_PAGETITLE;

            if (Request.QueryString["UserGroupId"] == null)
                Response.Redirect("GroupMenu.aspx", true);

            ClassUserGroup oGrp = new ClassUserGroup(Convert.ToInt32(Request.QueryString["UserGroupId"].ToString()));

            this.TxtGroupName.Text = oGrp.UserGroupName;

            if ((oGrp.UserGroupPermissions & (Int32)Enum.Permissions.Administration) != 0)
                this.ChkAdmin.Checked = true;
            else
                this.ChkAdmin.Checked = false;

            if ((oGrp.UserGroupPermissions & (Int32) Enum.Permissions.Project) != 0)
                this.ChkProjects.Checked = true;
            else
                this.ChkProjects.Checked = false;

            if ((oGrp.UserGroupPermissions & (Int32)Enum.Permissions.Report) != 0)
                this.ChkReports.Checked = true;
            else
                this.ChkReports.Checked = false;

            if ((oGrp.UserGroupPermissions & (Int32)Enum.Permissions.Team) != 0)
                this.ChkUsers.Checked = true;
            else
                this.ChkUsers.Checked = false;

            if ((oGrp.UserGroupPermissions & (Int32)Enum.Permissions.Lock) != 0)
                this.ChkLocks.Checked = true;
            else
                this.ChkLocks.Checked = false;

            if ((oGrp.UserGroupPermissions & (Int32)Enum.Permissions.Timesheet) != 0)
                this.ChkTimesheet.Checked = true;
            else
                this.ChkTimesheet.Checked = false;

            if ((oGrp.UserGroupPermissions & (Int32)Enum.Permissions.JobMaintenance) != 0)
                this.ChkJobAdmin.Checked = true;
            else
                this.ChkJobAdmin.Checked = false;

            if ((oGrp.UserGroupPermissions & (Int32)Enum.Permissions.ManagerOnly) != 0)
                this.ChkManager.Checked = true;
            else
                this.ChkManager.Checked = false;

            ViewState["UserGroupId"] = oGrp.UserGroupId.ToString();
        }
    }