本文整理汇总了C#中POS.DataLayer.DatabaseHelper.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseHelper.Dispose方法的具体用法?C# DatabaseHelper.Dispose怎么用?C# DatabaseHelper.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类POS.DataLayer.DatabaseHelper
的用法示例。
在下文中一共展示了DatabaseHelper.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectByUserNameAndPassword
public static ADUser SelectByUserNameAndPassword(string UserName, string Password)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
oDatabaseHelper.AddParameter("@UserName", UserName);
oDatabaseHelper.AddParameter("@Password", Password);
// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_ADUser_SelectUserNameAndPassword", ref ExecutionState);
if (dr.Read())
{
ADUser obj = new ADUser();
PopulateObjectFromReader(obj, dr);
dr.Close();
oDatabaseHelper.Dispose();
return obj;
}
else
{
dr.Close();
oDatabaseHelper.Dispose();
return null;
}
}
示例2: SaveTransaction
public int SaveTransaction(SALSalesReturnHeader sALSalesReturnHeader, SALSalesReturnLineCollection sALSalesReturnLineCollection)
{
oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
int salesReturnHeaderID = -1;
oDatabaseHelper.BeginTransaction();
if (InsertHeader(oDatabaseHelper, sALSalesReturnHeader, out salesReturnHeaderID))
{
foreach (SALSalesReturnLine sALSalesLine in sALSalesReturnLineCollection)
{
if (!InsertDetails(oDatabaseHelper, sALSalesLine, salesReturnHeaderID))
{
ExecutionState = false;
break;
}
else
ExecutionState = true;
}
if (ExecutionState)
{
oDatabaseHelper.CommitTransaction();
}
else
{
oDatabaseHelper.RollbackTransaction();
salesReturnHeaderID = -1;
}
}
oDatabaseHelper.Dispose();
return salesReturnHeaderID;
}
示例3: InsertGroupRoles
public static bool InsertGroupRoles(ADGroupRoleCollection aDGroupRoleCollection, int groupID)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
oDatabaseHelper.BeginTransaction();
if (Deletelines(oDatabaseHelper, groupID))
{
foreach (ADGroupRole groupRole in aDGroupRoleCollection)
{
if (!InsertDetails(oDatabaseHelper, groupRole))
{
ExecutionState = false;
break;
}
else
ExecutionState = true;
}
if (ExecutionState)
oDatabaseHelper.CommitTransaction();
else
oDatabaseHelper.RollbackTransaction();
}
else
ExecutionState = false;
oDatabaseHelper.Dispose();
return ExecutionState;
}
示例4: HeaderSearch
public static PURPurchaseHeaderCollection HeaderSearch(int InventoryID, DateTime FromDate, DateTime ToDate, string SupplierName, string InvoiceNumber)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
// Pass the specified field and its value to the stored procedure.
oDatabaseHelper.AddParameter("@InventoryID", InventoryID );
oDatabaseHelper.AddParameter("@FromDate", FromDate);
oDatabaseHelper.AddParameter("@ToDate", ToDate );
if (SupplierName!="")
{
oDatabaseHelper.AddParameter("@SupplierName", SupplierName);
}
if (InvoiceNumber != "")
{
oDatabaseHelper.AddParameter("@InvoiceNumber", InvoiceNumber);
}
// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
IDataReader dr = oDatabaseHelper.ExecuteReader("usp_PURPurchaseHeader_SearchByCriteria", ref ExecutionState);
PURPurchaseHeaderCollection PURPurchaseHeaderCollection = PopulateFromReader(dr);
dr.Close();
oDatabaseHelper.Dispose();
return PURPurchaseHeaderCollection;
}
示例5: CloseOrder
public static bool CloseOrder(int SalesHeaderID, int UserID)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
// Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
oDatabaseHelper.AddParameter("@UserID", UserID);
oDatabaseHelper.AddParameter("@SlaesReturnHeaderID", SalesHeaderID);
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
oDatabaseHelper.ExecuteScalar("usp_SALSalesReturnHader_CloseOrder", ref ExecutionState);
oDatabaseHelper.Dispose();
return ExecutionState;
}
示例6: CloseOrder
public bool CloseOrder(int INVTransferHeaderID, int UserID, INVTransferLineCollection transferLineCollection)
{
oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
oDatabaseHelper.BeginTransaction();
oDatabaseHelper.AddParameter("@UserID", UserID);
oDatabaseHelper.AddParameter("@INVTransferHeaderID", INVTransferHeaderID);
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
oDatabaseHelper.ExecuteScalar("usp_INVTransferHader_CloseOrder", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);
if (ExecutionState)
oDatabaseHelper.CommitTransaction();
else
oDatabaseHelper.RollbackTransaction();
oDatabaseHelper.Dispose();
return ExecutionState;
}
示例7: SearchByriteria
public static VPurchaseReturnHeaderCollection SearchByriteria(string CustomerName, DateTime FromDate, DateTime ToDate, string InvoiceNumber)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
oDatabaseHelper.AddParameter("@SupplierName", CustomerName);
oDatabaseHelper.AddParameter("@FromDate", FromDate);
oDatabaseHelper.AddParameter("@DateTo", ToDate);
oDatabaseHelper.AddParameter("@InvoiceNumber", InvoiceNumber);
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
IDataReader dr = oDatabaseHelper.ExecuteReader("usp_VPurchaseReturnHeader_SearchByCriteria", ref ExecutionState);
VPurchaseReturnHeaderCollection VPurchaseReturnHeaderCollection = PopulateObjectsFromReader(dr);
dr.Close();
oDatabaseHelper.Dispose();
return VPurchaseReturnHeaderCollection;
}
示例8: SearcByCriteria
public static BDProductGroupCollection SearcByCriteria(string ProductGroupName)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
// Pass the specified field and its value to the stored procedure.
oDatabaseHelper.AddParameter("@ProductGroupName", ProductGroupName);
// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
IDataReader dr = oDatabaseHelper.ExecuteReader("usp_ProductGroup_SearchByCriteria", ref ExecutionState);
BDProductGroupCollection BDProductGroupCollection = PopulateObjectsFromReader(dr);
dr.Close();
oDatabaseHelper.Dispose();
return BDProductGroupCollection;
}
示例9: SaveAccountUpdates
public bool SaveAccountUpdates(PURPurchaseHeader purchaseHeader, BDSupplierAccount supplierAccount)
{
oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
oDatabaseHelper.BeginTransaction();
ExecutionState = UpdateSupplierAccount(oDatabaseHelper, supplierAccount, ExecutionState);
if (!UpdatePurchaseHeader(oDatabaseHelper, purchaseHeader))
{
ExecutionState = false;
}
else
ExecutionState = true;
if (ExecutionState)
oDatabaseHelper.CommitTransaction();
else
oDatabaseHelper.RollbackTransaction();
oDatabaseHelper.Dispose();
return ExecutionState;
}
示例10: SelectAllProductsByGroupID
public static BDProductCollection SelectAllProductsByGroupID(int InventoryID, BDProductGroupPrimaryKey pk)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
BDProductCollection obj = null;
oDatabaseHelper.AddParameter("@ProductGroupID", pk.ProductGroupID);
oDatabaseHelper.AddParameter("@InventoryID", InventoryID);
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
IDataReader dr = oDatabaseHelper.ExecuteReader("usp_SelectAllByGroupID", ref ExecutionState);
obj = new BDProductCollection();
obj = PopulateObjectsFromReaderWithCheckingReader(dr, oDatabaseHelper);
dr.Close();
oDatabaseHelper.Dispose();
return obj;
}
示例11: SaveAccountUpdates
public bool SaveAccountUpdates(SALSalesHeader salesHeader, BDCustomerAccount customerAccount)
{
oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
oDatabaseHelper.BeginTransaction();
ExecutionState = UpdateCustomerAccount(oDatabaseHelper, customerAccount, ExecutionState);
if (!UpdateSalesHeader(oDatabaseHelper, salesHeader))
{
ExecutionState = false;
}
else
ExecutionState = true;
if (ExecutionState)
oDatabaseHelper.CommitTransaction();
else
oDatabaseHelper.RollbackTransaction();
oDatabaseHelper.Dispose();
return ExecutionState;
}
示例12: HeaderSearch
public static SALSalesHeaderCollection HeaderSearch(string CustomerName, string InvoiceNumber)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
// Pass the specified field and its value to the stored procedure.
oDatabaseHelper.AddParameter("@CustomerName", CustomerName);
oDatabaseHelper.AddParameter("@InvoiceDate", null);
oDatabaseHelper.AddParameter("@InvoiceNumber", InvoiceNumber);
// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
IDataReader dr = oDatabaseHelper.ExecuteReader("usp_SALSalesHeader_SearchByCriteria", ref ExecutionState);
SALSalesHeaderCollection SALSalesHeaderCollection = PopulateFromReader(dr);
dr.Close();
oDatabaseHelper.Dispose();
return SALSalesHeaderCollection;
}
示例13: SelectByInvoiceNumber
public static VSALSalesOrderCollection SelectByInvoiceNumber(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
// Pass the specified field and its value to the stored procedure.
oDatabaseHelper.AddParameter("@Field", field);
oDatabaseHelper.AddParameter("@Value", fieldValue);
oDatabaseHelper.AddParameter("@Value2", fieldValue2);
oDatabaseHelper.AddParameter("@Operation", OperationCollection.Operation[(int)typeOperation]);
// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_VSALSalesOrder_SelectByField", ref ExecutionState);
VSALSalesOrderCollection VSALSalesOrderCollection = PopulateObjectsFromReader(dr);
dr.Close();
oDatabaseHelper.Dispose();
return VSALSalesOrderCollection;
}
示例14: SelectAllCount
/// <summary>
/// This method will return a count all records in the table.
/// </summary>
///
/// <returns>count records</returns>
///
/// <remarks>
///
/// <RevisionHistory>
/// Author Date Description
/// DLGenerator 3/7/2015 2:37:27 PM Created function
///
/// </RevisionHistory>
///
/// </remarks>
///
public static int SelectAllCount()
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
Object dr=oDatabaseHelper.ExecuteScalar("gsp_ADUser_SelectAllCount");
int count = Convert.ToInt32(dr);
oDatabaseHelper.Dispose();
return count;
}
示例15: SelectByFieldPaged
/// <summary>
/// This method will return a list of objects representing the specified number of entries from the specified record number in the table
/// using the value of the field specified
/// </summary>
///
/// <param name="field" type="string">Field of the class ADUser</param>
/// <param name="fieldValue" type="object">Value for the field specified.</param>
/// <param name="fieldValue2" type="object">Value for the field specified.</param>
/// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param>
/// <param name="orderByStatement" type="string">The field value to number.</param>
/// <param name="pageSize" type="int">Number of records returned.</param>
/// <param name="skipPages" type="int">The number of missing pages.</param>
///
/// <returns>List of object of class ADUser in the form of an object of class ADUserCollection</returns>
///
/// <remarks>
///
/// <RevisionHistory>
/// Author Date Description
/// DLGenerator 3/7/2015 2:37:27 PM Created function
///
/// </RevisionHistory>
///
/// </remarks>
///
public static ADUserCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
// Pass the specified field and its value to the stored procedure.
oDatabaseHelper.AddParameter("@Field",field);
oDatabaseHelper.AddParameter("@Value", fieldValue );
oDatabaseHelper.AddParameter("@Value2", fieldValue2 );
oDatabaseHelper.AddParameter("@Operation", OperationCollection.Operation[(int)typeOperation] );
oDatabaseHelper.AddParameter("@PageSize",pageSize);
oDatabaseHelper.AddParameter("@SkipPages", skipPages );
oDatabaseHelper.AddParameter("@OrderByStatement", orderByStatement );
// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_ADUser_SelectByFieldPaged", ref ExecutionState);
ADUserCollection ADUserCollection = PopulateObjectsFromReader(dr);
dr.Close();
oDatabaseHelper.Dispose();
return ADUserCollection;
}