Esempio n. 1
0
        public bool insertPhongBan(DTO_PhongBan phongBan)
        {
            try
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "sp_InsertDataIntoPhongBan";
                cmd.Parameters.AddWithValue("maPB", phongBan.maPB);
                cmd.Parameters.AddWithValue("tenPB", phongBan.maPB);
                cmd.Parameters.AddWithValue("truongPhong", phongBan.truongPhong);

                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                conn.Close();
            }
            return(false);
        }
Esempio n. 2
0
        //SUA
        private void btnSua_Click(object sender, EventArgs e)
        {
            try
            {
                DTO_PhongBan sv = new DTO_PhongBan(txtMaPB.Text, txtTenPB.Text, txtMaTP.Text, txtDiaDiemPB.Text, txtDienThoaiPB.Text, txtEmailPB.Text);

                BUS_PhongBan.Sua_phongban(sv);
                DialogResult dr = MessageBox.Show("Sua thanh Cong", "Thông Báo", MessageBoxButtons.OK);
                loaddata();
                if (dr == DialogResult.OK)
                {
                    loaddata();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Sua không thành công!\n" + ex.Message);
            }
        }
Esempio n. 3
0
 private void btLuu_Click(object sender, EventArgs e)
 {
     if (txtMaPB.Text != "" && txtTenPB.Text != "" && txtTruongPhong.Text != "")
     {
         DTO_PhongBan phongBan = new DTO_PhongBan(txtMaPB.Text, txtTenPB.Text, txtTruongPhong.Text);;
         if (busPhongBan.insertPhongBan(phongBan))
         {
             MessageBox.Show("Thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             LoadGridView_Phong();
             CloseTextbox();
         }
         else
         {
             MessageBox.Show("Thêm không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("Xin hãy nhập đầy đủ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 4
0
 private void btSua_Click(object sender, EventArgs e)
 {
     if (txtMaPB.Text != "" && txtTenPB.Text != "" && txtTruongPhong.Text != "")
     {
         DTO_PhongBan phongBan = new DTO_PhongBan(txtMaPB.Text, txtTenPB.Text, txtTruongPhong.Text);;
         if (MessageBox.Show("Bạn có chắc muốn sửa", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             if (busPhongBan.updatePhongBan(phongBan))
             {
                 MessageBox.Show("Sửa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 LoadGridView_Phong();
                 CloseTextbox();
             }
             else
             {
                 MessageBox.Show("Sửa không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     else
     {
         MessageBox.Show("Xin hãy nhập đầy đủ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 5
0
 public bool updatePhongBan(DTO_PhongBan phongBan)
 {
     return(dalPhongBan.updatePhongBan(phongBan));
 }
Esempio n. 6
0
 public bool insertPhongBan(DTO_PhongBan phongBan)
 {
     return(dalPhongBan.insertPhongBan(phongBan));
 }
Esempio n. 7
0
 public static void Sua_phongban(DTO_PhongBan nv)
 {
     con = DAO_KetNoiDB.OpenConnect();
     SqlHelper.ExecuteNonQuery(con, "PR_SUA_PHONGBAN", nv.MaPB, nv.TenPB, nv.MaTP, nv.DiaDiem, nv.DienThoai, nv.Email);
     DAO_KetNoiDB.CloseConnect(con);
 }
 public static void Sua_phongban(DTO_PhongBan nv)
 {
     DAO_PhongBan.Sua_phongban(nv);
 }
 public static void Them_phongban(DTO_PhongBan nv)
 {
     DAO_PhongBan.Them_phongban(nv);
 }