private void frmConfig_Load(object sender, EventArgs e) { ic = new initConnection(Properties.Settings.Default.Server, Properties.Settings.Default.DBName); txtHead1.Text = Properties.Settings.Default.Header1; txtHead2.Text = Properties.Settings.Default.Header2; txtServer.Text = Properties.Settings.Default.Server; txtDB.Text = Properties.Settings.Default.DBName; lblStatus.Text = "Status: " + (ic.isSQLConnected() ? "Terhubung" : "Tidak Terhubung"); greet.Checked = Properties.Settings.Default.greet; if (Properties.Settings.Default.greet == true) { custgreet.Visible = true; custgreet.Checked = Properties.Settings.Default.customgreet; if (Properties.Settings.Default.customgreet == true) { gbGreet.Visible = true; } else { gbGreet.Visible = false; } txtGreet.Text = Properties.Settings.Default.greettext; } else { custgreet.Visible = false; gbGreet.Visible = false; } }
private void button2_Click(object sender, EventArgs e) { if ((txtServer.Text == "") && (txtDBName.Text == "")) { MessageBox.Show(this, "Mohon isi informasi koneksi dengan valid!", "Invalid Connection", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { initConnection ic = new initConnection(txtServer.Text, txtDBName.Text); if (ic.isSQLConnected()) { Properties.Settings.Default.Server = txtServer.Text; Properties.Settings.Default.DBName = txtDBName.Text; Properties.Settings.Default.Save(); MessageBox.Show(this, "Berhasil terhubung dengan server!", "Connection Successful", MessageBoxButtons.OK, MessageBoxIcon.Information); lbStatus.Text = "Status: Terhubung"; } else { MessageBox.Show(this, "Gagal terhubung dengan server!", "Connection Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); lbStatus.Text = "Status: Tidak Terhubung"; } } }
private void button3_Click(object sender, EventArgs e) { lblStatus.Text = "Status: Menghubungkan..."; ic = new initConnection(txtServer.Text, txtDB.Text); if (ic.isSQLConnected()) { lblStatus.Text = "Status: Terhubung"; Properties.Settings.Default.Server = txtServer.Text; Properties.Settings.Default.DBName = txtDB.Text; Properties.Settings.Default.Save(); MessageBox.Show(this, "Koneksi smart system berhasil terhubung ke database dan konfigurasi berhasil disimpan!", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { lblStatus.Text = "Status: Tidak Terhubung"; MessageBox.Show(this, "Koneksi smart system gagal terhubung ke database", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmConfig_Load(object sender, EventArgs e) { txtHead1.Text = Properties.Settings.Default.header1; txtHead2.Text = Properties.Settings.Default.header2; txtFoot.Text = Properties.Settings.Default.footer; txtServer.Text = Properties.Settings.Default.Server; txtDBName.Text = Properties.Settings.Default.DBName; numtarif.Value = Properties.Settings.Default.tarifper; txtTrfMotor.Text = Properties.Settings.Default.tarifmotor.ToString(); txtTrfMobil.Text = Properties.Settings.Default.tarifmobil.ToString(); initConnection ic = new initConnection(Properties.Settings.Default.Server, Properties.Settings.Default.DBName); if (ic.isSQLConnected()) { lbStatus.Text = "Status: Terhubung"; } else { lbStatus.Text = "Status: Tidak Terhubung"; } }