private void CheckDependency()
    {
        InputForm inputForm = InputForm.GetByKey(InputFormId);

        if (inputForm != null)
        {
            if (refContainer.ContainerTypeCode == 'F') // feature container
            {
                // Retrieve all container dependencies for this feature container
                string filter = " FeatureContainerId=" + refContainer.Id;
                using (ContainerDependencyList dependencies = ContainerDependency.GetAll(filter))
                {
                    if ((dependencies != null) && (dependencies.Count > 0))
                    {
                        // Create list of tech spec containers (in container dependencies)
                        string techSpecsList = string.Empty;
                        foreach (HyperCatalog.Business.ContainerDependency d in dependencies)
                        {
                            // Current tech spec container
                            HyperCatalog.Business.Container techSpecContainer = d.TechspecContainer;

                            // tech spec container is or not attached to this input form
                            int i = 0;
                            using (InputFormContainerList ifcList = InputFormContainer.GetAll("InputFormId=" + InputFormId + " AND ContainerId=" + techSpecContainer.Id))
                            {
                                if ((ifcList == null) || (ifcList.Count == 0))
                                {
                                    i++;
                                    if (techSpecsList.Length > 0)
                                    {
                                        techSpecsList += "\\n";
                                    }
                                    techSpecsList += " " + i.ToString() + " - " + techSpecContainer.Name + " [" + techSpecContainer.Tag + "]";
                                }
                            }
                        }

                        // Tech specs (in container dependencies) are not attached to this input form
                        if (techSpecsList.Length > 0)
                        {
                            string msg = "REMINDER - are the following tech spec containers in your tech specs input forms?\\n";
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "warning", "<script>alert('" + msg + techSpecsList + "');</script>");
                        }
                    }
                }
            }
        }
    }
예제 #2
0
    protected void dlDataType_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (dlDataType.SelectedValue == "P")// Photo
        {
            dlLookupField.Enabled = false;
            txtInputMask.Enabled  = false;
            txtMaxLength.Enabled  = false;
            lbLookupField.Visible = lbInputMask.Visible = lbMaxLength.Visible = true;
        }
        else
        {
            lbLookupField.Visible = lbInputMask.Visible = lbMaxLength.Visible = false;
            txtInputMask.Enabled  = dlLookupField.Enabled = true;
            using (InputFormContainerList IFCList = InputFormContainer.GetAll("ContainerId = " + containerId.ToString()))
            {
                if (IFCList != null)
                {
                    foreach (InputFormContainer ifc in IFCList)
                    {
                        if (ifc.Type != InputFormContainerType.Normal)
                        {
                            dlLookupField.SelectedIndex = 0;
                            dlLookupField.Enabled       = false;
                            break;
                        }
                    }
                }
            }

            if (container != null)
            {
                // all content
                using (Database db = Utils.GetMainDB())
                {
                    if (db != null)
                    {
                        txtMaxLength.Enabled = true;
                        int r = db.RunSPReturnInteger("dbo._Container_HasNotContent",
                                                      new SqlParameter("@ContainerId", container.Id),
                                                      new SqlParameter("@CultureTypeId", (int)CultureType.Master));
                        if (r < 0)
                        {
                            UITools.HideToolBarButton(uwToolbar, "Delete");
                            UITools.HideToolBarSeparator(uwToolbar, "DeleteSep");

                            txtTag.Enabled              = false;
                            dlContainerType.Enabled     = false;
                            dlInheritanceMethod.Enabled = false;
                            dlDataType.Enabled          = false;
                            if (txtMaxLength.ValueDouble > 0)
                            {
                                txtMaxLength.MinValue = txtMaxLength.ValueDouble;
                            }
                            else
                            {
                                txtMaxLength.Enabled = false;
                            }
                        }
                        else
                        {
                            txtMaxLength.Enabled = true;
                        }
                    }
                }
            }
        }
    }
