示例#1
0
        /// <summary>
        /// Get the Add Layout Properties for the given RequestItem
        /// </summary>
        public JObject getRequestItemAddProps(CswNbtNode RequestItemNode)
        {
            CswEnumNbtNodeEditMode PrevMode = _CswNbtResources.EditMode;

            _CswNbtResources.EditMode = CswEnumNbtNodeEditMode.Add;

            CswNbtSdTabsAndProps PropsAction = new CswNbtSdTabsAndProps(_CswNbtResources);
            JObject Ret = PropsAction.getProps(RequestItemNode, "", null, CswEnumNbtLayoutType.Add);

            _CswNbtResources.EditMode = PrevMode;
            return(Ret);
        }
示例#2
0
        /// <summary>
        /// Get the Add Layout properties for a container
        /// </summary>
        public JObject getContainerAddProps(CswNbtObjClassContainer Container)
        {
            JObject Ret = new JObject();
            CswEnumNbtNodeEditMode PrevEditMode = _CswNbtResources.EditMode;

            _CswNbtResources.EditMode = CswEnumNbtNodeEditMode.Add;
            if (null != Container)
            {
                Ret = _CswNbtSdTabsAndProps.getProps(Container.Node, "", null, CswEnumNbtLayoutType.Add);
            }
            _CswNbtResources.EditMode = PrevEditMode;
            return(Ret);
        }
示例#3
0
        /// <summary>
        /// After the Object Class Button Click Event is triggered, determine whether any properties were part of the request. If so, return the updated properties for the provided tabs, if any.
        /// </summary>
        private void _onAfterButtonClickSaveProps(string TabId, NbtButtonData ButtonData)
        {
            Int32   TabIdAsInt  = CswConvert.ToInt32(TabId);
            JObject SelectedTab = null;

            if (null != ButtonData.PropsToSave && ButtonData.PropsToSave.HasValues)
            {
                SelectedTab = CswConvert.ToJObject(ButtonData.PropsToSave[TabId]);
            }
            if (TabIdAsInt > 0 || (null != SelectedTab && SelectedTab.HasValues))
            {
                CswNbtSdTabsAndProps Sd = new CswNbtSdTabsAndProps(_CswNbtResources);
                ButtonData.PropsToReturn = Sd.getProps(NodeId.ToString(), null, TabId, NodeTypeId, null, null, ForceReadOnly: false);
            }
        }
        private JObject _tryCreateTempMaterial(Int32 MaterialNodeTypeId, CswPrimaryKey SupplierId, string TradeName, string PartNo, string NodeId, bool IsConstituent)
        {
            JObject Ret = new JObject();

            NewMaterial PotentialMaterial = new NewMaterial(_CswNbtResources, MaterialNodeTypeId, TradeName, SupplierId, IsConstituent, PartNo, NodeId);

            bool MaterialExists = PotentialMaterial.existsInDb();

            Ret["materialexists"] = MaterialExists;
            if (false == MaterialExists)
            {
                CswNbtPropertySetMaterial NodeAsMaterial = PotentialMaterial.Node;
                if (null == NodeAsMaterial)
                {
                    NodeAsMaterial = PotentialMaterial.commit();
                }
                if (null != NodeAsMaterial)
                {
                    Ret["materialid"] = NodeAsMaterial.NodeId.ToString();
                    Ret["tradename"]  = NodeAsMaterial.TradeName.Text;
                    Ret["partno"]     = NodeAsMaterial.PartNumber.Text;
                    Ret["supplier"]   = false == IsConstituent ? NodeAsMaterial.Supplier.CachedNodeName : "";
                    Ret["supplierid"] = false == IsConstituent?SupplierId.ToString() : "";

                    Ret["nodetypeid"] = NodeAsMaterial.NodeTypeId;
                    NodeAsMaterial.Save.setHidden(value: true, SaveToDb: true);
                    CswNbtSdTabsAndProps SdProps = new CswNbtSdTabsAndProps(_CswNbtResources);
                    Ret["properties"] = SdProps.getProps(NodeAsMaterial.Node, string.Empty, null, CswEnumNbtLayoutType.Add);
                    if (_CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.SDS))
                    {
                        CswNbtMetaDataObjectClass SDSDocOC    = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.SDSDocumentClass);
                        CswNbtMetaDataNodeType    SDSNodeType = SDSDocOC.FirstNodeType;
                        if (null != SDSNodeType)
                        {
                            Ret["documenttypeid"] = SDSNodeType.NodeTypeId;
                        }
                    }
                    Ret["noderef"] = NodeAsMaterial.Node.NodeLink; //for the link
                }
            }
            else
            {
                CswNbtPropertySetMaterial ExisitingMaterial = PotentialMaterial.existingMaterial();
                Ret["noderef"] = ExisitingMaterial.Node.NodeLink;
            }

            return(Ret);
        }
示例#5
0
        } // getTabs()

        /// <summary>
        /// Returns JObject for all properties in a given tab
        /// </summary>
        public JObject getProps(string NodeId, string NodeKey, string TabId, Int32 NodeTypeId, string filterToPropId, string RelatedNodeId, bool ForceReadOnly, CswDateTime Date = null)
        {
            return(_TabsPropsSd.getProps(NodeId, NodeKey, TabId, NodeTypeId, filterToPropId, RelatedNodeId, ForceReadOnly, Date));
        } // getProps()