public commodityController() { _productBusiness = new ProductBusiness(); _product_dateBusiness = new product_dateBusiness(); _dictionaryBusiness = new DictionaryBusiness(); _teamBusiness = new TeamBusiness(); }
public ToTheFieldController() { _productBusiness = new ProductBusiness(); _product_dateBusiness = new product_dateBusiness(); _dictionaryBusiness = new DictionaryBusiness(); _teamBusiness = new TeamBusiness(); }
private void btnSelectTeam_Click(object sender, EventArgs e) { TeamBusiness tB = new TeamBusiness(); DataTable dt = new DataTable(); int teamID = comboBox4.SelectedIndex; teamID = teamID + 1; int count = 1; dt = tB.getTeamMembers(teamID, count); while (count < 5) { foreach (DataRow item in dt.Rows) { if (item == null) { continue; } else { int n = dataGridView4.Rows.Add(); dataGridView4.Rows[n].Cells["dataGridViewTextBoxColumn3"].Value = item["name"].ToString(); } } count++; } dataGridView4.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
public TicketController() { _productBusiness = new ProductBusiness(); _dictionaryBusiness = new DictionaryBusiness(); _areaBusiness = new AreaBusiness(); _product_dateBusiness = new product_dateBusiness(); _teamBusiness = new TeamBusiness(); }
public override async Task SetChannel() { var teamBusiness = new TeamBusiness(); SetTeamChannel(); teamBusiness.Edit(Team); await PostMessage(GetSlackExecutionSuccessMessage()); }
/// <summary> /// This class handles the view for viewing team information /// </summary> public TeamInfoForm() { InitializeComponent(); string[] teamInfo = TeamBusiness.GetTeamInfo(); lblTeamName.Text += " " + teamInfo[0]; lblTeamPoints.Text += " " + teamInfo[1]; lblTeamMembers.Text += " " + teamInfo[2]; lblTeamAvgPoints.Text += " " + teamInfo[3]; lblPlayerPlace.Text += " " + teamInfo[4] + " in this team"; List <user> listOfUsers = TeamBusiness.GetAllUsersInTeam(); foreach (var item in listOfUsers) { dgUsersInTeam.Rows.Add(item.Username, item.PointAmount); } }
/// <summary> /// The method shows all the teams that have points and members /// </summary> private void TeamJoinForm_Load(object sender, EventArgs e) { FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; TopMost = true; Dictionary <team, int> TeamsAndNumOfMem = TeamBusiness.GetTeamsAndNumOfMembers(); foreach (var item in TeamsAndNumOfMem) { if (item.Key.TeamPointAmount != 0 && item.Key.TeamId != 1) { dgTeamsShow.Rows.Add(item.Key.TeamName, item.Key.TeamPointAmount, item.Value, item.Key.TeamPointAmount / item.Value); } } dgTeamsShow.Sort(Column2, ListSortDirection.Descending); }
/// <summary> /// scope= set:settings /// cmd= 'set currency @p0'. /// @p0 parameter for desired currency /// </summary> /// <returns></returns> public override async Task SetCurrency() { int parameterCount = 1; var parameterSet = new List <CommandParameter> { new CommandParameter { Depth = 2, ParameterValue = Parameters[0].ToLower(), ParameterSet = new List <string> { "tl", "usd", "$" } } }; var validateResp = ValidateParameters(parameterSet, parameterCount); if (validateResp.ResponseCode != ResponseCode.Success) { await PostMessage(GetSlackExecutionErrorMessage(validateResp.ResponseData)); return; } var teamBusiness = new TeamBusiness(); var currency = Statics.GetMainCurrency(Parameters[0]); if (currency == MainCurrency.Unknown) { await PostMessage(GetSlackExecutionErrorMessage(3)); return; } Team.MainCurrency = currency; teamBusiness.Edit(Team); await PostMessage(GetSlackExecutionSuccessMessage()); }
/// <summary> /// scope= set:settings /// cmd= 'set lang @p0' /// </summary> /// <returns></returns> public override async Task SetLanguage() { int parameterCount = 1; var parameterSet = new List <CommandParameter> { new CommandParameter { Depth = 2, ParameterValue = Parameters[0].ToLower(), ParameterSet = new List <string> { "en", "tr" } } }; var validateResp = ValidateParameters(parameterSet, parameterCount); if (validateResp.ResponseCode != ResponseCode.Success) { await PostMessage(GetSlackExecutionErrorMessage(validateResp.ResponseData)); return; } var teamBusiness = new TeamBusiness(); var lang = Statics.GetLanguage(Parameters[0]); if (lang == Language.Unknown) { await PostMessage(GetSlackExecutionErrorMessage(3)); return; } SetTeamLanguage(lang); teamBusiness.Edit(Team); await PostMessage(GetSlackExecutionSuccessMessage()); }
/// <summary> /// The method changes the current user's team /// </summary> private void btnJoin_Click(object sender, EventArgs e) { if (dgTeamsShow.SelectedRows.Count != 1) { string message = "Please select ONE team"; string caption = "Error!"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } else { try { string teamName = GetSelecttedTeamName(); int newTeamId = GetSelectedTeamId(teamName); TeamBusiness.CheckIfTeamDifferent(newTeamId); CurrentUser.ChangeTeam(newTeamId); string message2 = "Joined" + teamName + "!"; string caption2 = "Success!"; MessageBoxButtons buttons2 = MessageBoxButtons.OK; MessageBox.Show(message2, caption2, buttons2); this.Hide(); var window = new TeamInfoForm(); window.ShowDialog(); this.Close(); } catch (IndexOutOfRangeException) { string message = "Please select ONE team"; string caption = "Error!"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } catch (AlreadyInTeamExeption) { string message = "You are already in team"; string caption = "Error!"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } } }
public HttpResponseMessage Get( string calendarYear, [ModelBinder(typeof(Guids))] IEnumerable <Guid> schoolSuperiorId = null, [ModelBinder(typeof(Ints))] IEnumerable <int> schoolClassificationId = null, [ModelBinder(typeof(Ints))] IEnumerable <int> schoolId = null, [ModelBinder(typeof(Ints))] IEnumerable <int> courseId = null, [ModelBinder(typeof(Strings))] IEnumerable <string> coursePeriodId = null, [ModelBinder(typeof(Ints))] IEnumerable <int> disciplineId = null) { try { var result = TeamBusiness.Get(claimData.UserId, claimData.GroupId, calendarYear, schoolSuperiorId, schoolClassificationId, schoolId, courseId, coursePeriodId, disciplineId); return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception exc) { var logId = LogBusiness.Error(exc); return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId))); } }
private void createProjectbtn_Click(object sender, EventArgs e) { if (DGVSelectedMemebers.Rows.Count > 0) { TeamBusiness bTeam = new TeamBusiness(); Team pTeam = new Team(); pTeam.name = txtTeamName.Text; pTeam.category = cmbTeamType.Text; pTeam.id = bTeam.createTeam(pTeam); foreach (DataGridViewRow member in DGVSelectedMemebers.Rows) { int uid = Convert.ToInt32(member.Cells[1].Value.ToString()); bTeam.addMemberToTeam(pTeam.id, uid); test } MessageBox.Show("Team Created"); } else { MessageBox.Show("No Member Selected!"); } }
/// <summary> /// Creates a team and joins the current user /// </summary> private void btnCreate_Click(object sender, EventArgs e) { try { TeamBusiness.CreateTeam(teamName); string message2 = "Team Created!"; string caption2 = "Success!"; MessageBoxButtons buttons2 = MessageBoxButtons.OK; MessageBox.Show(message2, caption2, buttons2); this.Hide(); var window = new TeamInfoForm(); window.ShowDialog(); this.Close(); } catch (TeamNameNullExeption) { string message = "Team name cannot be null!"; string caption = "Error!"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } catch (TeamAlreadyExistsExeption) { teamName = ""; lblTeamNameShown.Text = ""; string message = "Team already exists!"; string caption = "Error!"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } catch (InvalidOperationException) { string message = "Team name cannot be over 10 characters!"; string caption = "Error!"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } }
/// <summary> /// The method returns the team id of a given team's name /// </summary> /// <returns> /// int /// </returns> /// <example> /// <code> /// int newTeamId = GetSelectedTeamId(teamName); /// </code> /// </example> private int GetSelectedTeamId(string teamName) { int newTeamId = TeamBusiness.GetTeamIdByName(teamName); return(newTeamId); }
/// <summary> /// The method shows the top 10 players nad their points and the place of the current user overall /// </summary> /// <param name="topPlayers">Array of users containing the top 10 players.</param> /// <param name="place">integer conatining the overall position of the current user.</param> private void Ranking_Load(object sender, EventArgs e) { FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; TopMost = true; RankingController.Refresh(); List <user> topPlayers = RankingController.GetTopPlayersList(); int counter = 1; foreach (var item in topPlayers) { switch (item.Username.Length) { case 1: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + " -> " + item.PointAmount + " pts"); counter++; break; case 2: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + " -> " + item.PointAmount + " pts"); counter++; break; case 3: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + " -> " + item.PointAmount + " pts"); counter++; break; case 4: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + " -> " + item.PointAmount + " pts"); counter++; break; case 5: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + " -> " + item.PointAmount + " pts"); counter++; break; case 6: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + " -> " + item.PointAmount + " pts"); counter++; break; case 7: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + " -> " + item.PointAmount + " pts"); counter++; break; case 8: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + " -> " + item.PointAmount + " pts"); counter++; break; case 9: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + " -> " + item.PointAmount + " pts"); counter++; break; case 10: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "-> " + item.PointAmount + " pts"); counter++; break; default: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + " -> " + item.PointAmount + " pts"); counter++; break; } } int place = RankingController.GetPlayerPosition(); lblShowPlace.Text = "You are number " + place.ToString() + " in the univerce"; List <team> teams = TeamBusiness.GetListOfTeams(); int counter2 = 1; foreach (var item in teams) { if (item.TeamId != 1) { switch (item.TeamName.Length) { case 1: lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + " -> " + item.TeamPointAmount + " pts"); counter2++; break; case 2: lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + " -> " + item.TeamPointAmount + " pts"); counter2++; break; case 3: lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + " -> " + item.TeamPointAmount + " pts"); counter2++; break; case 4: lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + " -> " + item.TeamPointAmount + " pts"); counter2++; break; case 5: lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + " -> " + item.TeamPointAmount + " pts"); counter2++; break; case 6: lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + " -> " + item.TeamPointAmount + " pts"); counter2++; break; case 7: lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + " -> " + item.TeamPointAmount + " pts"); counter2++; break; case 8: lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + " -> " + item.TeamPointAmount + " pts"); counter2++; break; case 9: lBoxRanking.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + " -> " + item.TeamPointAmount + " pts"); counter2++; break; case 10: lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "-> " + item.TeamPointAmount + " pts"); counter2++; break; default: lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + " -> " + item.TeamPointAmount + " pts"); counter2++; break; } } } }