protected void grdPoints_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { int index = Convert.ToInt32(e.CommandArgument); string value = this.grdPoints.DataKeys[index].Values["id"].ToString(); Response.Redirect("edit.aspx?id=" + value.ToString()); } if (e.CommandName == "DeletePoints") { int index = Convert.ToInt32(e.CommandArgument); string value = this.grdPoints.DataKeys[index].Values["id"].ToString(); player_points _points = new player_points(); _points = _dal.GetPointsById(new Guid(value)); _points.isDeleted = true; _points.deletedDate = DateTime.Now; _dal.SkyLarkArenaEntities.SaveChanges(); } }
public player_points GetPointsTORedeemByPlayerId(Guid _pointsId) { try { if (_pointsId == Guid.Empty) { player_points _playerpoints = new player_points(); return _playerpoints; } else { var q = SkyLarkArenaEntities.player_points.Where(p => p.id == _pointsId && p.isDeleted==false); if (q == null) throw new EntityContextException(string.Format("No Points could be found for player to be processed {0}!", _pointsId)); else return q.ToList()[0]; } } catch (Exception ex) { throw new EntityContextException("GetPointsTORedeemByPlayerId failed.", ex); } }
public player_points GetPointsById(Guid _ppoints) { try { if (_ppoints == Guid.Empty) { player_points _points = new player_points(); return _points; } else { var q = SkyLarkArenaEntities.player_points.Where(p => p.id == _ppoints && p.isDeleted == false); if (q == null) throw new EntityContextException(string.Format("A Point could not be found {0}!", _ppoints)); else return q.ToList()[0]; } } catch (Exception ex) { throw new EntityContextException("GetPointsById failed.", ex); } }