Oracle and SQL BO for a single Windows GUI


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Ross,



I've been following this thread and at this point, I'd suggest you create a sample that reproduces what you are seeing. I would try to reduce the problem to its simplest form. I.e. don't just post a sample with your complete base class, but rather see how simple you could make it and still get the same behaviour. Often when I do this, I end up figuring out the issue myself and I always learn a lot and I don't figure it out, anyone who is helping usually figures the problem out right away. Ends up saving a lot of time.



Just a suggestion that might help you move forward sooner!



Not sure were you are, but here in the US, tomorrow is Thanksgiving, so may of US folks will be doing that tomorrow and Friday. Hope you have a nice weekend! Wink
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
I am already doing this. Just need to know about why the FillDataTable is not firing off.
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Ross.

Your BrowseDialog probably thinks that it should be querying an SQLServer database. I think that if you are going to be exchanging databases, you might need to build a way to determine the datasource in the SetDataSources of your Program.cs.

Ensure that your datasources are setup to use an OracleDataSourceItem.

Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
Please respond to me prior post as soon as possible. Thanks in advance. 
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
If you handle the filldatatable, it should catch everything. Is this not what you are experiencing? The BaseBO for FillDataTable is not firing off. Here is my code:

The base bo is called : TrustedVALETBaseBO and inherits from MicroFour.StrataFrame.Business.BusinessLayer

using MicroFour.StrataFrame.Business;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Runtime.Serialization;
using System.Text;
using System.Data.Common;
using System.Data.OleDb;
using System.Text.RegularExpressions;
using System.Data.OracleClient;

namespace TrustedVALET_BO
{
    [Serializable()]
    public partial class TrustedVALETBaseBO : MicroFour.StrataFrame.Business.BusinessLayer
    {
        public enum DatabaseType : int
        {
            SQLServer = 0,
            Oracle = 1
        }

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the BusinessObject1 class.
        /// </summary>
        public TrustedVALETBaseBO()
            : base()
        {
            InitializeComponent();
        }


        /// <summary>
        /// Initializes a new instance of the BusinessObject1 class.
        /// </summary>
        /// <param name="container">The IContainer to which this business object will be added.</param>
        public TrustedVALETBaseBO(IContainer container)
            : base()
        {
            container.Add(this);

            InitializeComponent();
        }

        /// <summary>
        /// Initializes a new instance of the BusinessObject1 class.
        /// </summary>
        /// <param name="info">The SerializationInfo for the object to create.</param>
        /// <param name="context">The StreamingContext for the source stream.</param>
        protected TrustedVALETBaseBO(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            InitializeComponent();
        }

        #endregion

        #region Data Retrieval Methods

        #endregion

        #region Event Handlers

        /// <summary>
        /// Checks the business rules on the current row
        /// </summary>
        /// <param name="e"></param>
        /// <remarks></remarks>
        private void TrustedVALETBaseBO_CheckRulesOnCurrentRow(CheckRulesEventArgs e)
        {

        }

        /// <summary>
        /// Sets the default values for a new row
        /// </summary>
        /// <remarks></remarks>
        private void TrustedVALETBaseBO_SetDefaultValues()
        {
           
        }

        #endregion


 
        private static DatabaseType _DatabaseQueryType =  DatabaseType.SQLServer ;

        public static DatabaseType DatabaseQueryType
        {
            get { return _DatabaseQueryType; }
            set { _DatabaseQueryType = value; }
        }

        private OracleCommand ConvertSqlToOracleCommand(SqlCommand cmd)
        {
     //  inserted next 2 lines just to have the code compile
            System.Data.OracleClient.OracleCommand strOr = null;
            return strOr;
            //-- Convert the SqlCommand into an Oracle Command
        }

        //-- Override the base FillDataTable and add a test to see if the command should be converted to Oracle
        public override void FillDataTable(DbCommand cmd)
        {
            if (TrustedVALETBaseBO.DatabaseQueryType ==  DatabaseType.Oracle)
                cmd = ConvertSqlToOracleCommand((SqlCommand)cmd);

                //  added write to see if this is being executed
  Console.WriteLine("Base class Constructor");

            base.FillDataTable(cmd);
            
        }

    }
}

The actual database bo for the table is: tbl_BargeClass_1 and inherits from TrustedVALETBaseBO

