private void tnLuu_Click(object sender, EventArgs e) { if (txtNameShipType.Text == "" || txtShipType.Text == "") { MessageBox.Show("Chưa nhập đủ thông tin"); return; } loaitau lt = new loaitau(); lt.ma = txtIDShipType.Text; lt.tenloaitau = txtNameShipType.Text; lt.kieutau = txtShipType.Text; if (MessageBox.Show(string.Format("Thêm loại tàu "), "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (shipTypeService.InsertTypesShip(lt) == 0) { MessageBox.Show("Đã thêm thành công!"); frmQuanlyLoaitau_Load(sender, e); } else { MessageBox.Show("Thông tin chưa được thêm"); } } }
public int UpdateTypesShip(loaitau _loaitau) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@IDShipType", _loaitau.ma), new SqlParameter("@NameShipType", _loaitau.tenloaitau), new SqlParameter("@ShipType", _loaitau.kieutau), }; return(db.doStoredProceduce("updateShipType", para)); }
public int InsertTypesShip(loaitau _loaitau) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@maloaitau", _loaitau.ma), new SqlParameter("@tenloaitau", _loaitau.tenloaitau), new SqlParameter("@kieutau", _loaitau.kieutau), }; return(db.doStoredProceduce("themloaitau", para)); }