Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InitWindowEdit(object sender, DirectEventArgs e)
        {
            if (int.TryParse(hdfRecordId.Text, out var id))
            {
                var model = GoAboardController.GetById(id);
                if (model != null)
                {
                    dfFromDate.SetValue(model.StartDate);
                    dfToDate.SetValue(model.EndDate);
                    txtReason.Text            = model.Reason;
                    txtNote.Text              = model.Note;
                    hdfNationId.Text          = model.NationId.ToString();
                    cboNation.Text            = model.NationName;
                    txtSponsorDepartment.Text = model.SponsorDepartment;
                    txtSourceDepartment.Text  = model.SourceDepartment;
                    txtDecisionMaker.Text     = model.DecisionMaker;
                    cbxMakerPosition.Text     = model.MakerPosition;
                    txtDecisionNumber.Text    = model.DecisionNumber;
                    dfDecisionDate.SetValue(model.DecisionDate);
                }
            }

            ctnEmployee.Hide();
            hdfCommandName.Text = @"Update";
            wdGoAboard.Show();
        }
Beispiel #2
0
        protected void InitWindowEdit(object sender, DirectEventArgs e)
        {
            int id;

            if (int.TryParse(hdfRecordId.Text, out id))
            {
                var hs = GoAboardController.GetById(id);
                if (hs != null)
                {
                    cbx_quocgia.Text = hs.NationName;
                    if (hs.StartDate != null)
                    {
                        dfNgayBatDau.SelectedDate = (DateTime)hs.StartDate;
                    }
                    if (hs.EndDate != null)
                    {
                        dfNgayKetThuc.SelectedDate = (DateTime)hs.EndDate;
                    }
                    txtLyDo.Text              = hs.Reason;
                    txtGhiChu.Text            = hs.Note;
                    hdfNationId.Text          = hs.NationId.ToString();
                    cbx_quocgia.Text          = hs.NationName;
                    txtSponsorDepartment.Text = hs.SponsorDepartment;
                    txtSourceDepartment.Text  = hs.SourceDepartment;
                    txtDecisionMaker.Text     = hs.DecisionMaker;
                    cbxMakerPosition.Text     = hs.MakerPosition;
                }
            }

            hdfCommandName.Text = @"Update";
            ctn23.Hide();
            wdDiNuocNgoai.Show();
        }
Beispiel #3
0
        /// <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));
            }
        }