private void Button1_Click(object sender, EventArgs e) { if (tabControl1.TabPages.Count > 0) { tabControl1.TabPages.Remove(tabControl1.SelectedTab); } if (tabControl1.TabPages.Count == 0) { FormWelcome frm = new FormWelcome(); addTab(frm); } }
public void login_as(String j) { tabControl1.Size = new Size(1160, 610); tabControl1.TabPages.Clear(); button1.Show(); tabControl1.Show(); if (j == "RESEPSIONIS") { FormWelcome frm = new FormWelcome(); addTab(frm); btnMenu = new Button[8]; for (int i = 0; i < 8; i++) { btnMenu[i] = new Button(); btnMenu[i].Height = 100; btnMenu[i].Width = 100; btnMenu[i].BackColor = Color.LightBlue; btnMenu[i].Location = new Point(i * 100 + 15, 15); btnMenu[i].Font = new Font("MS Reference Sans Serif", 12); } btnMenu[0].Text = "Data Member"; btnMenu[0].Click += data_member; btnMenu[1].Text = "Register Member"; btnMenu[1].Click += new_member; btnMenu[2].Text = "Rawat Spesialis"; btnMenu[2].Click += rawat_spesialis; btnMenu[3].Text = "Rawat Jalan"; btnMenu[3].Click += rawat_jalan; btnMenu[4].Text = "Rawat Inap"; btnMenu[4].Click += rawat_inap; btnMenu[5].Text = "Donor"; btnMenu[5].Click += donor; btnMenu[6].Text = "Absensi"; btnMenu[6].Click += absensi_tugas; btnMenu[7].Text = "Logout"; btnMenu[7].Click += logout; for (int i = 0; i < 8; i++) { Controls.Add(btnMenu[i]); } } else if (j == "ADMIN") { FormWelcome frm = new FormWelcome(); addTab(frm); btnMenu = new Button[5]; for (int i = 0; i < 5; i++) { btnMenu[i] = new Button(); btnMenu[i].Height = 100; btnMenu[i].Width = 100; btnMenu[i].BackColor = Color.LightBlue; btnMenu[i].Location = new Point(i * 100 + 15, 15); btnMenu[i].Font = new Font("MS Reference Sans Serif", 12); } btnMenu[0].Text = "Data Pegawai"; btnMenu[0].Click += data_pegawai; btnMenu[1].Text = "Register Pegawai"; btnMenu[1].Click += new_pegawai; btnMenu[2].Text = "Admin Rumah Sakit"; btnMenu[2].Click += data_rs; btnMenu[3].Text = "Laporan"; btnMenu[3].Click += laporanAdmin; btnMenu[4].Text = "Logout"; btnMenu[4].Click += logout; for (int i = 0; i < 5; i++) { Controls.Add(btnMenu[i]); } } else if (j == "DOKTER" || j == "SUSTER") { FormWelcome frm = new FormWelcome(); addTab(frm); btnMenu = new Button[7]; for (int i = 0; i < 7; i++) { btnMenu[i] = new Button(); btnMenu[i].Height = 100; btnMenu[i].Width = 100; btnMenu[i].BackColor = Color.LightBlue; btnMenu[i].Location = new Point(i * 100 + 15, 15); btnMenu[i].Font = new Font("MS Reference Sans Serif", 10); } btnMenu[0].Text = "Perawatan Pasien Inap"; btnMenu[0].Click += perawatan_inap; btnMenu[1].Text = "Perawatan Jalan"; btnMenu[1].Click += perawatan_jalan; btnMenu[2].Text = "Perawatan Spesialis"; btnMenu[2].Click += perawatan_checkup; btnMenu[3].Text = "Tindakan Donor"; btnMenu[3].Click += tindakan_donor; btnMenu[4].Text = "Detail Perawatan"; btnMenu[4].Click += detail_trans; btnMenu[5].Text = "Absensi"; btnMenu[5].Click += absensi_tugas; btnMenu[6].Text = "Logout"; btnMenu[6].Click += logout; for (int i = 0; i < 7; i++) { Controls.Add(btnMenu[i]); } } else if (j == "APOTEKER") { FormWelcome frm = new FormWelcome(); addTab(frm); btnMenu = new Button[4]; for (int i = 0; i < 4; i++) { btnMenu[i] = new Button(); btnMenu[i].Height = 100; btnMenu[i].Width = 100; btnMenu[i].BackColor = Color.LightBlue; btnMenu[i].Location = new Point(i * 100 + 15, 15); btnMenu[i].Font = new Font("MS Reference Sans Serif", 9); } btnMenu[0].Text = "Pengambilan Obat"; btnMenu[0].Click += pengambilan_obat; btnMenu[1].Text = "Data Obat"; btnMenu[1].Click += master_obat; btnMenu[2].Text = "Tambah Obat"; btnMenu[2].Click += new_obat; btnMenu[3].Text = "Logout"; btnMenu[3].Click += logout; for (int i = 0; i < 4; i++) { Controls.Add(btnMenu[i]); } } else if (j == "WAREHOUSE") { FormWelcome frm = new FormWelcome(); addTab(frm); btnMenu = new Button[3]; for (int i = 0; i < 3; i++) { btnMenu[i] = new Button(); btnMenu[i].Height = 100; btnMenu[i].Width = 100; btnMenu[i].BackColor = Color.LightBlue; btnMenu[i].Location = new Point(i * 100 + 15, 15); btnMenu[i].Font = new Font("MS Reference Sans Serif", 9); } btnMenu[0].Text = "Isi Stok"; btnMenu[0].Click += isi_stok; btnMenu[1].Text = "Laporan Gudang"; btnMenu[1].Click += master_obat; btnMenu[2].Text = "Logout"; btnMenu[2].Click += logout; for (int i = 0; i < 3; i++) { Controls.Add(btnMenu[i]); } } else if (j == "KASIR") { FormWelcome frm = new FormWelcome(); addTab(frm); btnMenu = new Button[2]; for (int i = 0; i < 2; i++) { btnMenu[i] = new Button(); btnMenu[i].Height = 100; btnMenu[i].Width = 100; btnMenu[i].BackColor = Color.LightBlue; btnMenu[i].Location = new Point(i * 100 + 15, 15); btnMenu[i].Font = new Font("MS Reference Sans Serif", 9); } btnMenu[0].Text = "Pembayaran"; btnMenu[0].Click += kasir; btnMenu[1].Text = "Logout"; btnMenu[1].Click += logout; for (int i = 0; i < 2; i++) { Controls.Add(btnMenu[i]); } } }