コード例 #1
0
        private void BtnMasuk_Click(object sender, EventArgs e)
        {
            string id = TxtID.Text.Trim();
            string pw = TxtPassword.Text.Trim();

            if (login.LoginCek(id, pw) == true)
            {
                string cek = login.CekStat(id).Rows[0][0].ToString();

                menu.username = id;

                if (cek == "Tidak Login")
                {
                    login.Ubah(TxtID.Text, " Sedang Login");
                    menu.Show();
                    Hide();
                }

                else
                {
                    MessageBox.Show("User sedang Login", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("ID atau Password anda salah !", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
ファイル: ManagerLogin.cs プロジェクト: atoulloh/peminjaman
        void Hapus()
        {
            LoginServ login = new LoginServ();

            try
            {
                string cek = login.CekStat(dgvmanagerLogin.Rows[dgvmanagerLogin.CurrentCell.RowIndex].Cells[0].Value.ToString()).Rows[0][0].ToString();
                if (cek == "Sedang Login")
                {
                    MessageBox.Show("Sedang Login.. Tidak dapat menghapus data !", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                else if (Is.isExistData(dgvmanagerLogin.Rows[dgvmanagerLogin.CurrentCell.RowIndex].Cells[0].Value.ToString()))
                {
                    if (MessageBox.Show("Apakah data tersebut akan dihapus?", "Hapus Data", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Is.Hapus(dgvmanagerLogin.Rows[dgvmanagerLogin.CurrentCell.RowIndex].Cells[0].Value.ToString());
                        MessageBox.Show("Data Berhasil di hapus.  ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        manager();
                    }



                    else if (!Is.isExistData(dgvmanagerLogin.Rows[dgvmanagerLogin.CurrentCell.RowIndex].Cells[0].Value.ToString()))
                    {
                        MessageBox.Show("Delum ada data yg dipilih.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch
            {
                MessageBox.Show("Terjadi Kesalahan tidak dapat menghapus data !", "Pesan", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }