void GanDuLieu(PhuTung pt) { pt.MaPT = txtMaPT.Text.Trim(); pt.TenPT = txtTenPT.Text.Trim(); pt.MaLoai = cbbLoaiXe.SelectedValue.ToString(); pt.DonVi = txtDonVi.Text.Trim(); pt.GiaNhap = int.Parse(txtGiaNhap.Text.Trim()); pt.GiaBan = int.Parse(txtGiaBan.Text.Trim()); pt.SLTon = int.Parse(txtSoLuongTon.Text.Trim()); pt.GhiChu = txtGhiChu.Text.Trim(); }
public bool SuaPhuTung(PhuTung pt) { cmd.CommandText = "UPDATE PhuTung SET TenPhuTung = N'" + pt.TenPT + "',MaLoaiXe = '" + pt.MaLoai + "', DonVi =N'" + pt.DonVi + "', GhiChu ='" + pt.GhiChu + "', GiaBan ='" + pt.GiaBan + "', GiaNhap ='" + pt.GiaNhap + "', SoLuongTon='" + pt.SLTon + "' Where MaPT= '" + pt.MaPT + "'"; cmd.CommandType = CommandType.Text; cmd.Connection = cn.Connection; try { cn.Connect(); cmd.ExecuteNonQuery(); cn.DisConnect(); return(true); } catch (Exception ex) { string mex = ex.Message; cmd.Dispose(); cn.DisConnect(); } return(false); }
public bool ThemPhuTung(PhuTung pt) { cmd.CommandText = "INSERT INTO PhuTung values ('" + pt.MaPT + "', '" + pt.MaLoai + "', N'" + pt.TenPT + "', N'" + pt.DonVi + "', '" + pt.GiaNhap + "', '" + pt.GiaBan + "', '" + pt.SLTon + "', '" + pt.GhiChu + "')"; cmd.CommandType = CommandType.Text; cmd.Connection = cn.Connection; try { cn.Connect(); cmd.ExecuteNonQuery(); cn.DisConnect(); return(true); } catch (Exception ex) { string mex = ex.Message; cmd.Dispose(); cn.DisConnect(); } return(false); }
public bool SuaPhuTung(PhuTung pt) { return(ptMod.SuaPhuTung(pt)); }
public bool ThemPhuTung(PhuTung pt) { return(ptMod.ThemPhuTung(pt)); }