Esempio n. 1
0
        public bool UpdateKhoanThu(DTO_KhoanThu kt)
        {
            try
            {
                _conn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = _conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "UpdateDataIntoKhoanThu";
                cmd.Parameters.AddWithValue("maKT", kt.MaKT);
                cmd.Parameters.AddWithValue("tenkhoanthu", kt.TenKT);
                cmd.Parameters.AddWithValue("ngaythu", kt.NgayThu);
                cmd.Parameters.AddWithValue("sotien", kt.SoTien);
                cmd.Parameters.AddWithValue("mota", kt.MoTa);

                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }
            finally
            {
                _conn.Close();
            }
            return(false);
        }
Esempio n. 2
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            float soTienThu;
            bool  isfloatThu = float.TryParse(txtSoTien.Text.Trim().ToString(), out soTienThu);

            if (txtKhoanThu.Text.Trim().Length == 0)
            {
                MessageBox.Show("Bạn phải nhập tên khoản thu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtKhoanThu.Focus();
                return;
            }
            else if (!isfloatThu || float.Parse(txtSoTien.Text) < 0)
            {
                MessageBox.Show("Bạn phải nhập số tiền", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtSoTien.Focus();
                return;
            }
            else
            {
                DTO_KhoanThu kt = new DTO_KhoanThu(txtMaKT.Text, txtKhoanThu.Text, dtpkNgayThu.Value, float.Parse(txtSoTien.Text), txtMoTa.Text);
                if (busKhoanThu.UpdateKhoanThu(kt))
                {
                    MessageBox.Show("Sửa thành công");
                    ResetValues();
                    LoadGridView_KhoanThu();
                }
                else
                {
                    MessageBox.Show("Sửa không thành công");
                }
            }
        }
Esempio n. 3
0
 public bool UpdateKhoanThu(DTO_KhoanThu kt)
 {
     return(dalKhoanThu.UpdateKhoanThu(kt));
 }
Esempio n. 4
0
 public bool InsertKhoanThu(DTO_KhoanThu kt)
 {
     return(dalKhoanThu.InsertKhoanThu(kt));
 }