本文整理汇总了C#中POS.DataLayer.DatabaseHelper类的典型用法代码示例。如果您正苦于以下问题:C# DatabaseHelper类的具体用法?C# DatabaseHelper怎么用?C# DatabaseHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseHelper类属于POS.DataLayer命名空间,在下文中一共展示了DatabaseHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateTransaction
public bool UpdateTransaction(PURPurchaseReturnHeader pURPurchaseReturnHeader, PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection)
{
oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
oDatabaseHelper.BeginTransaction();
if (UpdateHeader(oDatabaseHelper, pURPurchaseReturnHeader))
{
if (DeleteDetails(oDatabaseHelper, (int)pURPurchaseReturnHeader.PurchaseReturnID, (int)pURPurchaseReturnHeader.UpdatedBy))
{
foreach (PURPurchaseReturnLine pURPurchaseReturnLine in pURPurchaseReturnLineCollection)
{
if (!InsertDetails(oDatabaseHelper, pURPurchaseReturnLine, (int)pURPurchaseReturnHeader.PurchaseReturnID))
{
ExecutionState = false;
break;
}
else
ExecutionState = true;
}
if (ExecutionState)
oDatabaseHelper.CommitTransaction();
else
oDatabaseHelper.RollbackTransaction();
}
else
ExecutionState = false;
}
else
ExecutionState = false;
return ExecutionState;
}
示例2: SaveTransaction
public int SaveTransaction(PURPurchaseReturnHeader pURPurchaseReturnHeader, PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection)
{
oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
int salesReturnHeaderID = -1;
oDatabaseHelper.BeginTransaction();
if (InsertHeader(oDatabaseHelper, pURPurchaseReturnHeader, out salesReturnHeaderID))
{
foreach (PURPurchaseReturnLine pURPurchaseLine in pURPurchaseReturnLineCollection)
{
if (!InsertDetails(oDatabaseHelper, pURPurchaseLine, salesReturnHeaderID))
{
ExecutionState = false;
break;
}
else
ExecutionState = true;
}
if (ExecutionState)
oDatabaseHelper.CommitTransaction();
else
oDatabaseHelper.RollbackTransaction();
}
return salesReturnHeaderID;
}
示例3: 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;
}
}
示例4: SaveAndCommitTransaction
public bool SaveAndCommitTransaction(INVTransferHeader transferHeader, INVTransferLineCollection transferLineCollection)
{
oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
int transferHeaderID;
oDatabaseHelper.BeginTransaction();
if (InsertHeader(oDatabaseHelper, transferHeader, out transferHeaderID))
{
foreach (INVTransferLine transferLine in transferLineCollection)
{
if (!InsertDetailsAndCommit(oDatabaseHelper, transferLine, transferHeaderID))
{
ExecutionState = false;
break;
}
else
ExecutionState = true;
}
if (ExecutionState)
oDatabaseHelper.CommitTransaction();
else
oDatabaseHelper.RollbackTransaction();
}
return ExecutionState;
}
示例5: UpdateTransaction
public bool UpdateTransaction(SALSalesReturnHeader sALSalesReturnHeader, SALSalesReturnLineCollection sALSalesReturnLineCollection)
{
oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
oDatabaseHelper.BeginTransaction();
if (UpdateHeader(oDatabaseHelper, sALSalesReturnHeader))
{
if (DeleteDetails(oDatabaseHelper, (int)sALSalesReturnHeader.SlaesReturnHeaderID, (int)sALSalesReturnHeader.UpdatedBy))
{
foreach (SALSalesReturnLine sALSalesReturnLine in sALSalesReturnLineCollection)
{
if (!InsertDetails(oDatabaseHelper, sALSalesReturnLine, (int)sALSalesReturnHeader.SlaesReturnHeaderID))
{
ExecutionState = false;
break;
}
else
ExecutionState = true;
}
if (ExecutionState)
oDatabaseHelper.CommitTransaction();
else
oDatabaseHelper.RollbackTransaction();
}
else
ExecutionState = false;
}
else
ExecutionState = false;
oDatabaseHelper.Dispose();
return ExecutionState;
}
示例6: 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;
}
示例7: 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;
}
示例8: DeleteTransaction
public bool DeleteTransaction(int ProductStockID,INVAdjustStockCollection ajustStockCollection)
{
oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
oDatabaseHelper.BeginTransaction();
if (DeleteAdjustStock(oDatabaseHelper,ProductStockID))
{
foreach (INVAdjustStock adjustStock in ajustStockCollection)
{
if (!InsertDetailsAndCommit(oDatabaseHelper, adjustStock))
{
ExecutionState = false;
break;
}
else
ExecutionState = true;
}
}
else
ExecutionState = false;
if (ExecutionState)
oDatabaseHelper.CommitTransaction();
else
oDatabaseHelper.RollbackTransaction();
return ExecutionState;
}
示例9: 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;
}
示例10: Deletelines
private static bool Deletelines(DatabaseHelper oDatabaseHelper, int groupID)
{
bool ExecutionState = false;
oDatabaseHelper.AddParameter("@Field", "GroupID");
oDatabaseHelper.AddParameter("@Value", groupID);
// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
oDatabaseHelper.ExecuteScalar("gsp_ADGroupRole_DeleteByField", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);
return ExecutionState;
}
示例11: 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;
}
示例12: GetAllProductsForOpenningQuantities
public static BDProductCollection GetAllProductsForOpenningQuantities(int InventoryID)
{
DatabaseHelper oDatabaseHelper = new DatabaseHelper();
bool ExecutionState = false;
oDatabaseHelper.AddParameter("@InventoryID", InventoryID);
IDataReader dr = oDatabaseHelper.ExecuteReader("usp_GetopeningStockLine", ref ExecutionState);
BDProductCollection BDProductCollection = BDProductBase.PopulateObjectsFromReader(dr);
dr.Close();
oDatabaseHelper.Dispose();
return BDProductCollection;
}
示例13: 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;
}
示例14: InsertProductStockBatches
public bool InsertProductStockBatches(int userID, INVBatch iNVBatch)
{
bool ExecutionState = false;
oDatabaseHelper = new DatabaseHelper();
oDatabaseHelper.AddParameter("@ProductStockID", iNVBatch.ProductStockID);
oDatabaseHelper.AddParameter("@BatchNumber", iNVBatch.BatchNumber);
oDatabaseHelper.AddParameter("@ExpiryDate", iNVBatch.ExpiryDate);
oDatabaseHelper.AddParameter("@Qty", iNVBatch.Qty);
oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
oDatabaseHelper.ExecuteScalar("usp_INVBatch_ProductStockBatch", ref ExecutionState);
oDatabaseHelper.Dispose();
return ExecutionState;
}
示例15: 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;
}