private void buttonLogin_Click(object sender, EventArgs e) { museid = this.textBoxUser.Text; ParameterUrl LoginPHP = new ParameterUrl(); LoginPHP.musename = museid; LoginPHP.password = password; LoginPHP.mode = API_MODE.LOGIN; LoginPHP.timeout = 300000; LoginPHP.url = string.Format("{0}{1}", mainUrl, "login.php").Trim(); LoginPHP.method = API_METHOD.POST; try { RESPONSE_FEEDBACK response = new NetworkManager().Connect(LoginPHP); if (response.status == false) { throw new Exception(string.Format("Login Failed. {0}", response.message)); } status = response.status; actionTaken = DialogStep.BYPASS; DialogDashboard.RunLoop("MainForm"); } catch (Exception ex) { DialogDashboard.Append(Level.Error, String.Format("what:{0} {1}", ex.HelpLink, ex.Message)); } }
private void buttonLogout_Click(object sender, EventArgs e) { ParameterUrl Logout = new ParameterUrl(); Logout.musename = activeUser; Logout.password = ""; Logout.mode = API_MODE.LOGOUT; Logout.timeout = 300000; Logout.url = string.Format("{0}{1}", mainUrl, "logout.php").Trim(); Logout.method = API_METHOD.POST; try { RESPONSE_FEEDBACK response = new NetworkManager().Connect(Logout); if (response.status == false) { throw new Exception(string.Format("Logout Failed. {0}", response.message)); } else { status = response.status; } ActionTaken = DialogStep.LOGIN; MainDashboard.RunLoop("BypassForm"); } catch (Exception ex) { MainDashboard.Append(Level.Error, String.Format("what:{0} {1}", ex.HelpLink, ex.Message)); } }
public RequestManager(ParameterUrl paramurl) { parameterUrl = paramurl; //! Slot this.finished += new Connect(Finished); this.readyRead += new Connect(ReadyRead); CreateRequest(); }
private void buttonAccept_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxMuseName.Text)) { System.Windows.Forms.MessageBox.Show(this, string.Format("user name smaller than or empty {0}", textBoxMuseName.Text), "User registration", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(textBoxMuseId.Text)) { System.Windows.Forms.MessageBox.Show(this, string.Format("user name smaller than or empty {0}", textBoxMuseId.Text), "User registration", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ParameterUrl Register = new ParameterUrl(); Register.url = string.Format("{0}{1}", mainUrl, "register.php"); Register.musename = textBoxMuseName.Text; Register.password = password; Register.museid = textBoxMuseId.Text; Register.mode = API_MODE.REGISTER; Register.timeout = 30000; Register.method = API_METHOD.POST; try { RESPONSE_FEEDBACK response = new NetworkManager().Connect(Register); if (response.status == false) { actionTaken = DialogStep.LOGIN; DialogLogging.RunLoop("RegisterForm"); throw new Exception(string.Format("Registration Failed. {0}", response.message)); } //! create email Parameter_Email NewEmail = new Parameter_Email(); NewEmail.display_name = textBoxMuseName.Text; NewEmail.msg_subject = string.Format("User name:{0} - id:{1}", textBoxMuseName.Text, textBoxMuseId.Text); NewEmail.msg_body = password; //! sender email NewEmail.sender_address = "*****@*****.**"; //! recepient email NewEmail.receive_address = "*****@*****.**"; //! credential sender email NewEmail.username = ""; NewEmail.password = ""; //! send email new NetworkManager().SendEmail(NewEmail); MessageBox.Show(this, string.Format("Registration success {0}. Please be patien an admin will activated.", textBoxMuseName.Text), "User registration", MessageBoxButtons.OK, MessageBoxIcon.Information); actionTaken = DialogStep.LOGIN; DialogLogging.RunLoop("RegisterForm"); } catch (Exception ex) { DialogLogging.Append(Level.Error, String.Format("what:{0} {1}", ex.HelpLink, ex.Message)); } }
public RESPONSE_FEEDBACK Connect(ParameterUrl paramurl) { return(new RequestManager(paramurl).Status); }