コード例 #1
0
    private DC_hedgeem_game_state f_sit_at_anonymous_table(enum_theme a_enum_theme )
    {
        HedgeEmLogEvent my_log_event = new HedgeEmLogEvent();
        DC_hedgeem_game_state my_game_state = new DC_hedgeem_game_state();
        my_log_event.p_method_name = System.Reflection.MethodBase.GetCurrentMethod().ToString();
        my_log_event.p_message = "f_sit_at_anonymous_table";
        log.Debug(_xxx_log_event.ToString());
        string my_endpoint = "Not Set";
        try
        {
            try
            {
    
                // Creates (registers) a new user (HedgeEmPlayer) in the HedgeEm Server.
                // Note this also creates a Personal Table for them (which the HedgeEmTable is returned in the Player object 'p_personal_table_id
                enum_authentication_method my_authentication_method = enum_authentication_method.FACEBOOK;
            my_endpoint = String.Format("{0}/ws_sit_at_anonymous_table/{1},{2},{3},{4}/",
                                                p_current_json_webservice_url_base,
                                                "anon_session_id_123",
                                                83,
                                                a_enum_theme.ToString(),
                                                "FASTPLAY_FLOP");

            my_game_state = (DC_hedgeem_game_state)f_get_object_from_json_call_to_server(my_endpoint, typeof(DC_hedgeem_game_state));
                if (my_game_state.p_error_message != null)
                {
                    if (my_game_state.p_error_message != "")
                    {
                        string my_error_msg = string.Format("Failed trying call 'sit anonymously' to server, Error returned [{0}], Endpoint targeted [{1}]",my_game_state.p_error_message,my_endpoint);
                        throw new Exception(my_error_msg);
                    }
                }

                // If we got here we assume Player was created successfully so store Player ID and continue
                //p_session_player_id = my_game_state.p_player_id;


                // login to the game
                /*Session["p_session_username"] = txt_username.Text;
                Session["password"] = txt_password.Text;
                Session["display_name"] = txt_full_name.Text;
                Session["p_session_personal_table_id"] = my_game_state.p_personal_table_id;
                Session["p_session_username"] = my_game_state.p_username;
                Session["p_session_password"] = txt_password.Text;
                Session["p_session_display_name"] = my_game_state.p_display_name;


                ScriptManager.RegisterStartupScript(Page, GetType(), "OnLoad", "alert('Thank you for registering,your facebook account with HedgeEm. A confirmation mail is sent to your email Id '); if(alert){ window.location='frm_facebook_canvas.aspx';}", true);
                */
                //Page.RegisterStartupScript("OnLoad", "<script>alert('Thank you for registering, you are now logged in an can start to play HedgeEm'); if(alert){ window.location='frm_facebook_canvas.aspx';}</script>");
            }
            catch (Exception ex)
            {
                string my_error_msg_summary = String.Format("Fatal error trying to sit at table anonymously");
                string my_error_msg_detail = String.Format("Error in {0} Reason [{1}]", 
                    my_log_event.p_method_name, 
                    ex.Message.ToString());

                my_log_event.p_message = my_error_msg_detail;

                log.Error(my_log_event.ToString());

                HedgeemerrorPopup my_popup_messageError = new HedgeemerrorPopup();
                my_popup_messageError.p_user_message_str = my_error_msg_summary;
                my_popup_messageError.p_detailed_message_str = my_error_msg_detail;
                my_popup_messageError.p_is_visible = true;

                Place_Holder_Popup_Message.Controls.Add(my_popup_messageError);

                my_popup_messageError.Dispose();

                //newuser.Visible = false;



            }
        }
        catch (Exception ex)
        {
            string my_error_popup = "Error in f_get_free_anonymous_player suald - " + ex.Message.ToString();
       //     ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true);
            log.Error("Error in f_get_free_anonymous_player xxxaawe", new Exception(ex.Message));

            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();

        }

        return my_game_state;
        
    }
コード例 #2
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();

        }
    }
