private void button1_Click(object sender, EventArgs e) { if (!(tbDeviceName.Text == "" || tbPrice.Text == "" || tbQuantity.Text == "")) { try { //Tạo đối tượng DTO Nhập thiết bị DTO_NhapThietBi nhapDTO; nhapDTO = new DTO_NhapThietBi(); nhapDTO.Date = DateTime.Now; nhapDTO.DeviceName = tbDeviceName.Text; nhapDTO.Quantity = Int32.Parse(tbQuantity.Text); nhapDTO.UnitPrice = Int32.Parse(tbPrice.Text); nhapDTO.ID = nhapBUS.getNextBoughtDeviceId(); nhapDTO.RequestID = hoadonDTO.ID; nhapBUS.insertBoughtDevice(nhapDTO); ((GUI_SuaChua)parent).ReloadBoughtDevicesList(); MessageBox.Show("Ghi thông tin thành công !!!!!!!!"); } catch (Exception ex) { MessageBox.Show("Kiểm tra lại thông tin nhập !!!!!!!!!!!!!!!!!!!!!!!!!!!!"); return; } } else { MessageBox.Show("Cần nhập đầy đủ thông tin !!!!!!!!!!!"); } }
public bool deleteBoughtDevice(DTO_NhapThietBi nhapDTO) { string query = "delete from NHAPTHIETBI where MaNhap = @_id"; SqlParameter[] sqlParameters = new SqlParameter[1]; sqlParameters[0] = new SqlParameter("@_id", SqlDbType.VarChar); sqlParameters[0].Value = Convert.ToString(nhapDTO.ID); return(conn.executeDeleteQuery(query, sqlParameters)); }
public DTO_NhapThietBi getBoughtDeviceById(int _id) { DTO_NhapThietBi nhapDTO = new DTO_NhapThietBi(); DataTable dataTable = new DataTable(); dataTable = nhapDAL.getBoughtDeviceById(_id); foreach (DataRow dr in dataTable.Rows) { nhapDTO.fromDatarow(dr); } return(nhapDTO); }
public bool insertBoughtDevice(DTO_NhapThietBi nhapDTO) { string query = "insert into NHAPTHIETBI(MaYeuCau, TenThietBi, SoLuong, DonGia, NgayNhap) " + " values(@_MaYeuCau,@_TenThietBi, @_SoLuong, @_DonGia, @_NgayNhap)"; SqlParameter[] sqlParameters = new SqlParameter[5]; sqlParameters[0] = new SqlParameter("@_MaYeuCau", SqlDbType.VarChar); sqlParameters[0].Value = nhapDTO.RequestID.ToString(); sqlParameters[1] = new SqlParameter("@_TenThietBi", SqlDbType.NVarChar); sqlParameters[1].Value = nhapDTO.DeviceName; sqlParameters[2] = new SqlParameter("@_SoLuong", SqlDbType.VarChar); sqlParameters[2].Value = nhapDTO.Quantity.ToString(); sqlParameters[3] = new SqlParameter("@_DonGia", SqlDbType.VarChar); sqlParameters[3].Value = nhapDTO.UnitPrice.ToString(); sqlParameters[4] = new SqlParameter("@_NgayNhap", SqlDbType.VarChar); sqlParameters[4].Value = nhapDTO.Date.ToString("MM-dd-yyyy"); return(conn.executeInsertQuery(query, sqlParameters)); }
public bool deleteBoughtDevice(DTO_NhapThietBi nhapDTO) { return(nhapDAL.deleteBoughtDevice(nhapDTO)); }
public bool insertBoughtDevice(DTO_NhapThietBi nhapDTO) { return(nhapDAL.insertBoughtDevice(nhapDTO)); }