Beispiel #1
0
        public bool insertTinChi(Entities.tblTinChi kh)
        {
            bool   check = false;
            string sql   = "sp_tblTinChi_Insert";

            try
            {
                con = ds.getConnect();
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = sql;
                cmd.Connection  = con;
                cmd.Parameters.Add("@matinchi", SqlDbType.NVarChar).Value = kh.Matinchi;
                cmd.Parameters.Add("@sotinchi", SqlDbType.Int).Value      = kh.Sotinchi;
                cmd.ExecuteNonQuery();
                check = true;
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
            return(check);
        }
Beispiel #2
0
        public bool deleteTinChi(Entities.tblTinChi kh)
        {
            bool   check = false;
            string sql   = "sp_tblTinChi_Delete";

            try
            {
                con = ds.getConnect();
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@id", SqlDbType.Int).Value = kh.Id;
                cmd.ExecuteNonQuery();
                check = true;
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
            return(check);
        }
Beispiel #3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (int.TryParse(lblID.Text, out _ID))
     {
     }
     if (int.TryParse(txtSoTinChi.Text, out _stc))
     {
     }
     if (CheckObject())
     {
         Entities.tblTinChi kh = new Entities.tblTinChi();
         kh.Id       = _ID;
         kh.Matinchi = txtMaTinChi.Text;
         kh.Sotinchi = _stc;
         if (flag == "add")
         {
             bool check = bllTinChi.insertTinChi(kh);
             if (check)
             {
                 MessageBox.Show("Thêm thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         else if (flag == "update")
         {
             bool check = bllTinChi.updateTinChi(kh);
             if (check)
             {
                 MessageBox.Show("Cập nhật thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         else if (flag == "delete")
         {
             bool check = bllTinChi.deleteTinChi(kh);
             if (check)
             {
                 MessageBox.Show("Xóa thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         ReLoad();
         dgvTinChi_SelectionChanged(sender, e);
     }
 }
Beispiel #4
0
 public bool deleteTinChi(Entities.tblTinChi tt)
 {
     return(dal.deleteTinChi(tt));
 }
Beispiel #5
0
 public bool updateTinChi(Entities.tblTinChi tt)
 {
     return(dal.updateTinChi(tt));
 }
Beispiel #6
0
 public bool insertTinChi(Entities.tblTinChi tt)
 {
     return(dal.insertTinChi(tt));
 }