コード例 #3
0
    public void send_fb_user_registration_mail(string email_id, string password, string display_name)
    {
        _xxx_log_event.p_method_name = "send_fb_user_registration_mail";
        _xxx_log_event.p_message = "Method to send Email of User Registration";
        log.Debug(_xxx_log_event.ToString());
        try
        {
            // Send mail to user
            string encrypted_email = Encryptdata(email_id);
            string encrypted_password = Encryptdata(password);
            string encrypted_displayname = Encryptdata(display_name);

            // code to send facebook user registration mail
            SmtpClient smtp = new SmtpClient();
            smtp.Credentials = new NetworkCredential("*****@*****.**", "Plok23712");
            smtp.Port = 25;
            smtp.Host = "smtp.gmail.com";
            smtp.EnableSsl = true;

            MailMessage message = new MailMessage();
            message.From = new MailAddress("*****@*****.**");
            message.To.Add(email_id);
            message.Subject = "Successfully Registered - Hedgeem Poker";
            message.Body = "Hi " + display_name + ",<br> Thank you for registering your facebook account with HedgeEm us can now log in at any time with your Facebook account alternatively you can login with you Hedgeem Player name <br> Email Id-" + email_id + " <br/> Password - " + password + "<br/> Username - " + display_name + ".";
            // Send mail copy to Simon
            message.CC.Add("*****@*****.**");
            message.IsBodyHtml = true;
            smtp.Send(message);
        }
        catch (Exception ex)
        {
            string my_error_popup = "Error in send_fb_user_registration_mail - " + ex.Message.ToString();
            //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true);
            HedgeemerrorPopup my_popup_messageError = new HedgeemerrorPopup();
            my_popup_messageError.p_detailed_message_str = "";
            my_popup_messageError.p_detailed_message_str = my_error_popup;
            my_popup_messageError.p_is_visible = true;

            Place_Holder_Popup_Message.Controls.Add(my_popup_messageError);

            my_popup_messageError.Dispose();
            log.Error("Fatal error in 'send_fb_user_registration_mail'", new Exception(ex.Message));
        }
    }
コード例 #4
0
    /// <summary>
    /// Created by Simon on 4th Jan 2014 - I dont think this method is called - VERY BAD DUPLICATED CODE
    /// </summary>
    private void f_create_new_user_based_on_facebook_authentication()
    {

        HedgeEmLogEvent my_log_event = new HedgeEmLogEvent();
        my_log_event.p_method_name = System.Reflection.MethodBase.GetCurrentMethod().ToString();
        my_log_event.p_message = "This message creates new fb user in database";
        log.Debug(_xxx_log_event.ToString());
        string my_endpoint = "Not Set";
        try
        {
            xxxHC_a_opening_balance = 100;
            string xxx_default_password = "******";
            try
            {

                // Creates (registers) a new user (HedgeEmPlayer) in the HedgeEm Server.
                // Note this also creates a Personal Table for them (which the HedgeEmTable is returned in the Player object 'p_personal_table_id
                enum_authentication_method my_authentication_method = enum_authentication_method.FACEBOOK;
                my_endpoint = String.Format("{0}/ws_register_user_and_create_personal_table/{1},{2},{3},{4},{5}/",
                                                p_current_json_webservice_url_base,
                                                txt_fb_username.Text,
                                                xxx_default_password,
                                                txt_fb_display_name.Text,
                                                xxxHC_a_opening_balance,
                                                my_authentication_method);

                HedgeEmPlayer my_player = (HedgeEmPlayer)f_get_object_from_json_call_to_server(my_endpoint, typeof(HedgeEmPlayer));
                if (my_player.p_error_message != null)
                {
                    if (my_player.p_error_message != "")
                    {
                        throw new Exception(my_player.p_error_message);
                    }
                }

                // If we got here we assume Player was created successfully so store Player ID and continue
                p_session_player_id = my_player.p_player_id;


                // login to the game
                Session["p_session_username"] = txt_username.Text;
                Session["password"] = txt_password.Text;
                Session["display_name"] = txt_full_name.Text;
                Session["p_session_personal_table_id"] = my_player.p_personal_table_id;
                Session["p_session_username"] = my_player.p_username;
                Session["p_session_password"] = txt_password.Text;
                Session["p_session_display_name"] = my_player.p_display_name;


                //service.f_activate_user(txt_fb_username.Text);

                //send_fb_user_registration_mail(txt_fb_username.Text, xxx_default_password, txt_fb_display_name.Text);

                //lbl_register_status_msg.Visible = true;
                //lbl_register_status_msg.Text = "Thank you for registering, Please activate your account by clicking link sent on your registered email id.";
                ScriptManager.RegisterStartupScript(Page, GetType(), "OnLoad", "alert('Thank you for registering,your facebook account with HedgeEm. A confirmation mail is sent to your email Id '); if(alert){ window.location='frm_facebook_canvas.aspx';}", true);

                //Page.RegisterStartupScript("OnLoad", "<script>alert('Thank you for registering, you are now logged in an can start to play HedgeEm'); if(alert){ window.location='frm_facebook_canvas.aspx';}</script>");
            }
            catch (Exception ex)
            {
                string my_error_popup = "Error in btn_new_fb_user_Click - " + ex.Message.ToString();
          //      ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true);
                log.Error("Error while btn_new_fb_user_Click", new Exception(ex.Message));

                HedgeemerrorPopup my_popup_messageError = new HedgeemerrorPopup();
                my_popup_messageError.p_detailed_message_str = "";
                my_popup_messageError.p_detailed_message_str = my_error_popup;
                my_popup_messageError.p_is_visible = true;

                Place_Holder_Popup_Message.Controls.Add(my_popup_messageError);

                my_popup_messageError.Dispose();

                //newuser.Visible = false;



            }
        }
        catch (Exception ex)
        {
            string my_error_popup = "Error in creating user - " + ex.Message.ToString();
       //     ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true);
            log.Error("Error in creating user", new Exception(ex.Message));

            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();

        }
    }
