Beispiel #1
0
        public static void AddPageElement(XmlElement statusElement, IfsProperties ifsProperties, OracleConnection connection)
        {
            XmlElement pageElement = statusElement.OwnerDocument.CreateElement("PAGE");

            statusElement.AppendChild(pageElement);

            string message = getPageMessage(ifsProperties.Username, connection);

            if (null != message)
            {
                pageElement.AppendChild(statusElement.OwnerDocument.CreateTextNode(message));
            }
        }
Beispiel #2
0
        public static XmlDocument Menu(OracleConnection connection, string methodName, XmlNode apiNode, IfsProperties ifsProperties)
        {
            XmlDocument result;

            switch (methodName)
            {
            case "Get_Menu":
            case "Get_Dynamic_Menu":
                result = GetMenu(connection, apiNode, ifsProperties);
                break;

            default:
                throw new Exception(string.Format("{0}:  Unknown method: {1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name, methodName));
            }

            return(result);
        }
Beispiel #3
0
        private static XmlDocument GetMenu(OracleConnection connection, XmlNode apiNode, IfsProperties ifsProperties)
        {
            XmlNodeList parameters = apiNode.ChildNodes;

            XmlNode menuDoc  = null;
            string  menuName = ifsProperties.DefaultMenu;

            for (int i = 0; (i < parameters.Count); i += 1)
            {
                for (int j = 0; (j < parameters[i].Attributes.Count); j += 1)
                {
                    XmlAttribute attribute = parameters[i].Attributes[j];
                    switch (attribute.Value)
                    {
                    case "menu_doc_":
                        menuDoc = parameters[i];
                        break;

                    case "menu_name_":
                        menuName = ((XmlText)parameters[i].FirstChild).Value;
                        ifsProperties.CurrentMenu = menuName;
                        break;
                    }
                }
            }



            OracleQueryBuilder menuQuery = new OracleQueryBuilder(ifsProperties.AppOwner);

            // menuQuery.AddSelect("PROMPT", "", "", "", "");
            menuQuery.AddFrom("ESI_SW_MENU_SYSTEM");
            menuQuery.AddSelect("PROMPT", "", "", "", "");
            menuQuery.AddSelect("TRANSACTION", "", "", "", "");
            //           menuQuery.AddSelect("API", "", "", "", "");
            menuQuery.AddSelect("SUBMENU", "", "", "", "");
            menuQuery.AddSelect("ICON", "", "", "", "");
            //          menuQuery.AddFrom("ESI_SW_MENU_SYSTEM");
            menuQuery.AddWhere("CONTRACT", ifsProperties.DefaultContract, "=", "", false, "");
            menuQuery.AddWhere("MENU_NAME", menuName, "=", "", false, "");
            menuQuery.AddOrder("RANK", "", "");

/*
 *          using (OracleCommand cmd = connection.CreateCommand())
 *          {
 *              cmd.CommandText = "select prompt, transaction_name, submenu, icon from esi_scanworks_menus_tab where menu_name = :menuName order by rank";
 *              cmd.6t0.Add("menuName", OracleType.VarChar).Value = menuName;
 */

            bool noEscapeItem = true;

            using (OracleDataReader reader = menuQuery.Execute(connection))
            {
                IfsMenuItem.MenuItemRecord menuItemRecord = new IfsMenuItem.MenuItemRecord();

                while (reader.Read())
                {
                    menuItemRecord.Prompt          = reader.GetString(0);
                    menuItemRecord.TransactionName = reader.GetString(1);
                    menuItemRecord.Api             = reader.GetString(1);
                    menuItemRecord.SubMenu         = reader.GetString(2);
                    menuItemRecord.Icon            = reader.GetOracleLob(3);

                    XmlElement menuItem = IfsMenuItem.BuildElement(menuItemRecord, apiNode.OwnerDocument, connection);

                    menuDoc.AppendChild(menuItem);

                    if (menuItemRecord.TransactionName.Equals("LOGOFF") || menuItemRecord.TransactionName.Equals("RETURN"))
                    {
                        noEscapeItem = false;
                    }
                }
            }

            if (noEscapeItem)
            {
                OracleQueryBuilder iconQuery = new OracleQueryBuilder(ifsProperties.AppOwner);

                // menuQuery.AddSelect("PROMPT", "", "", "", "");
                iconQuery.AddFrom("ESI_SW_ICONS");
                iconQuery.AddSelect("ICON_FILE", "", "", "", "");
                iconQuery.AddWhere("ICON", "ShutDown", "=", "", false, "");

                using (OracleDataReader reader = iconQuery.Execute(connection))
                {
                    IfsMenuItem.MenuItemRecord menuItemRecord = new IfsMenuItem.MenuItemRecord();

                    while (reader.Read())
                    {
                        menuItemRecord.Prompt          = "Logoff";
                        menuItemRecord.TransactionName = "LOGOFF";
                        menuItemRecord.Api             = "LOGOFF";
                        menuItemRecord.SubMenu         = "*";
                        menuItemRecord.Icon            = reader.GetOracleLob(0);

                        XmlElement menuItem = IfsMenuItem.BuildElement(menuItemRecord, apiNode.OwnerDocument, connection);

                        menuDoc.AppendChild(menuItem);
                    }
                }

/*
 *                  iconQuery = new OracleQueryBuilder(ifsProperties.AppOwner);
 *
 *                  iconQuery.AddFrom("ESI_SW_ICONS");
 *                  iconQuery.AddSelect("ICON", "", "", "", "");
 *                  iconQuery.AddWhere("ICON_NAME", "ShutDown", "=", "", false, "");
 *
 *                  using (OracleDataReader reader = menuQuery.Execute(connection))
 *                  {
 *                      IfsMenuItem.MenuItemRecord menuItemRecord = new IfsMenuItem.MenuItemRecord();
 *
 *                      while (reader.Read())
 *                      {
 *
 *                          menuItemRecord.Prompt = "Logoff";
 *                          menuItemRecord.TransactionName = "LOGOFF";
 *                          menuItemRecord.Api = "Logoff";
 *                          menuItemRecord.SubMenu = "";
 *                          menuItemRecord.Icon = reader.GetOracleLob(3);
 *
 *                          XmlElement menuItem = IfsMenuItem.BuildElement(menuItemRecord, apiNode.OwnerDocument, connection);
 *
 *                          menuDoc.AppendChild(menuItem);
 *
 *                      }
 *                  }*/
            }
            //  }
            return(apiNode.OwnerDocument);
        }
 public void LoadFields(OracleConnection connection, IfsProperties ifsProperties)
 {
     Failed = false;
     Fields = new IfsFields(connection, this.Id, ifsProperties);
 }
        //Constructor to create an initializer based on IFS transaction field values in the database and then sets
        //the transaction fields to these values
        public IfsTransactions(OracleConnection connection, IfsProperties ifsProperties)
        {
            Initalizer   = new Dictionary <string, Transaction>();
            Transactions = new Dictionary <string, Transaction>();

            //Build a query to get transaction fields
            OracleQueryBuilder TransactionsQuery = new OracleQueryBuilder(ifsProperties.AppOwner);

            //Add Table to Select From
            TransactionsQuery.AddFrom("ESI_SW_TRANSACTIONS");

            //Add Fields to Select
            TransactionsQuery.AddSelect("TRANSACTION", "", "", "ESI_SW_TRANSACTIONS", ""); //0
            TransactionsQuery.AddSelect("TITLE", "", "", "ESI_SW_TRANSACTIONS", "");       //1
            TransactionsQuery.AddSelect("DESCRIPTION", "", "", "ESI_SW_TRANSACTIONS", ""); //2
            TransactionsQuery.AddSelect("PACKAGE", "", "", "ESI_SW_TRANSACTIONS", "");     //3
            TransactionsQuery.AddSelect("API", "", "", "ESI_SW_TRANSACTIONS", "");         //4
            TransactionsQuery.AddSelect("VERSION", "", "", "ESI_SW_TRANSACTIONS", "");     //5

            //Execute the query
            using (OracleDataReader results = TransactionsQuery.Execute(connection))
            {
                while (results.Read())
                {
                    if (!results.IsDBNull(0))
                    {
                        TransactionCount++;

                        //Create a field to store the values for each row
                        Transaction transaction = new Transaction();

                        //Set the field hierarchy to the value from the hierarchy
                        //                   field.Hierarchy = Hierarchy.IndexOf(results.GetString(0));

                        //Add row values to the field

                        transaction.Id          = results.GetString(0) ?? "";
                        transaction.Title       = results.GetString(1) ?? "";
                        transaction.Description = results.GetString(2) ?? "";
                        transaction.Package     = results.GetString(3) ?? "";
                        transaction.Api         = results.GetString(4) ?? "";
                        transaction.Version     = results.GetString(5) ?? "";
                        transaction.Licensed    = false;

                        //Add each field to the initializer
                        Initalizer.Add(transaction.Id, transaction);
                    }
                }
            }

            /*     //Add System Transactions
             *   Initalizer.Add("esi_scanworks_settings", AddSystemTransaction("esi_scanworks_settings"));
             *   Initalizer.Add("esi_scanworks_logon", AddSystemTransaction("esi_scanworks_logon"));
             *   Initalizer.Add("esi_scanworks_menu", AddSystemTransaction("esi_scanworks_menu"));
             *   Initalizer.Add("esi_scanworks_lov", AddSystemTransaction("esi_scanworks_lov"));
             *   Initalizer.Add("esi_scanworks_interface", AddSystemTransaction("esi_scanworks_interface"));
             *   Initalizer.Add("esi_scanworks_dialog_message", AddSystemTransaction("esi_scanworks_dialog_message"));
             */
            //Initalize the transaction fields to the intializer values
            Transactions = InitializeTransactions(Initalizer);
        }
Beispiel #6
0
        //Constructor to create an initializer based on IFS transaction field values in the database and then sets
        //the transaction fields to these values
        public IfsFields(OracleConnection connection, string transaction, IfsProperties ifsProperties)
        {
            Hierarchy  = new List <string>();
            Initalizer = new Dictionary <string, IfsField>();
            Fields     = new Dictionary <string, IfsField>();

            //Build a query to get transaction fields
            OracleQueryBuilder fieldsQuery = new OracleQueryBuilder(ifsProperties.AppOwner);

            //Add Table to Select From
            fieldsQuery.AddFrom("ESI_SW_TRANSACTION_SYSTEM");

            //Add Fields to Select
            fieldsQuery.AddSelect("FIELD_ID", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");      //0
            fieldsQuery.AddSelect("PROMPT", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");        //1
            fieldsQuery.AddSelect("FIELD_NAME", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");    //2
            fieldsQuery.AddSelect("DEFAULT_VALUE", "", "", "ESI_SW_TRANSACTION_SYSTEM", ""); //3
            fieldsQuery.AddSelect("MAX_LENGTH", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");    //4
            fieldsQuery.AddSelect("READ_ONLY", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");     //5
            fieldsQuery.AddSelect("UPPERCASE", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");     //6
            fieldsQuery.AddSelect("HAS_UOM", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");       //7
            fieldsQuery.AddSelect("LOV", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");           //8
            fieldsQuery.AddSelect("LOV_PROMPT", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");    //9
            fieldsQuery.AddSelect("LOV_ON_ENTRY", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");  //10
            fieldsQuery.AddSelect("LOV_READ_ONLY", "", "", "ESI_SW_TRANSACTION_SYSTEM", ""); //11
            fieldsQuery.AddSelect("CONFIGURABLE", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");  //12
            fieldsQuery.AddSelect("LOOKUP_TABLE", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");  //13
            fieldsQuery.AddSelect("ENABLED", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");       //14
            fieldsQuery.AddSelect("TRANSACTION", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");   //15
            fieldsQuery.AddSelect("TITLE", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");         //16
            fieldsQuery.AddSelect("API", "", "", "ESI_SW_TRANSACTION_SYSTEM", "");           //17

            //Add Query Criteria
            fieldsQuery.AddWhere("TRANSACTION", transaction, "=", "ESI_SW_TRANSACTION_SYSTEM", false, "");

            //Add Query Sorting
            fieldsQuery.AddOrder("HIERARCHY", "ESI_SW_TRANSACTION_SYSTEM", "");

            //Execute the query
            OracleDataReader results = fieldsQuery.Execute(connection);

            while (results.Read())
            {
                if (!results.IsDBNull(0))
                {
                    FieldCount++;

                    //Add each row to the Hierarchy in order
                    Hierarchy.Add(results.GetString(0));

                    //Create a field to store the values for each row
                    IfsField field = new IfsField();

                    //Set the field hierarchy to the value from the hierarchy
                    //                   field.Hierarchy = Hierarchy.IndexOf(results.GetString(0));

                    //Add row values to the field
                    field.Hierarchy        = FieldCount;
                    field.FieldID          = GetSafeDBString(results, 0) ?? "";
                    field.Prompt           = GetSafeDBString(results, 1) ?? "";
                    field.FieldName        = GetSafeDBString(results, 2) ?? "";
                    field.DefaultValue     = GetSafeDBString(results, 3) ?? "";
                    field.MaxLength        = GetSafeDBString(results, 4) ?? "-1";
                    field.ReadOnly         = results.GetString(5) == "Y" ? true : false;
                    field.Uppercase        = results.GetString(6) == "Y" ? true : false;
                    field.HasUom           = results.GetString(7) == "Y" ? true : false;
                    field.Lov              = GetSafeDBString(results, 8) ?? "";
                    field.LovPrompt        = GetSafeDBString(results, 9) ?? "";
                    field.LovOnEntry       = results.GetString(10) == "Y" ? true : false;
                    field.LovReadOnly      = results.GetString(11) == "Y" ? true : false;
                    field.Configurable     = results.GetString(12) == "Y" ? true : false;
                    field.Table            = GetSafeDBString(results, 13) ?? "";
                    field.Enabled          = results.GetString(14) == "Y" ? true : false;
                    field.Transaction      = GetSafeDBString(results, 15) ?? "";
                    field.TransactionTitle = GetSafeDBString(results, 16) ?? "";
                    field.API              = GetSafeDBString(results, 17) ?? "";
                    field.Value            = "";

                    //Add each field to the initializer
                    Initalizer.Add(field.FieldID, field);
                }
            }

            //Initalize the transaction fields to the intializer values
            Fields = InitializeFields(Initalizer);
        }