protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UcComments1.UnitID = UnitID; UcComments1.DataBind(); var unit = Global.Db.Units.Single(x => x.UnitID == UnitID); lbCode.Text = unit.Code; imgUnit.ImageUrl = string.Format("unitpics/{0}.png", unit.Code); lbName.Text = unit.Name; lbDescription.Text = unit.Description; tbNote.Text = unit.CurrentStatus; ddLicense.SelectedValue = unit.LicenseType.ToString(); tbModelProg.Text = unit.ModelProgress.ToString(); tbTextureProg.Text = unit.TextureProgress.ToString(); tbScriptProg.Text = unit.ScriptProgress.ToString(); lbLastChanged.Text = unit.User != null ? unit.User.Login : ""; lbGame.Text = unit.Game.Name; FillCandidates(unit); if (Global.LoggedUser == null || !Global.LoggedUser.IsAdmin) { btnSubmit.Enabled = false; btnRemove.Enabled = false; tbNote.ReadOnly = true; ddLicense.Enabled = false; tbModelProg.ReadOnly = true; tbTextureProg.ReadOnly = true; tbScriptProg.ReadOnly = true; } } }
protected void Page_Load(object sender, EventArgs e) { Model model = Global.Db.Models.Single(x => x.ModelID == ModelID); if (!IsPostBack) { if (Request["ModelID"] != null) { UcComments1.ModelID = ModelID; } UcComments1.DataBind(); linkSources.Text = "Download model sources"; linkSources.NavigateUrl = string.Format("http://springrts.com/websvn/listing.php?repname=ModelBase&path=%2F{0}%2F{1}%2F#path_{0}_{1}_", model.User.Login, model.Name); lbName.Text = model.Name; imgUnit.ImageUrl = model.GetIconUrl(); tbDescription.Text = model.Description; lbTags.Text = Global.PrintTags(model.ModelTags); lbModified.Text = model.Modified.ToString(); lbAuthor.Text = model.User.Login; tbModelProg.Text = model.ModelProgress.ToString(); tbTextureProg.Text = model.TextureProgress.ToString(); tbScriptProg.Text = model.ScriptProgress.ToString(); ddGames.Items.Clear(); foreach (var g in Global.Db.Games.OrderBy(x => x.Shortcut)) { ddGames.Items.Add(new ListItem(g.Shortcut, g.GameID.ToString())); } ddLicense.Items.Clear(); foreach (var l in Global.Db.Licenses.OrderBy(x => x.Name)) { ddLicense.Items.Add(new ListItem(l.Name, l.LicenseID.ToString()) { Selected = l.LicenseID == model.LicenseID }); } UpdateLicenseLink(model); foreach (Tag tag in Global.Db.Tags.OrderBy(x => x.Name)) { ListItem li = new ListItem(tag.Name, tag.TagID.ToString()) { Selected = model.ModelTags.Select(x => x.TagID).Contains(tag.TagID) }; ddTags.Items.Add(li); } FillCandidates(model); if (Global.LoggedUser == null || (!Global.LoggedUser.IsAdmin && Global.LoggedUserID != model.AuthorUserID)) { tbDescription.ReadOnly = true; btnSubmit.Enabled = false; ddTags.Visible = false; btnRemove.Enabled = false; tbModelProg.ReadOnly = true; tbScriptProg.ReadOnly = true; tbTextureProg.ReadOnly = true; ddLicense.Enabled = false; } } AddScreenshots(model); }