コード例 #5
0
    public void send_forgot_password_mail(string email_id, string password)
    {
        _xxx_log_event.p_method_name = "send_forgot_password_mail";
        _xxx_log_event.p_message = "Method to send Email of Forgotten Password";
        log.Debug(_xxx_log_event.ToString());
        try
        {
            // code to send password through mail
            SmtpClient smtp = new SmtpClient();
            smtp.Credentials = new NetworkCredential("*****@*****.**", "Plok23712");
            smtp.Port = 25;
            smtp.Host = "smtp.gmail.com";
            smtp.EnableSsl = true;

            MailMessage message = new MailMessage();
            message.From = new MailAddress("*****@*****.**");
            message.To.Add(email_id);
            message.Subject = "Forgot Password Mail";
            message.Body = "As requested, your details are :- <br/><br/> Username - " + email_id + " <br/> Password - " + password + "";
            // Send mail copy to Simon
            message.CC.Add("*****@*****.**");
            message.IsBodyHtml = true;
            smtp.Send(message);
            Page.RegisterStartupScript("UserMsg", "<script>alert('Password has been sent to you successfully. Check Your Mail for further instructions.');if(alert){ window.location='frm_facebook_canvas.aspx';}</script>");
        }
        catch (Exception ex)
        {
            string my_error_popup = "Error in send_forgot_password_mail - " + ex.Message.ToString();
            //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true);
            HedgeemerrorPopup my_popup_messageError = new HedgeemerrorPopup();
            my_popup_messageError.p_detailed_message_str = "";
            my_popup_messageError.p_detailed_message_str = my_error_popup;
            my_popup_messageError.p_is_visible = true;

            Place_Holder_Popup_Message.Controls.Add(my_popup_messageError);

            my_popup_messageError.Dispose();
            log.Error("Fatal error in 'send_forgot_password_mail'", new Exception(ex.Message));
        }
    }
コード例 #6
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        _xxx_log_event.p_method_name = "btnSend_Click";
        _xxx_log_event.p_message = "This button is clicked to send forgot password for the user.";
        log.Debug(_xxx_log_event.ToString());
        bool user_exist;

        string my_endpoint = "Not Set";

        try
        {

            // This checks whether the entered email id exists in the database or not.
            my_endpoint = String.Format("{0}/get_server_info/10/", p_current_json_webservice_url_base);

            List<HedgeEmPlayer> my_player_list = (List<HedgeEmPlayer>)f_get_object_from_json_call_to_server("ws_get_player_list/sessionabc123,10,10000/", typeof(List<HedgeEmPlayer>));
            user_exist = my_player_list.Exists(x => x.p_username == txt_username.Text);

            // If user exists then proceed
            if (user_exist != false)
            {
                DataTable dt = new DataTable();
                // get password of the entered username
                string my_endpoint1 = String.Format("{0}/ws_get_password_from_db/{1}/", p_current_json_webservice_url_base,
                                                                                  txt_Email.Text);

                dt = (DataTable)f_get_object_from_json_call_to_server(my_endpoint1, typeof(DataTable));

             //   dt = service.f_get_password_from_db(txt_Email.Text);
                string password = "";
                if (dt.Rows.Count > 0)
                {
                    password = dt.Rows[0]["password"].ToString();
                }

                // send email method is called with email and password of the user
                send_forgot_password_mail(txt_Email.Text, password);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, GetType(), "OnLoad", "alert('This Email doesnot exists. Please try again with valid Email Id.'); show_forgot_password();", true);

            }
        }
        catch (Exception ex)
        {
            string my_error_popup = "alert('Error in btnSend_Click - " + ex.Message.ToString() + "');";
            //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true);
            HedgeemerrorPopup my_popup_messageError = new HedgeemerrorPopup();
            my_popup_messageError.p_detailed_message_str = "";
            my_popup_messageError.p_detailed_message_str = my_error_popup;
            my_popup_messageError.p_is_visible = true;

            Place_Holder_Popup_Message.Controls.Add(my_popup_messageError);

            my_popup_messageError.Dispose();
            log.Error("Fatal error in 'btnSend_Click'", new Exception(ex.Message));
        }
    }
