Ejemplo n.º 1
0
        private ApiResult SaveUserPick(Dictionary <string, string> p)
        {
            ApiResult result = new ApiResult();

            try
            {
                int tournamentId = Convert.ToInt32(p["tournament"]);
                int userId       = Convert.ToInt32(p["user"]);
                int golferId     = Convert.ToInt32(p["golfer"]);

                if (tournamentId > 0 && userId > 0 && golferId > 0)
                {
                    UserPickService.Save(userId, tournamentId, golferId);
                    result.Success = true;
                }
                else
                {
                    result.Success = false;
                    result.Message = "One of the parameters was missing";
                }
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Message = ex.Message;
            }

            return(result);
        }
Ejemplo n.º 2
0
        protected void OnSelectGolfer(object sender, EventArgs e)
        {
            var ddl = (DropDownList)sender;

            if (ddl != null)
            {
                int tournamentId = Convert.ToInt32(ddl.Attributes["TournamentId"].ToString());
                int userId       = Convert.ToInt32(user_list.SelectedValue);
                int golferId     = Convert.ToInt32(ddl.SelectedValue);

                UserPickService.Save(userId, tournamentId, golferId);
            }
        }
Ejemplo n.º 3
0
        protected void OnSavePick(object sender, EventArgs e)
        {
            ////save values
            //SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["default"].ConnectionString);
            //connection.Open();

            //connection.Query("UserPick_Set", new {
            //	TournamentId = tournament_list.SelectedValue,
            //	UserId = user_list.SelectedValue,
            //	GolferId = golfer_list.SelectedValue
            //}, commandType: CommandType.StoredProcedure);

            //connection.Close();

            UserPickService.Save(user_list.SelectedValue, tournament_list.SelectedValue, golfer_list.SelectedValue);
            //should the change log be here, or in the UserPick.Save mehtod?

            message_label_panel.Visible = true;
            message_label.Text          = "Pick was saved";

            BindGrid();
        }