예제 #1
0
        public static bool xoaLoaiSanh(DTO.DTO_LoaiSanh ls)
        {
            string sTruyVan = string.Format(@"delete from LOAI_SANH where MA_LOAI_SANH = '{0}'", ls.MA_LOAI_SANH);

            if (DatabaseHelper.ExcuteSql(sTruyVan) > 0)
            {
                return(true);
            }
            return(false);
        }
예제 #2
0
        public static bool suaLoaiSanh(DTO.DTO_LoaiSanh ls)
        {
            string sTruyVan = string.Format(@"UPDATE LOAI_SANH SET TEN_LOAI_SANH='{1}', DON_GIA_TOI_THIEU='{2}' where MA_LOAI_SANH = '{0}'", ls.MA_LOAI_SANH, ls.TEN_LOAI_SANH, ls.DON_GIA_TOI_THIEU);

            if (DatabaseHelper.ExcuteSql(sTruyVan) > 0)
            {
                return(true);
            }
            return(false);
        }
예제 #3
0
        public static bool themLoaiSanh(DTO.DTO_LoaiSanh ls)
        {
            string sTruyVan = string.Format(@"INSERT INTO LOAI_SANH(MA_LOAI_SANH, TEN_LOAI_SANH, DON_GIA_TOI_THIEU) values ('{0}','{1}',{2})", ls.MA_LOAI_SANH, ls.TEN_LOAI_SANH, ls.DON_GIA_TOI_THIEU);

            if (DatabaseHelper.ExcuteSql(sTruyVan) > 0)
            {
                return(true);
            }
            return(false);
        }
예제 #4
0
        public static DTO.DTO_LoaiSanh getThongTinLoaiSanh(String maLS)
        {
            String    sql = String.Format(@"SELECT * FROM LOAI_SANH WHERE MA_LOAI_SANH = '{0}'", maLS);
            DataTable da  = DatabaseHelper.GetData(sql);

            DTO.DTO_LoaiSanh result = null;
            if (da.Rows.Count > 0)
            {
                result = new DTO.DTO_LoaiSanh();
                DataRow row = da.Rows[0];
                result.MA_LOAI_SANH      = maLS;
                result.TEN_LOAI_SANH     = row["TEN_LOAI_SANH"].ToString();
                result.DON_GIA_TOI_THIEU = int.Parse(row["DON_GIA_TOI_THIEU"].ToString());
            }
            return(result);
        }
예제 #5
0
        private void BtnXoaloai_Click(object sender, EventArgs e)
        {
            String MaLS = DgvLoaiSanh.CurrentRow.Cells[0].Value.ToString();

            if (MaLS == "")
            {
                MessageBox.Show("Vui Lòng Chọn Loại Sảnh Cần Xóa!", "Thông Báo!");
                return;
            }
            DTO.DTO_LoaiSanh ls = new DTO.DTO_LoaiSanh();
            ls.MA_LOAI_SANH = MaLS;
            if (BUS_TiepNhanSanh.xoaLoaiSanh(ls) == true)
            {
                MessageBox.Show("Xóa Thành Công!", "Thông Báo!");
                LoadDataGridView();
                loadLoaiSanh();
                LoadDataGridViewLoaiSanh();
                ClearInputs();
                return;
            }
            MessageBox.Show("Xóa Thất Bại!", "Thông Báo!");
        }
예제 #6
0
 private void Button1_Click(object sender, EventArgs e)
 {
     if (txtTenLoaiSanh.Text == "" || txtDonGia.Text == "")
     {
         MessageBox.Show("Vui lòng nhập dữ liệu!", "Thông Báo!");
         return;
     }
     DTO.DTO_LoaiSanh ls = new DTO.DTO_LoaiSanh();
     ls.MA_LOAI_SANH      = GetNewMaLS();
     ls.TEN_LOAI_SANH     = txtTenLoaiSanh.Text;
     ls.DON_GIA_TOI_THIEU = int.Parse(txtDonGia.Text);
     if (BUS_TiepNhanSanh.themLoaiSanh(ls) == true)
     {
         MessageBox.Show("Thêm Thành  Công!", "Thông Báo!");
         LoadDataGridView();
         loadLoaiSanh();
         LoadDataGridViewLoaiSanh();
         ClearInputs();
         return;
     }
     MessageBox.Show("Thêm That Bai!", "Thông Báo!");
 }
예제 #7
0
        private void BtnSuaLoai_Click(object sender, EventArgs e)
        {
            if (txtTenLoaiSanh.Text == "" || txtDonGia.Text == "")
            {
                MessageBox.Show("Vui lòng Nhập Dữ Liệu!", "Thông Báo");
                return;
            }
            DTO.DTO_LoaiSanh ls   = new DTO.DTO_LoaiSanh();
            String           MaLS = DgvLoaiSanh.CurrentRow.Cells[0].Value.ToString();

            ls.MA_LOAI_SANH      = MaLS;
            ls.TEN_LOAI_SANH     = txtTenLoaiSanh.Text;
            ls.DON_GIA_TOI_THIEU = int.Parse(txtDonGia.Text);
            if (BUS_TiepNhanSanh.suaLoaiSanh(ls) == true)
            {
                MessageBox.Show("Sửa Thành Công!", "Thông Báo!");
                LoadDataGridView();
                loadLoaiSanh();
                LoadDataGridViewLoaiSanh();
                ClearInputs();
                return;
            }
            MessageBox.Show("Sửa Thất Bại!", "Thông Báo!");
        }
예제 #8
0
 public static bool xoaLoaiSanh(DTO.DTO_LoaiSanh ls)
 {
     return(DAO.DAO_QuanLyLoaiSanh.xoaLoaiSanh(ls));
 }