コード例 #7
0
    protected void btn_new_user_Click(object sender, EventArgs e)
    {
        HedgeEmLogEvent my_log_event = new HedgeEmLogEvent();
        my_log_event.p_method_name = System.Reflection.MethodBase.GetCurrentMethod().ToString();
        my_log_event.p_message = "This message creates new user in database";
        log.Debug(my_log_event.ToString());
        string my_endpoint = "Not Set";

        bool user_exist;
        hedgeem_control_popup_message my_popup_message = new hedgeem_control_popup_message();
        my_popup_message.p_detailed_message_str = "";

        try
        {
            // This checks whether the entered email id exists in the database or not.
            my_endpoint = String.Format("{0}/ws_get_player_list/sessionabc123,{1},10000/", p_current_json_webservice_url_base, p_server_id);

            List<HedgeEmPlayer> my_player_list = (List<HedgeEmPlayer>)f_get_object_from_json_call_to_server(my_endpoint, typeof(List<HedgeEmPlayer>));
            user_exist = my_player_list.Exists(x => x.p_username == txt_username.Text);

            if (user_exist == false)
            {
                xxxHC_a_opening_balance = 100;
                try
                {
                    enum_authentication_method my_authentication_method = enum_authentication_method.HEDGEEM_ACCOUNT;
                    // Creates (registers) a new user (HedgeEmPlayer) in the HedgeEm Server.
                    // Note this also creates a Personal Table for them (which the HedgeEmTable is returned in the Player object 'p_personal_table_id
                    my_endpoint = String.Format("{0}/ws_register_user_and_create_personal_table/{1},{2},{3},{4},{5}/",
                                                    p_current_json_webservice_url_base,
                                                    txt_username.Text,
                                                    txt_password.Text,
                                                    txt_full_name.Text,
                                                    xxxHC_a_opening_balance,
                                                    my_authentication_method);

                    HedgeEmPlayer my_player = (HedgeEmPlayer)f_get_object_from_json_call_to_server(my_endpoint, typeof(HedgeEmPlayer));
                    if (my_player.p_error_message != null)
                    {
                        if (my_player.p_error_message != "")
                        {
                //            throw new Exception(my_player.p_error_message);




                        }
                    }

                    // If we got here we assume Player was created successfully so store Player ID and continue
                    p_session_player_id = my_player.p_player_id;


                    // login to the game
                    Session["p_session_username"] = txt_username.Text;
                    Session["password"] = txt_password.Text;
                    Session["display_name"] = txt_full_name.Text;
                    Session["p_session_personal_table_id"] = my_player.p_personal_table_id;
                    Session["p_session_username"] = my_player.p_username;
                    Session["p_session_password"] = txt_password.Text;
                    Session["p_session_display_name"] = my_player.p_display_name;

                    //sends registration mail
                    //send_user_registration_mail(txt_username.Text, txt_password.Text, txt_full_name.Text);

                    //my_popup_message.p_detailed_message_str = "Thank you for registering, you may now start to play.  Please don't forget to confirm your registration by clicking on the link in the mail we have just sent you to get your free 50 chips and benefit from extra features.";
                    //Place_Holder_Popup_Message.Controls.Add(my_popup_message);
                    HedgeemMessage my_popup_messageError = new HedgeemMessage();
                    my_popup_messageError.p_detailed_message_str = "";
                    my_popup_messageError.p_detailed_message_str = "Thank you for registering, you may now start to play.  Please don't forget to confirm your registration by clicking on the link in the mail we have just sent you to get your free 50 chips and benefit from extra features.";
                    my_popup_messageError.p_is_visible = true;

                    Place_Holder_Popup_Message.Controls.Add(my_popup_messageError);

                    my_popup_messageError.Dispose();
                   // ScriptManager.RegisterStartupScript(Page, GetType(), "OnLoad", "alert('Thank you for registering. You may now start to play. Click on the link in the mail we have just sent you to get benefit from extra features.');", true);
                    //ScriptManager.RegisterStartupScript(Page, GetType(), "OnLoad", "alert('Thank you for registering, you may now start to play.  Please don't forget to confirm your registration by clicking on the link in the mail we have just sent you to get your free 50 chips and benefit from extra features.'); if(alert){ window.location='frm_facebook_canvas.aspx';}", true);
                    if (Session["p_session_username"] != null)
                    {

                        Logout.Attributes.Add("style", "display:block!Important;");
                        btnLogout.Visible = true;
                        btnLogout.Enabled = true;
                        Page.RegisterStartupScript("OnLoading", "<script>load_edit_profile();</script>");
                        if (Session["display_name"] != null)
                        {
                            lbl_user_name.Text = Session["display_name"].ToString();
                        }
                        //LoginDiv.Attributes.Add("style", "display:none !Important;");
                        divLogin.Attributes.Add("style", "display:none !Important;");
                        if (Session["p_session_username"] != null)
                        {
                            if (File.Exists(Server.MapPath("resources/player_avatar_" + Session["p_session_username"].ToString() + ".jpg")))
                            {
                                usr_image.ImageUrl = "../resources/player_avatar_" + Session["p_session_username"].ToString() + ".jpg";
                            }
                            
                            else
                            {
                                usr_image.ImageUrl = "../resources/avitars/user_square.png";
                            }
                        }

                        btn_play_now.Enabled = true;



                        string role = "";
                        if (my_player != null)
                        {
                            role = my_player.p_role;

                            my_log_event.p_message = String.Format("User/player role hardcoded to BASIC_USER");
                            log.Debug(my_log_event.ToString());

                        }

                        if (role == enum_user_role.ADMIN.ToString())
                        {
                            btnAdmin.Attributes.Add("style", "display:block");
                        }

                        // - xxx- Hardcoding value of role to BASIC_USER as need to discuss this with Simon.
                        Session["user_role"] = "BASIC_USER";
                        Page.RegisterStartupScript("OnLoad", "<script>document.getElementById('progressbar').style.display='none';</script>");
                    }

                }
                catch (Exception ex)
                {
                    my_log_event.p_message = String.Format("Reason [{0}]", ex.Message);
                    HedgeemerrorPopup my_popup_messageError = new HedgeemerrorPopup();
                    my_popup_messageError.p_detailed_message_str = "";
                    my_popup_messageError.p_detailed_message_str = String.Format("Reason [{0}]", ex.Message);
                    my_popup_messageError.p_is_visible = true;

                    Place_Holder_Popup_Message.Controls.Add(my_popup_messageError);

                    my_popup_messageError.Dispose();
                    log.Error(my_log_event.ToString());
                 //   throw new Exception(my_log_event.ToString());
                }
            }

            else
            {
                lbl_register_status_msg.Visible = true;
                lbl_register_status_msg.Text = "This User Already exists. Please try again or Login to continue.";
                //ScriptManager.RegisterStartupScript(Page, GetType(), "OnLoad", "alert('This User Already exists. Please try again or Login to continue.');", true);
            }
        }
        catch (Exception ex)
        {
            string my_error_message = String.Format("ERROR! Unable to create user.  Reason [{0}]", ex.Message);
            //string my_error_popup = "alert('Error in creating user - " + ex.Message.ToString() + "');";
            lbl_register_status_msg.Visible = true;
            lbl_register_status_msg.Text = "ERROR! Unable to create user.  Hedge'Em Administrators have been informed.";
            log.Error("Error in creating user", new Exception(ex.Message));
            HedgeemerrorPopup my_popup_messageError = new HedgeemerrorPopup();
            my_popup_messageError.p_detailed_message_str = "";
            my_popup_messageError.p_detailed_message_str = my_error_message;
            my_popup_messageError.p_is_visible = true;

            Place_Holder_Popup_Message.Controls.Add(my_popup_messageError);

            my_popup_messageError.Dispose();
            //throw new Exception("ssssss");

        }
    }
