Example #1
0
        public System.Data.DataSet GetAllDisplay_tblOrderItem_Collection_DataSet(WSTypes.WSGuid col_Oit_GuidOrderID, WSTypes.WSGuid col_Oit_GuidProductID)
        {
            Params.spS_tblOrderItem_Display param = new Params.spS_tblOrderItem_Display(true);

            param.SetUpConnection(string.Empty);

            if (col_Oit_GuidOrderID == null || col_Oit_GuidOrderID.UseNull)
            {
                param.Param_Oit_GuidOrderID = SqlGuid.Null;
            }
            else if (!col_Oit_GuidOrderID.UseDefault)
            {
                param.Param_Oit_GuidOrderID = col_Oit_GuidOrderID.Value;
            }

            if (col_Oit_GuidProductID == null || col_Oit_GuidProductID.UseNull)
            {
                param.Param_Oit_GuidProductID = SqlGuid.Null;
            }
            else if (!col_Oit_GuidProductID.UseDefault)
            {
                param.Param_Oit_GuidProductID = col_Oit_GuidProductID.Value;
            }


            using (SPs.spS_tblOrderItem_Display sp = new SPs.spS_tblOrderItem_Display(true)) {
                System.Data.DataSet dataSet = null;
                sp.Execute(ref param, ref dataSet);
                param.Dispose();

                return(dataSet);
            }
        }
Example #2
0
        /// <summary>
        /// Load or reloads all the table content. You can specify which records you want to be checked by default.
        /// In order to successfully call this method, you need to call first the Initialize method.
        /// </summary>
        /// <param name="ArrayOf_PK_Oit_GuidID">Primary keys of the records you want to be checked by default.</param>
        /// <param name="startRecord">The zero-based record number to start with.</param>
        /// <param name="maxRecords">The maximum number of records to retrieve.</param>
        public void RefreshData(System.Data.SqlTypes.SqlGuid[] ArrayOf_PK_Oit_GuidID, int startRecord, int maxRecords)
        {
            this.param = new Params.spS_tblOrderItem_Display(true);

            switch (this.LastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                this.param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                this.param.SetUpConnection(this.sqlConnection);
                break;

            default:
                throw new InvalidOperationException("This control has not been initialized. You must call the Initialize method before calling this method.");
            }

            this.param.Param_Oit_GuidOrderID   = this.FK_Oit_GuidOrderID;
            this.param.Param_Oit_GuidProductID = this.FK_Oit_GuidProductID;

            System.Data.DataSet DS = null;

            SPs.spS_tblOrderItem_Display SP = new SPs.spS_tblOrderItem_Display(false);

            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.BeginUpdate();
                this.bindingInProgress = true;
                this.DataSource        = DS.Tables["spS_tblOrderItem_Display"].DefaultView;
                this.ValueMember       = SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnName;
                this.DisplayMember     = SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnName;
                this.bindingInProgress = false;

                System.Data.DataView dataView = DS.Tables["spS_tblOrderItem_Display"].DefaultView;

                if (ArrayOf_PK_Oit_GuidID != null && ArrayOf_PK_Oit_GuidID.Length > 0)
                {
                    this.SetRecordsCheckState(ArrayOf_PK_Oit_GuidID, System.Windows.Forms.CheckState.Checked);
                }
                else
                {
                    base.OnSelectedIndexChanged(EventArgs.Empty);
                }
                this.EndUpdate();
                SP.Dispose();
            }
            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WinCheckedListBox_tblOrderItem : System.Windows.Forms.CheckedListBox", "RefreshData");
            }
        }
Example #3
0
        /// <summary>
        /// Load or reloads a subset of the table content. You can specify which record you want to be selected
        /// by default. In order to successfully call this method, you need to call first the Initialize method.
        /// </summary>
        /// <param name="PK_Oit_GuidID">Primary key of the record you want to be selected by default.</param>
        /// <param name="startRecord">The zero-based record number to start with.</param>
        /// <param name="maxRecords">The maximum number of records to retrieve.</param>
        public void RefreshData(System.Data.SqlTypes.SqlGuid PK_Oit_GuidID, int startRecord, int maxRecords)
        {
            this.param = new Params.spS_tblOrderItem_Display(true);

            switch (this.LastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                this.param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                this.param.SetUpConnection(this.sqlConnection);
                break;

            default:
                throw new InvalidOperationException("This control has not been initialized. You must call the Initialize method before calling this method.");
            }

            this.param.Param_Oit_GuidOrderID   = this.FK_Oit_GuidOrderID;
            this.param.Param_Oit_GuidProductID = this.FK_Oit_GuidProductID;

            System.Data.DataSet DS = null;

            SPs.spS_tblOrderItem_Display SP = new SPs.spS_tblOrderItem_Display(false);

            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.DataSource     = DS.Tables["spS_tblOrderItem_Display"].DefaultView;
                this.DataValueField = SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnName;
                this.DataTextField  = SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnName;
                if (this.doDataBindAfterRefreshData)
                {
                    this.DataBind();
                }

                if (!PK_Oit_GuidID.IsNull)
                {
                    System.Web.UI.WebControls.ListItem listItem = this.Items.FindByValue(PK_Oit_GuidID.Value.ToString());
                    if (listItem != null)
                    {
                        listItem.Selected = true;
                    }
                }
            }
            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WebDropDownList_tblOrderItem : System.Web.UI.WebControls.DropDownList", "RefreshData");
            }
        }
