public bool updatePSC(Entity_PhieuSuaChua _psc) { try { const string strSQL = "SP_UPDATE_PSC"; string[] pNames = { "@maPsc" }; object[] pValues = { _psc.MaPsc, _psc.User_id }; int count = con.ExecuteStoredProcedure(strSQL, pNames, pValues); if (count >= 0) { return(true); } else { return(false); } } catch { return(false); } }
public bool insertPSC(Entity_PhieuSuaChua _psc) { try { const string strSQL = "SP_INSERT_PSC"; string[] pNames = { "@maPsc", "@bs", "@uid" }; object[] pValues = { _psc.MaPsc, _psc.BienSo, _psc.User_id }; int count = con.ExecuteStoredProcedure(strSQL, pNames, pValues); if (count >= 0) { return(true); } else { return(false); } } catch { return(false); } }
private void btnLuu_Click(object sender, EventArgs e) { string bs = this.cbbBienSo.Text; string khachHang = this.cbbKhachHang.SelectedValue.ToString(); int kh_id = 1; try { kh_id = Int32.Parse(khachHang); this.txtMPSC.Text = maPSC.ToString(); tong = Double.Parse(this.txtTong.Text); } catch { tong = 0; } if (bs == "" || khachHang == "") { MessageBox.Show("Vui lòng điền đầy đủ thông tin!", "Thông Báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Entity_PhieuSuaChua _psc = new Entity_PhieuSuaChua(maPSC, bs, kh_id); if (psc.insertPSC(_psc)) { MessageBox.Show("Thêm thành công", "Thông Báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); this.gwPhieuSuaChua.DataSource = psc.getData(); } else if (psc.updatePSC(_psc) == true) { MessageBox.Show("Lưu thành công", "Thông Báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); this.gwPhieuSuaChua.DataSource = psc.getData(); } else { MessageBox.Show("Không thể thêm!", "Thông Báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public bool updatePSC(Entity_PhieuSuaChua _psc) { return(psc.updatePSC(_psc)); }
public bool insertPSC(Entity_PhieuSuaChua _psc) { return(psc.insertPSC(_psc)); }