Ejemplo n.º 1
0
        private void UpdateDataEdit(int selContainerId)
        {
            currentComponent = selContainerId >= 0 ? appComponents[selContainerId] : null;

            panelGrid.Visible       = false;
            panelProperties.Visible = true;
        }
Ejemplo n.º 2
0
        private void propertiesToolBar_ButtonClicked(object sender, Infragistics.WebUI.UltraWebToolbar.ButtonEvent be)
        {
            switch (be.Button.Key)
            {
            case "List":
                panelGrid.Visible       = true;
                panelProperties.Visible = false;
                currentComponent        = null;
                break;

            case "Save":
                if (!HyperCatalog.Shared.SessionState.User.IsReadOnly && HyperCatalog.Shared.SessionState.User.HasCapability(updateCapability))
                {
                    if (appComponents.Contains(txtComponentNameValue.Text) && (currentComponent == null || !currentComponent.Name.Equals(txtComponentNameValue.Text)))
                    {
                        Tools.UITools.SetMessage(propertiesMsgLbl, "Component \"" + currentComponent.Name + "\" already exists.", Tools.UITools.MessageLevel.Error);
                    }
                    if (txtComponentNameValue.Text == string.Empty)
                    {
                        Tools.UITools.SetMessage(propertiesMsgLbl, "Component name is mandatory.", Tools.UITools.MessageLevel.Error);
                    }
                    else if (currentComponent != null)
                    {
                        currentComponent.Name        = txtComponentNameValue.Text;
                        currentComponent.Description = txtComponentDescriptionValue.Value;
                        currentComponent.TypeCode    = txtComponentTypeValue.SelectedValue;
                        currentComponent.URI         = txtComponentURIValue.Text;
                        currentComponent.Login       = txtComponentLoginValue.Text;
                        if (txtComponentPasswordValue.Value != "")
                        {
                            currentComponent.Password = txtComponentPasswordValue.Value;
                        }
                        currentComponent.Options       = txtComponentOptionsValue.Text;
                        currentComponent.Action        = getActionValue();
                        currentComponent.UIGroupBy     = txtComponentGroupByValue.Text;
                        currentComponent.VersionNumber = txtComponentVersionNumberValue.Text;

                        if (currentComponent.SaveWithTrace(HyperCatalog.Shared.SessionState.User.Id))
                        {
                            Tools.UITools.SetMessage(propertiesMsgLbl, "Component \"" + currentComponent.Name + "\" updated.", Tools.UITools.MessageLevel.Information);
                            LoadGrid();
                            DataBind();
                        }
                        else
                        {
                            Tools.UITools.SetMessage(propertiesMsgLbl, "Component \"" + currentComponent.Name + "\" could not be updated.", Tools.UITools.MessageLevel.Error);
                        }
                    }
                    else
                    {
                        currentComponent = appComponents.Add(txtComponentNameValue.Text, txtComponentDescriptionValue.Value, txtComponentTypeValue.SelectedValue, txtComponentURIValue.Text, txtComponentLoginValue.Text, txtComponentPasswordValue.Value, txtComponentOptionsValue.Text, getActionValue(), null, txtComponentGroupByValue.Text, txtComponentVersionNumberValue.Text);
                        if (currentComponent != null && currentComponent.SaveWithTrace(HyperCatalog.Shared.SessionState.User.Id))
                        {
                            Tools.UITools.SetMessage(propertiesMsgLbl, "Component \"" + currentComponent.Name + "\" insertion succeeded.", Tools.UITools.MessageLevel.Information);
                            panelGrid.Visible       = true;
                            panelProperties.Visible = false;
                            currentComponent        = null;
                            LoadGrid();
                            DataBind();
                        }
                        else
                        {
                            Tools.UITools.SetMessage(propertiesMsgLbl, "Component insertion failed.", Tools.UITools.MessageLevel.Error);
                        }
                    }
                }
                else
                {
                    Tools.UITools.SetMessage(propertiesMsgLbl, "You're not allowed to create or modify components.", Tools.UITools.MessageLevel.Warning);
                }

                break;

            case "Delete":
                break;
            }
        }