protected void lbtnGhiLai_Click(object sender, EventArgs e) { AdminLoaiTinController control = new AdminLoaiTinController(); // UPDATE if (Request["action"] != null) { AdminLoaiTinInfo cv = control.GetAdminLoaiTins(int.Parse(Request["action"])); cv.Ten = this.tbxTieuDe.Text.Trim(); cv.Cha =Convert.ToInt32(this.tbxCha.Text.Trim()); cv.ThuTu =Convert.ToInt32(this.tbxThuTu.Text.Trim()); cv.NgayTao = DateTime.Now; cv.NguonTin =Convert.ToInt32(this.ddlNguonTin.SelectedValue.Trim()); cv.Lang = this.ddlNgonNgu.SelectedValue.Trim(); cv.TinhTrang = this.cbxTinhTrang.Checked; try { control.UpdateAdminLoaiTin(cv); this.lblThongBao.Text = "Ghi lại thành công"; } catch (Exception ex) { this.lblThongBao.Text = "Có lỗi: " + ex.ToString(); } } else // INSERT { AdminLoaiTinInfo cv = new AdminLoaiTinInfo(); cv.Ten = this.tbxTieuDe.Text.Trim(); cv.Cha = Convert.ToInt32(this.tbxCha.Text.Trim()); cv.ThuTu = Convert.ToInt32(this.tbxThuTu.Text.Trim()); cv.NgayTao = DateTime.Now; cv.NguonTin = Convert.ToInt32(this.ddlNguonTin.SelectedValue.Trim()); cv.Lang = this.ddlNgonNgu.SelectedValue.Trim(); cv.TinhTrang = this.cbxTinhTrang.Checked; try { control.AddAdminLoaiTin(cv); this.lblThongBao.Text = "Ghi lại thành công"; } catch (Exception ex) { this.lblThongBao.Text = "Có lỗi: " + ex.ToString(); } } }
/// <summary> /// update a info object already stored in the database /// </summary> /// <param name="info"></param> public void UpdateAdminLoaiTin(AdminLoaiTinInfo info) { DataProvider.Instance().UpdateAdminLoaiTin(info.ID, info.Ten, info.Cha, info.ThuTu, info.NgayTao, info.NguonTin, info.Lang, info.TinhTrang); }