Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            db = Global.CrusadersEntitiesDB();
            ResultRepeater.DataSource = Global.CrusadersEntitiesDB().GameResults.ToList();
            ResultRepeater.DataBind();

            string id = Request.QueryString["id"];
            if (!string.IsNullOrEmpty(id))
            {
                if (!IsPostBack)
                {
                    gm = db.Games1.Where(x => x.id == int.Parse(id)).Single();
                    allPlayers = db.Players.ToList();
                    players = gm.Players.ToList();
                    TxtData.Text = gm.Data;
                    TxtOpnt.Text = gm.Opponent;
                    TxtVenue.Text = gm.Venue;
                    TxtComp.Text = gm.Comp;
                    ResSlc.Value = gm.Result_id.ToString();
                }
            }
            else
            {
                Response.Redirect("Show.aspx");
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];
            if (!string.IsNullOrEmpty(id))
            {
                if (!IsPostBack)
                {
                    db = Global.CrusadersEntitiesDB();

                    game = db.Games1.Where(x => x.id == int.Parse(id)).First();

                }
            }
            else
            {
                Response.Redirect("Games.aspx");
            }

            PlayersRepeater.DataSource = game.Players.ToList();
            PlayersRepeater.DataBind();
        }
Esempio n. 3
0
        protected void SbmBtn_Click(object sender, EventArgs e)
        {
            var db = Global.CrusadersEntitiesDB();

            CrusadersService.Game gm = new CrusadersService.Game();

            gm.Data = TxtData.Text;
            gm.Opponent = TxtOpnt.Text;
            gm.Venue = TxtVenue.Text;
            gm.Comp = TxtComp.Text;

            if ((File1.PostedFile != null) && (File1.PostedFile.ContentLength > 0))
            {
                string fn = System.IO.Path.GetFileName(File1.PostedFile.FileName);
                string SaveLocation = Server.MapPath("/Admin/Games/Data/")+ fn;
                try
                {
                    File1.PostedFile.SaveAs(SaveLocation);
                    Response.Write("The file has been uploaded.");
                    gm.Image = fn;
                }
                catch (Exception ex)
                {
                    Response.Write("Error: " + ex.Message);
                    //Note: Exception.Message returns a detailed message that describes the current exception.
                    //For security reasons, we do not recommend that you return Exception.Message to end users in
                    //production environments. It would be better to return a generic error message.
                }

            }
            else
            {
                Response.Write("Please select a file to upload.");
            }

            db.AddToGames1(gm);
            db.SaveChanges();
            setUpdatedMessage();
        }