Beispiel #1
0
        public bool Remove(SpendSpecy spendSpecy)
        {
            SpendSpecy a = new SpendSpecy();

            a = dt.SpendSpecies.FirstOrDefault(t => t.SpendSpeciesID == spendSpecy.SpendSpeciesID);
            dt.SpendSpecies.DeleteOnSubmit(a);
            dt.SubmitChanges();
            return(true);
        }
Beispiel #2
0
        public bool Insert(SpendSpecy entity)
        {
            SpendSpecy a = new SpendSpecy();

            a.Name        = entity.Name;
            a.CreatedDate = entity.CreatedDate;
            a.Note        = entity.Note;
            a.Status      = true;
            dt.SpendSpecies.InsertOnSubmit(a);
            dt.SubmitChanges();
            return(true);
        }
Beispiel #3
0
        public bool Edit(SpendSpecy spendSpecy)
        {
            SpendSpecy a = new SpendSpecy();

            a             = dt.SpendSpecies.Where(t => t.SpendSpeciesID == spendSpecy.SpendSpeciesID).FirstOrDefault();
            a.Name        = spendSpecy.Name;
            a.CreatedDate = spendSpecy.CreatedDate;
            a.Note        = spendSpecy.Note;
            a.Status      = spendSpecy.Status;
            dt.SubmitChanges();
            return(true);
        }
        private void btnLuu_Click(object sender, EventArgs e)
        {
            SpendSpeciesDAO dt = new SpendSpeciesDAO();
            SpendSpecy      a  = new SpendSpecy();

            a.Name        = txtTenDanhMuc.Text;
            a.CreatedDate = DateTime.Now;
            a.Note        = txtGhichu.Text;
            if (dt.Insert(a) == true)
            {
                MessageBox.Show("Lưu thành công");
                //btnThoat.PerformClick();
                this.Close();
            }
        }