/// <summary> /// Создает новую группу. /// </summary> /// <param name="team">Группа.</param> /// <returns>Идентификатор созданной группы.</returns> public int Create(TeamItem team) { if (string.IsNullOrWhiteSpace(team.Name)) { throw new Exception("Поле 'Name' не должно быть пустым."); } return(_teamRepository.Create(team)); }
public void AddTeam(string teamName) { GameObject newTeamObject = GameObject.Instantiate(Resources.Load("UI/Team/TeamItem") as GameObject); TeamItem newTeamItem = newTeamObject.GetComponent <TeamItem>(); _teams[teamName] = newTeamItem; newTeamItem.SetTeamName(teamName); newTeamObject.transform.SetParent(_teamsContainer.transform); }
public void SetUp() { _transactionScope = new TransactionScope(); _studentRepository = new StudentRepository(); _personRepository = new PersonRepository(); _teamRepository = new TeamRepository(); _specialtyDetailRepository = new SpecialtyDetailRepository(); _specialtyRepository = new SpecialtyRepository(); _cathedraRepository = new CathedraRepository(); _facultyRepository = new FacultyRepository(); _team = new TeamItem() { CreateDate = DateTime.Now, Name = "ПЕ-22б", SpecialtyDetailId = _specialtyDetailRepository.Create(new SpecialtyDetailItem() { SpecialtyId = _specialtyRepository.Create(new SpecialtyItem() { CathedraId = _cathedraRepository.Create(new CathedraItem() { FacultyId = _facultyRepository.Create(new FacultyItem()), FullName = "Кафедра", ShortName = "K" }), FullName = "Специальность", ShortName = "С", Code = "1" }), ActualDate = DateTime.Now }) }; _student = new StudentItem() { LastName = "Егоров", FirstName = "Виталий", FatherName = "Игоревич", Birthday = DateTime.Now, TeamId = _teamRepository.Create(_team) }; _student.Id = _personRepository.Create(_student); _studentNew = new StudentItem() { LastName = "Журавлев", FirstName = "Данил", FatherName = "Александрович", Birthday = DateTime.Now, TeamId = _teamRepository.Create(_team) }; _studentNew.Id = _personRepository.Create(_student); }
/// <summary> /// Обновляет данные по группе. /// </summary> /// <param name="team">Группа.</param> public void Update(TeamItem team) { if (string.IsNullOrWhiteSpace(team.Name)) { throw new Exception("Поле 'Name' не должно быть пустым."); } if (GetById(team.Id) == null) { throw new Exception("Группа не найдена."); } _teamRepository.Update(team); }
private static void EmitParentItem(StreamWriter file, TeamItem child) { var id = child.Id; var title = FormatValue(child.Title); var state = FormatValue(child.State); var createdDate = child.CreatedDate.ToShortDateString(); var tags = FormatValue(child.Tags); var iteration = FormatValue(child.Iteration); var link = FormatValue(child.Link); file.WriteLine($"<span class=\"parentTitle\">{title}</span>"); file.WriteLine("<br>"); }
public void SetUp() { _teamRepository = Mock.Of <ITeamRepository>(); _teamService = new TeamService(_teamRepository); _team = new TeamItem() { Id = 1, Name = "Назване группы", CreateDate = DateTime.Now.Date, SpecialtyDetailId = 1 }; }
/// <summary> /// Обновляет данные по группе. /// </summary> /// <param name="team">Группу.</param> public void Update(TeamItem team) { using (var sqlh = new SqlHelper()) { sqlh.ExecNoQuery(@" update Team.Team set name = @Name, create_date = @CreateDate, specialty_detail = @SpecialtyDetailId where Team = @Id", team); } }
public ActionResult TeamItemEdit(TeamItem teamItem) { if (Session["UserName"] != null) { _db.Entry(teamItem).State = EntityState.Modified; _db.SaveChanges(); if (Session["TeamEditStatus"] != null) { Session["TeamEditStatus"] = false; } return(RedirectToAction("TeamIndex")); } else { return(RedirectToAction("Login", "MyAccount")); } }
private void CreateGrid() { grid = new GridNode[gridSizeX, gridSizeY]; Vector3 worldBottomLeft = transform.position - Vector3.right * gridWorldSize.x / 2 - Vector3.forward * gridWorldSize.y / 2; for (int x = 0; x < gridSizeX; x++) { for (int y = 0; y < gridSizeY; y++) { Vector3 worldPoint = worldBottomLeft + Vector3.right * (x * nodeDiameter + nodeRadius) + Vector3.forward * (y * nodeDiameter + nodeRadius); bool walkable = !(Physics.CheckSphere(worldPoint, nodeRadius, unwalkableMask)); //checks if the point collides with the unwakable mask, true if it does int movementPenalty = 0; Ray ray = new Ray(worldPoint + Vector3.up * 50, Vector3.down); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100, walkableMask)) { walkableRegionsDictionary.TryGetValue(hit.collider.gameObject.layer, out movementPenalty); } if (!walkable) { movementPenalty += obstacleProximityPenalty; } grid[x, y] = new GridNode(walkable, worldPoint, x, y, movementPenalty); //adds the currrent point to the grid Collider[] items = Physics.OverlapSphere(worldPoint, nodeRadius, playableItemsMask); if (items.Length > 0) { TeamItem item = items[0].GetComponent <TeamItem>(); item.currentNode = grid[x, y]; grid[x, y].isOccupied = item; } } } BlurPenaltyMap(3); }
public override void Read(BinaryHelper stream, int fixSize) { for (int i = 0; i < m_teamList.Length; i++) { if (null == m_teamList[i]) { m_teamList[i] = new TeamItem(); m_teamList[i].m_memberList = new CSItemGuid[4]; } m_teamList[i].m_index = i; for (int index = 0; index < 4; index++) { m_teamList[i].m_memberList[index].m_lowPart = stream.ReadInt(); m_teamList[i].m_memberList[index].m_highPart = stream.ReadInt(); } } }
public ActionResult TeamItemEdit(int id = 0) { if (Session["UserName"] != null) { ViewBag.ActivePage = "TEAMS"; ViewBag.title = "TEAM EDIT"; ViewBag.DistrictCategory = MyAccountController.DistrictCategory; TeamItem item = _db.TeamItems.Find(id); if (item == null) { return(HttpNotFound()); } string district = item.DISTRICT; if (district != null && district != "") { string[] listStr = district.Split(new char[] { ',' }); string[] SelectedDistrict = new string[listStr.Count()]; for (int i = 0; i < listStr.Count(); i++) { string txtItem = listStr[i]; if (listStr[i].Substring(0, 1) == " ") { txtItem = listStr[i].Trim(); } SelectedDistrict[i] = txtItem; } ViewBag.SelectedDistricts = SelectedDistrict; } if (Session["TeamEditStatus"] != null) { Session["TeamEditStatus"] = true; } else { Session.Add("TeamEditStatus", true); } return(View("TeamItemEdit", item)); } else { return(RedirectToAction("Login", "MyAccount")); } }
public ActionResult AddEditTeam(TeamItem teamItem) { if (Session["UserName"] != null) { if (teamItem.TEAMNAME == null) { return(RedirectToAction("TeamIndex")); } teamItem.MEMBERCOUNT = 0; teamItem.TEAMSTATUS = "out of service"; _db.TeamItems.Add(teamItem); _db.SaveChanges(); return(RedirectToAction("TeamIndex")); } else { return(RedirectToAction("Login", "MyAccount")); } }
public void AddTeamMember(int index, EDITTYPE type, CSItemGuid guid) { //UnityEngine.Debug.Log("AddTeamMember:" + index + "," + type); foreach (TeamItem item in m_teamList) { if (item.m_index == index) { item.m_memberList[(int)type] = guid; return; } } TeamItem teamItem = new TeamItem(); teamItem.m_memberList[(int)type] = guid; teamItem.m_index = index; m_teamList.Add(teamItem); }
private static void EmitItem(StreamWriter file, TeamItem parent, TeamItem child) { var id = child.Id; var title = FormatValue(child.Title); var state = FormatValue(child.State); var createdDate = child.CreatedDate.ToShortDateString(); var tags = FormatValue(child.Tags); var iteration = FormatValue(child.Iteration); var link = FormatValue(child.Link); if (parent != null) { var parentTitle = FormatValue(parent.Title); file.WriteLine($"{id},{parentTitle},{title},{state},{createdDate},{tags},{iteration},{link}"); } else { file.WriteLine($"{id},{title},{state},{createdDate},{tags},{iteration},{link}"); } }
private void CreateTeamItems() { _menuBasedShellViewModel.IsLoadingData = true; new Task(() => { try { IList <ExtendedTeam> allTeams = _teamsDataModel.GetAllExtendedTeams(); uint userId = _menuBasedShellViewModel.CurrentUser.Id; IList <Team> userTeams = _teamsDataModel.GetTeamsOfUser(userId); _allTeams = new List <TeamItem>(); foreach (ExtendedTeam team in allTeams) { TeamItem teamItem = null; if (userTeams.Contains(team)) { teamItem = new TeamItem(team, _LEAVE_TEAM_ACTION_NAME, LeaveCommand); } else { teamItem = new TeamItem(team, _JOIN_TEAM_ACTION_NAME, JoinCommand); } _allTeams.Add(teamItem); } Teams = new ObservableCollection <TeamItem>(_allTeams); } catch (Exception ex) { _logger.Fatal(ex); } _menuBasedShellViewModel.IsLoadingData = false; }).Start(); }
/// <summary> /// Создает новую группу. /// </summary> /// <param name="team">Группу.</param> /// <returns>Идентификатор созданной группу.</returns> public int Create(TeamItem team) { using (var sqlh = new SqlHelper()) { return(sqlh.ExecScalar <int>(@" insert into Team.Team ( name, create_date, specialty_detail ) values ( @Name, @CreateDate, @SpecialtyDetailId ) select scope_identity()", team)); } }
public ActionResult AddEditTeamMembers(TeamMemberEntry teamMemberEntry) { if (Session["UserName"] != null) { _db.TeamMemberEntries.Add(teamMemberEntry); TeamItem team = _db.TeamItems.First(f => f.TEAMNAME == teamMemberEntry.TEAMCODE); int count = team.MEMBERCOUNT; team.MEMBERCOUNT = count + 1; if (team.TEAMSTATUS == "out of service") { team.TEAMSTATUS = "free"; } _db.Entry(team).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("AddEditTeamMembers")); } else { return(RedirectToAction("Login", "MyAccount")); } }
public void SetUp() { _transactionScope = new TransactionScope(); _teamRepository = new TeamRepository(); _specialtyDetailRepository = new SpecialtyDetailRepository(); _specialtyRepository = new SpecialtyRepository(); _cathedraRepository = new CathedraRepository(); _facultyRepository = new FacultyRepository(); var specialty_detail = new SpecialtyDetailItem() { SpecialtyId = _specialtyRepository.Create(new SpecialtyItem() { CathedraId = _cathedraRepository.Create(new CathedraItem() { FacultyId = _facultyRepository.Create(new FacultyItem()), FullName = "Кафедра", ShortName = "K" }), FullName = "Специальность", ShortName = "С", Code = "1" }), ActualDate = DateTime.Now }; _team = new TeamItem() { Name = "ПЕ-22б", CreateDate = DateTime.Now.Date, SpecialtyDetailId = _specialtyDetailRepository.Create(specialty_detail) }; _teamNew = new TeamItem() { Name = "ПЕ-21б", CreateDate = DateTime.Now.AddYears(-1).Date, SpecialtyDetailId = _specialtyDetailRepository.Create(specialty_detail) }; }
public async Task <TeamItem> GetItems(string urlLeader, TeamItem teamItem) { List <string> _allItems = JsonSerializer.Deserialize <List <string> >(File.ReadAllText("C:\\Users\\FERNANDODASILVASALGA\\source\\repos\\BPL3\\BPL3\\JSONs\\ItemList.json")); List <string> _items = new List <string>(); for (int i = 1; i < 21; i++) { if (i != 5 && i != 19) { var url = $"{urlLeader}/{i}"; var document = await context.OpenAsync(url); var items = document.QuerySelectorAll(".owned"); foreach (var item in items) { _items.Add(item.FirstElementChild.FirstElementChild.InnerHtml); } } } var results = _items.Select(i => i).ToList().Intersect(_allItems.Select(i => i).ToList()).ToList(); results.Add("The Pandemonius"); foreach (var item in results) { Item i = teamItem.Items.Where(i => i.Name == item && i.Obtained == "False").FirstOrDefault(); if (i != null) { i.Obtained = "True"; teamItem.Team.SetPoints += 20; var set = teamItem.Items.Where(it => it.SetName == i.SetName && it.Obtained == "False").ToList(); if (set.Count == 0) { teamItem.Team.SetPoints += 100; } } } return(teamItem); }
public ActionResult AddNewTask(TaskEntry taskEntry) { if (Session["UserName"] != null) { TeamItem team = _db.TeamItems.First(f => f.TEAMNAME == taskEntry.TEAMNAME); //if (taskEntry.STATUS == "Open") //{ // team.TEAMSTATUS = "on mission"; // _db.Entry(team).State = EntityState.Modified; //} //taskEntry.COORDINATE = "31.5,31.5"; taskEntry.END = taskEntry.START; _db.TaskEntries.Add(taskEntry); _db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Login", "MyAccount")); } }
public ActionResult TeamItemDelete(int id = 0) { if (Session["UserName"] != null) { ViewBag.ActivePage = "TEAMS"; TeamItem TeamItem = _db.TeamItems.Find(id); _db.Entry(TeamItem).State = EntityState.Deleted; _db.SaveChanges(); var data = _db.TeamMemberEntries.Where(f => f.TEAMCODE == TeamItem.TEAMNAME).ToList(); foreach (TeamMemberEntry p in data) { p.TEAMCODE = ""; _db.Entry(p).State = EntityState.Modified; _db.SaveChanges(); } return(RedirectToAction("TeamIndex")); } else { return(RedirectToAction("Login", "MyAccount")); } }
private static void EmitItem(string itemGuid, StreamWriter file, TeamItem item, string parentItemGuid, List <string> links) { int color; if (item.State == "Closed") { color = 1; } else { color = 0; } var itemTitle = item.Title; var title = $"{itemTitle}"; var subtitle = $"#{item.Id} {item.Link}"; file.WriteLine($"<shape color=\"{ color }\" expanded=\"1\" guid=\"{ itemGuid }\" kind=\"0\" order=\"0\" fontSize=\"0\" size=\"0\">"); file.WriteLine($"<name>{ XmlEscape(title.Trim()) }</name>"); file.WriteLine($"<notes>{ XmlEscape(subtitle.Trim()) }</notes>"); file.WriteLine("<center x=\"1750\" y=\"1750\" />"); file.WriteLine("</shape>"); links.Add($"<link guid=\"{ Guid.NewGuid() }\" childShape=\"{ itemGuid }\" parentShape=\"{ parentItemGuid }\" />"); }
public ActionResult EditTask(TaskEntry taskEntry) { if (Session["UserName"] != null) { //DateTime initDate = new DateTime(); if (taskEntry.STATUS == "Closed") { taskEntry.END = DateTime.Now; TeamItem team = _db.TeamItems.First(f => f.TEAMNAME == taskEntry.TEAMNAME); team.TEAMSTATUS = "free"; _db.Entry(team).State = EntityState.Modified; } _db.Entry(taskEntry).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Login", "MyAccount")); } }
public ActionResult Edit(RegisterModel registerModel) { if (Session["UserName"] != null) { TeamEntry teamEntry = _db.TeamEntries.Find(registerModel.SelectUserId); string userName = teamEntry.USENAME; string userRole = teamEntry.ROLE; string userTeam = teamEntry.TEAMCODE; if (userRole != registerModel.Role) { if (userRole == strRoles[0]) { string tememberRole = "team member"; if (registerModel.Role == "Crew Teams Manager") { tememberRole = "team leader"; } _db.TeamMemberEntries.Add(new TeamMemberEntry() { TEAMCODE = registerModel.Team, TEAMMEMBERNAME = registerModel.UserName, TEAMMEMBERNO = registerModel.PHONE, TEAMMEMBERROLE = tememberRole }); TeamItem team = _db.TeamItems.First(f => f.TEAMNAME == registerModel.Team); int count = team.MEMBERCOUNT; team.MEMBERCOUNT = count + 1; if (team.TEAMSTATUS == "out of service") { team.TEAMSTATUS = "free"; } _db.Entry(team).State = EntityState.Modified; _db.SaveChanges(); } else if (registerModel.Role == strRoles[0]) { TeamMemberEntry mem = _db.TeamMemberEntries.FirstOrDefault(m => m.TEAMCODE == userTeam && m.TEAMMEMBERNAME == userName); _db.Entry(mem).State = EntityState.Deleted; TeamItem team = _db.TeamItems.First(f => f.TEAMNAME == userTeam); int count = team.MEMBERCOUNT; team.MEMBERCOUNT = count - 1; if (team.MEMBERCOUNT < 1) { team.TEAMSTATUS = "out of service"; } _db.Entry(team).State = EntityState.Modified; _db.SaveChanges(); } else { string tememberRole = "team member"; if (registerModel.Role == "Crew Teams Manager") { tememberRole = "team leader"; } _db.TeamMemberEntries.Add(new TeamMemberEntry() { TEAMCODE = registerModel.Team, TEAMMEMBERNAME = registerModel.UserName, TEAMMEMBERNO = registerModel.PHONE, TEAMMEMBERROLE = tememberRole }); _db.SaveChanges(); } } else if (userTeam != registerModel.Team) { TeamMemberEntry mem = _db.TeamMemberEntries.FirstOrDefault(m => m.TEAMCODE == userTeam && m.TEAMMEMBERNAME == userName); _db.Entry(mem).State = EntityState.Deleted; TeamItem team = _db.TeamItems.First(f => f.TEAMNAME == userTeam); int count = team.MEMBERCOUNT; team.MEMBERCOUNT = count - 1; if (team.MEMBERCOUNT < 1) { team.TEAMSTATUS = "out of service"; } _db.Entry(team).State = EntityState.Modified; string tememberRole = "team member"; if (registerModel.Role == "Crew Teams Manager") { tememberRole = "team leader"; } _db.TeamMemberEntries.Add(new TeamMemberEntry() { TEAMCODE = registerModel.Team, TEAMMEMBERNAME = registerModel.UserName, TEAMMEMBERNO = registerModel.PHONE, TEAMMEMBERROLE = tememberRole }); TeamItem team1 = _db.TeamItems.First(f => f.TEAMNAME == registerModel.Team); count = team1.MEMBERCOUNT; team1.MEMBERCOUNT = count + 1; if (team1.TEAMSTATUS == "out of service") { team1.TEAMSTATUS = "free"; } _db.Entry(team1).State = EntityState.Modified; _db.SaveChanges(); } teamEntry.USENAME = registerModel.UserName; teamEntry.PHONE = registerModel.PHONE; teamEntry.EMAIL = registerModel.EMAIL; teamEntry.ROLE = registerModel.Role; teamEntry.TEAMCODE = registerModel.Team; teamEntry.NAME = registerModel.NAME; Users user = _db.Users.First(m => m.UserName == userName && m.SeletUserId == registerModel.SelectUserId); user.Password = registerModel.Password; user.UserName = registerModel.UserName; user.Role = registerModel.Role; _db.Entry(teamEntry).State = EntityState.Modified; _db.Entry(user).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Login", "MyAccount")); } }
static async Task Main(string[] args) { //CsvReaderService _csvReader = new CsvReaderService(); //_csvReader.ReadTeamFile(); LadderService _ladder = new LadderService(); List <Team> teams = new List <Team>(); ScrapingService _scrapper = new ScrapingService(); Team theFormed = JsonSerializer.Deserialize <Team>(File.ReadAllText(filePathBase + filePathTheFormed)); Team theTwisted = JsonSerializer.Deserialize <Team>(File.ReadAllText(filePathBase + filePathTheTwisted)); Team theFeared = JsonSerializer.Deserialize <Team>(File.ReadAllText(filePathBase + filePathTheFeared)); Team theHidden = JsonSerializer.Deserialize <Team>(File.ReadAllText(filePathBase + filePathTheHidden)); List <Item> theFormedItems = JsonSerializer.Deserialize <List <Item> >(File.ReadAllText(filePathBase + filePathTheFormedItems)); List <Item> theTwistedItems = JsonSerializer.Deserialize <List <Item> >(File.ReadAllText(filePathBase + filePathTheTwistedItems)); List <Item> theFearedItems = JsonSerializer.Deserialize <List <Item> >(File.ReadAllText(filePathBase + filePathTheFearedItems)); List <Item> theHiddenTeams = JsonSerializer.Deserialize <List <Item> >(File.ReadAllText(filePathBase + filePathTheHiddenItems)); List <Member> members = JsonSerializer.Deserialize <List <Member> >(File.ReadAllText(filePathBase + "\\BPL3Members.json")); List <Member> updateMember = await GetLadder(members, new List <Team> { theFormed, theTwisted, theFeared, theHidden }); SerializeJsonService.SerializeJson(updateMember, filePathBase + "\\BPL3Members.json"); TeamItem updateFormed = await _scrapper.GetItems(theFormed.StashUrl, new TeamItem { Team = theFormed, Items = theFormedItems }); TeamItem updateFearedItems = await _scrapper.GetItems(theFeared.StashUrl, new TeamItem { Team = theFeared, Items = theFearedItems }); TeamItem updateTwistedItems = await _scrapper.GetItems(theTwisted.StashUrl, new TeamItem { Team = theTwisted, Items = theTwistedItems }); TeamItem updateHiddenItems = await _scrapper.GetItems(theHidden.StashUrl, new TeamItem { Team = theHidden, Items = theHiddenTeams }); List <Member> theTwistedMembers = members.Where(m => m.TeamName == "The Twisted").ToList(); List <Member> theFearedMembers = members.Where(m => m.TeamName == "The Feared").ToList(); List <Member> theHiddenMembers = members.Where(m => m.TeamName == "The Hidden").ToList(); List <Member> theFormedMembers = members.Where(m => m.TeamName == "The Formed").ToList(); List <int> points = new List <int>(); points.AddRange(CalcPoints(theTwistedMembers)); points.AddRange(CalcPoints(theFearedMembers)); points.AddRange(CalcPoints(theHiddenMembers)); points.AddRange(CalcPoints(theFormedMembers)); theTwisted.LevelPoints = points[0]; theTwisted.DelvePoints = points[1]; theTwisted.TotalPoints = theTwisted.LevelPoints + theTwisted.DelvePoints + theTwisted.SetPoints; theFeared.LevelPoints = points[2]; theFeared.DelvePoints = points[3]; theFeared.TotalPoints = theFeared.LevelPoints + theFeared.DelvePoints + theFeared.SetPoints; theHidden.LevelPoints = points[4]; theHidden.DelvePoints = points[5]; theHidden.TotalPoints = theHidden.LevelPoints + theHidden.DelvePoints + theHidden.SetPoints; theFormed.LevelPoints = points[6]; theFormed.DelvePoints = points[7]; theFormed.TotalPoints = theFormed.LevelPoints + theFormed.DelvePoints + theFormed.SetPoints; SerializeJsonService.SerializeJson(updateFormed.Team, filePathBase + filePathTheFormed); SerializeJsonService.SerializeJson(updateFormed.Items, filePathBase + filePathTheFormedItems); SerializeJsonService.SerializeJson(updateHiddenItems.Team, filePathBase + filePathTheHidden); SerializeJsonService.SerializeJson(updateHiddenItems.Items, filePathBase + filePathTheHiddenItems); SerializeJsonService.SerializeJson(updateTwistedItems.Team, filePathBase + filePathTheTwisted); SerializeJsonService.SerializeJson(updateTwistedItems.Items, filePathBase + filePathTheTwistedItems); SerializeJsonService.SerializeJson(updateFearedItems.Team, filePathBase + filePathTheFeared); SerializeJsonService.SerializeJson(updateFearedItems.Items, filePathBase + filePathTheFearedItems); }
public ActionResult Add(RegisterModel model) { if (Session["UserName"] != null) { try { TeamEntry userTeam = new TeamEntry() { USENAME = model.UserName, PHONE = model.PHONE, EMAIL = model.EMAIL, ROLE = model.Role, NAME = model.NAME }; if (model.Team != "Administrator") { userTeam.TEAMCODE = model.Team; } _db.TeamEntries.Add(userTeam); _db.SaveChanges(); //TeamEntry firstUser = _db.TeamEntries.First(m => m.USENAME == model.UserName && m.NAME == model.NAME); TeamEntry firstUser = _db.TeamEntries.First(m => m.USENAME == model.UserName); _db.Users.Add(new Users() { UserName = model.UserName, Password = model.Password, Role = model.Role, SeletUserId = firstUser.id }); _db.SaveChanges(); if (model.Role == "Crew Teams Manager") { _db.TeamMemberEntries.Add(new TeamMemberEntry() { TEAMCODE = model.Team, TEAMMEMBERNAME = model.UserName, TEAMMEMBERNO = model.PHONE, TEAMMEMBERROLE = "team leader" }); TeamItem team = _db.TeamItems.First(f => f.TEAMNAME == model.Team); int count = team.MEMBERCOUNT; team.MEMBERCOUNT = count + 1; if (team.TEAMSTATUS == "out of service") { team.TEAMSTATUS = "free"; } _db.Entry(team).State = EntityState.Modified; _db.SaveChanges(); } else if (model.Role == "Crew Member") { _db.TeamMemberEntries.Add(new TeamMemberEntry() { TEAMCODE = model.Team, TEAMMEMBERNAME = model.UserName, TEAMMEMBERNO = model.PHONE, TEAMMEMBERROLE = "team member" }); TeamItem team = _db.TeamItems.First(f => f.TEAMNAME == model.Team); int count = team.MEMBERCOUNT; team.MEMBERCOUNT = count + 1; if (team.TEAMSTATUS == "out of service") { team.TEAMSTATUS = "free"; } _db.Entry(team).State = EntityState.Modified; _db.SaveChanges(); } return(RedirectToAction("Index", "Teams")); } catch (MembershipCreateUserException e) { ModelState.AddModelError("", MyAccountController.ErrorCodeToString(e.StatusCode)); } return(RedirectToAction("Index")); } else { return(RedirectToAction("Login", "MyAccount")); } }
public ActionResult Create(TeamItem team) { Access.CheckAccess("Team.Creator"); return(RedirectToAction("Index", new { id = _teamService.Create(team) })); }
/// <summary> /// Проверяет эквивалентны ли две группы. /// </summary> /// <param name="first_team">Первая группа для сравнения.</param> /// <param name="second_team">Вторая группа для сравнения.</param> private void AreEqualTeams(TeamItem first_team, TeamItem second_team) { Assert.AreEqual(first_team.Id, second_team.Id); Assert.AreEqual(first_team.Name, second_team.Name); Assert.AreEqual(first_team.CreateDate, second_team.CreateDate); }
public ActionResult Update(TeamItem team) { Access.CheckAccess("Team.Updater"); _teamService.Update(team); return(RedirectToAction("Index", new { id = team.Id })); }