Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            AdminController lg = new AdminController();
            try
            {
                if (lg.SearchID(textBox1.Text, textBox2.Text))
                {
                    this.Hide();
                    var homeform = new home();

                    homeform.Show();
                }
                else
                {
                    MessageBox.Show("username atau password salah");
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show("Eror");
                MessageBox.Show(ex.InnerException.InnerException.Message);
            }
            
            

        }
        private void button1_Click(object sender, EventArgs e)
        {
            using (HospitalEntities context = new HospitalEntities())
            {
                try
                {
                    int result = (int)(context.GetNewAdminId().FirstOrDefault());
                    if (result > -1)
                    {
                        Admin p = new Admin()
                        {
                            Id_Admin = result,
                            Id_pegawai = System.Convert.ToInt32(textBox2.Text),
                            User_name = textBox3.Text,
                            Password = textBox4.Text,

                        };
                        AdminController pc = new AdminController();
                        pc.addAdmin(p);
                    }
                }
                catch (FormatException)
                {
                    MessageBox.Show("Data harus teriisi semua");
                }
            }
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            AdminController lg = new AdminController();

            try
            {
                if (lg.SearchID(textBox1.Text, textBox2.Text))
                {
                    this.Hide();
                    var homeform = new home();

                    homeform.Show();
                }
                else
                {
                    MessageBox.Show("username atau password salah");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Eror");
                MessageBox.Show(ex.InnerException.InnerException.Message);
            }
        }
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         AdminController pc = new AdminController();
         pc.Delete(System.Convert.ToInt32(textBox1.Text));
     }
     catch (FormatException fe)
     {
         MessageBox.Show("Pilih Data yang akan dipilih");
     }
 }
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                Admin p = new Admin()
                {
                    Id_Admin = System.Convert.ToInt32(textBox1.Text),
                    Id_pegawai = System.Convert.ToInt32(textBox2.Text),
                    User_name = textBox3.Text,
                    Password = textBox4.Text,

                };
                AdminController pc = new AdminController();
                pc.updateAdmin(p);
            }
            catch (FormatException fe)
            {
                MessageBox.Show("Data harus terisi semua");
            }
        }
 private void button5_Click(object sender, EventArgs e)
 {
     AdminController pc = new AdminController();
     IEnumerable<Admin> hasil = pc.ShowData();
     dataGridView2.DataSource = hasil.ToList();
 }