protected void AddAwardButton_Click(object sender, EventArgs e) { if (AwardYearTextBox.Text != "") { Award a1 = new Award(int.Parse(AwardsDropDownList.SelectedItem.Value), AwardsDropDownList.SelectedItem.Text, int.Parse(AwardYearTextBox.Text)); m1 = Movies.GetMovieByID(Request["mid"]); Movies.AddMovieAward(m1, a1); } else { NewAwardTextBox.Visible = true; if (NewAwardTextBox.Text.Trim() != "") { Award a1 = new Award(0, NewAwardTextBox.Text.Trim()); Awards.AddAward(a1); NewAwardTextBox.Text = ""; NewAwardTextBox.Visible = false; AwardsDropDownList.DataSource = Awards.GetAllAwards(); AwardsDropDownList.DataTextField = "Award"; AwardsDropDownList.DataValueField = "AwardID"; AwardsDropDownList.DataBind(); } } }
public override void Use(Player p, string message) { if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; } string[] args = message.Split(trimChars, 2); if (!(args[0].CaselessEq("add") || args[0].CaselessEq("del"))) { Help(p); return; } if (args[0].CaselessEq("add")) { args = args[1].Split(awardArgs, 2); if (args.Length == 1) { Player.SendMessage(p, "&cUse a : to separate the award name from its description."); Help(p); return; } if (!Awards.AddAward(args[0], args[1])) { Player.SendMessage(p, "This award already exists."); return; } else { Player.GlobalMessage("Award added: &6" + args[0] + " : " + args[1]); } } else { if (!Awards.RemoveAward(args[1])) { Player.SendMessage(p, "This award does not exist."); return; } else { Player.GlobalMessage("Award removed: &6" + args[1]); } } Awards.Save(); }