Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        private void Insert(DirectEventArgs e)
        {
            try
            {
                foreach (var itemRow in chkEmployeeRowSelection.SelectedRows)
                {
                    var model = new GoAboardModel()
                    {
                        RecordId    = Convert.ToInt32(itemRow.RecordID),
                        CreatedBy   = CurrentUser.User.UserName,
                        CreatedDate = DateTime.Now,
                        EditedDate  = DateTime.Now,
                        EditedBy    = CurrentUser.User.UserName,
                    };

                    //edit data
                    EditDataSave(model);

                    //create
                    GoAboardController.Create(model);
                }

                gpGoAboard.Reload();
                ResetForm();
                wdGoAboard.Hide();
            }
            catch (Exception ex)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình tạo: {0}".FormatWith(ex.Message));
            }
        }
Ejemplo 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 = 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();
        }
Ejemplo n.º 4
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));
            }
        }
Ejemplo n.º 5
0
        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));
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Delete(object sender, DirectEventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(hdfRecordId.Text))
         {
             GoAboardController.Delete(Convert.ToInt32(hdfRecordId.Text));
         }
         gpGoAboard.Reload();
     }
     catch (Exception ex)
     {
         Dialog.Alert("Có lỗi xảy ra trong quá trình xóa: {0}".FormatWith(ex.Message));
     }
 }
Ejemplo n.º 7
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));
            }
        }