using MicroFour.StrataFrame.Business;

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Runtime.Serialization;

using System.Text;

using MicroFour.StrataFrame.Security;

namespace TrustedVALET_BO

{

[Serializable()]

//public partial class tbl_BargeClass_1 : MicroFour.StrataFrame.Business.BusinessLayer

public partial class tbl_BargeClass_1 : TrustedVALETBaseBO

{

#region Constructors

/// <summary>

/// Initializes a new instance of the BusinessObject1 class.

/// </summary>

public tbl_BargeClass_1()

: base()

{

InitializeComponent();

}

/// <summary>

/// Initializes a new instance of the BusinessObject1 class.

/// </summary>

/// <param name="container">The IContainer to which this business object will be added.</param>

public tbl_BargeClass_1(IContainer container)

: base()

{

container.Add(this);

InitializeComponent();

}

/// <summary>

/// Initializes a new instance of the BusinessObject1 class.

/// </summary>

/// <param name="info">The SerializationInfo for the object to create.</param>

/// <param name="context">The StreamingContext for the source stream.</param>

protected tbl_BargeClass_1(SerializationInfo info, StreamingContext context)

: base(info, context)

{

InitializeComponent();

}

#endregion

#region Data Retrieval Methods

#endregion

#region Event Handlers

/// <summary>

/// Checks the business rules on the current row

/// </summary>

/// <param name="e"></param>

/// <remarks></remarks>

private void tbl_BargeClass_1_CheckRulesOnCurrentRow(CheckRulesEventArgs e)

{

}

/// <summary>

/// Sets the default values for a new row

/// </summary>

/// <remarks></remarks>

private void tbl_BargeClass_1_SetDefaultValues()

{

this.BARGECLASS_ENTDT = DateTime.Now;

this.BARGECLASS_USERE = SecurityBasics.CurrentUser.UserName;

}

#endregion

private void tbl_BargeClass_1_BeforeSave(MicroFour.StrataFrame.Data.BeforeSaveUndoEventArgs e)

{

this.BARGECLASS_UPDT = DateTime.Now;

this.BARGECLASS_USERU = SecurityBasics.CurrentUser.UserName;

}

}

}

The SF Maintenance form has the tbl_BargeClass_1 BO on the form. This is a typical Maint Form where it has a browse where the user searches and there is no code which I coded to fill th BO other than what the SF framework does internally.

 

 


Dustin Taylor
Dustin Taylor
StrataFrame Team Member (660 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
If you handle the filldatatable, it should catch everything. Is this not what you are experiencing?

There are a small number of intrinsic calls such as FillByParent that use changedatatable, but these use QueryInformation which is, by nature, completely database independent and, as such, don't need to go through your translation routines.

Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
I am doing exactly what you described above in terms of the  MyDatabaseBO inheriting from MyBaseBO, and that MyBaseBO overrides the filldatatable method. But if the SF Maintenance framework is not always calling the FillDataTable method as pointed out about then I need to make sure it does get called. 
Dustin Taylor
Dustin Taylor
StrataFrame Team Member (660 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
If you are inheriting your custom BaseBO from all of your business objects, then they should be using your overridden FillDataTable whenever they get filled. As Greg mentioned, this is BO logic, not Form logic, so there isn't anything on your maintenance form to change. In your example, you need to ensure that MyDatabaseBO inherits from MyBaseBO, and that MyBaseBO overrides the filldatatable method as Trent outlined.  That is how to go about plumbing in your logic and what allows you to make the changes Trent described.
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Ross L. Rooker, Sr. (11/24/2008)
How can I force every Maintenance form to call the FillDataTable method. IE... the ones that I totally let the framework do everything for me. What I am asking is in the Maintenance form, or the Browse, what code do I insert and where to have the framework call the FillDataTable method with the select statement it automatically generated?

Hi Ross,

You don't need to insert any code, just make sure your form is using a BO which is subclassed from your based BO which has the FillDataTable method override.

Edhy Rijo

Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
How can I force every Maintenance form to call the FillDataTable method. IE... the ones that I totally let the framework do everything for me. What I am asking is in the Maintenance form, or the Browse, what code do I insert and where to have the framework call the FillDataTable method with the select statement it automatically generated?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search