예제 #1
0
        private void LoadRow(int rowId)
        {
            try
            {
                var rep = new DivisionRepository(new CSBCDbContext());
                var division = rep.GetById(Convert.ToInt32(rowId));
                DivisionId = division.DivisionID;
                LoadRow(division);
            }
            catch (Exception ex)
            {
                lblError.Text = "LoadRow::" + ex.Message;
            }

            LoadTeams(DivisionId);
        }
예제 #2
0
 protected void btnDelete_Command(object sender, CommandEventArgs e)
 {
     var rep = new TeamVM();
     var divisionId = Convert.ToInt32(lblDivisionID.Value);
     var teams = rep.GetDivisionTeams(divisionId);
     if (teams.Count() > 0)
     {
         lblError.Text = "Cannot delete Division because teams exist!";
     }
     else
     {
         var repDivision = new DivisionRepository(new CSBCDbContext());
         repDivision.Delete(repDivision.GetById(divisionId));
         LoadDivisions();
         DivisionId = 0;
         //LoadTeams();
     }
 }
예제 #3
0
 protected void grdDivisions_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     var id = e.CommandArgument.ToString();
     var rep = new DivisionRepository(new CSBCDbContext());
     var division = rep.GetById(Convert.ToInt32(id));
     DivisionId = division.DivisionID;
     LoadRow(division);
     LoadTeams(DivisionId);
 }
예제 #4
0
 //Private Sub CheckForStats()
 //    If KeepStats() Then
 //        'transfer to stats
 //        Response.Redirect("GamesStats.aspx")
 //        Exit Sub
 //    End If
 //End Sub
 private bool CheckAD(int divisionId, User user)
 {
     bool functionReturnValue = false;
     using (var db = new CSBCDbContext())
     {
         var divisionRepo = new DivisionRepository(db);
         var division = divisionRepo.GetById(divisionId);
         if (division.DirectorID != 0)
         {
             if (user.HouseID != 0)
             {
                 var householdMembers = db.Set<Person>().Where(p => p.HouseID == user.HouseID);
                 functionReturnValue = householdMembers.Any(h => h.PeopleID == division.DirectorID);
                 lblName.Text = user.Name;
                 lblName.Visible = true;
             }
         }
     }
     return functionReturnValue;
 }