コード例 #8
0
    protected void btnAdmin_Click(object sender, EventArgs e)
    {
        log.Info("User clicked on Admin Button");
        try
        {
            if (txt_get_fm_email_id.Text == "")
            {
                Page.RegisterStartupScript("Alert Message", "<script type='text/javascript'> document.getElementById('alertmessage').style.display = 'block';</script>");
                //  Page.RegisterStartupScript("Alert Message", "<script type='text/javascript'>alert('You are not logged in. Please log in to view this Page.');document.getElementById('progressbar').style.display='none'; </script>");
            }
            else
            {
                DataTable get_password = new DataTable();
                DataTable user_details = new DataTable();

                string my_endpoint1 = String.Format("{0}/ws_get_password_from_db/{1}/", p_current_json_webservice_url_base,
                                                                           txt_get_fm_email_id.Text);

                get_password = (DataTable)f_get_object_from_json_call_to_server(my_endpoint1, typeof(DataTable));

              //  get_password = service.f_get_password_from_db(txt_get_fm_email_id.Text);
                if (get_password.Rows.Count == 0)
                {
                    Page.RegisterStartupScript("Alert Message", "<script type='text/javascript'> document.getElementById('alertmessage').style.display = 'block';</script>");
                    // Page.RegisterStartupScript("Alert Message", "<script type='text/javascript'>alert('You are not authorized to view this page.');</script>");
                }
                else
                {
                    string password = get_password.Rows[0]["password"].ToString();


                  string  my_endpoint = String.Format("{0}/ws_my_user_details/{1},{2}/", p_current_json_webservice_url_base,
                                                                                    txt_get_fm_email_id.Text,
                                                                                     password);

                    user_details = (DataTable)f_get_object_from_json_call_to_server(my_endpoint, typeof(DataTable));
          
                   // user_details = service.my_user_details(txt_get_fm_email_id.Text, password);
                    // Check you got only one record back, if not throw appropriate exception
                    if (user_details.Rows.Count < 1)
                    {
                        throw new Exception(String.Format("Username '{0}' not found. Username or password incorrect.", txt_get_fm_email_id.Text));
                    }
                    else if (user_details.Rows.Count > 1)
                    {
                        throw new Exception(String.Format("Multiple users found for username '{0}'.  This indicates something is wrong so cancelling operation..", txt_get_fm_email_id.Text));
                    }
                    else
                    {
                        enum_user_role role = (enum_user_role)Enum.Parse(typeof(enum_user_role), user_details.Rows[0]["role"].ToString());
                        if (role == enum_user_role.ADMIN)
                        {
                            Response.Redirect("http://serveradmin.hedgeem.com");
                        }
                        else
                        {
                            Page.RegisterStartupScript("Alert Message", "<script type='text/javascript'> document.getElementById('alertmessage').style.display = 'block';</script>");

                            //Page.RegisterStartupScript("Alert Message", "<script type='text/javascript'>alert('You are not authorized to view this page.');</script>");
                        }
                    }
                }

            }
        }
        catch (Exception ex)
        {
            string my_error_popup = "Error in method [btnAdmin_Click] - " + ex.Message.ToString();
        //    ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true);
            log.Error("Error in btnAdmin_Click", new Exception(ex.Message));

            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;
           
            Place_Holder_Popup_Message.Controls.Add(my_popup_message);

            my_popup_message.Dispose();

        }
    }
コード例 #9
0
    protected void btn_play_shared_table_Click(object sender, EventArgs e)
    {

        try
        {
            // Log that the user has clicked the 'Play now' button.
            HedgeEmLogEvent my_log_event = new HedgeEmLogEvent();
            my_log_event.p_method_name = System.Reflection.MethodBase.GetCurrentMethod().ToString();
            my_log_event.p_message = String.Format("User [{0}] click 'Play Shared Table", Session["p_session_username"]);
            log.Info(my_log_event.ToString());

            Session["p_session_player_id"] = xxxHC_ANON_PLAYER_ID;
            Session["theme"] = "CASINO_TABLE";
            Session["Facebook_User_Id"] = "not_set";
            Session["user_role"] = "BASIC_USER";
            Session["p_session_username"] = xxxHC_ANON_USERNAME;
            Session["p_session_personal_table_id"] = 1000;
            f_goto_table(1000);
        }
        catch (Exception ex)
        {
            string my_error_popup = "alert('Error in method [btn_play_shared_table_Click] - " + ex.Message.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();

            log.Error("Error in btn_play_shared_table_Click", new Exception(ex.Message));
      //      throw new Exception(String.Format("fish cakes:", ex.Message));
        }


    }