Exemplo n.º 1
0
        public override void update()
        {
            CswNbtMetaDataNodeType ReportNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType("Report");

            if (null != ReportNT)
            {
                CswNbtObjClassReport ReportNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId(ReportNT.NodeTypeId, OnAfterMakeNode : delegate(CswNbtNode newNode)
                {
                    CswNbtObjClassReport report = newNode;
                    report.ReportName.Text      = "Custom Text Barcode";
                    report.Category.Text        = "System Reports";
                    report.SQL.Text             = "select UPPER('{text}') as text from dual";

                    CswNbtMetaDataObjectClass ReportGroupOC     = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.ReportGroupClass);
                    CswNbtObjClassReportGroup SystemReportGroup = ReportGroupOC.getNodes(forceReInit: false, includeSystemNodes: true)
                                                                  .FirstOrDefault(ReportGroup => ((CswNbtObjClassReportGroup)ReportGroup).Name.Text == "System Reports");
                    if (null != SystemReportGroup)
                    {
                        report.ReportGroup.RelatedNodeId = SystemReportGroup.NodeId;
                    }
                });

                // upload .RPT
                string        Filename   = "customtextbarcode.rpt";
                CswPropIdAttr PropId     = new CswPropIdAttr(ReportNode.Node, ReportNode.RPTFile.NodeTypeProp);
                string        Filepath   = CswFilePath.getConfigurationFilePath(CswEnumSetupMode.NbtExe) + "\\" + Filename;
                byte[]        ReportFile = File.ReadAllBytes(Filepath);

                const string     ContentType = "application/octet-stream";
                string           Href;
                CswNbtSdBlobData SdBlobData = _CswNbtSchemaModTrnsctn.CswNbtSdBlobData;
                SdBlobData.saveFile(PropId.ToString(), ReportFile, ContentType, Filename, out Href);
            } // if( null != ReportNT )
        }     // update()
        private void _uploadBlobData( CswNbtObjClassReport ReportNode, string Filename )
        {
            CswPropIdAttr PropId = new CswPropIdAttr( ReportNode.Node, ReportNode.RPTFile.NodeTypeProp );
            string Filepath = CswFilePath.getConfigurationFilePath( CswEnumSetupMode.NbtExe ) + "\\" + Filename;
            byte[] ReportFile = File.ReadAllBytes( Filepath );
            const string ContentType = "application/octet-stream";
            string Href;

            CswNbtSdBlobData SdBlobData = _CswNbtSchemaModTrnsctn.CswNbtSdBlobData;
            SdBlobData.saveFile( PropId.ToString(), ReportFile, ContentType, Filename, out Href );

        }
