private void UpdateDataView()
    {
        if (inputFormTypeCode == ' ')
        {
            // Create input form type
            UITools.HideToolBarButton(uwToolbar, "Delete");
            UITools.HideToolBarSeparator(uwToolbar, "DeleteSep");

            txtInputFormTypeCode.Enabled = true;
        }
        else
        {
            // Modify input form type
            HyperCatalog.Business.InputFormType inputFormType = HyperCatalog.Business.InputFormType.GetByKey(inputFormTypeCode);
            if (inputFormType != null)
            {
                txtInputFormTypeCode.Text = inputFormType.Code.ToString();
                txtInputFormType.Text     = inputFormType.Name;

                txtInputFormTypeCode.Enabled = false;

                if (SessionState.User.HasCapability(HyperCatalog.Business.CapabilitiesEnum.EXTEND_CONTENT_MODEL))
                {
                    UITools.ShowToolBarButton(uwToolbar, "Delete");
                    UITools.ShowToolBarSeparator(uwToolbar, "DeleteSep");
                }
            }
            else
            {
                lbError.CssClass = "hc_error";
                lbError.Text     = "Error: Input form type is null";
                lbError.Visible  = true;
            }
        }
    }
    private void Delete()
    {
        HyperCatalog.Business.InputFormType inputFormType = HyperCatalog.Business.InputFormType.GetByKey(Convert.ToChar(inputFormTypeCode));
        if (inputFormType != null)
        {
            if (inputFormType.Delete(HyperCatalog.Shared.SessionState.User.Id))
            {
                lbError.Visible = false;
                lbError.Text    = string.Empty;

                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>back();</script>");
            }
            else
            {
                lbError.CssClass = "hc_error";
                lbError.Text     = HyperCatalog.Business.InputFormType.LastError;
                lbError.Visible  = true;
            }
        }
        else
        {
            lbError.CssClass = "hc_error";
            lbError.Text     = "Error: input form type is null";
            lbError.Visible  = true;
        }
    }
Example #3
0
        private void UpdateDataEdit(string selInputFormType)
        {
            if (selInputFormType == string.Empty)
            {
                // Create input form type
                webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./inputformtypes/inputformtype_properties.aspx";
                lbTitle.Text = "Input form type: New";
                webTab.Tabs.GetTab(1).Visible = false;

                panelGrid.Visible = false;
                webTab.Visible    = true;
            }
            else
            {
                // Modify input form types
                char code = Convert.ToChar(selInputFormType);
                HyperCatalog.Business.InputFormType inputFormType = HyperCatalog.Business.InputFormType.GetByKey(code);

                if (inputFormType != null)
                {
                    webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./inputformtypes/inputformtype_properties.aspx?d=" + inputFormType.Code;
                    webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "./inputformtypes/inputformtype_exclusionrules.aspx?d=" + inputFormType.Code;
                    string sqlFilter = " InputFormTypeCode = '" + inputFormType.Code.ToString() + "'";
                    webTab.Tabs.GetTab(1).Text    = webTab.Tabs.GetTab(1).Text + " (" + HyperCatalog.Business.InputFormTypeExclusionRule.GetAll(sqlFilter).Count.ToString() + ")";
                    webTab.Tabs.GetTab(1).Visible = true;

                    lbTitle.Text = "Input form type: " + inputFormType.Name;

                    panelGrid.Visible = false;
                    webTab.Visible    = true;
                }
            }
        }
    private void Save()
    {
        HyperCatalog.Business.InputFormType ifType = null;
        if (!txtInputFormTypeCode.Enabled)
        {
            // Update modified input form type
            ifType      = HyperCatalog.Business.InputFormType.GetByKey(inputFormTypeCode);
            ifType.Name = txtInputFormType.Text;
        }
        else
        {
            // Save new input form type
            ifType = new HyperCatalog.Business.InputFormType(Convert.ToChar(txtInputFormTypeCode.Text), txtInputFormType.Text, 0);
        }

        if (ifType != null)
        {
            if (ifType.Save(txtInputFormTypeCode.Enabled))
            {
                if (txtInputFormTypeCode.Enabled)
                {
                    // create
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>back();</script>");
                }
                else
                {
                    // update
                    lbError.Text     = "Data saved!";
                    lbError.CssClass = "hc_success";
                    lbError.Visible  = true;
                }
            }
            else
            {
                lbError.CssClass = "hc_error";
                lbError.Text     = HyperCatalog.Business.InputFormType.LastError;
                lbError.Visible  = true;
            }
        }
        else
        {
            lbError.CssClass = "hc_error";
            lbError.Text     = "Error: input form type is null";
            lbError.Visible  = true;
        }
    }
Example #5
0
        /// <summary>
        /// Apply new sort
        /// </summary>
        private void Save()
        {
            lbError.Visible = false;

            if (dg != null)
            {
                bool isSaved = false;
                foreach (UltraGridRow r in dg.Rows)
                {
                    char code = Convert.ToChar(r.Cells.FromKey("Code").Value);
                    HyperCatalog.Business.InputFormType ift = HyperCatalog.Business.InputFormType.GetByKey(code);
                    ift.Sort = r.Index;

                    if (!ift.Save(false))
                    {
                        lbError.CssClass = "hc_error";
                        lbError.Text     = HyperCatalog.Business.InputFormType.LastError;
                        lbError.Visible  = true;

                        isSaved = false;
                        break;
                    }
                    else
                    {
                        isSaved = true;
                    }
                }

                if (isSaved)
                {
                    lbError.CssClass = "hc_success";
                    lbError.Text     = "New sort saved!";
                    lbError.Visible  = true;
                }
            }
        }