private void btnXoa_Click(object sender, EventArgs e) { DBCongViec dbCV = new DBCongViec(); dbCV.removeCV(this.congviecID); btnXoa.Enabled = false; khoitaoform(); }
private void khoitaoform() { lblCaID.Text = this.caID; lblKipThucHien.Text = this.maKip; t.Interval = 1000; //in milliseconds t.Tick += new EventHandler(this.t_Tick); t.Start(); //this will use t_Tick() method khoitaoListNV(); DBCongViec dbnv = new DBCongViec(); dbnv.updateGridData(dGCongViec, this.caID); txtCongViec.Text = ""; txtXuLy.Text = ""; txtDeXuat.Text = ""; txtGhiChu.Text = ""; }
private void updateCongViec(bool isNewCongViec) { if (txtCongViec.Text.Equals("")) { MessageBox.Show(this, "Chưa điền nội dung Cong Việc"); return; } CongViec cv = new CongViec(); if (isNewCongViec) { cv.maCV = "" + DateTime.Now; } else { cv.maCV = this.congviecID; } cv.maCa = this.caID; cv.moTaCV = txtCongViec.Text; cv.xuLyCV = txtXuLy.Text; cv.deXuat = txtDeXuat.Text; cv.ghiChu = txtGhiChu.Text; DBCongViec dbnv = new DBCongViec(); string ret = dbnv.addNewCV(cv, isNewCongViec); if (ret.Contains("duplicate key")) { MessageBox.Show(this, "TRUNG ID", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (ret.Length > 0) { MessageBox.Show(this, ret, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning); } dbnv.updateGridData(dGCongViec, cv.maCa); }