Example #4
0
        public Common.Item[] GetAllDisplay_tblOrderItem_Collection_Array(WSTypes.WSGuid col_Oit_GuidOrderID, WSTypes.WSGuid col_Oit_GuidProductID)
        {
            Params.spS_tblOrderItem_Display param = new Params.spS_tblOrderItem_Display(true);

            param.SetUpConnection(string.Empty);

            if (col_Oit_GuidOrderID == null || col_Oit_GuidOrderID.UseNull)
            {
                param.Param_Oit_GuidOrderID = SqlGuid.Null;
            }
            else if (!col_Oit_GuidOrderID.UseDefault)
            {
                param.Param_Oit_GuidOrderID = col_Oit_GuidOrderID.Value;
            }

            if (col_Oit_GuidProductID == null || col_Oit_GuidProductID.UseNull)
            {
                param.Param_Oit_GuidProductID = SqlGuid.Null;
            }
            else if (!col_Oit_GuidProductID.UseDefault)
            {
                param.Param_Oit_GuidProductID = col_Oit_GuidProductID.Value;
            }


            using (SPs.spS_tblOrderItem_Display sp = new SPs.spS_tblOrderItem_Display(true)) {
                System.Collections.ArrayList records = new System.Collections.ArrayList();

                System.Data.SqlClient.SqlDataReader sqlDataReader = null;
                sp.Execute(ref param, out sqlDataReader);

                while (sqlDataReader.Read())
                {
                    records.Add(new Common.Item(sqlDataReader.GetGuid(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnIndex), sqlDataReader.GetString(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex)));
                }

                sqlDataReader.Close();

                if (sp.Connection.State == System.Data.ConnectionState.Open)
                {
                    sp.Connection.Close();
                }

                sp.Dispose();
                param.Dispose();

                return((Common.Item[])records.ToArray(typeof(Common.Item)));
            }
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        public void Refresh()
        {
            internalRecords = new System.Collections.ArrayList();

            bool alreadyOpened = false;

            Params.spS_tblOrderItem_Display Param = new Params.spS_tblOrderItem_Display(true);
            Param.CommandTimeOut = this.selectCollectionCommandTimeOut;
            switch (this.lastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                Param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                Param.SetUpConnection(this.sqlConnection);
                alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                Param.SetUpConnection(this.sqlTransaction);
                break;
            }

            if (!this.col_Oit_GuidOrderID.IsNull)
            {
                Param.Param_Oit_GuidOrderID = this.col_Oit_GuidOrderID;
            }

            if (!this.col_Oit_GuidProductID.IsNull)
            {
                Param.Param_Oit_GuidProductID = this.col_Oit_GuidProductID;
            }

            System.Data.SqlClient.SqlDataReader sqlDataReader = null;
            SPs.spS_tblOrderItem_Display        Sp            = new SPs.spS_tblOrderItem_Display(false);
            if (Sp.Execute(ref Param, out sqlDataReader))
            {
                while (sqlDataReader.Read())
                {
                    tblOrderItem_Record record = null;

                    switch (this.lastKnownConnectionType)
                    {
                    case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                        record = new tblOrderItem_Record(this.connectionString, sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnIndex));
                        break;

                    case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                        record = new tblOrderItem_Record(this.sqlConnection, sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnIndex));
                        break;

                    case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                        record = new tblOrderItem_Record(this.sqlTransaction, sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnIndex));
                        break;
                    }


                    record.UpdateCommandTimeOut = this.updateCommandTimeOut;
                    record.SelectCommandTimeOut = this.selectCommandTimeOut;

                    if (sqlDataReader.GetFieldType(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex) == typeof(string))
                    {
                        record.displayName = sqlDataReader.GetString(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex);
                    }
                    else
                    {
                        record.displayName = sqlDataReader.GetValue(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex).ToString();
                    }

                    internalRecords.Add(record);
                }

                if (sqlDataReader != null && !sqlDataReader.IsClosed)
                {
                    sqlDataReader.Close();
                }

                CloseConnection(Sp.Connection, alreadyOpened);

                this.recordsAreLoaded = true;
            }
            else
            {
                if (sqlDataReader != null && !sqlDataReader.IsClosed)
                {
                    sqlDataReader.Close();
                }

                CloseConnection(Sp.Connection, alreadyOpened);

                this.recordsAreLoaded = false;
                throw new OlymarsDemo.DataClasses.CustomException(Param, "OlymarsDemo.BusinessComponents.tblOrderItem_Collection", "Refresh");
            }
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <returns>[To be supplied.]</returns>
        public override string ToString()
        {
            if (!this.recordWasLoadedFromDB)
            {
                throw new ArgumentException("No record was loaded from the database. The DisplayName is not available.");
            }

            if (this.displayName == null)
            {
                bool alreadyOpened = false;

                Params.spS_tblOrderItem_Display Param = new Params.spS_tblOrderItem_Display(true);

                switch (this.lastKnownConnectionType)
                {
                case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                    Param.SetUpConnection(this.connectionString);
                    break;

                case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                    Param.SetUpConnection(this.sqlConnection);
                    alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open);
                    break;

                case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                    Param.SetUpConnection(this.sqlTransaction);
                    break;
                }

                Param.Param_Oit_GuidID = this.col_Oit_GuidID;

                System.Data.SqlClient.SqlDataReader sqlDataReader = null;
                SPs.spS_tblOrderItem_Display        Sp            = new SPs.spS_tblOrderItem_Display(false);
                if (Sp.Execute(ref Param, out sqlDataReader))
                {
                    if (sqlDataReader.Read())
                    {
                        if (!sqlDataReader.IsDBNull(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex))
                        {
                            if (sqlDataReader.GetFieldType(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex) == typeof(string))
                            {
                                this.displayName = sqlDataReader.GetString(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex);
                            }
                            else
                            {
                                this.displayName = sqlDataReader.GetValue(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex).ToString();
                            }
                        }
                    }

                    if (sqlDataReader != null && !sqlDataReader.IsClosed)
                    {
                        sqlDataReader.Close();
                    }

                    CloseConnection(Sp.Connection, alreadyOpened);
                }
                else
                {
                    if (sqlDataReader != null && !sqlDataReader.IsClosed)
                    {
                        sqlDataReader.Close();
                    }

                    CloseConnection(Sp.Connection, alreadyOpened);

                    throw new OlymarsDemo.DataClasses.CustomException(Param, "OlymarsDemo.BusinessComponents.tblOrderItem_Record", "ToString");
                }
            }

            return(this.displayName);
        }
