Beispiel #1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (KiemTraThongTinTrong())
            {
                MessageBox.Show("Làm ơn điền đầy đủ thông tin loại địa ốc");
            }
            else
            {
                if (KiemTraThongTinHopLe())
                {
                    LoaiDiaOcDTO loaiDiaOcDTO = new LoaiDiaOcDTO(txtTenLoaiDiaOc.Text, txtMoTa.Text);

                    try
                    {
                        if (loaiDiaOcBLL.ThemLoaiDiaOc(loaiDiaOcDTO))
                        {
                            MessageBox.Show("Thêm loại địa ốc thành công");
                            dgvLoaiDiaOc.DataSource = loaiDiaOcBLL.LayDanhSachLoaiDiaOc();
                        }
                        else
                        {
                            MessageBox.Show("Thêm loại địa ốc thất bại");
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Beispiel #2
0
 public bool ThemLoaiDiaOc(LoaiDiaOcDTO loaiDiaOcDTO)
 {
     try
     {
         OpenConnect();
         string store = "sp_LoaiDiaOc_Them";
         sqlCommand             = new SqlCommand(store, connect);
         sqlCommand.CommandType = CommandType.StoredProcedure;
         sqlCommand.Parameters.Add(new SqlParameter("@ten", loaiDiaOcDTO.TenLoaiDiaOc));
         sqlCommand.Parameters.Add(new SqlParameter("@mota", loaiDiaOcDTO.MoTa));
         sqlCommand.ExecuteNonQuery();
         return(true);
     }
     catch
     {
         return(false);
     }
     finally
     {
         CloseConnect();
     }
 }
Beispiel #3
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            if (id == "")
            {
                MessageBox.Show("Làm ơn chọn loại địa ốc muốn sửa");
            }
            else
            {
                if (KiemTraThongTinTrong())
                {
                    MessageBox.Show("Làm ơn điền đầy đủ thông tin loại địa ốc");
                }
                else
                {
                    if (KiemTraThongTinHopLe())
                    {
                        LoaiDiaOcDTO loaiDiaOcDTO = new LoaiDiaOcDTO(Int32.Parse(txtMaLoaiDiaOc.Text), txtTenLoaiDiaOc.Text, txtMoTa.Text);

                        try
                        {
                            if (loaiDiaOcBLL.SuaLoaiDiaOc(loaiDiaOcDTO))
                            {
                                MessageBox.Show("Sửa loại địa ốc thành công");
                                dgvLoaiDiaOc.DataSource = loaiDiaOcBLL.LayDanhSachLoaiDiaOc();
                                LamMoiThongTin();
                            }
                            else
                            {
                                MessageBox.Show("Sửa loại địa ốc thất bại");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
Beispiel #4
0
 public bool SuaLoaiDiaOc(LoaiDiaOcDTO loaiDiaOcDTO)
 {
     return(LoaiDiaOcDAL.SuaLoaiDiaOc(loaiDiaOcDTO));
 }
Beispiel #5
0
 public bool ThemLoaiDiaOc(LoaiDiaOcDTO loaiDiaOcDTO)
 {
     return(LoaiDiaOcDAL.ThemLoaiDiaOc(loaiDiaOcDTO));
 }