示例#1
0
        public bool update(tinhthanh _tt)
        {
            tinhthanh tt = tinhthanhrespository.First(c => c.id == _tt.id);

            tt.matt  = _tt.matt;
            tt.tentt = _tt.tentt;
            return(tinhthanhrespository.Update(tt));
        }
示例#2
0
        private void themttbtn_Click(object sender, EventArgs e)
        {
            tinhthanh tt = new tinhthanh();

            tt.matt  = matttxt.Text;
            tt.tentt = tentttxt.Text;
            bool s = ttbus.tinhthanhrespository.Add(tt);

            helpers.successorerror(s);
            if (s)
            {
                helpers.ClearOnlyTextBoxes(tinhthanhpanel);
                loadtinhthanhdgv();
            }
        }
示例#3
0
        private void suattbtn_Click(object sender, EventArgs e)
        {
            tinhthanh tt = new tinhthanh();

            tt.id    = currentid;
            tt.matt  = matttxt.Text;
            tt.tentt = tentttxt.Text;
            bool s = ttbus.update(tt);

            helpers.successorerror(s);
            if (s)
            {
                exiteditingmode();
                loadtinhthanhdgv();
            }
        }
示例#4
0
 public bool sua(int id, string matt, string tentt)
 {
     try
     {
         tinhthanh t = db.tinhthanhs.First(o => o.id == id);
         t.matt            = matt;
         t.tentt           = tentt;
         db.Entry(t).State = EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Lỗi " + ex);
         return(false);
     }
 }
示例#5
0
 public bool them(string matt, string tentt)
 {
     try
     {
         tinhthanh t = new tinhthanh();
         t.matt  = matt;
         t.tentt = tentt;
         db.tinhthanhs.Add(t);
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Lỗi :" + ex);
         return(false);
     }
 }
示例#6
0
 public tinhthanhdto(tinhthanh o)
 {
     ID    = o.id;
     matt  = o.matt;
     tentt = o.tentt;
 }