Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {




            Leauge _Leauge = new Leauge();

            string id = Request.QueryString["id"];

            Guid _guid = string.IsNullOrEmpty(id) ? new Guid() : new Guid(id);


            _Leauge = _dal.GetLeaguesByLeagueId(_guid);


            if (!Page.IsPostBack)
            {
                txtName.Text = _Leauge.LeagueName;
                txtLeagueId.Text = _Leauge.LeagueID.ToString();


            }

        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {


                string id = Request.QueryString["id"];
                if (id != "00000000-0000-0000-0000-000000000000")
                {
                    _leaugeId = string.IsNullOrEmpty(id) ? new Guid() : new Guid(id);

                }


                Leauge _leauge = new Leauge();
                _leauge = _dal.GetLeaguesByLeagueId(_leaugeId);

                _leauge.LeagueName = txtName.Text;
                _leauge.LeagueID = Convert.ToInt32(txtLeagueId.Text);





                if (id == "00000000-0000-0000-0000-000000000000")
                {


                    _dal.SkyLarkArenaEntities.Leauges.Add(_leauge);

                }

                _dal.SkyLarkArenaEntities.SaveChanges();

                Response.Redirect("default.aspx");



            }
            catch (Exception ex)
            {
                Log.Error(string.Format("Prizes Edit Exception {0}", ex.ToString()));

            }
        }
Ejemplo n.º 3
0
        public Leauge GetLeaguesByLeagueId(Guid _leagueId)
        {
            try
            {
                if (_leagueId == Guid.Empty)
                {
                    Leauge _league = new Leauge();
                    return _league;
                }
                else
                {
                    var q = SkyLarkArenaEntities.Leauges.Where(p => p.id == _leagueId && p.isDeleted == false);

                    if (q == null)
                        throw new EntityContextException(string.Format("A Prize could not be found {0}!", _leagueId));
                    else
                        return q.ToList()[0];
                }
            }
            catch (Exception ex)
            {
                throw new EntityContextException("GetLeaguesByLeagueId failed.", ex);
            }
        }