Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static TrainingHistoryModel Create(TrainingHistoryModel model)
        {
            // init entity
            var entity = new hr_TrainingHistory();

            // fill entity
            model.FillEntity(ref entity);

            // create
            return(new TrainingHistoryModel(hr_TrainingHistoryServices.Create(entity)));
        }
Exemplo n.º 2
0
        private void Insert(DirectEventArgs e)
        {
            var listId = e.ExtraParams["ListId"].Split(',');

            if (listId.Length <= 1)
            {
                Dialog.Alert("Bạn chưa chọn cán bộ nào!");
                return;
            }

            for (var i = 0; i < listId.Length - 1; i++)
            {
                var util   = new Util();
                var id     = listId[i];
                var record = new hr_TrainingHistory
                {
                    RecordId      = Convert.ToInt32(id),
                    TrainingName  = txtDTTenKhoaDaoTao.Text.Trim(),
                    Reason        = txtDTLyDoDaoTao.Text.Trim(),
                    TrainingPlace = txtDTNoiDaoTao.Text.Trim(),
                    Note          = txtDTGhiChu.Text.Trim(),
                    Type          = hdfType.Text,
                };
                if (!string.IsNullOrEmpty(hdfTrainingStatusId.Text))
                {
                    //Kế hoạch đào tạo
                    record.TrainingStatusId = (TrainingStatus)Enum.Parse(typeof(TrainingStatus), hdfTrainingStatusId.Text);
                }

                int nationId;
                if (int.TryParse(cbxDTQuocGia.SelectedItem.Value, out nationId))
                {
                    record.NationId = nationId;
                }

                if (!util.IsDateNull(dfDTTuNgay.SelectedDate))
                {
                    record.StartDate = dfDTTuNgay.SelectedDate;
                }

                if (!util.IsDateNull(dfDTDenNgay.SelectedDate))
                {
                    record.EndDate = dfDTDenNgay.SelectedDate;
                }

                record.SponsorDepartment = txtSponsorDepartment.Text;
                record.DecisionMaker     = txtDecisionMaker.Text;
                record.SourceDepartment  = txtSourceDepartment.Text;
                var makerPosition = string.Empty;
                if (hdfIsMakerPosition.Text == @"0")
                {
                    makerPosition = cbxMakerPosition.Text;
                }
                else
                {
                    makerPosition = cbxMakerPosition.SelectedItem.Text;
                }
                record.MakerPosition = makerPosition;
                if (!string.IsNullOrEmpty(hdfFieldTrainingId.Text))
                {
                    record.FieldTrainingId = Convert.ToInt32(hdfFieldTrainingId.Text);
                }
                if (!string.IsNullOrEmpty(hdfOrganizeDepartmentId.Text))
                {
                    record.OrganizeDepartmentId = Convert.ToInt32(hdfOrganizeDepartmentId.Text);
                }

                record.DocumentNumber = txtDocumentNumber.Text;

                hr_TrainingHistoryServices.Create(record);
            }

            grp_Training.Reload();
        }