private void btnHoanTat_Click(object sender, EventArgs e) { if (checktxt()) { t = new Entities.tblTra(); t.MaNV1 = labNVGD.Text; t.MaS1 = txtMaS.Text; t.NgayT1 = DateTime.Parse(txtNgayT.Value.ToString()); t.GhiChu1 = txtGhiChu.Text; bool kt = bll_Tra.Insert_Tra(t); if (kt) { MessageBox.Show("Bạn đã trả thành công!", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtGhiChu.Text = ""; txtMaS.Text = ""; txtNgayT.Value = DateTime.Now; txtMaS.Focus(); reloadgrid(); Reset(); } else { MessageBox.Show("Không thành công thành công!", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMaS.Focus(); Reset(); } } }
public bool Insert_Tra(Entities.tblTra s) { bool kt = false; string sql = "Prd_Tra_Insert"; try { con = ds.getConnect(); cmd = new SqlCommand(sql, con); con.Open(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@MaNV", SqlDbType.NVarChar).Value = s.MaNV1; cmd.Parameters.Add("@MaS", SqlDbType.NVarChar).Value = s.MaS1; cmd.Parameters.Add("@NgayT", SqlDbType.Date).Value = s.NgayT1; cmd.Parameters.Add("@GhiChu", SqlDbType.NVarChar).Value = s.GhiChu1; cmd.ExecuteNonQuery(); kt = true; } catch (Exception) { } finally { cmd.Dispose(); con.Close(); } return(kt); }
public bool Insert_Tra(Entities.tblTra s) { return(dal.Insert_Tra(s)); }