示例#1
0
        public void InitBindSource()

        {
            CaptainModel model = new CaptainModel()
            {
                PositionName = "东塔", TypeName = "类型", PlanePlace = "机位", IsSelect = false
            };
            CaptainModel model2 = new CaptainModel()
            {
                PositionName = "西塔", TypeName = "类型", PlanePlace = "机位", IsSelect = true
            };
            CaptainModel model3 = new CaptainModel()
            {
                PositionName = "东地", TypeName = "类型", PlanePlace = "航司", IsSelect = false
            };
            CaptainModel model4 = new CaptainModel()
            {
                PositionName = "西塔", TypeName = "类型", PlanePlace = "机位", IsSelect = true
            };

            Capture.Add(model);
            Capture.Add(model2);
            Capture.Add(model3);
            Capture.Add(model4);
        }
 /// <summary>
 /// Check player has been selected as a captain
 /// Update Display
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void captainSelectButton_Click(object sender, EventArgs e)
 {
     // If a player Has beeen selected
     if (teamCaptainDropdown.SelectedIndex != 0)
     {
         CaptainModel c = getCaptain();
         DisplayCaptain.Text = c.Name;
     }
 }
示例#3
0
        public override async Task <ActionReplay> Update(CaptainModel request, ServerCallContext context)
        {
            var result = await _captainService.UpdateAsync(new Core.Models.Captain
            {
                Id     = Guid.Parse(request.Id),
                Status = (CaptainStatus)request.Status
            });

            return(result.ToActionReplay());
        }
示例#4
0
        public override async Task <ActionReplay> Add(CaptainModel request, ServerCallContext context)
        {
            var result = await _captainService.AddAsync(new Core.Models.Captain
            {
                Age      = request.Age,
                Username = request.Username
            });

            return(result.ToActionReplay());
        }
示例#5
0
 private void ExecuteEditCaptain()
 {
     MouseArea.Visibility = Visibility.Collapsed;
     OldModel             = new CaptainModel()
     {
         PersonName = PersonName,
         Age        = Age,
         Skill      = Skill,
         Resources  = CaptainsResources,
         Loyalty    = Loyalty
     };
 }
 /// <summary>
 /// Identify captain and Display
 /// </summary>
 /// <param name="tm"></param>
 private void DoCaptainStuff(TeamModel tm)
 {
     captains = GlobalConfig.Connection.GetTeamCaptains(tm);
     captain  = captains.Find(c => c.DivisionTeamID == tm.DivisionTeamsID);
     if ((captain != null) && (captain.CaptianID != 0))
     {
         DisplayCaptain.Text = selectedPlayers.Find(p => p.PersonID == captain.PersonID).FullName;
     }
     else
     {
         DisplayCaptain.Text = "No Captain";
     }
 }
示例#7
0
        private void OnPositionClick(object obj)
        {
            CaptainModel mdl = (CaptainModel)obj;

            if (mdl.IsOpenPop)
            {
                mdl.IsOpenPop = false;
            }
            else
            {
                InitPositionData();
                mdl.IsOpenPop = true;
            }
        }
示例#8
0
        private void OnLableItemClick(object obj)
        {
            CaptainModel mdl = (CaptainModel)obj;

            if (mdl.IsOpenPop)
            {
                mdl.IsOpenPop = false;
            }
            else
            {
                InitTowerData();
                mdl.IsOpenPop = true;
            }
        }
示例#9
0
 private static Core.Models.Teams.Captain ToCaptain(CaptainModel captain)
 {
     if (string.IsNullOrEmpty(captain.Id))
     {
         return(new Core.Models.Teams.Captain());
     }
     return(new Core.Models.Teams.Captain
     {
         Age = captain.Age,
         Expeditions = captain.Expeditions,
         Id = Guid.Parse(captain.Id),
         Status = (CaptainStatus)captain.Status,
         Name = captain.Name
     });
 }
示例#10
0
        private void TextBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            CaptainModel model = ((Label)sender).DataContext as CaptainModel;

            if (model != null)
            {
                if (model.IsSelect == false)
                {
                    model.IsSelect = true;
                }
                else
                {
                    model.IsSelect = false;
                }
            }
        }
示例#11
0
 public CaptainUIEventArgs(
     RoutedEvent routedEvent,
     int id,
     string action,
     CaptainModel model = null,
     int boatId         = -1,
     string boatName    = ""
     )
     : base(routedEvent)
 {
     _id       = id;
     _action   = action;
     _model    = model;
     _boatId   = boatId;
     _boatName = boatName;
 }
示例#12
0
        /// <summary>
        /// Saves a new TeamCaptain in Selected Dvision to the MySQL DB
        /// </summary>
        /// <param name="model"></param>
        /// <returns>The TeamCaptain information, including the unique identifier</returns>
        public CaptainModel CreateTeamCaptain(CaptainModel model)
        {
            using (IDbConnection connection = new MySqlConnection(GlobalConfig.CnnString(db)))
            {
                var p = new DynamicParameters();
                p.Add("@CaptainID", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
                p.Add("@InDivisionTeamsID", model.DivisionTeamID);
                p.Add("@InPersonID", model.PersonID);

                connection.Execute("spTeamCaptains", p, commandType: CommandType.StoredProcedure);

                var id = p.Get <int?>("CaptainID");
                model.CaptianID = Convert.ToInt32(id);

                return(model);
            }
        }
        /// <summary>
        /// Creates a new Captain model from selected team member
        /// </summary>
        /// <returns>A Captain Model</returns>
        private CaptainModel getCaptain()
        {
            PersonModel p = new PersonModel();

            // potentially redunsant check here with check in captainSelectButton_Click
            if (teamCaptainDropdown.SelectedItem != null)
            {
                captain          = new CaptainModel();
                p                = (PersonModel)teamCaptainDropdown.SelectedItem;
                captain.PersonID = p.PersonID;
                captain.Name     = p.FullName;
                return(captain);
            }
            else
            {
                return(captain);
            }
        }
示例#14
0
 public CaptainModel CreateTeamCaptain(CaptainModel model)
 {
     throw new NotImplementedException();
 }