Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static GoAboardModel Create(GoAboardModel model)
        {
            // init entity
            var entity = new hr_GoAboard();

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

            // create
            return(new GoAboardModel(hr_GoAboardServices.Create(entity)));
        }
Exemple #2
0
        private void Insert(DirectEventArgs e)
        {
            try
            {
                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 id        = listId[i];
                    var util      = new Util();
                    var controler = new GoAboardController();
                    var hs        = new hr_GoAboard
                    {
                        RecordId = int.Parse(id),
                        Reason   = txtLyDo.Text.Trim(),
                        Note     = txtGhiChu.Text.Trim()
                    };
                    if (!string.IsNullOrEmpty(hdfNationId.Text))
                    {
                        hs.NationId = Convert.ToInt32(hdfNationId.Text);
                    }

                    if (!util.IsDateNull(dfNgayBatDau.SelectedDate))
                    {
                        hs.StartDate = dfNgayBatDau.SelectedDate;
                    }

                    if (!util.IsDateNull(dfNgayKetThuc.SelectedDate))
                    {
                        hs.EndDate = dfNgayKetThuc.SelectedDate;
                    }

                    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;
                    controler.Insert(hs);
                }

                grp_HoSoDiNuocNgoai.Reload();
                ResetForm();
            }
            catch (Exception ex)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình tạo: {0}".FormatWith(ex.Message));
            }
        }