Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        private void Update()
        {
            try
            {
                if (!int.TryParse(hdfRecordId.Text, out var id))
                {
                    return;
                }
                var model = TrainingHistoryController.GetById(id);
                if (model != null)
                {
                    model.TrainingName  = txtDaoTao.Text.Trim();
                    model.Reason        = txtLyDoDaoTao.Text.Trim();
                    model.TrainingPlace = txtNoiDaoTao.Text.Trim();
                    model.Note          = txt_GhiChu.Text.Trim();
                    if (!string.IsNullOrEmpty(hdfNationId.Text))
                    {
                        model.NationId = Convert.ToInt32(hdfNationId.Text);
                    }

                    if (!DatetimeHelper.IsNull(dfTuNgay.SelectedDate))
                    {
                        model.StartDate = dfTuNgay.SelectedDate;
                    }

                    if (!DatetimeHelper.IsNull(dfDenNgay.SelectedDate))
                    {
                        model.EndDate = dfDenNgay.SelectedDate;
                    }

                    model.SponsorDepartment = txtUpdateSponsorDepartment.Text;
                    model.DecisionMaker     = txtUpdateDecisionMaker.Text;
                    model.SourceDepartment  = txtUpdateSourceDepartment.Text;
                    model.MakerPosition     = hdfIsUpdateMakerPosition.Text == @"0" ? cbxUpdateMakerPosition.Text : cbxUpdateMakerPosition.SelectedItem.Text;
                    model.EditedDate        = DateTime.Now;
                    model.EditedBy          = CurrentUser.User.UserName;

                    //update
                    TrainingHistoryController.Update(model);
                }

                wdDaoTao.Hide();
                gpTrainingHistory.Reload();
            }
            catch (Exception e)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(e.Message));
            }
        }
Esempio n. 2
0
        protected void InitWindowEdit(object sender, DirectEventArgs e)
        {
            if (int.TryParse(hdfRecordId.Text, out var id))
            {
                var training = TrainingHistoryController.GetById(id);
                if (training != null)
                {
                    txtDaoTao.Text     = training.TrainingName;
                    txt_GhiChu.Text    = training.Note;
                    txtLyDoDaoTao.Text = training.Reason;
                    txtNoiDaoTao.Text  = training.TrainingPlace;
                    if (training.StartDate.HasValue &&
                        training.StartDate.Value.ToString(CultureInfo.InvariantCulture).Contains("0001") == false)
                    {
                        dfTuNgay.SelectedDate = training.StartDate.Value;
                    }

                    if (training.EndDate.HasValue &&
                        training.EndDate.Value.ToString(CultureInfo.InvariantCulture).Contains("0001") == false)
                    {
                        dfDenNgay.SelectedDate = training.EndDate.Value;
                    }

                    hdfQuocGiaDaoTao.Text            = training.NationId.ToString();
                    cbx_QuocGiaDaoTao.Text           = training.NationName;
                    txtUpdateSourceDepartment.Text   = training.SourceDepartment;
                    txtUpdateDecisionMaker.Text      = training.DecisionMaker;
                    txtUpdateSponsorDepartment.Text  = training.SponsorDepartment;
                    cbxUpdateMakerPosition.Text      = training.MakerPosition;
                    txtUpdateDocumentNumber.Text     = training.DocumentNumber;
                    hdfUpdateFieldTrainingId.Text    = training.FieldTrainingId.ToString();
                    cbxUpdateField.Text              = cat_FieldOfTrainingServices.GetFieldValueById(training.FieldTrainingId, "Name");
                    hdfUpdateOrganizeId.Text         = training.OrganizeDepartmentId.ToString();
                    cbxUpdateOrganizeDepartment.Text = cat_TrainingOrganizationServices.GetFieldValueById(training.OrganizeDepartmentId, "Name");
                    hdfUpdateTrainingStatusId.Text   = training.TrainingStatusId.ToString();
                    cbx_UpdateTrainingStatus.Text    = training.TrainingStatusId.Description();
                }
            }

            wdDaoTao.Show();
        }
Esempio n. 3
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 = TrainingHistoryController.GetById(id);
                if (model != null)
                {
                    txtDaoTao.Text     = model.TrainingName;
                    txt_GhiChu.Text    = model.Note;
                    txtLyDoDaoTao.Text = model.Reason;
                    txtNoiDaoTao.Text  = model.TrainingPlace;
                    dfTuNgay.SetValue(model.StartDate);
                    dfDenNgay.SetValue(model.EndDate);
                    hdfNationId.Text = model.NationId.ToString();
                    cboNation.Text   = model.NationName;
                    txtUpdateSourceDepartment.Text  = model.SourceDepartment;
                    txtUpdateDecisionMaker.Text     = model.DecisionMaker;
                    txtUpdateSponsorDepartment.Text = model.SponsorDepartment;
                    cbxUpdateMakerPosition.Text     = model.MakerPosition;
                }
            }

            wdDaoTao.Show();
        }