Exemplo n.º 3
0
            public JObject ToJson()
            {
                JObject ThisProp = new JObject();
                if( null != PropId )
                {
                    ThisProp["propid"] = PropId.ToString();
                }

                ThisProp["propname"] = PropName;
                ThisProp["gestalt"] = Gestalt;
                ThisProp["fieldtype"] = FieldType;
                ThisProp["propData"] = PropData;

                if( null != Source )
                {
                    ThisProp["source"] = Source.ToString();
                }

                return ThisProp;
            } // ToJson()
        } // update()

        private void _moveBlobData( CswNbtNodePropWrapper PropWrapper, CswNbtNode Node )
        {
            if( Int32.MinValue != PropWrapper.JctNodePropId )
            {
                CswNbtSdBlobData SdBlobData = _CswNbtSchemaModTrnsctn.CswNbtSdBlobData;

                CswPropIdAttr PropId = new CswPropIdAttr( Node.NodeId, PropWrapper.NodeTypePropId );
                byte[] BlobData = new byte[0];
                string ContentType = string.Empty;
                string FileName = string.Empty;

                CswTableSelect JctTS = _CswNbtSchemaModTrnsctn.makeCswTableSelect( "getBlobData", "jct_nodes_props" );
                {
                    DataTable JctDT = JctTS.getTable( "jctnodepropid", PropWrapper.JctNodePropId );
                    foreach( DataRow Row in JctDT.Rows ) //should only be one
                    {
                        if( _CswNbtSchemaModTrnsctn.isColumnDefined( "jct_nodes_props", "blobdata" ) )
                        {
                            BlobData = Row["blobdata"] as byte[];
                        }
                        else
                        {
                            BlobData = new byte[0];
                        }
                        FileName = Row["field1"].ToString();
                        ContentType = Row["field2"].ToString();
                    }

                    if( null != BlobData )
                    {
                        string Href;
                        SdBlobData.saveFile( PropId.ToString(), BlobData, ContentType, FileName, out Href );
                    }
                }
            }
        }
        }//afterPopulateProps()

        /// <summary>
        ///
        /// </summary>
        public override bool onPropertySetButtonClick(NbtButtonData ButtonData)
        {
            if (null != ButtonData.NodeTypeProp)
            {
                //Remember: Save is an OCP too
                switch (ButtonData.NodeTypeProp.getObjectClassPropName())
                {
                case PropertyName.Fulfill:
                    switch (ButtonData.SelectedText)
                    {
                    case FulfillMenu.Order:
                        ButtonData.Action         = CswEnumNbtButtonAction.editprop;
                        ButtonData.Data["nodeid"] = NodeId.ToString();
                        CswPropIdAttr OrdIdAttr = new CswPropIdAttr(Node, ExternalOrderNumber.NodeTypeProp);
                        ButtonData.Data["propidattr"] = OrdIdAttr.ToString();
                        ButtonData.Data["title"]      = "Enter the External Order Number";
                        break;

                    case FulfillMenu.Receive:
                        CswNbtPropertySetMaterial NodeAsMaterial = _CswNbtResources.Nodes.GetNode(Material.RelatedNodeId);
                        if (null != NodeAsMaterial)
                        {
                            if (null != NodeAsMaterial.Receive.NodeTypeProp)
                            {
                                NbtButtonData ReceiveData = new NbtButtonData(NodeAsMaterial.Receive.NodeTypeProp);
                                NodeAsMaterial.triggerOnButtonClick(ReceiveData);
                                ButtonData.clone(ReceiveData);
                                if (_CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.SDS))
                                {
                                    CswNbtMetaDataObjectClass SDSDocOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.SDSDocumentClass);
                                    Int32 SDSNodeTypeId = SDSDocOC.FirstNodeType.NodeTypeId;
                                    if (Int32.MinValue != SDSNodeTypeId)
                                    {
                                        ButtonData.Data["documenttypeid"] = SDSNodeTypeId;
                                    }
                                }
                            }
                        }
                        break;

                    case FulfillMenu.Dispense:
                        JObject InitialQuantity = null;
                        if (false == Quantity.Empty)
                        {
                            InitialQuantity = new JObject();
                            Quantity.ToJSON(InitialQuantity);
                        }
                        if (null != InitialQuantity)
                        {
                            ButtonData.Data["initialQuantity"] = InitialQuantity;
                        }
                        string Title = "Fulfill Request for " + Quantity.Gestalt + " of " + Material.Gestalt;
                        if (TotalDispensed.Quantity > 0)
                        {
                            Title += " (" + TotalDispensed.Gestalt + ") dispensed.";
                        }
                        ButtonData.Data["title"] = Title;
                        ButtonData.Action        = CswEnumNbtButtonAction.dispense;
                        break;

                    case FulfillMenu.Move:
                        ButtonData.Data["title"]    = "Fulfill Request for " + Count.Value + " x " + Size.Gestalt + " of " + Material.Gestalt;
                        ButtonData.Data["sizeid"]   = Size.RelatedNodeId.ToString();
                        ButtonData.Data["location"] = Location.Gestalt;
                        ButtonData.Action           = CswEnumNbtButtonAction.move;
                        break;
                    }     //switch( ButtonData.SelectedText )

                    _getNextStatus(ButtonData.SelectedText);
                    ButtonData.Data["requestitem"] = ButtonData.Data["requestitem"] ?? new JObject();
                    ButtonData.Data["requestitem"]["requestMode"]      = Type.Value.ToLower();
                    ButtonData.Data["requestitem"]["requestitemid"]    = NodeId.ToString();
                    ButtonData.Data["requestitem"]["inventorygroupid"] = (InventoryGroup.RelatedNodeId ?? new CswPrimaryKey()).ToString();
                    ButtonData.Data["requestitem"]["materialid"]       = (Material.RelatedNodeId ?? new CswPrimaryKey()).ToString();
                    ButtonData.Data["requestitem"]["locationid"]       = (Location.SelectedNodeId ?? new CswPrimaryKey()).ToString();
                    break;     //case PropertyName.Fulfill:
                }
            }
            return(true);
        }
