예제 #1
0
 protected void btnEdit_Click(object sender, DirectEventArgs e)
 {
     try
     {
         ThamSoTrangThaiController controller = new ThamSoTrangThaiController();
         DAL.ThamSoTrangThai       thamso     = controller.GetByID(int.Parse(hdfRecordID.Text));
         if (thamso != null)
         {
             txtGhiChu.Text       = thamso.Description;
             txtGiaTri.Text       = thamso.Value;
             chkTinhTrang.Checked = thamso.IsInUsed;
         }
         wdThemGiaTri.Show();
     }
     catch (Exception ex)
     {
         X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show();
     }
 }
예제 #2
0
 protected void btnCapNhat_Click(object sender, DirectEventArgs e)
 {
     try
     {
         DAL.ThamSoTrangThai thamso = new DAL.ThamSoTrangThai()
         {
             CreatedBy   = CurrentUser.ID,
             CreatedDate = DateTime.Now,
             Description = txtGhiChu.Text.Trim(),
             MaDonVi     = Session["MaDonVi"].ToString(),
             Value       = txtGiaTri.Text.Trim(),
             IsInUsed    = chkTinhTrang.Checked,
             ParamName   = cbDanhSachThamSo.SelectedItem.Value
         };
         if (e.ExtraParams["Command"] == "Update")
         {
             thamso.ID = int.Parse(hdfRecordID.Text);
             new ThamSoTrangThaiController().Update(thamso);
             wdThemGiaTri.Hide();
         }
         else
         {
             new ThamSoTrangThaiController().Add(thamso);
         }
         if (e.ExtraParams["Close"] == "True")
         {
             wdThemGiaTri.Hide();
         }
         txtGhiChu.Text = "";
         txtGiaTri.Text = "";
         grpDanhSachThamSo.Reload();
     }
     catch (Exception ex)
     {
         X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show();
     }
 }