private void label12_Click(object sender, EventArgs e) { chuyen_mau(label12, 12, num); dataGridView1.DataSource = TaiVu.getCuocHop(conn); dataGridView1.ReadOnly = true; label13.Visible = false; }
private void label10_Click(object sender, EventArgs e) { chuyen_mau(label10, 10, num); dataGridView1.DataSource = TaiVu.getTrucPhongKham(conn); dataGridView1.ReadOnly = true; label13.Visible = false; }
private void label5_Click(object sender, EventArgs e) { chuyen_mau(label5, 5, num); dataGridView1.DataSource = TaiVu.getDVKhamBenh(conn); dataGridView1.ReadOnly = false; label13.Visible = false; }
public FormTaiVu(f_DangNhap login) { InitializeComponent(); conn = login.conn; dataGridView1.DataSource = TaiVu.getViewTaiVu(conn); dataGridView1.ReadOnly = false; }
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { int col = dataGridView1.SelectedCells[0].ColumnIndex; int row = dataGridView1.SelectedCells[0].RowIndex; if (col == 5) { if (dataGridView1.Columns[col].Name.ToUpper() == "GIATIEN") { string GiaTienUpdate = dataGridView1.SelectedCells[0].Value.ToString(); string IDSuDungDichVu = dataGridView1.Rows[row].Cells[4].Value.ToString(); string sql = "UPDATE DBA_USER.DANH_SACH_SU_DUNG_DICH_VU SET GIATIEN=" + GiaTienUpdate + " WHERE ID_SUDUNGDICHVU=" + IDSuDungDichVu; TaiVu.runSQL(conn, sql); } } }
private void label13_Click(object sender, EventArgs e) { string Ma = dataGridView1.Rows[rowInsert].Cells[0].Value.ToString(); string Ten = dataGridView1.Rows[rowInsert].Cells[1].Value.ToString(); string Gia = dataGridView1.Rows[rowInsert].Cells[2].Value.ToString(); if (num == 1) { sqlInsert = "INSERT INTO DBA_USER.THUOC VALUES(" + Ma + ",'" + Ten + "'," + Gia + ")"; } else if (num == 5) { sqlInsert = "INSERT INTO DBA_USER.DICH_VU_KHAM_BENH VALUES(" + Ma + ",'" + Ten + "'," + Gia + ")"; } TaiVu.runSQL(conn, sqlInsert); MessageBox.Show("Đã thêm thành công!"); }
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { int col = dataGridView1.SelectedCells[0].ColumnIndex; int row = dataGridView1.SelectedCells[0].RowIndex; if (col == 2) { if (dataGridView1.Columns[col].Name.ToUpper() == "GIATHUOC") { string GiaThuocUpdate = dataGridView1.SelectedCells[0].Value.ToString(); string MaThuoc = dataGridView1.Rows[row].Cells[0].Value.ToString(); string sql = "UPDATE DBA_USER.THUOC SET GIATHUOC=" + GiaThuocUpdate + " WHERE MATHUOC=" + MaThuoc; TaiVu.runSQL(conn, sql); } else if (dataGridView1.Columns[col].Name.ToUpper() == "GIADV") { string GiaDVUpdate = dataGridView1.SelectedCells[0].Value.ToString(); string MaDV = dataGridView1.Rows[row].Cells[0].Value.ToString(); string sql = "UPDATE DBA_USER.DICH_VU_KHAM_BENH SET GIADV=" + GiaDVUpdate + " WHERE MADV=" + MaDV; TaiVu.runSQL(conn, sql); } } }
private void button1_Click(object sender, EventArgs e) { try { string username = f_DangNhap_Username_textbox.Text; username = username.ToLower(); string password = f_DangNhap_Password_textbox.Text; //Oracle db = new Oracle(); //MainForm = new ChucNang_form(); LogedIn_Username = username; //MainForm.username = f_DangNhap_Username_textbox.Text; //MessageBox.Show("Da dang nhap voi username:"******"sy") == true || username.StartsWith("dba") == true) { conn = Oracle.CreateDBConnection(username, password); ChucNang_form MainFrom = new ChucNang_form(this); MainFrom.Show(); } if (username.StartsWith("tt") == true) { conn = TiepTan.CreateDBConnection(username, password); try { // conn.Open(); FormTiepTan tieptan = new FormTiepTan(this); tieptan.Show(); } catch { MessageBox.Show("Đăng nhập thất bại!"); } } if (username.StartsWith("kt") == true) { conn = Oracle.CreateDBConnection(username, password); conn.Open(); FormKeToan ketoan = new FormKeToan(this); ketoan.Show(); } if (username.StartsWith("bs") == true) { conn = BacSi.CreateDBConnection(username, password); try { conn.Open(); FormBacSi bacsi = new FormBacSi(this); bacsi.Show(); } catch { MessageBox.Show("Đăng nhập thất bại!"); } } if (username.StartsWith("bt") == true) { conn = BacSi.CreateDBConnection(username, password); try { FormBanThuoc bt = new FormBanThuoc(this); bt.Show(); } catch { MessageBox.Show("Đăng nhập thất bại!"); } } if (username.StartsWith("tv") == true) { conn = TaiVu.CreateDBConnection(username, password); try { conn.Open(); FormTaiVu f_tv = new FormTaiVu(this); f_tv.Show(); //this.Hide(); } catch (Exception ex) { MessageBox.Show("Đăng nhập thất bại!"); } } if (username.StartsWith("ql002") == true) { conn = TaiVu.CreateDBConnection(username, password); try { conn.Open(); FormQuanLiTaiVu f_qltv = new FormQuanLiTaiVu(this); f_qltv.Show(); //this.Hide(); } catch (Exception ex) { MessageBox.Show("Đăng nhập thất bại!"); } } if (username.StartsWith("ql001") == true) { conn = QuanLy.CreateDBConnection(username, password); try { conn.Open(); QLTNNS f_qltnns = new QLTNNS(this); f_qltnns.Show(); //this.Hide(); } catch (Exception ex) { MessageBox.Show("Đăng nhập thất bại!"); } } if (username.StartsWith("ql003") == true) { conn = QuanLy.CreateDBConnection(username, password); try { conn.Open(); QLCM f_qlcm = new QLCM(this); f_qlcm.Show(); //this.Hide(); } catch (Exception ex) { MessageBox.Show("Đăng nhập thất bại!"); } } } catch (Exception er) { MessageBox.Show("Error: " + er); } }