protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Models.ChinhTriXaHoiEntity ctxhEntity = new Models.ChinhTriXaHoiEntity(); ctxhEntity.Load_DataSource_DropDownList(RadDropDownListCTXH); RadDatePickerTuNgay.SelectedDate = DateTime.Now; } if (this.Page.RouteData.Values["ctxh"] == null) { _nhanvienID = Convert.ToInt32(Page.RouteData.Values["nhanvien"]); this.CreateStatus(); } else { this.UpdateStatus(); _thamgiactxhID = Convert.ToInt32(this.Page.RouteData.Values["ctxh"]); Models.ThamGiaChinhTriXaHois tgctxh = _thamgiaCTXHEntity.Find(_thamgiactxhID); _nhanvienID = tgctxh.NVID; if (!IsPostBack) { RadDropDownListCTXH.SelectedValue = tgctxh.CTXHID.ToString(); RadTextBoxChucVu.Text = tgctxh.TGCTXHChucVu; RadDatePickerTuNgay.SelectedDate = tgctxh.TGCTXHTuNgay; RadDatePickerDenNgay.SelectedDate = tgctxh.TGCTXHDenNgay; RadTextBoxNoiDung.Text = tgctxh.TGCTXHNoiDung; } } }
protected void Page_Load(object sender, EventArgs e) { if (this.Page.RouteData.Values["ctxh"] != null) { try { int thamgiaID = Convert.ToInt32(this.Page.RouteData.Values["ctxh"]); Models.ThamGiaChinhTriXaHoiEntity thamgiaEntity = new Models.ThamGiaChinhTriXaHoiEntity(); Models.ThamGiaChinhTriXaHois thamgia = thamgiaEntity.Find(thamgiaID); if (thamgia == null) { Response.Redirect("~/NhanSu"); } else { lblNhanVien.Text = thamgia.NhanVien.NVTen; } } catch (Exception) { Response.Redirect("~/NhanSu"); } } else if (this.Page.RouteData.Values["nhanvien"] != null) { try { int nhanvienID = nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]); Models.NhanVienEntity nhanvienEntity = new Models.NhanVienEntity(); Models.NhanVien nhanvien = nhanvienEntity.Find_NhanVien(nhanvienID); if (nhanvien == null) { Response.Redirect("~/NhanSu"); } else { lblNhanVien.Text = nhanvien.NVTen; } } catch (Exception) { } } else { Response.Redirect("~/NhanSu"); } }