예제 #3
0
    protected void UpdateDataEdit()
    {
        #region Load ContainerGroups drop down
        ddlContainerGroups.Items.Clear();
        if (container == null)
        {
            ddlContainerGroups.Items.Add(new ListItem("--> Please choose a group <--", "-1"));
        }
        for (int i = 0; i < SessionState.AppContainersGroups.Count; i++)
        {
            if (SessionState.AppContainersGroups[i].SubGroupCount == 0)
            {
                ddlContainerGroups.Items.Add(new ListItem(SessionState.AppContainersGroups[i].Path + SessionState.AppContainersGroups[i].Name, SessionState.AppContainersGroups[i].Id.ToString()));
            }
        }
        #endregion

        dlDataType.DataSource = SessionState.AppDataTypes;
        dlDataType.DataBind();
        dlContainerType.DataSource = SessionState.AppContainerTypes;
        dlContainerType.DataBind();
        dlLookupField.DataSource = SessionState.AppLookupGroups;
        dlLookupField.DataBind();
        dlInheritanceMethod.DataSource = SessionState.AppInheritanceMethods;
        dlInheritanceMethod.DataBind();
        using (Database dbObj = Utils.GetMainDB())
        {
            ddlSegments.DataSource     = SessionState.AppContainerSegments;
            ddlSegments.DataTextField  = "SegmentName";
            ddlSegments.DataValueField = "SegmentId";
            ddlSegments.DataBind();

            dlLookupField.Items.Insert(0, new ListItem("None", ""));
            if (container != null)
            {
                ddlContainerGroups.SelectedValue = container.GroupId.ToString();
                txtContainerId.Text   = container.Id.ToString();
                txtTag.Text           = container.Tag;
                txtContainerName.Text = container.Name;
                txtDefinition.Text    = container.Definition;
                txtEntryRule.Text     = container.EntryRule;
                txtMaxLength.Value    = container.MaxLength;
                txtSample.Text        = container.Sample;
                cbLabel.Value         = container.Label;
                tbWWXPath.Text        = container.WWXPath;
                if (container.Creator != null)
                {
                    hlCreator.NavigateUrl = "mailto:" + UITools.GetDisplayEmail(container.Creator.Email);
                    hlCreator.Text        = "Created by " + container.Creator.FullName + " on " + SessionState.User.FormatUtcDate(container.CreateDate.Value, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime) + "<br/><br/>";
                    if (container.Modifier != null && container.ModifyDate.HasValue)
                    {
                        hlModifier.NavigateUrl = "mailto:" + UITools.GetDisplayEmail(container.Modifier.Email);
                        hlModifier.Text        = "Modified by " + container.Modifier.FullName + " on " + SessionState.User.FormatUtcDate(container.ModifyDate.Value, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime) + "<br/><br/>";
                    }
                }
                cbPublishable.Checked     = container.Publishable;
                cbRegionalizable.Checked  = container.Regionalizable;
                cbLocalizable.Checked     = container.Localizable;
                cbTranslatable.Checked    = container.Translatable;
                cbReadOnly.Checked        = container.ReadOnly;
                cbKeepIfObsolete.Checked  = container.KeepIfObsolete;
                cbMECD.Checked            = container.Mecd;
                cbMMD.Checked             = container.Mmd;
                cbCDM.Checked             = container.Cdm;
                ddlSegments.SelectedValue = container.SegmentId.ToString();
                txtSort.Value             = container.Sort;
                txtInputMask.Text         = container.InputMask;
                if (container.Lookup != null)
                {
                    dlLookupField.SelectedValue = container.LookupId.ToString();
                }
                using (InputFormContainerList IFCList = InputFormContainer.GetAll("ContainerId = " + containerId.ToString()))
                {
                    if (IFCList != null)
                    {
                        foreach (InputFormContainer ifc in IFCList)
                        {
                            if (ifc.Type != InputFormContainerType.Normal)
                            {
                                dlLookupField.SelectedIndex = 0;
                                dlLookupField.Enabled       = false;
                                break;
                            }
                        }
                    }
                }

                dlDataType.SelectedValue          = container.DataTypeCode.ToString();
                dlContainerType.SelectedValue     = container.ContainerTypeCode.ToString();
                dlInheritanceMethod.SelectedValue = container.InheritanceMethodId.ToString();

                panelId.Visible     = true;
                ViewState["action"] = "update";

                if (SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_DICTIONARY))
                {
                    UITools.ShowToolBarButton(uwToolbar, "Delete");
                    UITools.ShowToolBarSeparator(uwToolbar, "DeleteSep");
                }

                // Update field Enable/Disable
                if (cbReadOnly.Checked)
                {
                    cbTranslatable.Enabled = cbRegionalizable.Enabled = cbLocalizable.Enabled = false;
                }

                // all content
                if (dbObj != null)
                {
                    int r = dbObj.RunSPReturnInteger("dbo._Container_HasNotContent",
                                                     new SqlParameter("@ContainerId", container.Id),
                                                     new SqlParameter("@CultureTypeId", (int)CultureType.Master));
                    if (r < 0)
                    {
                        UITools.HideToolBarButton(uwToolbar, "Delete");
                        UITools.HideToolBarSeparator(uwToolbar, "DeleteSep");

                        txtTag.Enabled              = false;
                        dlContainerType.Enabled     = false;
                        dlInheritanceMethod.Enabled = false;
                        dlDataType.Enabled          = false;
                        txtInputMask.Enabled        = false;

                        if (txtMaxLength.ValueDouble > 0)
                        {
                            txtMaxLength.MinValue = txtMaxLength.ValueDouble;
                        }
                        else
                        {
                            txtMaxLength.Enabled = false;
                        }
                    }

                    // regionalized content
                    r = dbObj.RunSPReturnInteger("dbo._Container_HasNotContent",
                                                 new SqlParameter("@ContainerId", container.Id),
                                                 new SqlParameter("@CultureTypeId", (int)CultureType.Regionale));
                    if (r < 0 && cbRegionalizable.Checked)
                    {
                        cbRegionalizable.Enabled = false;
                    }

                    // localized content (or translated content)
                    r = dbObj.RunSPReturnInteger("dbo._Container_HasNotContent",
                                                 new SqlParameter("@ContainerId", container.Id),
                                                 new SqlParameter("@CultureTypeId", (int)CultureType.Locale));
                    if (r < 0)
                    {
                        if (cbTranslatable.Checked)
                        {
                            cbTranslatable.Enabled = false;
                        }
                        if (cbLocalizable.Checked)
                        {
                            cbLocalizable.Enabled = false;
                        }
                    }
                }
            }
            else
            {
                ViewState["action"] = "create";
                ddlContainerGroups.SelectedIndex = 0;
                dlDataType.SelectedValue         = "T";
                txtMaxLength.Value = 0;
                hlCreator.Text     = "";
                dlLookupField.Items.Insert(0, new ListItem("", ""));
                cbLocalizable.Checked             = false;
                cbRegionalizable.Checked          = false;
                cbPublishable.Checked             = false;
                cbTranslatable.Checked            = true;
                txtSort.Text                      = "0";
                dlContainerType.SelectedValue     = "*";
                dlInheritanceMethod.SelectedValue = "1";
                tbWWXPath.Text                    = string.Empty;
                cbKeepIfObsolete.Checked          = false;
                ddlSegments.SelectedIndex         = 0;
                cbReadOnly.Checked                = false;
                cbMECD.Checked                    = false;
                cbMMD.Checked                     = false;
                cbCDM.Checked                     = false;

                UITools.HideToolBarButton(uwToolbar, "Delete");
                UITools.HideToolBarSeparator(uwToolbar, "DeleteSep");
            }
        }
        //ChiantiUpdate();
    }