Example #7
0
        /// <summary>
        /// Load or reloads a subset of the table content. You can specify which record you want to be selected
        /// by default. In order to successfully call this method, you need to call first the Initialize method.
        /// </summary>
        /// <param name="PK_Oit_GuidID">Primary key of the record you want to be selected by default.</param>
        /// <param name="startRecord">The zero-based record number to start with.</param>
        /// <param name="maxRecords">The maximum number of records to retrieve.</param>
        public void RefreshData(System.Data.SqlTypes.SqlGuid PK_Oit_GuidID, int startRecord, int maxRecords)
        {
            if (!PK_Oit_GuidID.IsNull && this.SelectionMode == System.Windows.Forms.SelectionMode.None)
            {
                throw new ArgumentException("You cannot supply a value to this parameter when SelectionMode property is set to None.", "PK_Oit_GuidID");
            }

            if (this.LastKnownConnectionType == OlymarsDemo.DataClasses.ConnectionType.None)
            {
                throw new InvalidOperationException("You must call the 'Initialize' method before calling this method.");
            }

            this.param = new Params.spS_tblOrderItem_Display(true);

            switch (this.LastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                this.param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                this.param.SetUpConnection(this.sqlConnection);
                break;

            default:
                throw new InvalidOperationException("This control has not been initialized. You must call the Initialize method before calling this method.");
            }

            this.param.Param_Oit_GuidOrderID   = this.FK_Oit_GuidOrderID;
            this.param.Param_Oit_GuidProductID = this.FK_Oit_GuidProductID;

            System.Data.DataSet DS = null;

            SPs.spS_tblOrderItem_Display SP = new SPs.spS_tblOrderItem_Display(false);

            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.BeginUpdate();
                this.bindingInProgress = true;
                this.DataSource        = DS.Tables["spS_tblOrderItem_Display"].DefaultView;
                this.ValueMember       = SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnName;
                this.DisplayMember     = SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnName;
                this.bindingInProgress = false;

                if (!PK_Oit_GuidID.IsNull)
                {
                    this.SelectedValue = PK_Oit_GuidID.Value;
                }
                else
                {
                    base.OnSelectedIndexChanged(EventArgs.Empty);
                }

                this.EndUpdate();
                SP.Dispose();
            }
            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WinListBox_tblOrderItem : System.Windows.Forms.ListBox", "RefreshData");
            }
        }