private void logoutToolStripMenuItem_Click(object sender, EventArgs e) { try { frmSample.isLogOut = true; frmLoginScreen objLogin = new frmLoginScreen(); Main.showWindow(objLogin, this); } catch (Exception ex) { Main.showMessage(ex.Message, "error"); } }
private void frmMDI_Load(object sender, EventArgs e) { try { if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\rms_connect")) { frmSettings objsetting = new frmSettings(); Main.showWindow(objsetting, this); } else { frmLoginScreen objls = new frmLoginScreen(); Main.showWindow(objls, this); } } catch (Exception ex) { Main.showMessage(ex.Message, "error"); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (chkIntegratedSecurity.Checked) { if (txtServer.Text == "") { lblServerError.Visible = true; } else { lblServerError.Visible = false; } if (txtDatabase.Text == "") { lblDatabaseError.Visible = true; } else { lblDatabaseError.Visible = false; } if (lblServerError.Visible || lblDatabaseError.Visible) { Main.showMessage("field with * are mandatory", "error"); } else { Main.getConnectionString(txtServer.Text, txtDatabase.Text); Main.writeConnectionFile(); DialogResult dr = MessageBox.Show("Settings saved successfully."); if (dr == DialogResult.OK) { frmLoginScreen ls = new frmLoginScreen(); Main.showWindow(ls, this, frmMDI.ActiveForm); } } } else { if (txtServer.Text == "") { lblServerError.Visible = true; } else { lblServerError.Visible = false; } if (txtDatabase.Text == "") { lblDatabaseError.Visible = true; } else { lblDatabaseError.Visible = false; } if (txtUsername.Text == "") { lblUsernameError.Visible = true; } else { lblUsernameError.Visible = false; } if (txtPassword.Text == "") { lblPasswordError.Visible = true; } else { lblPasswordError.Visible = false; } if (lblServerError.Visible || lblDatabaseError.Visible || lblUsernameError.Visible || lblPasswordError.Visible) { Main.showMessage("field with * are mandatory", "error"); } else { Main.getConnectionString(txtServer.Text, txtDatabase.Text, txtUsername.Text, txtPassword.Text); Main.writeConnectionFile(); DialogResult dr = MessageBox.Show("Settings saved successfully."); if (dr == DialogResult.OK) { frmLoginScreen ls = new frmLoginScreen(); Main.showWindow(ls, this, frmMDI.ActiveForm); } } } } catch (Exception ex) { Main.showMessage(ex.Message, "error"); } }