protected void BtnConfirm_Click(object sender, EventArgs e) { ClassTeam oTm = new ClassTeam(); oTm.Delete(Convert.ToInt32(ViewState["TeamId"].ToString())); Response.Redirect("TeamMenu.aspx?TaskId=0", true); }
internal WorldCommands(Function function) : base(function) { Objective = new ClassObjective(function); Team = new ClassTeam(function); Datapack = new ClassDatapack(function); Time = new ClassTime(function); Border = new ClassBorder(function); BossBar = new ClassBossBar(function); LoadSquare = new ClassLoadSquare(function); Data = new ClassData(function); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { // First time initialisation. Page.Title = TXT_PAGETITLE; this.LblPageTitle.Text = TXT_PAGETITLE; ClassTeam oTm = new ClassTeam(); this.BtnAddTeam.Enabled = true; this.BtnDeleteTeam.Enabled = false; this.BtnEditTeam.Enabled = false; this.DdlTeams.Enabled = false; this.DdlTeams.DataSource = oTm.ShowTeams1(); this.DdlTeams.DataTextField = "TeamName"; this.DdlTeams.DataValueField = "TeamId"; this.DdlTeams.DataBind(); if (this.DdlTeams.Items.Count > 0) { int UsrId; if (Request.QueryString["TeamId"] != null) UsrId = Convert.ToInt32(Request.QueryString["TeamId"]); else UsrId = 0; try { this.DdlTeams.SelectedValue = UsrId.ToString(); } catch (Exception) { // Okay to error here. It just means that the Team ID doesn't // exist in the dropdown listbox. } this.BtnDeleteTeam.Enabled = true; this.BtnEditTeam.Enabled = true; this.DdlTeams.Enabled = 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["TeamId"] == null) Response.Redirect("TeamMenu.aspx", true); ClassTeam oTm = new ClassTeam(Convert.ToInt32(Request.QueryString["TeamId"].ToString())); this.TxtTeamName.Text = oTm.TeamName; ViewState["TeamId"] = oTm.TeamId.ToString(); } }
protected void BtnSubmit_Click(object sender, EventArgs e) { // Submit button. int TeamId = 0; try { ClassTeam oTm = new ClassTeam(); oTm.TeamName = this.TxtTeamName.Text; TeamId = oTm.Save(Convert.ToInt32(ViewState["TeamId"].ToString())); } catch (Exception ex) { Log.LogMsg(ex.Message); } Response.Redirect(string.Format("TeamMenu.aspx?TeamId={0}", TeamId), 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["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(); } }
private void ShowTeams() { ClassUser oUsr = new ClassUser(Convert.ToInt32(ViewState["UserId"].ToString())); ClassTeam oTm = new ClassTeam(); DataSet oDs; Boolean bManager = false; if (((oUsr.Permissions & (Int32)Enum.Permissions.ManagerOnly) == 0) || (ViewState["UserId"].ToString() == "0")) { bManager = true; } if (bManager == false) { // This user is only allowed to access their own team. oDs = oTm.ShowTeams2(oUsr.TeamId); } else { // This user has access to all teams. oDs = oTm.ShowTeams1(); } this.DdlTeams.DataSource = oDs; this.DdlTeams.DataTextField = "TeamName"; this.DdlTeams.DataValueField = "TeamId"; this.DdlTeams.DataBind(); }