Exemplo n.º 6
0
        public static void wAddAuthenticationStatus(CswNbtResources CswNbtResources, CswSessionResourcesNbt CswSessionResources, CswWebSvcReturn SvcReturn, CswEnumAuthenticationStatus AuthenticationStatusIn, HttpContext HttpContext)
        {
            // ******************************************
            // IT IS VERY IMPORTANT for this function not to require the use of database resources,
            // since it occurs AFTER the call to _deInitResources(), and thus will leak Oracle connections
            // (see case 26273)
            // ******************************************
            if (null != SvcReturn)
            {
                SvcReturn.Authentication = SvcReturn.Authentication ?? new CswWebSvcSessionAuthenticateData.Authentication.Response();
                SvcReturn.Authentication.AuthenticationStatus = AuthenticationStatusIn;
                if (null != CswNbtResources)
                {
                    if (null != CswNbtResources.CswSessionManager)
                    {
                        SvcReturn.Authentication.TimeOut = CswDateTime.ToClientAsJavascriptString(CswNbtResources.CswSessionManager.TimeoutDate);
                    }
                    if (SvcReturn.Authentication.AuthenticationStatus == CswEnumAuthenticationStatus.ExpiredPassword)
                    {
                        SvcReturn.Authentication.ExpirationReset = new CswWebSvcSessionAuthenticateData.Authentication.Response.Expired();

                        ICswNbtUser CurrentUser = CswNbtResources.CurrentNbtUser;
                        SvcReturn.Authentication.ExpirationReset.UserId = CurrentUser.UserId.ToString();
                        CswNbtNodeKey FakeKey = new CswNbtNodeKey()
                        {
                            NodeId        = CurrentUser.UserId,
                            NodeSpecies   = CswEnumNbtNodeSpecies.Plain,
                            NodeTypeId    = CurrentUser.UserNodeTypeId,
                            ObjectClassId = CurrentUser.UserObjectClassId
                        };
                        SvcReturn.Authentication.ExpirationReset.UserKey = FakeKey.ToString();
                        CswPropIdAttr PasswordPropIdAttr = new CswPropIdAttr(CurrentUser.UserId, CurrentUser.PasswordPropertyId);
                        SvcReturn.Authentication.ExpirationReset.PasswordId = PasswordPropIdAttr.ToString();
                    }

                    SvcReturn.Performance               = SvcReturn.Performance ?? new CswWebSvcReturnBase.Performance();
                    SvcReturn.Performance.ServerInit    = Math.Round(CswNbtResources.ServerInitTime, 3);
                    SvcReturn.Performance.DbDeinit      = Math.Round(CswNbtResources.CswLogger.DbInitTime, 3);
                    SvcReturn.Performance.DbQuery       = Math.Round(CswNbtResources.CswLogger.DbQueryTime, 3);
                    SvcReturn.Performance.DbCommit      = Math.Round(CswNbtResources.CswLogger.DbCommitTime, 3);
                    SvcReturn.Performance.DbDeinit      = Math.Round(CswNbtResources.CswLogger.DbDeInitTime, 3);
                    SvcReturn.Performance.TreeLoaderSql = Math.Round(CswNbtResources.CswLogger.TreeLoaderSQLTime, 3);
                    SvcReturn.Performance.ServerTotal   = Math.Round(CswNbtResources.TotalServerTime, 3);

                    SvcReturn.Logging            = SvcReturn.Logging ?? new CswWebSvcReturnBase.Logging();
                    SvcReturn.Logging.CustomerId = CswNbtResources.AccessId;
                    SvcReturn.Logging.Server     = Environment.MachineName;
                    CswEnumLogLevels LogLevel = CswNbtResources.ConfigVbls.getConfigVariableValue(CswEnumConfigurationVariableNames.Logging_Level);

                    if (LogLevel == CswNbtResources.UnknownEnum)
                    {
                        LogLevel = CswEnumLogLevels.Error;
                    }
                    SvcReturn.Logging.LogLevel = LogLevel;

                    // Return any messages acquired along the way
                    if (null != CswNbtResources.Messages && CswNbtResources.Messages.Count > 0)
                    {
                        SvcReturn.Status.Messages = CswNbtResources.Messages;
                    }
                }
            }
            HttpCookie AuthStatusCookie = HttpContext.Request.Cookies["CswAuthStatus"];

            if (null == AuthStatusCookie)
            {
                AuthStatusCookie = new HttpCookie("CswAuthStatus")
                {
                    HttpOnly = true
                };
            }
            if (AuthStatusCookie.Value != AuthenticationStatusIn.ToString())
            {
                AuthStatusCookie.Value = AuthenticationStatusIn;
                HttpContext.Response.Cookies.Add(AuthStatusCookie);
            }
        } // wAddAuthenticationStatus()
