예제 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            string ten            = dataGridView1.Rows[0].Cells[1].Value.ToString();
            int    namsinh        = Convert.ToInt32(dataGridView1.Rows[0].Cells[2].Value);
            string diachilienlac  = dataGridView1.Rows[0].Cells[3].Value.ToString();
            int    sdt            = Convert.ToInt32(dataGridView1.Rows[0].Cells[4].Value);
            string trieuchungbenh = dataGridView1.Rows[0].Cells[5].Value.ToString();

            TiepTan.addBenhNhan(conn, ten, namsinh, diachilienlac, sdt, trieuchungbenh);
        }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            int    mabenhnhan     = Convert.ToInt32(dataGridView1.Rows[0].Cells[0].Value);
            string ten            = dataGridView1.Rows[0].Cells[1].Value.ToString();
            int    namsinh        = Convert.ToInt32(dataGridView1.Rows[0].Cells[2].Value);
            string diachilienlac  = dataGridView1.Rows[0].Cells[3].Value.ToString();
            int    sdt            = Convert.ToInt32(dataGridView1.Rows[0].Cells[4].Value);
            string trieuchungbenh = dataGridView1.Rows[0].Cells[5].Value.ToString();

            Console.Write("ten:" + ten);
            TiepTan.updateBenhNhan(conn, mabenhnhan, ten, namsinh, diachilienlac, sdt, trieuchungbenh);
        }
예제 #3
0
        public void getthongtinbenhnhan()
        {
            string mabenhnhan = textBox1.Text.ToString();

            if (mabenhnhan == "")
            {
                MessageBox.Show("Bạn chưa điền thông tin");
            }
            else
            {
                dataGridView1.DataSource = TiepTan.getBenhNhan(conn, mabenhnhan);
            }
        }
예제 #4
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);
            }
        }
예제 #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 == 5)
            {
                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 SET TRIEUCHUNGBENH = '" + trieuchungUpdate + "' WHERE MABENHNHAN=" + mabenhnhan;
                    Console.Write(sql);
                    MessageBox.Show("Cập nhật thành công");
                    TiepTan.runSQL(conn, sql);
                }
            }
            if (col == 4)
            {
                if (dataGridView1.Columns[col].Name.ToUpper() == "SDT")
                {
                    string trieuchungUpdate = dataGridView1.SelectedCells[0].Value.ToString();
                    string mabenhnhan       = dataGridView1.Rows[row].Cells[0].Value.ToString();

                    string sql = "UPDATE DBA_USER.BENH_NHAN SET SDT = '" + trieuchungUpdate + "' WHERE MABENHNHAN=" + mabenhnhan;
                    Console.Write(sql);
                    MessageBox.Show("Cập nhật thành công");
                    TiepTan.runSQL(conn, sql);
                }
            }
            if (col == 3)
            {
                if (dataGridView1.Columns[col].Name.ToUpper() == "DIACHILIENLAC")
                {
                    string trieuchungUpdate = dataGridView1.SelectedCells[0].Value.ToString();
                    string mabenhnhan       = dataGridView1.Rows[row].Cells[0].Value.ToString();

                    string sql = "UPDATE DBA_USER.BENH_NHAN SET DIACHILIENLAC = '" + trieuchungUpdate + "' WHERE MABENHNHAN=" + mabenhnhan;
                    Console.Write(sql);
                    MessageBox.Show("Cập nhật thành công");
                    TiepTan.runSQL(conn, sql);
                }
            }
            if (col == 2)
            {
                if (dataGridView1.Columns[col].Name.ToUpper() == "NAMSINH")
                {
                    string trieuchungUpdate = dataGridView1.SelectedCells[0].Value.ToString();
                    string mabenhnhan       = dataGridView1.Rows[row].Cells[0].Value.ToString();

                    string sql = "UPDATE DBA_USER.BENH_NHAN SET NAMSINH = '" + trieuchungUpdate + "' WHERE MABENHNHAN=" + mabenhnhan;
                    Console.Write(sql);
                    MessageBox.Show("Cập nhật thành công");
                    TiepTan.runSQL(conn, sql);
                }
            }
            if (col == 1)
            {
                if (dataGridView1.Columns[col].Name.ToUpper() == "TEN")
                {
                    string trieuchungUpdate = dataGridView1.SelectedCells[0].Value.ToString();
                    string mabenhnhan       = dataGridView1.Rows[row].Cells[0].Value.ToString();

                    string sql = "UPDATE DBA_USER.BENH_NHAN SET TEN = '" + trieuchungUpdate + "' WHERE MABENHNHAN=" + mabenhnhan;
                    Console.Write(sql);
                    MessageBox.Show("Cập nhật thành công");
                    TiepTan.runSQL(conn, sql);
                }
            }
        }