Exemple #1
0
        protected void UpdateDataEdit(string selContainerTypeCode)
        {
            if ((selContainerTypeCode == null) || (selContainerTypeCode.Length == 0))
            {
                selContainerTypeCode = " ";
            }

            ContainerType containerType = ContainerType.GetByKey(Convert.ToChar(selContainerTypeCode));

            if (containerType == null)
            {
                webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./ContainerTypes/containertype_properties.aspx?d=";
                lbTitle.Text = "Container type: New";
                webTab.Tabs.GetTab(1).Visible = false;
            }
            else
            {
                webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./ContainerTypes/containertype_properties.aspx?d=" + selContainerTypeCode;
                webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "./ContainerTypes/containertype_containers.aspx?d=" + selContainerTypeCode;
                string sqlFilter = " ContainerTypeCode = '" + containerType.Code + "'";
                using (ContainerList c = HyperCatalog.Business.Container.GetAll(sqlFilter))
                {
                    webTab.Tabs.GetTab(1).Text = "Containers (" + c.Count + ")";
                }
                webTab.Tabs.GetTab(1).Visible = true;
                lbTitle.Text = "Container type: " + containerType.Name;
            }
            panelGrid.Visible = false;
            webTab.Visible    = true;
        }
Exemple #2
0
    private void UpdateDataView()
    {
        txtTypeCodeDisable.Visible = false;
        txtTypeCode.Visible        = false;
        if (typeCode.Length == 0)
        {
            // Create new container type
            txtTypeCode.Visible = true;

            UITools.HideToolBarButton(uwToolbar, "Delete");
            UITools.HideToolBarSeparator(uwToolbar, "DeleteSep");
        }
        else
        {
            // Update container type
            ContainerType containerType = ContainerType.GetByKey(Convert.ToChar(typeCode));
            if (containerType != null)
            {
                txtTypeCodeDisable.Text = containerType.Code.ToString();
                txtTypeName.Text        = containerType.Name;
                cbIsResource.Checked    = containerType.IsResource;

                txtTypeCodeDisable.Visible = true;
            }
            else
            {
                lbError.CssClass = "hc_error";
                lbError.Text     = "Error: Container type is null";
                lbError.Visible  = true;
            }
        }
    }
Exemple #3
0
    private void Save()
    {
        ContainerType type = null;

        if (txtTypeCode.Visible)
        {
            type = new ContainerType(Convert.ToChar(txtTypeCode.Text), txtTypeName.Text, cbIsResource.Checked);
        }
        else
        {
            type = ContainerType.GetByKey(Convert.ToChar(txtTypeCodeDisable.Text));
            if (type != null)
            {
                type.Name       = txtTypeName.Text;
                type.IsResource = cbIsResource.Checked;
            }
        }
        if (type != null)
        {
            if (type.Save(txtTypeCodeDisable.Text == string.Empty))
            {
                SessionState.ClearAppContainerTypes();
                if (txtTypeCode.Visible)
                {
                    // Create new container type
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>back();</script>");
                }
                else
                {
                    // Update container type
                    lbError.Text     = "Data saved!";
                    lbError.CssClass = "hc_success";
                    lbError.Visible  = true;
                }
            }
            else
            {
                lbError.CssClass = "hc_error";
                lbError.Text     = ContainerType.LastError;
                lbError.Visible  = true;
            }
        }
        else
        {
            lbError.CssClass = "hc_error";
            lbError.Text     = "Error: Container type is null";
            lbError.Visible  = true;
        }
    }
Exemple #4
0
    private void Delete()
    {
        ContainerType type = ContainerType.GetByKey(Convert.ToChar(txtTypeCodeDisable.Text));

        if (type != null)
        {
            if (type.Delete(HyperCatalog.Shared.SessionState.User.Id))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>back();</script>");
            }
            else
            {
                lbError.CssClass = "hc_error";
                lbError.Text     = ContainerType.LastError;
                lbError.Visible  = true;
            }
        }
        else
        {
            lbError.CssClass = "hc_error";
            lbError.Text     = "Error: Container type is null";
            lbError.Visible  = true;
        }
    }