Exemplo n.º 7
0
        public static void jAddAuthenticationStatus(CswNbtResources CswNbtResources, CswSessionResourcesNbt CswSessionResources, JObject SvcReturn, CswEnumAuthenticationStatus AuthenticationStatusIn, bool IsMobile = false)
        {
            if (SvcReturn != null)
            {
                SvcReturn["AuthenticationStatus"]     = AuthenticationStatusIn.ToString();
                SvcReturn["AuthenticationStatusText"] = CswEnumAuthenticationStatus.EuphamizedText[AuthenticationStatusIn];
                if (false == IsMobile)
                {
                    SvcReturn["server"] = Environment.MachineName;
                    if (null != CswNbtResources)
                    {
                        if (null != CswNbtResources.CswSessionManager)
                        {
                            SvcReturn["timeout"] = CswDateTime.ToClientAsJavascriptString(CswNbtResources.CswSessionManager.TimeoutDate);
                        }
                        if (AuthenticationStatusIn == CswEnumAuthenticationStatus.ExpiredPassword)
                        {
                            ICswNbtUser CurrentUser = CswNbtResources.CurrentNbtUser;
                            SvcReturn.Add(new JProperty("nodeid", CurrentUser.UserId.ToString()));
                            CswNbtNodeKey FakeKey = new CswNbtNodeKey()
                            {
                                NodeId        = CurrentUser.UserId,
                                NodeSpecies   = CswEnumNbtNodeSpecies.Plain,
                                NodeTypeId    = CurrentUser.UserNodeTypeId,
                                ObjectClassId = CurrentUser.UserObjectClassId
                            };
                            SvcReturn.Add(new JProperty("nodekey", FakeKey.ToString()));
                            CswPropIdAttr PasswordPropIdAttr = new CswPropIdAttr(CurrentUser.UserId, CurrentUser.PasswordPropertyId);
                            SvcReturn.Add(new JProperty("passwordpropid", PasswordPropIdAttr.ToString()));
                        }

                        SvcReturn["timer"] = new JObject();

                        SvcReturn["timer"]["serverinit"] = Math.Round(CswNbtResources.ServerInitTime, 3);
                        CswEnumLogLevels LogLevel = CswNbtResources.ConfigVbls.getConfigVariableValue(CswEnumConfigurationVariableNames.Logging_Level);
                        if (LogLevel == CswNbtResources.UnknownEnum)
                        {
                            LogLevel = CswEnumLogLevels.Error;
                        }
                        SvcReturn["LogLevel"] = LogLevel.ToString().ToLower();

                        SvcReturn["timer"]["customerid"]    = CswNbtResources.AccessId;
                        SvcReturn["timer"]["dbinit"]        = Math.Round(CswNbtResources.CswLogger.DbInitTime, 3);
                        SvcReturn["timer"]["dbquery"]       = Math.Round(CswNbtResources.CswLogger.DbQueryTime, 3);
                        SvcReturn["timer"]["dbcommit"]      = Math.Round(CswNbtResources.CswLogger.DbCommitTime, 3);
                        SvcReturn["timer"]["dbdeinit"]      = Math.Round(CswNbtResources.CswLogger.DbDeInitTime, 3);
                        SvcReturn["timer"]["treeloadersql"] = Math.Round(CswNbtResources.CswLogger.TreeLoaderSQLTime, 3);
                        SvcReturn["timer"]["servertotal"]   = Math.Round(CswNbtResources.TotalServerTime, 3);

                        // Return any messages acquired along the way
                        if (null != CswNbtResources.Messages && CswNbtResources.Messages.Count > 0)
                        {
                            JArray Messages = new JArray();
                            SvcReturn["messages"] = Messages;
                            foreach (CswWebSvcReturnBase.ErrorMessage Message in CswNbtResources.Messages)
                            {
                                Messages.Add(Message.ToJObject());
                            }
                        }
                    }//if( null != CswNbtResources )
                }
            }
        }