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; }
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; }
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; } }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
public INVTakingInventoryCollection GetNotCommittedTaking() { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // 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_INVTakingInventory_GetNotCommited", ref ExecutionState); INVTakingInventoryCollection list = new INVTakingInventoryCollection(); while (dr.Read()) { INVTakingInventory obj = new INVTakingInventory(); obj.TakingHeaderID = dr.GetInt32(dr.GetOrdinal(INVTakingInventoryFields.TakingHeaderID)); obj.TakingDate = dr.GetDateTime(dr.GetOrdinal(INVTakingInventoryFields.TakingDate)); obj.TakingName = dr.GetString(dr.GetOrdinal(INVTakingInventoryFields.TakingName)); if (!dr.IsDBNull(dr.GetOrdinal(INVTakingInventoryFields.Notes))) { obj.Notes = dr.GetString(dr.GetOrdinal(INVTakingInventoryFields.Notes)); } if (!dr.IsDBNull(dr.GetOrdinal(INVTakingInventoryFields.InventoryID))) { obj.InventoryID = dr.GetInt32(dr.GetOrdinal(INVTakingInventoryFields.InventoryID)); } //if (!dr.IsDBNull(dr.GetOrdinal("UserName"))) //{ // obj.CreatedBy = dr.GetString(dr.GetOrdinal("UserName")); //} if (!dr.IsDBNull(dr.GetOrdinal("InventoryName"))) { obj.InventoryName = dr.GetString(dr.GetOrdinal("InventoryName")); } list.Add(obj); } dr.Close(); oDatabaseHelper.Dispose(); return list; //usp_INVTakingInventory_GetNotCommited }
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; }
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; }
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; }
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; }
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; }
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; }
public bool SaveTransaction(INVAdjustStockCollection ajustStockCollection) { oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; oDatabaseHelper.BeginTransaction(); foreach (INVAdjustStock adjustStock in ajustStockCollection) { if (!InsertDetailsAndCommit(oDatabaseHelper, adjustStock)) { ExecutionState = false; break; } else ExecutionState = true; } if (ExecutionState) oDatabaseHelper.CommitTransaction(); else oDatabaseHelper.RollbackTransaction(); return ExecutionState; }
private bool UpdateSupplierAccount(DatabaseHelper oDatabaseHelper, BDSupplierAccount supplierAccount, bool ExecutionState) { oDatabaseHelper.AddParameter("@SupplierAccountId", supplierAccount.SupplierAccountId); oDatabaseHelper.AddParameter("@PurcaseInvoiceID", supplierAccount.PurcaseInvoiceID); oDatabaseHelper.AddParameter("@PurchaseDate", supplierAccount.PurchaseDate); oDatabaseHelper.AddParameter("@SupplierID", supplierAccount.SupplierID); oDatabaseHelper.AddParameter("@InvoiceNumber", supplierAccount.InvoiceNumber); oDatabaseHelper.AddParameter("@TotalPrice", supplierAccount.TotalPrice); oDatabaseHelper.AddParameter("@PaidAmount", supplierAccount.PaidAmount); oDatabaseHelper.AddParameter("@IsVoid", supplierAccount.IsVoid); oDatabaseHelper.AddParameter("@RemainingAmount", supplierAccount.RemainingAmount); oDatabaseHelper.AddParameter("@CreateDate", supplierAccount.CreateDate); oDatabaseHelper.AddParameter("@CreatedBy", supplierAccount.CreatedBy); oDatabaseHelper.AddParameter("@updateDate", supplierAccount.updateDate); oDatabaseHelper.AddParameter("@UpdatedBy", supplierAccount.UpdatedBy); oDatabaseHelper.AddParameter("@IsDeleted", supplierAccount.IsDeleted); oDatabaseHelper.AddParameter("@DeleteDate", supplierAccount.DeleteDate); oDatabaseHelper.AddParameter("@DeletedBy", supplierAccount.DeletedBy); oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_BDSupplierAccounts_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return ExecutionState; }
private bool DeleteDetails(DatabaseHelper oDatabaseHelper, int SalesReturnHeaderID, int UserID) { bool ExecutionState = false; oDatabaseHelper.AddParameter("@UserID", UserID); oDatabaseHelper.AddParameter("@SalesReturnHeaderID", SalesReturnHeaderID); oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("usp_SALSalesReturnLine_DeleteLines", ref ExecutionState); return ExecutionState; }
private bool UpdateHeader(DatabaseHelper oDatabaseHelper, SALSalesReturnHeader sALSalesReturnHeader) { bool ExecutionState = false; // Pass the value of '_slaesReturnHeaderID' as parameter 'SlaesReturnHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@SlaesReturnHeaderID", sALSalesReturnHeader.SlaesReturnHeaderID); // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure. oDatabaseHelper.AddParameter("@ReturnDate", sALSalesReturnHeader.ReturnDate); // Pass the value of '_originalSalesHeadeID' as parameter 'OriginalSalesHeadeID' of the stored procedure. oDatabaseHelper.AddParameter("@OriginalSalesHeadeID", sALSalesReturnHeader.OriginalSalesHeadeID); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedBy", sALSalesReturnHeader.CreatedBy); // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. oDatabaseHelper.AddParameter("@CreateDate", sALSalesReturnHeader.CreateDate); // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@UpdatedBy", sALSalesReturnHeader.UpdatedBy); // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. oDatabaseHelper.AddParameter("@UpdateDate", sALSalesReturnHeader.UpdateDate); // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. oDatabaseHelper.AddParameter("@IsDeleted", sALSalesReturnHeader.IsDeleted); // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. oDatabaseHelper.AddParameter("@DeletedBy", sALSalesReturnHeader.DeletedBy); // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. oDatabaseHelper.AddParameter("@DeleteDate", sALSalesReturnHeader.DeleteDate); // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. oDatabaseHelper.AddParameter("@IsClosed", sALSalesReturnHeader.IsClosed); // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. oDatabaseHelper.AddParameter("@IsVoid", sALSalesReturnHeader.IsVoid); if (sALSalesReturnHeader.InventoryID != null) oDatabaseHelper.AddParameter("@InventoryID", sALSalesReturnHeader.InventoryID); else oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value); if (sALSalesReturnHeader.ReturnMoney != null) oDatabaseHelper.AddParameter("@ReturnMoney", sALSalesReturnHeader.ReturnMoney); else oDatabaseHelper.AddParameter("@ReturnMoney", DBNull.Value); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("usp_SALSalesReturnHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return ExecutionState; }
private bool InsertDetails(DatabaseHelper oDatabaseHelper, SALSalesReturnLine sALSalesReturnLine, int salesReturnHeaderID) { bool ExecutionState = false; // Pass the value of '_qty' as parameter 'Qty' of the stored procedure. if (sALSalesReturnLine.Qty != null) oDatabaseHelper.AddParameter("@Qty", sALSalesReturnLine.Qty); else oDatabaseHelper.AddParameter("@Qty", DBNull.Value); // Pass the value of '_reason' as parameter 'Reason' of the stored procedure. if (sALSalesReturnLine.Reason != null) oDatabaseHelper.AddParameter("@Reason", sALSalesReturnLine.Reason); else oDatabaseHelper.AddParameter("@Reason", DBNull.Value); // Pass the value of '_originalSalesLineID' as parameter 'OriginalSalesLineID' of the stored procedure. if (sALSalesReturnLine.OriginalSalesLineID != null) oDatabaseHelper.AddParameter("@OriginalSalesLineID", sALSalesReturnLine.OriginalSalesLineID); else oDatabaseHelper.AddParameter("@OriginalSalesLineID", DBNull.Value); // Pass the value of '_batchID' as parameter 'BatchID' of the stored procedure. if (sALSalesReturnLine.BatchID != null) oDatabaseHelper.AddParameter("@BatchID", sALSalesReturnLine.BatchID); else oDatabaseHelper.AddParameter("@BatchID", DBNull.Value); // Pass the value of '_batchNumber' as parameter 'BatchNumber' of the stored procedure. if (sALSalesReturnLine.BatchNumber != null) oDatabaseHelper.AddParameter("@BatchNumber", sALSalesReturnLine.BatchNumber); else oDatabaseHelper.AddParameter("@BatchNumber", DBNull.Value); // Pass the value of '_expiryDate' as parameter 'ExpiryDate' of the stored procedure. if (sALSalesReturnLine.ExpiryDate != null) oDatabaseHelper.AddParameter("@ExpiryDate", sALSalesReturnLine.ExpiryDate); else oDatabaseHelper.AddParameter("@ExpiryDate", DBNull.Value); if (sALSalesReturnLine.StockTypeID != null) oDatabaseHelper.AddParameter("@StockType", sALSalesReturnLine.StockTypeID); else oDatabaseHelper.AddParameter("@StockType", DBNull.Value); oDatabaseHelper.AddParameter("@SalesReturnHeaderID", salesReturnHeaderID); oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("usp_SALSalesReturnLine_InsertCommit", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return ExecutionState; }
private bool InsertHeader(DatabaseHelper oDatabaseHelper, SALSalesReturnHeader sALSalesReturnHeader, out int pK) { bool ExecutionState = false; // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure. if (sALSalesReturnHeader.ReturnDate != null) oDatabaseHelper.AddParameter("@ReturnDate", sALSalesReturnHeader.ReturnDate); else oDatabaseHelper.AddParameter("@ReturnDate", DBNull.Value); // Pass the value of '_originalSalesHeadeID' as parameter 'OriginalSalesHeadeID' of the stored procedure. if (sALSalesReturnHeader.OriginalSalesHeadeID != null) oDatabaseHelper.AddParameter("@OriginalSalesHeadeID", sALSalesReturnHeader.OriginalSalesHeadeID); else oDatabaseHelper.AddParameter("@OriginalSalesHeadeID", DBNull.Value); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (sALSalesReturnHeader.CreatedBy != null) oDatabaseHelper.AddParameter("@CreatedBy", sALSalesReturnHeader.CreatedBy); else oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (sALSalesReturnHeader.CreateDate != null) oDatabaseHelper.AddParameter("@CreateDate", sALSalesReturnHeader.CreateDate); else oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (sALSalesReturnHeader.UpdatedBy != null) oDatabaseHelper.AddParameter("@UpdatedBy", sALSalesReturnHeader.UpdatedBy); else oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (sALSalesReturnHeader.UpdateDate != null) oDatabaseHelper.AddParameter("@UpdateDate", sALSalesReturnHeader.UpdateDate); else oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (sALSalesReturnHeader.IsDeleted != null) oDatabaseHelper.AddParameter("@IsDeleted", sALSalesReturnHeader.IsDeleted); else oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (sALSalesReturnHeader.DeletedBy != null) oDatabaseHelper.AddParameter("@DeletedBy", sALSalesReturnHeader.DeletedBy); else oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. if (sALSalesReturnHeader.DeleteDate != null) oDatabaseHelper.AddParameter("@DeleteDate", sALSalesReturnHeader.DeleteDate); else oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value); // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. if (sALSalesReturnHeader.IsClosed != null) oDatabaseHelper.AddParameter("@IsClosed", sALSalesReturnHeader.IsClosed); else oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value); // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. if (sALSalesReturnHeader.IsVoid != null) oDatabaseHelper.AddParameter("@IsVoid", sALSalesReturnHeader.IsVoid); else oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value); if (sALSalesReturnHeader.InventoryID != null) oDatabaseHelper.AddParameter("@InventoryID", sALSalesReturnHeader.InventoryID); else oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value); if (sALSalesReturnHeader.ReturnMoney != null) oDatabaseHelper.AddParameter("@ReturnMoney", sALSalesReturnHeader.ReturnMoney); else oDatabaseHelper.AddParameter("@ReturnMoney", DBNull.Value); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); try { pK = Convert.ToInt32(oDatabaseHelper.ExecuteScalar("usp_SALSalesReturnHeader_Insert", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState)); // oDatabaseHelper.Dispose(); } catch (Exception ex) { throw; } return ExecutionState; }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="ADUserPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class ADUser</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static ADUser SelectOneWithBDCustomerAccountsUsingCreatedBy(ADUserPrimaryKey pk) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; ADUser obj=null; // Pass the values of all key parameters to the stored procedure. System.Collections.Specialized.NameValueCollection nvc = pk.GetKeysAndValues(); foreach (string key in nvc.Keys) { oDatabaseHelper.AddParameter("@" + key,nvc[key] ); } // 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_SelectOneWithBDCustomerAccountsUsingCreatedBy", ref ExecutionState); if (dr.Read()) { obj= new ADUser(); PopulateObjectFromReader(obj,dr); dr.NextResult(); //Get the child records. obj.BDCustomerAccountCollectionUsingCreatedBy=BDCustomerAccount.PopulateObjectsFromReader(dr); } dr.Close(); oDatabaseHelper.Dispose(); return obj; }
/// <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; }