/// <summary>
        /// Load or reloads a subset of the chosen resultset returned by the stored procedure.
        /// You can specify which record you want to be checked by default.
        /// </summary>
        /// <param name="PrimaryKey">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(object PrimaryKey, int startRecord, int maxRecords)
        {
            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_tblSupplier();

            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;
            }

            this.param.CommandTimeOut = this.commandTimeOut;


            if (!this.param_Sup_GuidID.IsNull)
            {
                this.param.Param_Sup_GuidID = this.param_Sup_GuidID;
            }


            System.Data.DataSet DS = null;

            SPs.spS_tblSupplier SP = new SPs.spS_tblSupplier();
            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.DataSource     = DS.Tables[this.tableName].DefaultView;
                this.DataValueField = this.valueMember;
                this.DataTextField  = this.displayMember;
                if (this.doDataBindAfterRefreshData)
                {
                    this.DataBind();
                }

                if (PrimaryKey != null)
                {
                    System.Web.UI.WebControls.ListItem listItem = this.Items.FindByValue(Convert.ToString(PrimaryKey));

                    if (listItem != null)
                    {
                        listItem.Selected = true;
                    }
                }
            }

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WebDropDownListCustom_spS_tblSupplier", "RefreshData");
            }
        }
Ejemplo n.º 2
0
        public Tables.Supplier GetOne_Supplier(Guid id)
        {
            Params.spS_tblSupplier param = new Params.spS_tblSupplier(true);

            param.SetUpConnection(string.Empty);

            param.Param_Sup_GuidID = id;

            using (SPs.spS_tblSupplier sp = new SPs.spS_tblSupplier(true)) {
                System.Data.SqlClient.SqlDataReader sqlDataReader = null;
                sp.Execute(ref param, out sqlDataReader);
                param.Dispose();

                if (sqlDataReader.Read())
                {
                    Tables.Supplier record = new Tables.Supplier();

                    record.Col_Sup_GuidID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblSupplier.Resultset1.Fields.Column_Sup_GuidID.ColumnIndex);
                    if (!record.Col_Sup_GuidID.UseNull)
                    {
                        record.Col_Sup_GuidID.Value = sqlDataReader.GetSqlGuid(SPs.spS_tblSupplier.Resultset1.Fields.Column_Sup_GuidID.ColumnIndex).Value;
                    }

                    record.Col_Sup_StrName.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblSupplier.Resultset1.Fields.Column_Sup_StrName.ColumnIndex);
                    if (!record.Col_Sup_StrName.UseNull)
                    {
                        record.Col_Sup_StrName.Value = sqlDataReader.GetSqlString(SPs.spS_tblSupplier.Resultset1.Fields.Column_Sup_StrName.ColumnIndex).Value;
                    }


                    sqlDataReader.Close();
                    sp.Connection.Close();

                    return(record);
                }
                else
                {
                    sqlDataReader.Close();
                    sp.Connection.Close();

                    return(null);
                }
            }
        }
        /// <summary>
        /// Load or reloads a subset of the table content. In order to successfully call this method, you need to call first
        /// the Initialize method.
        /// </summary>
        /// <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(int startRecord, int maxRecords)
        {
            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_tblSupplier(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;
            }

            System.Data.DataSet DS = null;

            SPs.spS_tblSupplier SP = new SPs.spS_tblSupplier(false);
            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.DataSource   = DS.Tables["spS_tblSupplier"].DefaultView;
                this.DataKeyField = "Sup_GuidID";
                if (this.doDataBindAfterRefreshData)
                {
                    this.DataBind();
                }

                SP.Dispose();
            }

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WebDataList_tblSupplier : System.Web.UI.WebControls.DataList", "RefreshData");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Load or reloads a subset of the chosen resultset returned by the stored procedure.
        /// You can specify which record you want to be checked by default.
        /// </summary>
        /// <param name="ArrayOf_PrimaryKeys">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(object[] ArrayOf_PrimaryKeys, int startRecord, int maxRecords)
        {
            this.CreateControl();

            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_tblSupplier();

            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;
            }

            this.param.CommandTimeOut = this.commandTimeOut;


            if (!this.param_Sup_GuidID.IsNull)
            {
                this.param.Param_Sup_GuidID = this.param_Sup_GuidID;
            }


            System.Data.DataSet DS = null;

            SPs.spS_tblSupplier SP = new SPs.spS_tblSupplier();
            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.BeginUpdate();
                this.bindingInProgress = true;
                this.DataSource        = DS.Tables[this.tableName].DefaultView;
                this.ValueMember       = this.valueMember;
                this.DisplayMember     = this.displayMember;
                this.bindingInProgress = false;

                if (ArrayOf_PrimaryKeys != null && ArrayOf_PrimaryKeys.Length > 0)
                {
                    this.SetRecordsCheckState(ArrayOf_PrimaryKeys, System.Windows.Forms.CheckState.Checked);
                }
                else
                {
                    base.OnSelectedIndexChanged(EventArgs.Empty);
                }

                this.EndUpdate();
                SP.Dispose();
            }

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WinCheckedListBoxCustom_spS_tblSupplier", "RefreshData");
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <returns>[To be supplied.]</returns>
        public bool Refresh()
        {
            this.displayName = null;

            this.col_Sup_StrNameWasUpdated = false;
            this.col_Sup_StrNameWasSet     = false;
            this.col_Sup_StrName           = System.Data.SqlTypes.SqlString.Null;

            bool alreadyOpened = false;

            Params.spS_tblSupplier Param = new Params.spS_tblSupplier(true);
            Param.CommandTimeOut = this.selectCommandTimeOut;
            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_Sup_GuidID.IsNull)
            {
                Param.Param_Sup_GuidID = this.col_Sup_GuidID;
            }


            System.Data.SqlClient.SqlDataReader sqlDataReader = null;
            SPs.spS_tblSupplier Sp = new SPs.spS_tblSupplier(false);
            if (Sp.Execute(ref Param, out sqlDataReader))
            {
                if (sqlDataReader.Read())
                {
                    if (!sqlDataReader.IsDBNull(SPs.spS_tblSupplier.Resultset1.Fields.Column_Sup_StrName.ColumnIndex))
                    {
                        this.col_Sup_StrName = sqlDataReader.GetSqlString(SPs.spS_tblSupplier.Resultset1.Fields.Column_Sup_StrName.ColumnIndex);
                    }

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

                    CloseConnection(Sp.Connection, alreadyOpened);

                    this.recordIsLoaded = true;

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

                    CloseConnection(Sp.Connection, alreadyOpened);

                    this.recordIsLoaded = false;

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

                CloseConnection(Sp.Connection, alreadyOpened);

                throw new OlymarsDemo.DataClasses.CustomException(Param, "OlymarsDemo.BusinessComponents.Supplier", "Refresh");
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Allows you to load a specific record of the [tblSupplier] table.
        /// </summary>
        /// <param name="col_Sup_GuidID">Update this description in the &quot;Olymars/Description&quot; extended property of the &quot;Sup_GuidID&quot; column.</param>
        public bool Refresh(System.Data.SqlTypes.SqlGuid col_Sup_GuidID)
        {
            bool Status;

            Reset();

            if (col_Sup_GuidID.IsNull)
            {
                throw new ArgumentNullException("col_Sup_GuidID", "The primary key 'col_Sup_GuidID' can not have a Null value!");
            }


            this.col_Sup_GuidID = col_Sup_GuidID;

            this.Param.Reset();

            this.Param.Param_Sup_GuidID = this.col_Sup_GuidID;

            System.Data.SqlClient.SqlDataReader DR;
            SPs.spS_tblSupplier SP = new SPs.spS_tblSupplier(false);

            if (SP.Execute(ref this.Param, out DR))
            {
                Status = false;
                if (DR.Read())
                {
                    if (!DR.IsDBNull(SPs.spS_tblSupplier.Resultset1.Fields.Column_Sup_StrName.ColumnIndex))
                    {
                        this.col_Sup_StrName = DR.GetSqlString(SPs.spS_tblSupplier.Resultset1.Fields.Column_Sup_StrName.ColumnIndex);
                    }

                    Status = true;
                }

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

                if (CloseConnectionAfterUse && SP.Connection != null && SP.Connection.State == System.Data.ConnectionState.Open)
                {
                    SP.Connection.Close();
                    SP.Connection.Dispose();
                }

                return(Status);
            }

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

                if (CloseConnectionAfterUse && SP.Connection != null && SP.Connection.State == System.Data.ConnectionState.Open)
                {
                    SP.Connection.Close();
                    SP.Connection.Dispose();
                }

                throw new OlymarsDemo.DataClasses.CustomException(this.Param, "OlymarsDemo.AbstractClasses.Abstract_tblSupplier", "Refresh");
            }
        }