Beispiel #1
0
        private void dataGridView2_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            int col = dataGridView2.SelectedCells[0].ColumnIndex;
            int row = dataGridView2.SelectedCells[0].RowIndex;

            Console.WriteLine("col:" + col);
            Console.WriteLine("row:" + row);
            if (col == 4)
            {
                if (dataGridView2.Columns[col].Name.ToUpper() == "MATHUOC")
                {
                    string mathuoc = dataGridView2.SelectedCells[0].Value.ToString();
                    string madsdt  = dataGridView2.Rows[row].Cells[0].Value.ToString();
                    string sql     = "UPDATE DBA_USER.DANH_SACH_DON_THUOC SET MATHUOC= " + mathuoc + " WHERE ID_DANHSACHDONTHUOC=" + madsdt;
                    Console.Write(sql);
                    BacSi.runSQL(conn, sql);
                }
            }
            if (col == 5)
            {
                if (dataGridView2.Columns[col].Name.ToUpper() == "SOLUONG")
                {
                    string soluong = dataGridView2.SelectedCells[0].Value.ToString();
                    string mast    = dataGridView2.Rows[row].Cells[0].Value.ToString();
                    string sql     = "UPDATE DBA_USER.DANH_SACH_DON_THUOC SET SOLUONG=" + soluong + " WHERE ID_DANHSACHDONTHUOC=" + mast;
                    Console.Write(sql);
                    BacSi.runSQL(conn, sql);
                }
            }
        }
Beispiel #2
0
        public void getchitietdonthuocc()
        {
            BacSi  a  = new BacSi();
            string ab = textBox1.Text;

            if (ab == "")
            {
                MessageBox.Show("Bạn phải nhập đầy đủ thông tin");
            }
            else
            {
                dataGridView1.DataSource = a.getDonThuoc(conn, ab);
            }
        }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            string mabenhnhan     = textBox1.Text;
            string trieuchungbenh = textBox6.Text;

            if (mabenhnhan == "" || trieuchungbenh == "")
            {
                MessageBox.Show("Bạn phải nhập đầy đủ thông tin.");
            }
            else
            {
                BacSi a = new BacSi();
                a.updatebenhnhan(conn, mabenhnhan, trieuchungbenh);
                MessageBox.Show("Cập nhật thông tin bệnh nhân thành công");
            }
        }
Beispiel #4
0
        private void button5_Click(object sender, EventArgs e)
        {
            BacSi a = new BacSi();

            a.themthuocvaodonthuoc(conn);
            string iddonthuoc = textBox7.Text;
            string mathuoc    = textBox8.Text;
            string soluong    = textBox9.Text;

            string sqlInsert = "INSERT INTO DBA_USER.DANH_SACH_DON_THUOC(ID_DANHSACHDONTHUOC, MADT, MATHUOC, SOLUONG, DONGIA) VALUES ((SELECT MAX(ID_DANHSACHDONTHUOC) FROM DBA_USER.DANH_SACH_DON_THUOC)+1, " + iddonthuoc + ", " + mathuoc + "," + soluong + ", 15000)";

            // string sqlInsert = "INSERT INTO DBA_USER.DANH_SACH_DON_THUOC(ID_DANHSACHDONTHUOC, MADT, MATHUOC, SOLUONG, DONGIA) VALUES ( (SELECT MAX(ID_DANHSACHDONTHUOC) FROM DBA_USER.DANH_SACH_DON_THUOC ) + 1,"+iddonthuoc+", "+mathuoc+", "+soluong+", '30000')";
            Console.Write(sqlInsert);
            BacSi.runSQL(conn, sqlInsert);
            MessageBox.Show("Đã thêm thành công!");
        }
Beispiel #5
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            int col = dataGridView1.SelectedCells[0].ColumnIndex;
            int row = dataGridView1.SelectedCells[0].RowIndex;

            Console.WriteLine("col:" + col);
            Console.WriteLine("row:" + row);
            if (col == 3)
            {
                if (dataGridView1.Columns[col].Name.ToUpper() == "TRIEUCHUNGBENH")
                {
                    string trieuchungUpdate = dataGridView1.SelectedCells[0].Value.ToString();
                    string mabenhnhan       = dataGridView1.Rows[row].Cells[0].Value.ToString();
                    string sql = "UPDATE DBA_USER.BENH_NHAN_BAC_SI_VIEW SET TRIEUCHUNGBENH = '" + trieuchungUpdate + "' WHERE MABENHNHAN=" + mabenhnhan;
                    Console.Write(sql);
                    BacSi.runSQL(conn, sql);
                }
            }
        }
Beispiel #6
0
        private void button4_Click(object sender, EventArgs e)
        {
            string madonthuoc = textBox2.Text;
            string idds       = textBox3.Text;
            string mathuoc    = textBox4.Text;
            string soluong    = textBox5.Text;

            if (madonthuoc == "" || idds == "" || mathuoc == "" || soluong == "")
            {
                MessageBox.Show("Bạn phải nhập đầy đủ thông tin.");
            }
            else
            {
                BacSi a = new BacSi();

                a.updatedonthuoc(conn, madonthuoc, idds, mathuoc, soluong);

                MessageBox.Show("Cập nhật thông tin bệnh nhân thành công");
            }
        }
Beispiel #7
0
        public void getchitietdonthuocc1()
        {
            BacSi a = new BacSi();

            dataGridView1.DataSource = a.getDonThuoc1(conn);
        }
Beispiel #8
0
        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);
            }
        }
Beispiel #9
0
        public void getthongtindonthuoc()
        {
            BacSi a = new BacSi();

            dataGridView2.DataSource = a.getthongdonthuoc(conn);
        }
Beispiel #10
0
        public void getthongtinbenhnhan()
        {
            BacSi a = new BacSi();

            dataGridView1.DataSource = a.getthongtinbenhnhan(conn);
        }