/// <summary> /// /// </summary> private void Update() { try { if (!int.TryParse(hdfRecordId.Text, out var id)) { return; } var model = GoAboardController.GetById(id); if (model == null) { return; } //edit data EditDataSave(model); model.EditedDate = DateTime.Now; model.EditedBy = CurrentUser.User.UserName; //update GoAboardController.Update(model); gpGoAboard.Reload(); wdGoAboard.Hide(); } catch (Exception e) { Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(e.Message)); } }
private void Update() { try { int id; var util = new Util(); var controler = new GoAboardController(); if (!int.TryParse(hdfRecordId.Text, out id)) { return; } var hs = hr_GoAboardServices.GetById(id); if (!util.IsDateNull(dfNgayBatDau.SelectedDate)) { hs.StartDate = dfNgayBatDau.SelectedDate; } if (!util.IsDateNull(dfNgayKetThuc.SelectedDate)) { hs.EndDate = dfNgayKetThuc.SelectedDate; } hs.Note = txtGhiChu.Text; hs.Reason = txtLyDo.Text; if (!string.IsNullOrEmpty(hdfNationId.Text)) { hs.NationId = Convert.ToInt32(hdfNationId.Text); } hs.DecisionNumber = txtDecisionNumber.Text; if (!util.IsDateNull(dfDecisionDate.SelectedDate)) { hs.DecisionDate = dfDecisionDate.SelectedDate; } hs.SponsorDepartment = txtSponsorDepartment.Text; hs.SourceDepartment = txtSourceDepartment.Text; hs.DecisionMaker = txtDecisionMaker.Text; var makerPosition = string.Empty; if (hdfIsMakerPosition.Text == @"0") { makerPosition = cbxMakerPosition.Text; } else { makerPosition = cbxMakerPosition.SelectedItem.Text; } hs.MakerPosition = makerPosition; hs.EditedDate = DateTime.Now; controler.Update(hs); grp_HoSoDiNuocNgoai.Reload(); RM.RegisterClientScriptBlock("Grid_Reload", "ReloadGrid();"); } catch (Exception e) { Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(e.Message)); } }