private void btnLogin_Click(object sender, EventArgs e) { var isConnected = false; SaveAppConfig(); // tes koneksi ke server using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0))) { IDbConnectionHelper dbConn = new DbConnectionHelper(); isConnected = dbConn.IsOpenConnection(); } if (!isConnected) { var msg = "Maaf koneksi ke database gagal !!!\n\n" + "Disarankan untuk menginstall OpenRetail di 'Drive D'.\n" + "Silahkan uninstall dulu OpenRetailnya, kemudian install lagi di 'Drive D'."; MsgHelper.MsgError(msg); return; } using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0))) { IPenggunaBll penggunaBll = new PenggunaBll(_log); var pass = CryptoHelper.GetMD5Hash(txtPassword.Text, MainProgram.securityCode); var isLogin = penggunaBll.IsValidPengguna(txtUserName.Text, pass); if (isLogin) { UpgradeDatabase(DatabaseVersionHelper.DatabaseVersion); log4net.GlobalContext.Properties["UserName"] = txtUserName.Text; MainProgram.pengguna = penggunaBll.GetByID(txtUserName.Text); SetProfil(); SetPengaturanUmum(); SetPengaturanBarcode(); SetSettingPort(); SetSettingCustomerDisplay(); LoadKabupaten(); LoadWilayah(); if (MainProgram.pengaturanUmum.is_show_minimal_stok) { LoadInfoMinimalStokProduk(); } this.DialogResult = DialogResult.OK; this.Close(); } else { MsgHelper.MsgWarning("User name atau password salah !!!"); txtUserName.Focus(); } } }
private void btnLogin_Click(object sender, EventArgs e) { var isConnected = false; SaveAppConfig(); // tes koneksi ke server using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0))) { IDbConnectionHelper dbConn = new DbConnectionHelper(); isConnected = dbConn.IsOpenConnection(); } if (!isConnected) { var msg = "Maaf koneksi ke server database gagal !!!\n" + "Silahkan cek koneksi jaringan Anda."; MsgHelper.MsgError(msg); return; } using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0))) { IPenggunaBll penggunaBll = new PenggunaBll(_log); var pass = CryptoHelper.GetMD5Hash(txtPassword.Text, MainProgram.securityCode); var isLogin = penggunaBll.IsValidPengguna(txtUserName.Text, pass); if (isLogin) { log4net.GlobalContext.Properties["UserName"] = txtUserName.Text; MainProgram.pengguna = penggunaBll.GetByID(txtUserName.Text); SetProfil(); //TODO: fix me, aktifkan jika module report sudah selesai /* * if (!Utils.IsRunningUnderIDE()) * { * LoadCrystalReportLib(); * }*/ this.DialogResult = DialogResult.OK; this.Close(); } else { MsgHelper.MsgWarning("User name atau password salah !!!"); txtUserName.Focus(); } } }
private void btnLogin_Click(object sender, EventArgs e) { var isConnected = false; SaveAppConfig(); // tes koneksi ke server using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0))) { IDbConnectionHelper dbConn = new DbConnectionHelper(); isConnected = dbConn.IsOpenConnection(); } if (!isConnected) { var msg = "Maaf koneksi ke server database gagal !!!\n" + "Silahkan cek koneksi jaringan Anda."; MsgHelper.MsgError(msg); return; } using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0))) { IPenggunaBll penggunaBll = new PenggunaBll(_log); var pass = CryptoHelper.GetMD5Hash(txtPassword.Text, MainProgram.securityCode); var isLogin = penggunaBll.IsValidPengguna(txtUserName.Text, pass); if (isLogin) { log4net.GlobalContext.Properties["UserName"] = txtUserName.Text; MainProgram.pengguna = penggunaBll.GetByID(txtUserName.Text); SetProfil(); SetPengaturanUmum(); // TODO: fix me (di aktifkan setelah rilis versi 1.0.0) // UpgradeDatabase(DatabaseVersion); this.DialogResult = DialogResult.OK; this.Close(); } else { MsgHelper.MsgWarning("User name atau password salah !!!"); txtUserName.Focus(); } } }
private void btnLogin_Click(object sender, EventArgs e) { // tes koneksi ke server using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0))) { IDbConnectionHelper dbConn = new DbConnectionHelper(); if (!dbConn.IsOpenConnection()) { var msg = "Maaf koneksi ke database gagal.\n"; if (!String.IsNullOrEmpty(((DbConnectionHelper)dbConn).DbError)) { msg += ((DbConnectionHelper)dbConn).DbError; } else { msg += "Disarankan untuk menginstall OpenRetail di 'Drive D'.\n" + "Silahkan uninstall dulu OpenRetailnya, kemudian install lagi di 'Drive D'."; } //MsgHelper.MsgError(msg); lblMessage.Text = msg; return; } } using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0))) { IPenggunaBll penggunaBll = new PenggunaBll(_log); var pass = CryptoHelper.GetMD5Hash(txtPassword.Text, MainProgram.securityCode); var isLogin = penggunaBll.IsValidPengguna(txtUserName.Text, pass); if (isLogin) { // TODO: upgrade db dibuat seperti opsi di utiliti // UpgradeDatabase(DatabaseVersionHelper.DatabaseVersion); SaveAppConfig(); log4net.GlobalContext.Properties["UserName"] = txtUserName.Text; MainProgram.pengguna = penggunaBll.GetByID(txtUserName.Text); SetProfil(); SetPengaturanUmum(); SetPengaturanBarcode(); SetPengaturanLabelHarga(); SetSettingPort(); SetSettingCustomerDisplay(); LoadKabupaten(); LoadWilayah(); if (MainProgram.pengaturanUmum.is_show_minimal_stok) { LoadInfoMinimalStokProduk(); } this.DialogResult = DialogResult.OK; this.Close(); } else { lblMessage.Text = "Username atau password salah."; txtUserName.Focus(); } } }