Ejemplo n.º 1
0
 public PlanAnualAddForm(PlanAnual source)
     : base()
 {
     InitializeComponent();
     _entity = source.Clone();
     _entity.BeginEdit();
     SetFormData();
     _mf_type  = ManagerFormType.MFAdd;
     this.Text = Resources.Labels.PLAN_ANUAL_ADD_TITLE;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected override bool SaveObject()
        {
            using (StatusBusy busy = new StatusBusy(moleQule.Face.Resources.Messages.SAVING))
            {
                this.Datos.RaiseListChangedEvents = false;

                PlanAnual temp = _entity.Clone();
                temp.ApplyEdit();

                foreach (Plan_Tipo item in _entity.PlanesTipos)
                {
                    if (item.OidTipo == 0)
                    {
                        MessageBox.Show(Resources.Messages.PLAN_TIPO_NO_VALIDO,
                                        moleQule.Library.Application.AppController.APP_TITLE,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                        return(false);
                    }
                }

                // do the save
                try
                {
                    _entity = temp.Save();
                    _entity.ApplyEdit();

                    //Decomentar si se va a mantener en memoria
                    //_entity.BeginEdit();
                    return(true);
                }
                catch (iQValidationException ex)
                {
                    MessageBox.Show(iQExceptionHandler.GetAllMessages(ex) +
                                    Environment.NewLine + ex.SysMessage,
                                    moleQule.Library.Application.AppController.APP_TITLE,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(iQExceptionHandler.GetAllMessages(ex),
                                    moleQule.Library.Application.AppController.APP_TITLE,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                finally
                {
                    this.Datos.RaiseListChangedEvents = true;
                }
            }
        }