コード例 #1
0
    private void f_goto_table(int a_table_id)
    {
        HedgeEmLogEvent my_log_event = new HedgeEmLogEvent();
        my_log_event.p_method_name = System.Reflection.MethodBase.GetCurrentMethod().ToString();
        my_log_event.p_message = "Method Entered";
        my_log_event.p_server_id = 4663662;
        my_log_event.p_table_id = a_table_id;
        my_log_event.p_player_id = p_session_player_id;

        log.Debug(my_log_event.ToString());

        /* Get reference to table by this table id
         For this GUI to work we need a HedgeEMTable object that it will obtain its data from (e.g. cards to display,
         odds for each hand etc).  So create a place-holder object that we will set later. */
        string my_endpoint = "Not Set";


        try
        {
            if (p_valid_session_exists)
            {

                HedgeemThemeInfo my_hedgeem_theme_info = new HedgeemThemeInfo();
                bool xxxHC_my_get_theme_info_from_server_definition = false;
                string theme_name = enum_theme.ONLINE.ToString();

                if (xxxHC_my_get_theme_info_from_server_definition){
                    my_endpoint = String.Format("{0}/ws_get_theme_details_for_hedgeem_table/{1}/", p_current_json_webservice_url_base, a_table_id);
                    my_hedgeem_theme_info = (HedgeemThemeInfo)f_get_object_from_json_call_to_server(my_endpoint, typeof(HedgeemThemeInfo));

                    if (my_hedgeem_theme_info == null)
                    {
                        throw new Exception(String.Format("Unable to determine theme for table [{0}]", a_table_id));
                    }

                    if (my_hedgeem_theme_info._error_message != "")
                    {
                        throw new Exception(my_hedgeem_theme_info._error_message);
                    }
                    theme_name = my_hedgeem_theme_info.short_name;
                    Session["theme"] = theme_name;
                }


                // xxx Note from Simon Jan 2015 - not sure what this next line does.  If it is just a pop up it can be deleted (esp as it does not work anyway)
                //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('" + "Theme name -" + Session["theme"].ToString() + "');", true);

                my_log_event.p_message = String.Format("Successfully retrieved theme for table ID [{0}] Theme [{1}] so redirecting to (opening) HedgeEmTable page so ASP can render page to this theme.", a_table_id, theme_name);
                log.Debug(my_log_event.ToString());

                Response.Redirect("frm_hedgeem_table.aspx", false);
            }
            else
            {
                Page.RegisterStartupScript("OnLoad", "<script>alert('You need to be logged in to sit at this table');</script>");
            }
        }
        catch (Exception ex)
        {
            // xxx_eh error not show to user
            string my_error_popup = "alert('Error in method [f_goto_table] - " + ex.Message.ToString() + "');";
        //    ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true);
            my_log_event.p_message = String.Format("Error", ex.Message);
            log.Error(my_log_event.ToString());
            //throw new Exception(my_log_event.ToString());               


            HedgeemerrorPopup my_popup_message = new HedgeemerrorPopup();
            my_popup_message.p_detailed_message_str = "";
              my_popup_message.p_detailed_message_str = my_error_popup;
            my_popup_message.p_is_visible = true;
            
            //newuser.Visible = false;
            
            Place_Holder_Popup_Message.Controls.Add(my_popup_message);
        
            my_popup_message.Dispose();

        }
    }
コード例 #2
0
    private void f_goto_table(int a_table_id)
    {

        /* Get reference to table by this table id
         For this GUI to work we need a HedgeEMTable object that it will obtain its data from (e.g. cards to display,
         odds for each hand etc).  So create a place-holder object that we will set later. */


        log.Debug("f_goto_table is called");
        try
        {
            if (Session["username"] != null)
            {

                //string theme_name = service.get_theme_name(a_table_id);
                HedgeemThemeInfo my_hedgeem_theme_info = new HedgeemThemeInfo();
                my_hedgeem_theme_info = (HedgeemThemeInfo)f_get_object_from_json_call_to_server("ws_get_theme_details_for_hedgeem_table/" + a_table_id, typeof(HedgeemThemeInfo));
                string theme_name = my_hedgeem_theme_info.short_name;
                Session["theme"] = theme_name;

                ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('" + "Theme name -" + Session["theme"].ToString() + "');", true);
                /* HACK xxx.  This is a hack to ensure that the 'style' is set correctly when
                 starting from the lobby window.  I have to call the menu item as I only want to set the background
                 once - this is also a hack */
                EventArgs ea = new EventArgs();

                Response.Redirect("frm_hedgeem_table.aspx", false);
            }
            else
            {
                Page.RegisterStartupScript("OnLoad", "<script>alert('You need to be logged in to sit at this table');</script>");
            }
        }
        catch (Exception ex)
        {
            string my_error_popup = "alert('Error in method [f_goto_table] - " + ex.Message.ToString() + "');";
            ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true);
            log.Error("Error in f_goto_table", new Exception(ex.Message));
        }
    }