Example #1
0
        public void actionsStackView_SaveButtonClick(object sender, EventArgs e)
        {
            try
            {
                bool res = false;
                //indicamos que ha dejado de editar el grid, por si modifica una celda y sin salir pulsa sobre guardar
                grdRoles.EndEdit();

                if (IsValidRoles() == false)
                {
                    return;
                }

                DialogResult result = MessageBox.Show(GlobalSetting.ResManager.GetString("SaveChanges"), "", MessageBoxButtons.YesNo);

                if (result != DialogResult.Yes)
                {
                    return;
                }

                if (actionsStackView.CurrentState == CustomControls.StackView.ToolbarStates.Edit)
                {
                    if (_modifiedRoles.Count() == 0)
                    {
                        MessageBox.Show(GlobalSetting.ResManager.GetString("NoPendingChanges"), "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        if (UpdateRoles())
                        {
                            res = true;
                        }
                    }
                }
                else if (actionsStackView.CurrentState == CustomControls.StackView.ToolbarStates.New)
                {
                    if (CreateRole())
                    {
                        res = true;
                    }
                }

                if (res == true)
                {
                    MessageBox.Show(GlobalSetting.ResManager.GetString("SaveSuccessfully"));
                    LoadAllRoles();
                    ConfigureRolesGridDefaultStyles();
                    actionsStackView.RestoreInitState();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
 public void actionsStackView_EditButtonClick(object sender, EventArgs e)
 {
     try
     {
         if (_customerOriginal == null)
         {
             MessageBox.Show("No customer selected");
             actionsStackView.RestoreInitState();
         }
         else
         {
             ConfigureActionsStackViewEditing();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }