public string _Mtd_Correlativo(string _Pr_Str_Sql) { string _Str_R = "0"; System.Data.SqlClient.SqlDataReader DR; DR = _Cls_Conexion._Mtd_Conexion_()._Mtd_RetornarDatareader(_Pr_Str_Sql); if (DR.HasRows) { while (DR.Read()) { if (DR.IsDBNull(0) == false) { _Str_R = Convert.ToString(Convert.ToInt32(DR.GetValue(0)) + 1); } else { _Str_R = "1"; } } } DR.Close(); return(_Str_R); }
/// <summary> /// Allows you to load a specific record of the [Customers] table. /// </summary> /// <param name="col_CustomerID">Customer unique identifier</param> public bool Refresh(System.Data.SqlTypes.SqlInt32 col_CustomerID) { bool Status; Reset(); if (col_CustomerID.IsNull) { throw new ArgumentNullException("col_CustomerID", "The primary key 'col_CustomerID' can not have a Null value!"); } this.col_CustomerID = col_CustomerID; this.Param.Reset(); this.Param.Param_CustomerID = this.col_CustomerID; System.Data.SqlClient.SqlDataReader DR; SPs.spS_Customers SP = new SPs.spS_Customers(false); if (SP.Execute(ref this.Param, out DR)) { Status = false; if (DR.Read()) { if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_CompanyName.ColumnIndex)) { this.col_CompanyName = DR.GetSqlString(SPs.spS_Customers.Resultset1.Fields.Column_CompanyName.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_ContactName.ColumnIndex)) { this.col_ContactName = DR.GetSqlString(SPs.spS_Customers.Resultset1.Fields.Column_ContactName.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_TitleId.ColumnIndex)) { this.col_TitleId = DR.GetSqlInt32(SPs.spS_Customers.Resultset1.Fields.Column_TitleId.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_Address.ColumnIndex)) { this.col_Address = DR.GetSqlString(SPs.spS_Customers.Resultset1.Fields.Column_Address.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_City.ColumnIndex)) { this.col_City = DR.GetSqlString(SPs.spS_Customers.Resultset1.Fields.Column_City.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_PostalCode.ColumnIndex)) { this.col_PostalCode = DR.GetSqlString(SPs.spS_Customers.Resultset1.Fields.Column_PostalCode.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_Phone.ColumnIndex)) { this.col_Phone = DR.GetSqlString(SPs.spS_Customers.Resultset1.Fields.Column_Phone.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_Email.ColumnIndex)) { this.col_Email = DR.GetSqlString(SPs.spS_Customers.Resultset1.Fields.Column_Email.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_WebAddress.ColumnIndex)) { this.col_WebAddress = DR.GetSqlString(SPs.spS_Customers.Resultset1.Fields.Column_WebAddress.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_Fax.ColumnIndex)) { this.col_Fax = DR.GetSqlString(SPs.spS_Customers.Resultset1.Fields.Column_Fax.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_Customers.Resultset1.Fields.Column_Active.ColumnIndex)) { this.col_Active = DR.GetSqlBoolean(SPs.spS_Customers.Resultset1.Fields.Column_Active.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 Bob.DataClasses.CustomException(this.Param, "Bob.AbstractClasses.Abstract_Customers", "Refresh"); } }
/// <summary> /// Allows you to load a specific record of the [JobPart] table. /// </summary> /// <param name="col_JobPartId">Update this description in the "Olymars/Description" extended property of the "JobPartId" column.</param> public bool Refresh(System.Data.SqlTypes.SqlInt32 col_JobPartId) { bool Status; Reset(); if (col_JobPartId.IsNull) { throw new ArgumentNullException("col_JobPartId", "The primary key 'col_JobPartId' can not have a Null value!"); } this.col_JobPartId = col_JobPartId; this.Param.Reset(); this.Param.Param_JobPartId = this.col_JobPartId; System.Data.SqlClient.SqlDataReader DR; SPs.spS_JobPart SP = new SPs.spS_JobPart(false); if (SP.Execute(ref this.Param, out DR)) { Status = false; if (DR.Read()) { if (!DR.IsDBNull(SPs.spS_JobPart.Resultset1.Fields.Column_JobId.ColumnIndex)) { this.col_JobId = DR.GetSqlInt32(SPs.spS_JobPart.Resultset1.Fields.Column_JobId.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_JobPart.Resultset1.Fields.Column_Description.ColumnIndex)) { this.col_Description = DR.GetSqlString(SPs.spS_JobPart.Resultset1.Fields.Column_Description.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_JobPart.Resultset1.Fields.Column_JobPartTypeId.ColumnIndex)) { this.col_JobPartTypeId = DR.GetSqlInt32(SPs.spS_JobPart.Resultset1.Fields.Column_JobPartTypeId.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_JobPart.Resultset1.Fields.Column_Units.ColumnIndex)) { this.col_Units = DR.GetSqlDecimal(SPs.spS_JobPart.Resultset1.Fields.Column_Units.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_JobPart.Resultset1.Fields.Column_PricePerUnit.ColumnIndex)) { this.col_PricePerUnit = DR.GetSqlMoney(SPs.spS_JobPart.Resultset1.Fields.Column_PricePerUnit.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_JobPart.Resultset1.Fields.Column_TotalPrice.ColumnIndex)) { this.col_TotalPrice = DR.GetSqlMoney(SPs.spS_JobPart.Resultset1.Fields.Column_TotalPrice.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 Bob.DataClasses.CustomException(this.Param, "Bob.AbstractClasses.Abstract_JobPart", "Refresh"); } }
/// <summary> /// Allows you to load a specific record of the [tblOrder] table. /// </summary> /// <param name="col_Ord_GuidID">Update this description in the "Olymars/Description" extended property of the "Ord_GuidID" column.</param> public bool Refresh(System.Data.SqlTypes.SqlGuid col_Ord_GuidID) { bool Status; Reset(); if (col_Ord_GuidID.IsNull) { throw new ArgumentNullException("col_Ord_GuidID", "The primary key 'col_Ord_GuidID' can not have a Null value!"); } this.col_Ord_GuidID = col_Ord_GuidID; this.Param.Reset(); this.Param.Param_Ord_GuidID = this.col_Ord_GuidID; System.Data.SqlClient.SqlDataReader DR; SPs.spS_tblOrder SP = new SPs.spS_tblOrder(false); if (SP.Execute(ref this.Param, out DR)) { Status = false; if (DR.Read()) { if (!DR.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_DatOrderedOn.ColumnIndex)) { this.col_Ord_DatOrderedOn = DR.GetSqlDateTime(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_DatOrderedOn.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_LngCustomerID.ColumnIndex)) { this.col_Ord_LngCustomerID = DR.GetSqlInt32(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_LngCustomerID.ColumnIndex); } if (!DR.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_CurTotal.ColumnIndex)) { this.col_Ord_CurTotal = DR.GetSqlMoney(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_CurTotal.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_tblOrder", "Refresh"); } }
/// <summary> /// Allows you to load a specific record of the [tblCategory] table. /// </summary> /// <param name="col_Cat_LngID">Update this description in the "Olymars/Description" extended property of the "Cat_LngID" column.</param> public bool Refresh(System.Data.SqlTypes.SqlInt32 col_Cat_LngID) { bool Status; Reset(); if (col_Cat_LngID.IsNull) { throw new ArgumentNullException("col_Cat_LngID", "The primary key 'col_Cat_LngID' can not have a Null value!"); } this.col_Cat_LngID = col_Cat_LngID; this.Param.Reset(); this.Param.Param_Cat_LngID = this.col_Cat_LngID; System.Data.SqlClient.SqlDataReader DR; SPs.spS_tblCategory SP = new SPs.spS_tblCategory(false); if (SP.Execute(ref this.Param, out DR)) { Status = false; if (DR.Read()) { if (!DR.IsDBNull(SPs.spS_tblCategory.Resultset1.Fields.Column_Cat_StrName.ColumnIndex)) { this.col_Cat_StrName = DR.GetSqlString(SPs.spS_tblCategory.Resultset1.Fields.Column_Cat_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_tblCategory", "Refresh"); } }