protected void Page_Load(object sender, EventArgs e) { if (Request.Params["id"] == null || Request.Params["id"] == "") return; bug = Bug.Get_ByID(Int32.Parse(Request.Params["id"])); Label_ID.Text = bug.ID.ToString(); Label_Title.Text = bug.Title; Entity.User Owner = Entity.User.Get_ByID(bug.OwnerID); Label_Owner.Text = Owner.Username; Entity.User Validator = Entity.User.Get_ByID(bug.ValidatorID); Label_Validator.Text = Validator.Username; TextBox_Reproduce.Text = bug.Reproduce; if (Owner.Equals(Session["user"])) { Button_Modify.Visible = false; Label_Owner.Visible = false; } else if (Validator.Equals(Session["user"])) { Label_Validator.Visible = false; } else Response.Redirect("~/Page/Login.aspx"); }
public static int AddBug(Bug bug) { return Int32.Parse(DBHelper.SelectCommand("InsertBug", CommandType.StoredProcedure, new SqlParameter("@title", bug.Title), new SqlParameter("@owner", bug.OwnerID), new SqlParameter("@validator", bug.ValidatorID), new SqlParameter("@reproduce", bug.Reproduce)).Rows[0][0].ToString()); }