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 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; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:16 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_salesHeaderID' as parameter 'SalesHeaderID' of the stored procedure. if(_salesHeaderIDNonDefault!=null) oDatabaseHelper.AddParameter("@SalesHeaderID", _salesHeaderIDNonDefault); else oDatabaseHelper.AddParameter("@SalesHeaderID", DBNull.Value ); // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if(_productIDNonDefault!=null) oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault); else oDatabaseHelper.AddParameter("@ProductID", DBNull.Value ); // Pass the value of '_totalQty' as parameter 'TotalQty' of the stored procedure. if(_totalQtyNonDefault!=null) oDatabaseHelper.AddParameter("@TotalQty", _totalQtyNonDefault); else oDatabaseHelper.AddParameter("@TotalQty", DBNull.Value ); // Pass the value of '_totalBonus' as parameter 'TotalBonus' of the stored procedure. if(_totalBonusNonDefault!=null) oDatabaseHelper.AddParameter("@TotalBonus", _totalBonusNonDefault); else oDatabaseHelper.AddParameter("@TotalBonus", DBNull.Value ); // Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure. if(_discountAmountNonDefault!=null) oDatabaseHelper.AddParameter("@DiscountAmount", _discountAmountNonDefault); else oDatabaseHelper.AddParameter("@DiscountAmount", DBNull.Value ); // Pass the value of '_discountRatio' as parameter 'DiscountRatio' of the stored procedure. if(_discountRatioNonDefault!=null) oDatabaseHelper.AddParameter("@DiscountRatio", _discountRatioNonDefault); else oDatabaseHelper.AddParameter("@DiscountRatio", DBNull.Value ); // Pass the value of '_unitPrice' as parameter 'UnitPrice' of the stored procedure. if(_unitPriceNonDefault!=null) oDatabaseHelper.AddParameter("@UnitPrice", _unitPriceNonDefault); else oDatabaseHelper.AddParameter("@UnitPrice", DBNull.Value ); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if(_createdByNonDefault!=null) oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); else oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value ); // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if(_createDateNonDefault!=null) oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault); else oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value ); // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if(_updatedByNonDefault!=null) oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); else oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value ); // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if(_updateDateNonDefault!=null) oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); else oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value ); // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if(_isDeletedNonDefault!=null) oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault); else oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value ); // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if(_deletedByNonDefault!=null) oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault); else oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value ); // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. if(_deleteDateNonDefault!=null) oDatabaseHelper.AddParameter("@DeleteDate", _deleteDateNonDefault); else oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); if(!getBackValues ) { oDatabaseHelper.ExecuteScalar("gsp_SALSalesLine_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_SALSalesLine_Insert_WithDefaultValues_AndReturn", ref ExecutionState); if (dr.Read()) { PopulateObjectFromReader(this,dr); } dr.Close(); } oDatabaseHelper.Dispose(); 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; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 4/4/2015 1:32:30 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if (_productIDNonDefault != null) { oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault); } else { oDatabaseHelper.AddParameter("@ProductID", DBNull.Value); } // Pass the value of '_batchID' as parameter 'BatchID' of the stored procedure. if (_batchIDNonDefault != null) { oDatabaseHelper.AddParameter("@BatchID", _batchIDNonDefault); } else { oDatabaseHelper.AddParameter("@BatchID", DBNull.Value); } // Pass the value of '_qty' as parameter 'Qty' of the stored procedure. if (_qtyNonDefault != null) { oDatabaseHelper.AddParameter("@Qty", _qtyNonDefault); } else { oDatabaseHelper.AddParameter("@Qty", DBNull.Value); } // Pass the value of '_adjustReasonID' as parameter 'AdjustReasonID' of the stored procedure. if (_adjustReasonIDNonDefault != null) { oDatabaseHelper.AddParameter("@AdjustReasonID", _adjustReasonIDNonDefault); } else { oDatabaseHelper.AddParameter("@AdjustReasonID", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (_createdByNonDefault != null) { oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_credateDate' as parameter 'CredateDate' of the stored procedure. if (_credateDateNonDefault != null) { oDatabaseHelper.AddParameter("@CredateDate", _credateDateNonDefault); } else { oDatabaseHelper.AddParameter("@CredateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (_updatedByNonDefault != null) { oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (_updateDateNonDefault != null) { oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_stockTypeID' as parameter 'StockTypeID' of the stored procedure. if (_stockTypeIDNonDefault != null) { oDatabaseHelper.AddParameter("@StockTypeID", _stockTypeIDNonDefault); } else { oDatabaseHelper.AddParameter("@StockTypeID", DBNull.Value); } // Pass the value of '_oldStockTypeID' as parameter 'OldStockTypeID' of the stored procedure. if (_oldStockTypeIDNonDefault != null) { oDatabaseHelper.AddParameter("@OldStockTypeID", _oldStockTypeIDNonDefault); } else { oDatabaseHelper.AddParameter("@OldStockTypeID", DBNull.Value); } // Pass the value of '_inventoryID' as parameter 'InventoryID' of the stored procedure. if (_inventoryIDNonDefault != null) { oDatabaseHelper.AddParameter("@InventoryID", _inventoryIDNonDefault); } else { oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value); } // Pass the value of '_expiryDate' as parameter 'ExpiryDate' of the stored procedure. if (_expiryDateNonDefault != null) { oDatabaseHelper.AddParameter("@ExpiryDate", _expiryDateNonDefault); } else { oDatabaseHelper.AddParameter("@ExpiryDate", DBNull.Value); } // Pass the value of '_batchNumber' as parameter 'BatchNumber' of the stored procedure. if (_batchNumberNonDefault != null) { oDatabaseHelper.AddParameter("@BatchNumber", _batchNumberNonDefault); } else { oDatabaseHelper.AddParameter("@BatchNumber", 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("gsp_INVAdjustStock_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <summary> /// This method will Update one new row into the database using the property Information /// </summary> /// /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:24 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault ); // Pass the value of '_productName' as parameter 'ProductName' of the stored procedure. oDatabaseHelper.AddParameter("@ProductName", _productNameNonDefault ); // Pass the value of '_productGroupID' as parameter 'ProductGroupID' of the stored procedure. oDatabaseHelper.AddParameter("@ProductGroupID", _productGroupIDNonDefault ); // Pass the value of '_productCode' as parameter 'ProductCode' of the stored procedure. oDatabaseHelper.AddParameter("@ProductCode", _productCodeNonDefault ); // Pass the value of '_isAcceptBatch' as parameter 'IsAcceptBatch' of the stored procedure. oDatabaseHelper.AddParameter("@IsAcceptBatch", _isAcceptBatchNonDefault ); // Pass the value of '_productPrice' as parameter 'ProductPrice' of the stored procedure. oDatabaseHelper.AddParameter("@ProductPrice", _productPriceNonDefault ); // Pass the value of '_isFixedPrice' as parameter 'IsFixedPrice' of the stored procedure. oDatabaseHelper.AddParameter("@IsFixedPrice", _isFixedPriceNonDefault ); // Pass the value of '_hasDiscount' as parameter 'HasDiscount' of the stored procedure. oDatabaseHelper.AddParameter("@HasDiscount", _hasDiscountNonDefault ); // Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure. oDatabaseHelper.AddParameter("@DiscountAmount", _discountAmountNonDefault ); // Pass the value of '_descountRatio' as parameter 'DescountRatio' of the stored procedure. oDatabaseHelper.AddParameter("@DescountRatio", _descountRatioNonDefault ); // Pass the value of '_isActive' as parameter 'IsActive' of the stored procedure. oDatabaseHelper.AddParameter("@IsActive", _isActiveNonDefault ); // Pass the value of '_notes' as parameter 'Notes' of the stored procedure. oDatabaseHelper.AddParameter("@Notes", _notesNonDefault ); // Pass the value of '_minPrice' as parameter 'MinPrice' of the stored procedure. oDatabaseHelper.AddParameter("@MinPrice", _minPriceNonDefault ); // Pass the value of '_maxPrice' as parameter 'MaxPrice' of the stored procedure. oDatabaseHelper.AddParameter("@MaxPrice", _maxPriceNonDefault ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_BDProduct_Update", ref ExecutionState); oDatabaseHelper.Dispose(); return ExecutionState; }
/// <summary> /// This method will Delete one row from the database using the primary key information /// </summary> /// /// <param name="pk" type="ADUserPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static bool Delete(ADUserPrimaryKey pk) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // 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); oDatabaseHelper.ExecuteScalar("gsp_ADUser_Delete", ref ExecutionState); oDatabaseHelper.Dispose(); 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 insert one new row into the database using the property Information /// </summary> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 12/27/2014 6:55:54 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_supplierCode' as parameter 'SupplierCode' of the stored procedure. if (_supplierCodeNonDefault != null) { oDatabaseHelper.AddParameter("@SupplierCode", _supplierCodeNonDefault); } else { oDatabaseHelper.AddParameter("@SupplierCode", DBNull.Value); } // Pass the value of '_supplierName' as parameter 'SupplierName' of the stored procedure. if (_supplierNameNonDefault != null) { oDatabaseHelper.AddParameter("@SupplierName", _supplierNameNonDefault); } else { oDatabaseHelper.AddParameter("@SupplierName", DBNull.Value); } // Pass the value of '_address' as parameter 'Address' of the stored procedure. if (_addressNonDefault != null) { oDatabaseHelper.AddParameter("@Address", _addressNonDefault); } else { oDatabaseHelper.AddParameter("@Address", DBNull.Value); } // Pass the value of '_phone1' as parameter 'Phone1' of the stored procedure. if (_phone1NonDefault != null) { oDatabaseHelper.AddParameter("@Phone1", _phone1NonDefault); } else { oDatabaseHelper.AddParameter("@Phone1", DBNull.Value); } // Pass the value of '_phone2' as parameter 'Phone2' of the stored procedure. if (_phone2NonDefault != null) { oDatabaseHelper.AddParameter("@Phone2", _phone2NonDefault); } else { oDatabaseHelper.AddParameter("@Phone2", DBNull.Value); } // Pass the value of '_mobile1' as parameter 'Mobile1' of the stored procedure. if (_mobile1NonDefault != null) { oDatabaseHelper.AddParameter("@Mobile1", _mobile1NonDefault); } else { oDatabaseHelper.AddParameter("@Mobile1", DBNull.Value); } // Pass the value of '_mobile2' as parameter 'Mobile2' of the stored procedure. if (_mobile2NonDefault != null) { oDatabaseHelper.AddParameter("@Mobile2", _mobile2NonDefault); } else { oDatabaseHelper.AddParameter("@Mobile2", DBNull.Value); } // Pass the value of '_email' as parameter 'Email' of the stored procedure. if (_emailNonDefault != null) { oDatabaseHelper.AddParameter("@Email", _emailNonDefault); } else { oDatabaseHelper.AddParameter("@Email", DBNull.Value); } // Pass the value of '_isActive' as parameter 'IsActive' of the stored procedure. if (_isActiveNonDefault != null) { oDatabaseHelper.AddParameter("@IsActive", _isActiveNonDefault); } else { oDatabaseHelper.AddParameter("@IsActive", 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("gsp_BDSupplier_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <summary> /// This method will Update one new row into the database using the property Information /// </summary> /// /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:09 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_adjustStockReasonID' as parameter 'AdjustStockReasonID' of the stored procedure. oDatabaseHelper.AddParameter("@AdjustStockReasonID", _adjustStockReasonIDNonDefault ); // Pass the value of '_adjustStockreasonName' as parameter 'AdjustStockreasonName' of the stored procedure. oDatabaseHelper.AddParameter("@AdjustStockreasonName", _adjustStockreasonNameNonDefault ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_INVAdjustStockReason_Update", ref ExecutionState); oDatabaseHelper.Dispose(); return ExecutionState; }
/// <summary> /// This method will Update one new row into the database using the property Information /// </summary> /// /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:36:58 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_iNVTransferHeaderID' as parameter 'INVTransferHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@INVTransferHeaderID", _iNVTransferHeaderIDNonDefault); // Pass the value of '_transferDate' as parameter 'TransferDate' of the stored procedure. oDatabaseHelper.AddParameter("@TransferDate", _transferDateNonDefault); // Pass the value of '_fromInventoryID' as parameter 'FromInventoryID' of the stored procedure. oDatabaseHelper.AddParameter("@FromInventoryID", _fromInventoryIDNonDefault); // Pass the value of '_toInventoryID' as parameter 'ToInventoryID' of the stored procedure. oDatabaseHelper.AddParameter("@ToInventoryID", _toInventoryIDNonDefault); // Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure. oDatabaseHelper.AddParameter("@InvoiceNumber", _invoiceNumberNonDefault); // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure. oDatabaseHelper.AddParameter("@InvoiceDate", _invoiceDateNonDefault); // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. oDatabaseHelper.AddParameter("@IsVoid", _isVoidNonDefault); // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure. oDatabaseHelper.AddParameter("@IsPrinted", _isPrintedNonDefault); // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. oDatabaseHelper.AddParameter("@IsClosed", _isClosedNonDefault); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault); // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault); // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault); // Pass the value of '_deletedDate' as parameter 'DeletedDate' of the stored procedure. oDatabaseHelper.AddParameter("@DeletedDate", _deletedDateNonDefault); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_INVTransferHeader_Update", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 12/27/2014 6:55:54 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_supplierCode' as parameter 'SupplierCode' of the stored procedure. if (_supplierCodeNonDefault != null) { oDatabaseHelper.AddParameter("@SupplierCode", _supplierCodeNonDefault); } else { oDatabaseHelper.AddParameter("@SupplierCode", DBNull.Value); } // Pass the value of '_supplierName' as parameter 'SupplierName' of the stored procedure. if (_supplierNameNonDefault != null) { oDatabaseHelper.AddParameter("@SupplierName", _supplierNameNonDefault); } else { oDatabaseHelper.AddParameter("@SupplierName", DBNull.Value); } // Pass the value of '_address' as parameter 'Address' of the stored procedure. if (_addressNonDefault != null) { oDatabaseHelper.AddParameter("@Address", _addressNonDefault); } else { oDatabaseHelper.AddParameter("@Address", DBNull.Value); } // Pass the value of '_phone1' as parameter 'Phone1' of the stored procedure. if (_phone1NonDefault != null) { oDatabaseHelper.AddParameter("@Phone1", _phone1NonDefault); } else { oDatabaseHelper.AddParameter("@Phone1", DBNull.Value); } // Pass the value of '_phone2' as parameter 'Phone2' of the stored procedure. if (_phone2NonDefault != null) { oDatabaseHelper.AddParameter("@Phone2", _phone2NonDefault); } else { oDatabaseHelper.AddParameter("@Phone2", DBNull.Value); } // Pass the value of '_mobile1' as parameter 'Mobile1' of the stored procedure. if (_mobile1NonDefault != null) { oDatabaseHelper.AddParameter("@Mobile1", _mobile1NonDefault); } else { oDatabaseHelper.AddParameter("@Mobile1", DBNull.Value); } // Pass the value of '_mobile2' as parameter 'Mobile2' of the stored procedure. if (_mobile2NonDefault != null) { oDatabaseHelper.AddParameter("@Mobile2", _mobile2NonDefault); } else { oDatabaseHelper.AddParameter("@Mobile2", DBNull.Value); } // Pass the value of '_email' as parameter 'Email' of the stored procedure. if (_emailNonDefault != null) { oDatabaseHelper.AddParameter("@Email", _emailNonDefault); } else { oDatabaseHelper.AddParameter("@Email", DBNull.Value); } // Pass the value of '_isActive' as parameter 'IsActive' of the stored procedure. if (_isActiveNonDefault != null) { oDatabaseHelper.AddParameter("@IsActive", _isActiveNonDefault); } else { oDatabaseHelper.AddParameter("@IsActive", DBNull.Value); } // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); if (!getBackValues) { oDatabaseHelper.ExecuteScalar("gsp_BDSupplier_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_BDSupplier_Insert_WithDefaultValues_AndReturn", ref ExecutionState); if (dr.Read()) { PopulateObjectFromReader(this, dr); } dr.Close(); } oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:36:58 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_transferDate' as parameter 'TransferDate' of the stored procedure. if (_transferDateNonDefault != null) { oDatabaseHelper.AddParameter("@TransferDate", _transferDateNonDefault); } else { oDatabaseHelper.AddParameter("@TransferDate", DBNull.Value); } // Pass the value of '_fromInventoryID' as parameter 'FromInventoryID' of the stored procedure. if (_fromInventoryIDNonDefault != null) { oDatabaseHelper.AddParameter("@FromInventoryID", _fromInventoryIDNonDefault); } else { oDatabaseHelper.AddParameter("@FromInventoryID", DBNull.Value); } // Pass the value of '_toInventoryID' as parameter 'ToInventoryID' of the stored procedure. if (_toInventoryIDNonDefault != null) { oDatabaseHelper.AddParameter("@ToInventoryID", _toInventoryIDNonDefault); } else { oDatabaseHelper.AddParameter("@ToInventoryID", DBNull.Value); } // Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure. if (_invoiceNumberNonDefault != null) { oDatabaseHelper.AddParameter("@InvoiceNumber", _invoiceNumberNonDefault); } else { oDatabaseHelper.AddParameter("@InvoiceNumber", DBNull.Value); } // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure. if (_invoiceDateNonDefault != null) { oDatabaseHelper.AddParameter("@InvoiceDate", _invoiceDateNonDefault); } else { oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value); } // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. if (_isVoidNonDefault != null) { oDatabaseHelper.AddParameter("@IsVoid", _isVoidNonDefault); } else { oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value); } // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure. if (_isPrintedNonDefault != null) { oDatabaseHelper.AddParameter("@IsPrinted", _isPrintedNonDefault); } else { oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value); } // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. if (_isClosedNonDefault != null) { oDatabaseHelper.AddParameter("@IsClosed", _isClosedNonDefault); } else { oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (_createdByNonDefault != null) { oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (_createDateNonDefault != null) { oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (_updatedByNonDefault != null) { oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (_updateDateNonDefault != null) { oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (_isDeletedNonDefault != null) { oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (_deletedByNonDefault != null) { oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deletedDate' as parameter 'DeletedDate' of the stored procedure. if (_deletedDateNonDefault != null) { oDatabaseHelper.AddParameter("@DeletedDate", _deletedDateNonDefault); } else { oDatabaseHelper.AddParameter("@DeletedDate", DBNull.Value); } // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); if (!getBackValues) { oDatabaseHelper.ExecuteScalar("gsp_INVTransferHeader_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_INVTransferHeader_Insert_WithDefaultValues_AndReturn", ref ExecutionState); if (dr.Read()) { PopulateObjectFromReader(this, dr); } dr.Close(); } oDatabaseHelper.Dispose(); 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 CommitDetails(DatabaseHelper oDatabaseHelper, INVTransferLine transferLine) { bool ExecutionState = false; // Pass the value of '_TransferHeaderID' as parameter 'TransferHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@TransferLineID", transferLine.TransferLineID); oDatabaseHelper.AddParameter("@TransferHeaderID", transferLine.TransferHeaderID); // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if (transferLine.ProductID != null) oDatabaseHelper.AddParameter("@ProductID", transferLine.ProductID); else oDatabaseHelper.AddParameter("@ProductID", DBNull.Value); // Pass the value of '_Qty' as parameter 'Qty' of the stored procedure. if (transferLine.Qty != null) oDatabaseHelper.AddParameter("@Qty", transferLine.Qty); else oDatabaseHelper.AddParameter("@Qty", DBNull.Value); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (transferLine.CreatedBy != null) oDatabaseHelper.AddParameter("@CreatedBy", transferLine.CreatedBy); else oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (transferLine.CreateDate != null) oDatabaseHelper.AddParameter("@CreateDate", transferLine.CreateDate); else oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (transferLine.UpdatedBy != null) oDatabaseHelper.AddParameter("@UpdatedBy", transferLine.UpdatedBy); else oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (transferLine.UpdateDate != null) oDatabaseHelper.AddParameter("@UpdateDate", transferLine.UpdateDate); else oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (transferLine.IsDeleted != null) oDatabaseHelper.AddParameter("@IsDeleted", transferLine.IsDeleted); else oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (transferLine.DeletedBy != null) oDatabaseHelper.AddParameter("@DeletedBy", transferLine.DeletedBy); else oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. if (transferLine.DeletedDate != null) oDatabaseHelper.AddParameter("@DeletedDate", transferLine.DeletedDate); else oDatabaseHelper.AddParameter("@DeletedDate", 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_INVTransferLine_Commit", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return ExecutionState; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:26 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_qty' as parameter 'Qty' of the stored procedure. if (_qtyNonDefault != null) { oDatabaseHelper.AddParameter("@Qty", _qtyNonDefault); } else { oDatabaseHelper.AddParameter("@Qty", DBNull.Value); } // Pass the value of '_reason' as parameter 'Reason' of the stored procedure. if (_reasonNonDefault != null) { oDatabaseHelper.AddParameter("@Reason", _reasonNonDefault); } else { oDatabaseHelper.AddParameter("@Reason", DBNull.Value); } // Pass the value of '_originalpurchaseLineID' as parameter 'OriginalpurchaseLineID' of the stored procedure. if (_originalpurchaseLineIDNonDefault != null) { oDatabaseHelper.AddParameter("@OriginalpurchaseLineID", _originalpurchaseLineIDNonDefault); } else { oDatabaseHelper.AddParameter("@OriginalpurchaseLineID", DBNull.Value); } // Pass the value of '_batchID' as parameter 'BatchID' of the stored procedure. if (_batchIDNonDefault != null) { oDatabaseHelper.AddParameter("@BatchID", _batchIDNonDefault); } else { oDatabaseHelper.AddParameter("@BatchID", DBNull.Value); } // Pass the value of '_batchNumber' as parameter 'BatchNumber' of the stored procedure. if (_batchNumberNonDefault != null) { oDatabaseHelper.AddParameter("@BatchNumber", _batchNumberNonDefault); } else { oDatabaseHelper.AddParameter("@BatchNumber", DBNull.Value); } // Pass the value of '_expiryDate' as parameter 'ExpiryDate' of the stored procedure. if (_expiryDateNonDefault != null) { oDatabaseHelper.AddParameter("@ExpiryDate", _expiryDateNonDefault); } else { oDatabaseHelper.AddParameter("@ExpiryDate", DBNull.Value); } // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); if (!getBackValues) { oDatabaseHelper.ExecuteScalar("gsp_PURPurchaseReturnLine_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_PURPurchaseReturnLine_Insert_WithDefaultValues_AndReturn", ref ExecutionState); if (dr.Read()) { PopulateObjectFromReader(this, dr); } dr.Close(); } oDatabaseHelper.Dispose(); 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 insert one new row into the database using the property Information /// </summary> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:26 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_qty' as parameter 'Qty' of the stored procedure. if (_qtyNonDefault != null) { oDatabaseHelper.AddParameter("@Qty", _qtyNonDefault); } else { oDatabaseHelper.AddParameter("@Qty", DBNull.Value); } // Pass the value of '_reason' as parameter 'Reason' of the stored procedure. if (_reasonNonDefault != null) { oDatabaseHelper.AddParameter("@Reason", _reasonNonDefault); } else { oDatabaseHelper.AddParameter("@Reason", DBNull.Value); } // Pass the value of '_originalpurchaseLineID' as parameter 'OriginalpurchaseLineID' of the stored procedure. if (_originalpurchaseLineIDNonDefault != null) { oDatabaseHelper.AddParameter("@OriginalpurchaseLineID", _originalpurchaseLineIDNonDefault); } else { oDatabaseHelper.AddParameter("@OriginalpurchaseLineID", DBNull.Value); } // Pass the value of '_batchID' as parameter 'BatchID' of the stored procedure. if (_batchIDNonDefault != null) { oDatabaseHelper.AddParameter("@BatchID", _batchIDNonDefault); } else { oDatabaseHelper.AddParameter("@BatchID", DBNull.Value); } // Pass the value of '_batchNumber' as parameter 'BatchNumber' of the stored procedure. if (_batchNumberNonDefault != null) { oDatabaseHelper.AddParameter("@BatchNumber", _batchNumberNonDefault); } else { oDatabaseHelper.AddParameter("@BatchNumber", DBNull.Value); } // Pass the value of '_expiryDate' as parameter 'ExpiryDate' of the stored procedure. if (_expiryDateNonDefault != null) { oDatabaseHelper.AddParameter("@ExpiryDate", _expiryDateNonDefault); } else { oDatabaseHelper.AddParameter("@ExpiryDate", 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("gsp_PURPurchaseReturnLine_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <summary> /// This method will Update one new row into the database using the property Information /// </summary> /// /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_userID' as parameter 'UserID' of the stored procedure. oDatabaseHelper.AddParameter("@UserID", _userIDNonDefault ); // Pass the value of '_userFullName' as parameter 'UserFullName' of the stored procedure. oDatabaseHelper.AddParameter("@UserFullName", _userFullNameNonDefault ); // Pass the value of '_userName' as parameter 'UserName' of the stored procedure. oDatabaseHelper.AddParameter("@UserName", _userNameNonDefault ); // Pass the value of '_password' as parameter 'Password' of the stored procedure. oDatabaseHelper.AddParameter("@Password", _passwordNonDefault ); // Pass the value of '_groupID' as parameter 'GroupID' of the stored procedure. oDatabaseHelper.AddParameter("@GroupID", _groupIDNonDefault ); // Pass the value of '_email' as parameter 'Email' of the stored procedure. oDatabaseHelper.AddParameter("@Email", _emailNonDefault ); // Pass the value of '_address' as parameter 'Address' of the stored procedure. oDatabaseHelper.AddParameter("@Address", _addressNonDefault ); // Pass the value of '_phone' as parameter 'Phone' of the stored procedure. oDatabaseHelper.AddParameter("@Phone", _phoneNonDefault ); // Pass the value of '_mobile' as parameter 'Mobile' of the stored procedure. oDatabaseHelper.AddParameter("@Mobile", _mobileNonDefault ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_ADUser_Update", ref ExecutionState); oDatabaseHelper.Dispose(); return ExecutionState; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 12/27/2014 6:56:12 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure. if (_returnDateNonDefault != null) { oDatabaseHelper.AddParameter("@ReturnDate", _returnDateNonDefault); } else { oDatabaseHelper.AddParameter("@ReturnDate", DBNull.Value); } // Pass the value of '_originalHeaderID' as parameter 'OriginalHeaderID' of the stored procedure. if (_originalHeaderIDNonDefault != null) { oDatabaseHelper.AddParameter("@OriginalHeaderID", _originalHeaderIDNonDefault); } else { oDatabaseHelper.AddParameter("@OriginalHeaderID", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (_createdByNonDefault != null) { oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (_createDateNonDefault != null) { oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (_updatedByNonDefault != null) { oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (_updateDateNonDefault != null) { oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (_isDeletedNonDefault != null) { oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (_deletedByNonDefault != null) { oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. if (_deleteDateNonDefault != null) { oDatabaseHelper.AddParameter("@DeleteDate", _deleteDateNonDefault); } else { oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value); } // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); if (!getBackValues) { oDatabaseHelper.ExecuteScalar("gsp_PURPurchaseReturnHeader_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_PURPurchaseReturnHeader_Insert_WithDefaultValues_AndReturn", ref ExecutionState); if (dr.Read()) { PopulateObjectFromReader(this, dr); } dr.Close(); } oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <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; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 12/27/2014 6:56:12 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure. if (_returnDateNonDefault != null) { oDatabaseHelper.AddParameter("@ReturnDate", _returnDateNonDefault); } else { oDatabaseHelper.AddParameter("@ReturnDate", DBNull.Value); } // Pass the value of '_originalHeaderID' as parameter 'OriginalHeaderID' of the stored procedure. if (_originalHeaderIDNonDefault != null) { oDatabaseHelper.AddParameter("@OriginalHeaderID", _originalHeaderIDNonDefault); } else { oDatabaseHelper.AddParameter("@OriginalHeaderID", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (_createdByNonDefault != null) { oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (_createDateNonDefault != null) { oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (_updatedByNonDefault != null) { oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (_updateDateNonDefault != null) { oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (_isDeletedNonDefault != null) { oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (_deletedByNonDefault != null) { oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. if (_deleteDateNonDefault != null) { oDatabaseHelper.AddParameter("@DeleteDate", _deleteDateNonDefault); } else { oDatabaseHelper.AddParameter("@DeleteDate", 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("gsp_PURPurchaseReturnHeader_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); 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 InsertDetailsAndCommit(DatabaseHelper oDatabaseHelper, INVAdjustStock adjustStock) { bool ExecutionState = false; // Pass the value of '_TransferHeaderID' as parameter 'TransferHeaderID' of the stored procedure. if (adjustStock.ProductID != null) { oDatabaseHelper.AddParameter("@ProductID", adjustStock.ProductID); } else { oDatabaseHelper.AddParameter("@ProductID", DBNull.Value); } // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if (adjustStock.StockTypeID != null) { oDatabaseHelper.AddParameter("@StockTypeID", adjustStock.StockTypeID); } else { oDatabaseHelper.AddParameter("@StockTypeID", DBNull.Value); } // Pass the value of '_Qty' as parameter 'Qty' of the stored procedure. if (adjustStock.InventoryID != null) { oDatabaseHelper.AddParameter("@InventoryID", adjustStock.InventoryID); } else { oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (adjustStock.CreatedBy != null) { oDatabaseHelper.AddParameter("@CreatedBy", adjustStock.CreatedBy); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (adjustStock.Qty != null) { oDatabaseHelper.AddParameter("@BatchQty", adjustStock.Qty); } else { oDatabaseHelper.AddParameter("@BatchQty", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (!string.IsNullOrEmpty(adjustStock.BatchNumber)) { oDatabaseHelper.AddParameter("@BatchNumber", adjustStock.BatchNumber); } else { oDatabaseHelper.AddParameter("@BatchNumber", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (adjustStock.ExpiryDate != null) { oDatabaseHelper.AddParameter("@ExpiryDate", adjustStock.ExpiryDate); } else { oDatabaseHelper.AddParameter("@ExpiryDate", DBNull.Value); } oDatabaseHelper.ExecuteScalar("usp_INVInventory_AddQtyToInventory", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return(ExecutionState); }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:24 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_productName' as parameter 'ProductName' of the stored procedure. if(_productNameNonDefault!=null) oDatabaseHelper.AddParameter("@ProductName", _productNameNonDefault); else oDatabaseHelper.AddParameter("@ProductName", DBNull.Value ); // Pass the value of '_productGroupID' as parameter 'ProductGroupID' of the stored procedure. if(_productGroupIDNonDefault!=null) oDatabaseHelper.AddParameter("@ProductGroupID", _productGroupIDNonDefault); else oDatabaseHelper.AddParameter("@ProductGroupID", DBNull.Value ); // Pass the value of '_productCode' as parameter 'ProductCode' of the stored procedure. if(_productCodeNonDefault!=null) oDatabaseHelper.AddParameter("@ProductCode", _productCodeNonDefault); else oDatabaseHelper.AddParameter("@ProductCode", DBNull.Value ); // Pass the value of '_isAcceptBatch' as parameter 'IsAcceptBatch' of the stored procedure. if(_isAcceptBatchNonDefault!=null) oDatabaseHelper.AddParameter("@IsAcceptBatch", _isAcceptBatchNonDefault); else oDatabaseHelper.AddParameter("@IsAcceptBatch", DBNull.Value ); // Pass the value of '_productPrice' as parameter 'ProductPrice' of the stored procedure. if(_productPriceNonDefault!=null) oDatabaseHelper.AddParameter("@ProductPrice", _productPriceNonDefault); else oDatabaseHelper.AddParameter("@ProductPrice", DBNull.Value ); // Pass the value of '_isFixedPrice' as parameter 'IsFixedPrice' of the stored procedure. if(_isFixedPriceNonDefault!=null) oDatabaseHelper.AddParameter("@IsFixedPrice", _isFixedPriceNonDefault); else oDatabaseHelper.AddParameter("@IsFixedPrice", DBNull.Value ); // Pass the value of '_hasDiscount' as parameter 'HasDiscount' of the stored procedure. if(_hasDiscountNonDefault!=null) oDatabaseHelper.AddParameter("@HasDiscount", _hasDiscountNonDefault); else oDatabaseHelper.AddParameter("@HasDiscount", DBNull.Value ); // Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure. if(_discountAmountNonDefault!=null) oDatabaseHelper.AddParameter("@DiscountAmount", _discountAmountNonDefault); else oDatabaseHelper.AddParameter("@DiscountAmount", DBNull.Value ); // Pass the value of '_descountRatio' as parameter 'DescountRatio' of the stored procedure. if(_descountRatioNonDefault!=null) oDatabaseHelper.AddParameter("@DescountRatio", _descountRatioNonDefault); else oDatabaseHelper.AddParameter("@DescountRatio", DBNull.Value ); // Pass the value of '_isActive' as parameter 'IsActive' of the stored procedure. if(_isActiveNonDefault!=null) oDatabaseHelper.AddParameter("@IsActive", _isActiveNonDefault); else oDatabaseHelper.AddParameter("@IsActive", DBNull.Value ); // Pass the value of '_notes' as parameter 'Notes' of the stored procedure. if(_notesNonDefault!=null) oDatabaseHelper.AddParameter("@Notes", _notesNonDefault); else oDatabaseHelper.AddParameter("@Notes", DBNull.Value ); // Pass the value of '_minPrice' as parameter 'MinPrice' of the stored procedure. if(_minPriceNonDefault!=null) oDatabaseHelper.AddParameter("@MinPrice", _minPriceNonDefault); else oDatabaseHelper.AddParameter("@MinPrice", DBNull.Value ); // Pass the value of '_maxPrice' as parameter 'MaxPrice' of the stored procedure. if(_maxPriceNonDefault!=null) oDatabaseHelper.AddParameter("@MaxPrice", _maxPriceNonDefault); else oDatabaseHelper.AddParameter("@MaxPrice", DBNull.Value ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); if(!getBackValues ) { oDatabaseHelper.ExecuteScalar("gsp_BDProduct_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_BDProduct_Insert_WithDefaultValues_AndReturn", ref ExecutionState); if (dr.Read()) { PopulateObjectFromReader(this,dr); } dr.Close(); } oDatabaseHelper.Dispose(); return ExecutionState; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:10 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_takingHeaderID' as parameter 'TakingHeaderID' of the stored procedure. if (_takingHeaderIDNonDefault != null) { oDatabaseHelper.AddParameter("@TakingHeaderID", _takingHeaderIDNonDefault); } else { oDatabaseHelper.AddParameter("@TakingHeaderID", DBNull.Value); } // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if (_productIDNonDefault != null) { oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault); } else { oDatabaseHelper.AddParameter("@ProductID", DBNull.Value); } // Pass the value of '_actualQty' as parameter 'ActualQty' of the stored procedure. if (_actualQtyNonDefault != null) { oDatabaseHelper.AddParameter("@ActualQty", _actualQtyNonDefault); } else { oDatabaseHelper.AddParameter("@ActualQty", DBNull.Value); } // Pass the value of '_expectedQty' as parameter 'ExpectedQty' of the stored procedure. if (_expectedQtyNonDefault != null) { oDatabaseHelper.AddParameter("@ExpectedQty", _expectedQtyNonDefault); } else { oDatabaseHelper.AddParameter("@ExpectedQty", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (_createdByNonDefault != null) { oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (_createDateNonDefault != null) { oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (_updatedByNonDefault != null) { oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (_updateDateNonDefault != null) { oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (_isDeletedNonDefault != null) { oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (_deletedByNonDefault != null) { oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. if (_deleteDateNonDefault != null) { oDatabaseHelper.AddParameter("@DeleteDate", _deleteDateNonDefault); } else { oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value); } // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); if (!getBackValues) { oDatabaseHelper.ExecuteScalar("gsp_INVTakingInventoryLine_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_INVTakingInventoryLine_Insert_WithDefaultValues_AndReturn", ref ExecutionState); if (dr.Read()) { PopulateObjectFromReader(this, dr); } dr.Close(); } oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <summary> /// This method will Update one new row into the database using the property Information /// </summary> /// /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:14 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_productStockBatchID' as parameter 'ProductStockBatchID' of the stored procedure. oDatabaseHelper.AddParameter("@ProductStockBatchID", _productStockBatchIDNonDefault ); // Pass the value of '_productStockID' as parameter 'ProductStockID' of the stored procedure. oDatabaseHelper.AddParameter("@ProductStockID", _productStockIDNonDefault ); // Pass the value of '_batchID' as parameter 'BatchID' of the stored procedure. oDatabaseHelper.AddParameter("@BatchID", _batchIDNonDefault ); // Pass the value of '_qty' as parameter 'Qty' of the stored procedure. oDatabaseHelper.AddParameter("@Qty", _qtyNonDefault ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_INVProductStockBatch_Update", ref ExecutionState); oDatabaseHelper.Dispose(); return ExecutionState; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 12/27/2014 6:56:03 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_salesHeaderID' as parameter 'SalesHeaderID' of the stored procedure. if (_salesHeaderIDNonDefault != null) { oDatabaseHelper.AddParameter("@SalesHeaderID", _salesHeaderIDNonDefault); } else { oDatabaseHelper.AddParameter("@SalesHeaderID", DBNull.Value); } // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if (_productIDNonDefault != null) { oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault); } else { oDatabaseHelper.AddParameter("@ProductID", DBNull.Value); } // Pass the value of '_totalQty' as parameter 'TotalQty' of the stored procedure. if (_totalQtyNonDefault != null) { oDatabaseHelper.AddParameter("@TotalQty", _totalQtyNonDefault); } else { oDatabaseHelper.AddParameter("@TotalQty", DBNull.Value); } // Pass the value of '_totalBonus' as parameter 'TotalBonus' of the stored procedure. if (_totalBonusNonDefault != null) { oDatabaseHelper.AddParameter("@TotalBonus", _totalBonusNonDefault); } else { oDatabaseHelper.AddParameter("@TotalBonus", DBNull.Value); } // Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure. if (_discountAmountNonDefault != null) { oDatabaseHelper.AddParameter("@DiscountAmount", _discountAmountNonDefault); } else { oDatabaseHelper.AddParameter("@DiscountAmount", DBNull.Value); } // Pass the value of '_discountRatio' as parameter 'DiscountRatio' of the stored procedure. if (_discountRatioNonDefault != null) { oDatabaseHelper.AddParameter("@DiscountRatio", _discountRatioNonDefault); } else { oDatabaseHelper.AddParameter("@DiscountRatio", DBNull.Value); } // Pass the value of '_unitPrice' as parameter 'UnitPrice' of the stored procedure. if (_unitPriceNonDefault != null) { oDatabaseHelper.AddParameter("@UnitPrice", _unitPriceNonDefault); } else { oDatabaseHelper.AddParameter("@UnitPrice", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (_createdByNonDefault != null) { oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (_createDateNonDefault != null) { oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (_updatedByNonDefault != null) { oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (_updateDateNonDefault != null) { oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (_isDeletedNonDefault != null) { oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (_deletedByNonDefault != null) { oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. if (_deleteDateNonDefault != null) { oDatabaseHelper.AddParameter("@DeleteDate", _deleteDateNonDefault); } else { oDatabaseHelper.AddParameter("@DeleteDate", 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("gsp_SALSalesLine_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <summary> /// This method will Update one new row into the database using the property Information /// </summary> /// /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:16 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_salesLineID' as parameter 'SalesLineID' of the stored procedure. oDatabaseHelper.AddParameter("@SalesLineID", _salesLineIDNonDefault ); // Pass the value of '_salesHeaderID' as parameter 'SalesHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@SalesHeaderID", _salesHeaderIDNonDefault ); // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault ); // Pass the value of '_totalQty' as parameter 'TotalQty' of the stored procedure. oDatabaseHelper.AddParameter("@TotalQty", _totalQtyNonDefault ); // Pass the value of '_totalBonus' as parameter 'TotalBonus' of the stored procedure. oDatabaseHelper.AddParameter("@TotalBonus", _totalBonusNonDefault ); // Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure. oDatabaseHelper.AddParameter("@DiscountAmount", _discountAmountNonDefault ); // Pass the value of '_discountRatio' as parameter 'DiscountRatio' of the stored procedure. oDatabaseHelper.AddParameter("@DiscountRatio", _discountRatioNonDefault ); // Pass the value of '_unitPrice' as parameter 'UnitPrice' of the stored procedure. oDatabaseHelper.AddParameter("@UnitPrice", _unitPriceNonDefault ); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault ); // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault ); // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault ); // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault ); // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault ); // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault ); // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. oDatabaseHelper.AddParameter("@DeleteDate", _deleteDateNonDefault ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_SALSalesLine_Update", ref ExecutionState); 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; }
private bool UpdatePurchaseHeader(DatabaseHelper oDatabaseHelper, PURPurchaseHeader purchaseHeader) { bool ExecutionState = false; // Pass the value of '_salesHeaderID' as parameter 'PurchaseHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@PurcaseHeaderID", purchaseHeader.PurcaseHeaderID); oDatabaseHelper.AddParameter("@PurchaseDate", purchaseHeader.PurchaseDate); // Pass the value of '_customerID' as parameter 'SupplierID' of the stored procedure. if (purchaseHeader.SupplierID != null) oDatabaseHelper.AddParameter("@SupplierID", purchaseHeader.SupplierID); else oDatabaseHelper.AddParameter("@SupplierID", DBNull.Value); // Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure. oDatabaseHelper.AddParameter("@InvoiceNumber", purchaseHeader.InvoiceNumber); // Pass the value of '_invoiceDate' as parameter 'Notes' of the stored procedure. if (purchaseHeader.Notes != null) oDatabaseHelper.AddParameter("@Notes", purchaseHeader.Notes); else oDatabaseHelper.AddParameter("@Notes", DBNull.Value); // Pass the value of '_invoiceDate' as parameter 'InventoryID' of the stored procedure. if (purchaseHeader.InventoryID != null) oDatabaseHelper.AddParameter("@InventoryID", purchaseHeader.InventoryID); else oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value); // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure. if (purchaseHeader.InvoiceDate != null) oDatabaseHelper.AddParameter("@InvoiceDate", purchaseHeader.InvoiceDate); else oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value); // Pass the value of '_paymentTypeID' as parameter 'PaymentTypeID' of the stored procedure. if (purchaseHeader.PaymentTypeID != null) oDatabaseHelper.AddParameter("@PaymentTypeID", purchaseHeader.PaymentTypeID); else oDatabaseHelper.AddParameter("@PaymentTypeID", DBNull.Value); // Pass the value of '_totalPrice' as parameter 'TotalPrice' of the stored procedure. if (purchaseHeader.TotalPrice != null) oDatabaseHelper.AddParameter("@TotalPrice", purchaseHeader.TotalPrice); else oDatabaseHelper.AddParameter("@TotalPrice", DBNull.Value); // Pass the value of '_paidAmount' as parameter 'PaidAmount' of the stored procedure. if (purchaseHeader.PaidAmount != null) oDatabaseHelper.AddParameter("@PaidAmount", purchaseHeader.PaidAmount); else oDatabaseHelper.AddParameter("@PaidAmount", DBNull.Value); // Pass the value of '_remainingAmount' as parameter 'RemainingAmount' of the stored procedure. if (purchaseHeader.RemainingAmount != null) oDatabaseHelper.AddParameter("@RemainingAmount", purchaseHeader.RemainingAmount); else oDatabaseHelper.AddParameter("@RemainingAmount", DBNull.Value); // Pass the value of '_lastDayToPay' as parameter 'LastDayToPay' of the stored procedure. if (purchaseHeader.LastDayToPay != null) oDatabaseHelper.AddParameter("@LastDayToPay", purchaseHeader.LastDayToPay); else oDatabaseHelper.AddParameter("@LastDayToPay", DBNull.Value); // Pass the value of '_totalDiscountAmount' as parameter 'TotalDiscountAmount' of the stored procedure. if (purchaseHeader.TotalDiscountAmount != null) oDatabaseHelper.AddParameter("@TotalDiscountAmount", purchaseHeader.TotalDiscountAmount); else oDatabaseHelper.AddParameter("@TotalDiscountAmount", DBNull.Value); // Pass the value of '_totalDiscountRatio' as parameter 'TotalDiscountRatio' of the stored procedure. if (purchaseHeader.TotalDiscountRatio != null) oDatabaseHelper.AddParameter("@TotalDiscountRatio", purchaseHeader.TotalDiscountRatio); else oDatabaseHelper.AddParameter("@TotalDiscountRatio", DBNull.Value); // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. if (purchaseHeader.IsClosed != null) oDatabaseHelper.AddParameter("@IsClosed", purchaseHeader.IsClosed); else oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value); // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. if (purchaseHeader.IsVoid != null) oDatabaseHelper.AddParameter("@IsVoid", purchaseHeader.IsVoid); else oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value); // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure. if (purchaseHeader.IsPrinted != null) oDatabaseHelper.AddParameter("@IsPrinted", purchaseHeader.IsPrinted); else oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value); // Pass the value of '_servicePrice' as parameter 'ServicePrice' of the stored procedure. if (purchaseHeader.ServicePrice != null) oDatabaseHelper.AddParameter("@ServicePrice", purchaseHeader.ServicePrice); else oDatabaseHelper.AddParameter("@ServicePrice", DBNull.Value); // Pass the value of '_taxTypeID' as parameter 'TaxTypeID' of the stored procedure. if (purchaseHeader.TaxTypeID != null) oDatabaseHelper.AddParameter("@TaxTypeID", purchaseHeader.TaxTypeID); else oDatabaseHelper.AddParameter("@TaxTypeID", DBNull.Value); // Pass the value of '_refuseReasonID' as parameter 'RefuseReasonID' of the stored procedure. if (purchaseHeader.RefuseReasonID != null) oDatabaseHelper.AddParameter("@RefuseReasonID", purchaseHeader.RefuseReasonID); else oDatabaseHelper.AddParameter("@RefuseReasonID", DBNull.Value); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (purchaseHeader.CreatedBy != null) oDatabaseHelper.AddParameter("@CreatedBy", purchaseHeader.CreatedBy); else oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (purchaseHeader.CreateDate != null) oDatabaseHelper.AddParameter("@CreateDate", purchaseHeader.CreateDate); else oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (purchaseHeader.UpdatedBy != null) oDatabaseHelper.AddParameter("@UpdatedBy", purchaseHeader.UpdatedBy); else oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (purchaseHeader.updateDate != null) oDatabaseHelper.AddParameter("@UpdateDate", purchaseHeader.updateDate); else oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (purchaseHeader.IsDeleted != null) oDatabaseHelper.AddParameter("@IsDeleted", purchaseHeader.IsDeleted); else oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (purchaseHeader.DeletedBy != null) oDatabaseHelper.AddParameter("@DeletedBy", purchaseHeader.DeletedBy); else oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure. if (purchaseHeader.DeleteDate != null) oDatabaseHelper.AddParameter("@DeletDate", purchaseHeader.DeleteDate); else oDatabaseHelper.AddParameter("@DeletDate", 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("gsp_PURPurchaseHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return ExecutionState; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:12 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_stockTypeName' as parameter 'StockTypeName' of the stored procedure. if(_stockTypeNameNonDefault!=null) oDatabaseHelper.AddParameter("@StockTypeName", _stockTypeNameNonDefault); else oDatabaseHelper.AddParameter("@StockTypeName", 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("gsp_INVStockType_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); return ExecutionState; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:01 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_transferHeaderID' as parameter 'TransferHeaderID' of the stored procedure. if (_transferHeaderIDNonDefault != null) { oDatabaseHelper.AddParameter("@TransferHeaderID", _transferHeaderIDNonDefault); } else { oDatabaseHelper.AddParameter("@TransferHeaderID", DBNull.Value); } // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if (_productIDNonDefault != null) { oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault); } else { oDatabaseHelper.AddParameter("@ProductID", DBNull.Value); } // Pass the value of '_qty' as parameter 'Qty' of the stored procedure. if (_qtyNonDefault != null) { oDatabaseHelper.AddParameter("@Qty", _qtyNonDefault); } else { oDatabaseHelper.AddParameter("@Qty", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (_createdByNonDefault != null) { oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (_createDateNonDefault != null) { oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (_updatedByNonDefault != null) { oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (_updateDateNonDefault != null) { oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (_isDeletedNonDefault != null) { oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (_deletedByNonDefault != null) { oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deletedDate' as parameter 'DeletedDate' of the stored procedure. if (_deletedDateNonDefault != null) { oDatabaseHelper.AddParameter("@DeletedDate", _deletedDateNonDefault); } else { oDatabaseHelper.AddParameter("@DeletedDate", 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("gsp_INVTransferLine_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }
private bool InsertHeader(DatabaseHelper oDatabaseHelper, PURPurchaseHeader sALPurchaseHeader, out int pK) { bool ExecutionState = false; // Pass the value of '_salesDate' as parameter 'PurchaseDate' of the stored procedure. oDatabaseHelper.AddParameter("@PurchaseDate", sALPurchaseHeader.PurchaseDate); // Pass the value of '_customerID' as parameter 'SupplierID' of the stored procedure. if (sALPurchaseHeader.SupplierID != null) { oDatabaseHelper.AddParameter("@SupplierID", sALPurchaseHeader.SupplierID); } else { oDatabaseHelper.AddParameter("@SupplierID", DBNull.Value); } // Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure. oDatabaseHelper.AddParameter("@InvoiceNumber", DBNull.Value); // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure. if (sALPurchaseHeader.InvoiceDate != null) { oDatabaseHelper.AddParameter("@InvoiceDate", sALPurchaseHeader.InvoiceDate); } else { oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value); } // Pass the value of '_sellerID' as parameter 'SellerID' of the stored procedure. //if (sALPurchaseHeader.SellerID != null) // oDatabaseHelper.AddParameter("@SellerID", sALPurchaseHeader.SellerID); //else // oDatabaseHelper.AddParameter("@SellerID", DBNull.Value); // Pass the value of '_paymentTypeID' as parameter 'PaymentTypeID' of the stored procedure. if (sALPurchaseHeader.PaymentTypeID != null) { oDatabaseHelper.AddParameter("@PaymentTypeID", sALPurchaseHeader.PaymentTypeID); } else { oDatabaseHelper.AddParameter("@PaymentTypeID", DBNull.Value); } if (sALPurchaseHeader.InventoryID != null) { oDatabaseHelper.AddParameter("@InventoryID", sALPurchaseHeader.InventoryID); } else { oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value); } // Pass the value of '_totalPrice' as parameter 'TotalPrice' of the stored procedure. if (sALPurchaseHeader.TotalPrice != null) { oDatabaseHelper.AddParameter("@TotalPrice", sALPurchaseHeader.TotalPrice); } else { oDatabaseHelper.AddParameter("@TotalPrice", DBNull.Value); } // Pass the value of '_paidAmount' as parameter 'PaidAmount' of the stored procedure. if (sALPurchaseHeader.PaidAmount != null) { oDatabaseHelper.AddParameter("@PaidAmount", sALPurchaseHeader.PaidAmount); } else { oDatabaseHelper.AddParameter("@PaidAmount", DBNull.Value); } // Pass the value of '_remainingAmount' as parameter 'RemainingAmount' of the stored procedure. if (sALPurchaseHeader.RemainingAmount != null) { oDatabaseHelper.AddParameter("@RemainingAmount", sALPurchaseHeader.RemainingAmount); } else { oDatabaseHelper.AddParameter("@RemainingAmount", DBNull.Value); } // Pass the value of '_lastDayToPay' as parameter 'LastDayToPay' of the stored procedure. if (sALPurchaseHeader.LastDayToPay != null) { oDatabaseHelper.AddParameter("@LastDayToPay", sALPurchaseHeader.LastDayToPay); } else { oDatabaseHelper.AddParameter("@LastDayToPay", DBNull.Value); } // Pass the value of '_totalDiscountAmount' as parameter 'TotalDiscountAmount' of the stored procedure. if (sALPurchaseHeader.TotalDiscountAmount != null) { oDatabaseHelper.AddParameter("@TotalDiscountAmount", sALPurchaseHeader.TotalDiscountAmount); } else { oDatabaseHelper.AddParameter("@TotalDiscountAmount", DBNull.Value); } // Pass the value of '_totalDiscountRatio' as parameter 'TotalDiscountRatio' of the stored procedure. if (sALPurchaseHeader.TotalDiscountRatio != null) { oDatabaseHelper.AddParameter("@TotalDiscountRatio", sALPurchaseHeader.TotalDiscountRatio); } else { oDatabaseHelper.AddParameter("@TotalDiscountRatio", DBNull.Value); } // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. if (sALPurchaseHeader.IsClosed != null) { oDatabaseHelper.AddParameter("@IsClosed", sALPurchaseHeader.IsClosed); } else { oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value); } // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. if (sALPurchaseHeader.IsVoid != null) { oDatabaseHelper.AddParameter("@IsVoid", sALPurchaseHeader.IsVoid); } else { oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value); } // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure. if (sALPurchaseHeader.IsPrinted != null) { oDatabaseHelper.AddParameter("@IsPrinted", sALPurchaseHeader.IsPrinted); } else { oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value); } // Pass the value of '_servicePrice' as parameter 'ServicePrice' of the stored procedure. if (sALPurchaseHeader.ServicePrice != null) { oDatabaseHelper.AddParameter("@ServicePrice", sALPurchaseHeader.ServicePrice); } else { oDatabaseHelper.AddParameter("@ServicePrice", DBNull.Value); } // Pass the value of '_taxTypeID' as parameter 'TaxTypeID' of the stored procedure. if (sALPurchaseHeader.TaxTypeID != null) { oDatabaseHelper.AddParameter("@TaxTypeID", sALPurchaseHeader.TaxTypeID); } else { oDatabaseHelper.AddParameter("@TaxTypeID", DBNull.Value); } // Pass the value of '_refuseReasonID' as parameter 'RefuseReasonID' of the stored procedure. if (sALPurchaseHeader.RefuseReasonID != null) { oDatabaseHelper.AddParameter("@RefuseReasonID", sALPurchaseHeader.RefuseReasonID); } else { oDatabaseHelper.AddParameter("@RefuseReasonID", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (sALPurchaseHeader.CreatedBy != null) { oDatabaseHelper.AddParameter("@CreatedBy", sALPurchaseHeader.CreatedBy); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (sALPurchaseHeader.CreateDate != null) { oDatabaseHelper.AddParameter("@CreateDate", sALPurchaseHeader.CreateDate); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (sALPurchaseHeader.UpdatedBy != null) { oDatabaseHelper.AddParameter("@UpdatedBy", sALPurchaseHeader.UpdatedBy); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (sALPurchaseHeader.updateDate != null) { oDatabaseHelper.AddParameter("@UpdateDate", sALPurchaseHeader.updateDate); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (sALPurchaseHeader.IsDeleted != null) { oDatabaseHelper.AddParameter("@IsDeleted", sALPurchaseHeader.IsDeleted); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (sALPurchaseHeader.DeletedBy != null) { oDatabaseHelper.AddParameter("@DeletedBy", sALPurchaseHeader.DeletedBy); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure. if (sALPurchaseHeader.DeleteDate != null) { oDatabaseHelper.AddParameter("@DeletDate", sALPurchaseHeader.DeleteDate); } else { oDatabaseHelper.AddParameter("@DeletDate", 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_PURPurcaseHeader_Insert", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState)); // oDatabaseHelper.Dispose(); } catch (Exception ex) { throw; } return(ExecutionState); }
private static bool InsertDetails(DatabaseHelper oDatabaseHelper, ADGroupRole groupRole) { bool ExecutionState = false; oDatabaseHelper.AddParameter("@GroupID", groupRole.GroupID); oDatabaseHelper.AddParameter("@RoleID", groupRole.RoleID); oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_ADGroupRole_Insert", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return ExecutionState; }
private bool InsertDetails(DatabaseHelper oDatabaseHelper, SALSalesLine sALSalesLine, int salesHeaderID) { bool ExecutionState = false; // Pass the value of '_salesHeaderID' as parameter 'SalesHeaderID' of the stored procedure. if (salesHeaderID != null) { oDatabaseHelper.AddParameter("@SalesHeaderID", salesHeaderID); } else { oDatabaseHelper.AddParameter("@SalesHeaderID", DBNull.Value); } // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if (sALSalesLine.ProductID != null) { oDatabaseHelper.AddParameter("@ProductID", sALSalesLine.ProductID); } else { oDatabaseHelper.AddParameter("@ProductID", DBNull.Value); } // Pass the value of '_totalQty' as parameter 'TotalQty' of the stored procedure. if (sALSalesLine.TotalQty != null) { oDatabaseHelper.AddParameter("@TotalQty", sALSalesLine.TotalQty); } else { oDatabaseHelper.AddParameter("@TotalQty", DBNull.Value); } // Pass the value of '_totalBonus' as parameter 'TotalBonus' of the stored procedure. if (sALSalesLine.TotalBonus != null) { oDatabaseHelper.AddParameter("@TotalBonus", sALSalesLine.TotalBonus); } else { oDatabaseHelper.AddParameter("@TotalBonus", DBNull.Value); } // Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure. if (sALSalesLine.DiscountAmount != null) { oDatabaseHelper.AddParameter("@DiscountAmount", sALSalesLine.DiscountAmount); } else { oDatabaseHelper.AddParameter("@DiscountAmount", DBNull.Value); } // Pass the value of '_discountRatio' as parameter 'DiscountRatio' of the stored procedure. if (sALSalesLine.DiscountRatio != null) { oDatabaseHelper.AddParameter("@DiscountRatio", sALSalesLine.DiscountRatio); } else { oDatabaseHelper.AddParameter("@DiscountRatio", DBNull.Value); } // Pass the value of '_unitPrice' as parameter 'UnitPrice' of the stored procedure. if (sALSalesLine.UnitPrice != null) { oDatabaseHelper.AddParameter("@UnitPrice", sALSalesLine.UnitPrice); } else { oDatabaseHelper.AddParameter("@UnitPrice", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (sALSalesLine.CreatedBy != null) { oDatabaseHelper.AddParameter("@CreatedBy", sALSalesLine.CreatedBy); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (sALSalesLine.CreateDate != null) { oDatabaseHelper.AddParameter("@CreateDate", sALSalesLine.CreateDate); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (sALSalesLine.UpdatedBy != null) { oDatabaseHelper.AddParameter("@UpdatedBy", sALSalesLine.UpdatedBy); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (sALSalesLine.UpdateDate != null) { oDatabaseHelper.AddParameter("@UpdateDate", sALSalesLine.UpdateDate); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (sALSalesLine.IsDeleted != null) { oDatabaseHelper.AddParameter("@IsDeleted", sALSalesLine.IsDeleted); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (sALSalesLine.DeletedBy != null) { oDatabaseHelper.AddParameter("@DeletedBy", sALSalesLine.DeletedBy); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. if (sALSalesLine.DeleteDate != null) { oDatabaseHelper.AddParameter("@DeleteDate", sALSalesLine.DeleteDate); } else { oDatabaseHelper.AddParameter("@DeleteDate", 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_SALSalesLine_InsertCommit", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return(ExecutionState); }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:09 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_adjustStockreasonName' as parameter 'AdjustStockreasonName' of the stored procedure. if(_adjustStockreasonNameNonDefault!=null) oDatabaseHelper.AddParameter("@AdjustStockreasonName", _adjustStockreasonNameNonDefault); else oDatabaseHelper.AddParameter("@AdjustStockreasonName", DBNull.Value ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); if(!getBackValues ) { oDatabaseHelper.ExecuteScalar("gsp_INVAdjustStockReason_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_INVAdjustStockReason_Insert_WithDefaultValues_AndReturn", ref ExecutionState); if (dr.Read()) { PopulateObjectFromReader(this,dr); } dr.Close(); } oDatabaseHelper.Dispose(); return ExecutionState; }
private bool UpdateHeader(DatabaseHelper oDatabaseHelper, SALSalesHeader sALSalesHeader) { bool ExecutionState = false; // Pass the value of '_salesHeaderID' as parameter 'SalesHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@SalesDate", sALSalesHeader.SalesDate); // Pass the value of '_customerID' as parameter 'CustomerID' of the stored procedure. if (sALSalesHeader.CustomerID != null) { oDatabaseHelper.AddParameter("@CustomerID", sALSalesHeader.CustomerID); } else { oDatabaseHelper.AddParameter("@CustomerID", DBNull.Value); } // Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure. oDatabaseHelper.AddParameter("@InvoiceNumber", sALSalesHeader.InvoiceNumber); // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure. if (sALSalesHeader.InvoiceDate != null) { oDatabaseHelper.AddParameter("@InvoiceDate", sALSalesHeader.InvoiceDate); } else { oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value); } // Pass the value of '_sellerID' as parameter 'SellerID' of the stored procedure. if (sALSalesHeader.SellerID != null) { oDatabaseHelper.AddParameter("@SellerID", sALSalesHeader.SellerID); } else { oDatabaseHelper.AddParameter("@SellerID", DBNull.Value); } // Pass the value of '_paymentTypeID' as parameter 'PaymentTypeID' of the stored procedure. if (sALSalesHeader.PaymentTypeID != null) { oDatabaseHelper.AddParameter("@PaymentTypeID", sALSalesHeader.PaymentTypeID); } else { oDatabaseHelper.AddParameter("@PaymentTypeID", DBNull.Value); } // Pass the value of '_totalPrice' as parameter 'TotalPrice' of the stored procedure. if (sALSalesHeader.TotalPrice != null) { oDatabaseHelper.AddParameter("@TotalPrice", sALSalesHeader.TotalPrice); } else { oDatabaseHelper.AddParameter("@TotalPrice", DBNull.Value); } // Pass the value of 'FinalPrice' as parameter 'TotalPrice' of the stored procedure. if (sALSalesHeader.FinalPrice != null) { oDatabaseHelper.AddParameter("@FinalPrice", sALSalesHeader.FinalPrice); } else { oDatabaseHelper.AddParameter("@TotalPrice", DBNull.Value); } // Pass the value of '_paidAmount' as parameter 'PaidAmount' of the stored procedure. if (sALSalesHeader.PaidAmount != null) { oDatabaseHelper.AddParameter("@PaidAmount", sALSalesHeader.PaidAmount); } else { oDatabaseHelper.AddParameter("@PaidAmount", DBNull.Value); } // Pass the value of '_remainingAmount' as parameter 'RemainingAmount' of the stored procedure. if (sALSalesHeader.RemainingAmount != null) { oDatabaseHelper.AddParameter("@RemainingAmount", sALSalesHeader.RemainingAmount); } else { oDatabaseHelper.AddParameter("@RemainingAmount", DBNull.Value); } // Pass the value of '_lastDayToPay' as parameter 'LastDayToPay' of the stored procedure. if (sALSalesHeader.LastDayToPay != null) { oDatabaseHelper.AddParameter("@LastDayToPay", sALSalesHeader.LastDayToPay); } else { oDatabaseHelper.AddParameter("@LastDayToPay", DBNull.Value); } // Pass the value of '_totalDiscountAmount' as parameter 'TotalDiscountAmount' of the stored procedure. if (sALSalesHeader.TotalDiscountAmount != null) { oDatabaseHelper.AddParameter("@TotalDiscountAmount", sALSalesHeader.TotalDiscountAmount); } else { oDatabaseHelper.AddParameter("@TotalDiscountAmount", DBNull.Value); } // Pass the value of '_totalDiscountRatio' as parameter 'TotalDiscountRatio' of the stored procedure. if (sALSalesHeader.TotalDiscountRatio != null) { oDatabaseHelper.AddParameter("@TotalDiscountRatio", sALSalesHeader.TotalDiscountRatio); } else { oDatabaseHelper.AddParameter("@TotalDiscountRatio", DBNull.Value); } // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. if (sALSalesHeader.IsClosed != null) { oDatabaseHelper.AddParameter("@IsClosed", sALSalesHeader.IsClosed); } else { oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value); } // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. if (sALSalesHeader.IsVoid != null) { oDatabaseHelper.AddParameter("@IsVoid", sALSalesHeader.IsVoid); } else { oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value); } // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure. if (sALSalesHeader.IsPrinted != null) { oDatabaseHelper.AddParameter("@IsPrinted", sALSalesHeader.IsPrinted); } else { oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value); } // Pass the value of '_servicePrice' as parameter 'ServicePrice' of the stored procedure. if (sALSalesHeader.ServicePrice != null) { oDatabaseHelper.AddParameter("@ServicePrice", sALSalesHeader.ServicePrice); } else { oDatabaseHelper.AddParameter("@ServicePrice", DBNull.Value); } // Pass the value of '_taxTypeID' as parameter 'TaxTypeID' of the stored procedure. if (sALSalesHeader.TaxTypeID != null) { oDatabaseHelper.AddParameter("@TaxTypeID", sALSalesHeader.TaxTypeID); } else { oDatabaseHelper.AddParameter("@TaxTypeID", DBNull.Value); } // Pass the value of '_refuseReasonID' as parameter 'RefuseReasonID' of the stored procedure. if (sALSalesHeader.RefuseReasonID != null) { oDatabaseHelper.AddParameter("@RefuseReasonID", sALSalesHeader.RefuseReasonID); } else { oDatabaseHelper.AddParameter("@RefuseReasonID", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (sALSalesHeader.CreatedBy != null) { oDatabaseHelper.AddParameter("@CreatedBy", sALSalesHeader.CreatedBy); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (sALSalesHeader.CreateDate != null) { oDatabaseHelper.AddParameter("@CreateDate", sALSalesHeader.CreateDate); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (sALSalesHeader.UpdatedBy != null) { oDatabaseHelper.AddParameter("@UpdatedBy", sALSalesHeader.UpdatedBy); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (sALSalesHeader.UpdateDate != null) { oDatabaseHelper.AddParameter("@UpdateDate", sALSalesHeader.UpdateDate); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (sALSalesHeader.IsDeleted != null) { oDatabaseHelper.AddParameter("@IsDeleted", sALSalesHeader.IsDeleted); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (sALSalesHeader.DeletedBy != null) { oDatabaseHelper.AddParameter("@DeletedBy", sALSalesHeader.DeletedBy); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure. if (sALSalesHeader.DeletDate != null) { oDatabaseHelper.AddParameter("@DeletDate", sALSalesHeader.DeletDate); } else { oDatabaseHelper.AddParameter("@DeletDate", 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_SALSalesHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return(ExecutionState); }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_userFullName' as parameter 'UserFullName' of the stored procedure. if(_userFullNameNonDefault!=null) oDatabaseHelper.AddParameter("@UserFullName", _userFullNameNonDefault); else oDatabaseHelper.AddParameter("@UserFullName", DBNull.Value ); // Pass the value of '_userName' as parameter 'UserName' of the stored procedure. if(_userNameNonDefault!=null) oDatabaseHelper.AddParameter("@UserName", _userNameNonDefault); else oDatabaseHelper.AddParameter("@UserName", DBNull.Value ); // Pass the value of '_password' as parameter 'Password' of the stored procedure. if(_passwordNonDefault!=null) oDatabaseHelper.AddParameter("@Password", _passwordNonDefault); else oDatabaseHelper.AddParameter("@Password", DBNull.Value ); // Pass the value of '_groupID' as parameter 'GroupID' of the stored procedure. if(_groupIDNonDefault!=null) oDatabaseHelper.AddParameter("@GroupID", _groupIDNonDefault); else oDatabaseHelper.AddParameter("@GroupID", DBNull.Value ); // Pass the value of '_email' as parameter 'Email' of the stored procedure. if(_emailNonDefault!=null) oDatabaseHelper.AddParameter("@Email", _emailNonDefault); else oDatabaseHelper.AddParameter("@Email", DBNull.Value ); // Pass the value of '_address' as parameter 'Address' of the stored procedure. if(_addressNonDefault!=null) oDatabaseHelper.AddParameter("@Address", _addressNonDefault); else oDatabaseHelper.AddParameter("@Address", DBNull.Value ); // Pass the value of '_phone' as parameter 'Phone' of the stored procedure. if(_phoneNonDefault!=null) oDatabaseHelper.AddParameter("@Phone", _phoneNonDefault); else oDatabaseHelper.AddParameter("@Phone", DBNull.Value ); // Pass the value of '_mobile' as parameter 'Mobile' of the stored procedure. if(_mobileNonDefault!=null) oDatabaseHelper.AddParameter("@Mobile", _mobileNonDefault); else oDatabaseHelper.AddParameter("@Mobile", DBNull.Value ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); if(!getBackValues ) { oDatabaseHelper.ExecuteScalar("gsp_ADUser_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_ADUser_Insert_WithDefaultValues_AndReturn", ref ExecutionState); if (dr.Read()) { PopulateObjectFromReader(this,dr); } dr.Close(); } oDatabaseHelper.Dispose(); return ExecutionState; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:24 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_productName' as parameter 'ProductName' of the stored procedure. if (_productNameNonDefault != null) { oDatabaseHelper.AddParameter("@ProductName", _productNameNonDefault); } else { oDatabaseHelper.AddParameter("@ProductName", DBNull.Value); } // Pass the value of '_productGroupID' as parameter 'ProductGroupID' of the stored procedure. if (_productGroupIDNonDefault != null) { oDatabaseHelper.AddParameter("@ProductGroupID", _productGroupIDNonDefault); } else { oDatabaseHelper.AddParameter("@ProductGroupID", DBNull.Value); } // Pass the value of '_productCode' as parameter 'ProductCode' of the stored procedure. if (_productCodeNonDefault != null) { oDatabaseHelper.AddParameter("@ProductCode", _productCodeNonDefault); } else { oDatabaseHelper.AddParameter("@ProductCode", DBNull.Value); } // Pass the value of '_isAcceptBatch' as parameter 'IsAcceptBatch' of the stored procedure. if (_isAcceptBatchNonDefault != null) { oDatabaseHelper.AddParameter("@IsAcceptBatch", _isAcceptBatchNonDefault); } else { oDatabaseHelper.AddParameter("@IsAcceptBatch", DBNull.Value); } // Pass the value of '_productPrice' as parameter 'ProductPrice' of the stored procedure. if (_productPriceNonDefault != null) { oDatabaseHelper.AddParameter("@ProductPrice", _productPriceNonDefault); } else { oDatabaseHelper.AddParameter("@ProductPrice", DBNull.Value); } // Pass the value of '_isFixedPrice' as parameter 'IsFixedPrice' of the stored procedure. if (_isFixedPriceNonDefault != null) { oDatabaseHelper.AddParameter("@IsFixedPrice", _isFixedPriceNonDefault); } else { oDatabaseHelper.AddParameter("@IsFixedPrice", DBNull.Value); } // Pass the value of '_hasDiscount' as parameter 'HasDiscount' of the stored procedure. if (_hasDiscountNonDefault != null) { oDatabaseHelper.AddParameter("@HasDiscount", _hasDiscountNonDefault); } else { oDatabaseHelper.AddParameter("@HasDiscount", DBNull.Value); } // Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure. if (_discountAmountNonDefault != null) { oDatabaseHelper.AddParameter("@DiscountAmount", _discountAmountNonDefault); } else { oDatabaseHelper.AddParameter("@DiscountAmount", DBNull.Value); } // Pass the value of '_descountRatio' as parameter 'DescountRatio' of the stored procedure. if (_descountRatioNonDefault != null) { oDatabaseHelper.AddParameter("@DescountRatio", _descountRatioNonDefault); } else { oDatabaseHelper.AddParameter("@DescountRatio", DBNull.Value); } // Pass the value of '_isActive' as parameter 'IsActive' of the stored procedure. if (_isActiveNonDefault != null) { oDatabaseHelper.AddParameter("@IsActive", _isActiveNonDefault); } else { oDatabaseHelper.AddParameter("@IsActive", DBNull.Value); } // Pass the value of '_notes' as parameter 'Notes' of the stored procedure. if (_notesNonDefault != null) { oDatabaseHelper.AddParameter("@Notes", _notesNonDefault); } else { oDatabaseHelper.AddParameter("@Notes", DBNull.Value); } // Pass the value of '_minPrice' as parameter 'MinPrice' of the stored procedure. if (_minPriceNonDefault != null) { oDatabaseHelper.AddParameter("@MinPrice", _minPriceNonDefault); } else { oDatabaseHelper.AddParameter("@MinPrice", DBNull.Value); } // Pass the value of '_maxPrice' as parameter 'MaxPrice' of the stored procedure. if (_maxPriceNonDefault != null) { oDatabaseHelper.AddParameter("@MaxPrice", _maxPriceNonDefault); } else { oDatabaseHelper.AddParameter("@MaxPrice", 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("gsp_BDProduct_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <summary> /// This method will Delete one row from the database using the property Information /// </summary> /// /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Delete() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_userID' as parameter 'UserID' of the stored procedure. if(_userIDNonDefault!=null) oDatabaseHelper.AddParameter("@UserID", _userIDNonDefault ); else oDatabaseHelper.AddParameter("@UserID", 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("gsp_ADUser_Delete", ref ExecutionState); oDatabaseHelper.Dispose(); return ExecutionState; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:28 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_purchaseLineID' as parameter 'PurchaseLineID' of the stored procedure. if(_purchaseLineIDNonDefault!=null) oDatabaseHelper.AddParameter("@PurchaseLineID", _purchaseLineIDNonDefault); else oDatabaseHelper.AddParameter("@PurchaseLineID", DBNull.Value ); // Pass the value of '_batchID' as parameter 'BatchID' of the stored procedure. if(_batchIDNonDefault!=null) oDatabaseHelper.AddParameter("@BatchID", _batchIDNonDefault); else oDatabaseHelper.AddParameter("@BatchID", DBNull.Value ); // Pass the value of '_qty' as parameter 'Qty' of the stored procedure. if(_qtyNonDefault!=null) oDatabaseHelper.AddParameter("@Qty", _qtyNonDefault); else oDatabaseHelper.AddParameter("@Qty", 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("gsp_PURPurchaseLineBatch_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); return ExecutionState; }
/// <summary> /// This method will Delete row(s) from the database using the value of the field specified /// </summary> /// /// <param name="field" type="ADUserFields">Field of the class ADUser</param> /// <param name="fieldValue" type="object">Value for the field specified.</param> /// /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static bool DeleteByField(string field, object fieldValue) { 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 ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_ADUser_DeleteByField", ref ExecutionState); 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 bool InsertINVProductStockWithBatch(INVProductStock iNVProductStock) { bool ExecutionState = false; DatabaseHelper oDatabaseHelper = new DatabaseHelper(); oDatabaseHelper.AddParameter("@ProductID", iNVProductStock.ProductID); oDatabaseHelper.AddParameter("@TotalQty", iNVProductStock.TotalQty); oDatabaseHelper.AddParameter("@CreatedBy", iNVProductStock.CreatedBy); oDatabaseHelper.AddParameter("@InventoryID", iNVProductStock.InventoryID); oDatabaseHelper.AddParameter("@BatchNumber", iNVProductStock.BatchNo); oDatabaseHelper.AddParameter("@ExpiryDate", iNVProductStock.ExpiryDate); oDatabaseHelper.AddParameter("@BatchQty", iNVProductStock.BatchQty); oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("usp_INVProductStock_InsertProductStockWithBatches", ref ExecutionState); oDatabaseHelper.Dispose(); return ExecutionState; }
/// <summary> /// This method will Update one new row into the database using the property Information /// </summary> /// /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:07 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_productGroupID' as parameter 'ProductGroupID' of the stored procedure. oDatabaseHelper.AddParameter("@ProductGroupID", _productGroupIDNonDefault ); // Pass the value of '_productGroupName' as parameter 'ProductGroupName' of the stored procedure. oDatabaseHelper.AddParameter("@ProductGroupName", _productGroupNameNonDefault ); // Pass the value of '_notes' as parameter 'Notes' of the stored procedure. oDatabaseHelper.AddParameter("@Notes", _notesNonDefault ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_BDProductGroup_Update", ref ExecutionState); oDatabaseHelper.Dispose(); 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; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// <returns>True if succeeded</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:18 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_purchaseHeaderID' as parameter 'PurchaseHeaderID' of the stored procedure. if(_purchaseHeaderIDNonDefault!=null) oDatabaseHelper.AddParameter("@PurchaseHeaderID", _purchaseHeaderIDNonDefault); else oDatabaseHelper.AddParameter("@PurchaseHeaderID", DBNull.Value ); // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if(_productIDNonDefault!=null) oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault); else oDatabaseHelper.AddParameter("@ProductID", DBNull.Value ); // Pass the value of '_totalQty' as parameter 'TotalQty' of the stored procedure. if(_totalQtyNonDefault!=null) oDatabaseHelper.AddParameter("@TotalQty", _totalQtyNonDefault); else oDatabaseHelper.AddParameter("@TotalQty", DBNull.Value ); // Pass the value of '_bonusQty' as parameter 'BonusQty' of the stored procedure. if(_bonusQtyNonDefault!=null) oDatabaseHelper.AddParameter("@BonusQty", _bonusQtyNonDefault); else oDatabaseHelper.AddParameter("@BonusQty", DBNull.Value ); // Pass the value of '_discountRatio' as parameter 'DiscountRatio' of the stored procedure. if(_discountRatioNonDefault!=null) oDatabaseHelper.AddParameter("@DiscountRatio", _discountRatioNonDefault); else oDatabaseHelper.AddParameter("@DiscountRatio", DBNull.Value ); // Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure. if(_discountAmountNonDefault!=null) oDatabaseHelper.AddParameter("@DiscountAmount", _discountAmountNonDefault); else oDatabaseHelper.AddParameter("@DiscountAmount", DBNull.Value ); // Pass the value of '_unitprice' as parameter 'Unitprice' of the stored procedure. if(_unitpriceNonDefault!=null) oDatabaseHelper.AddParameter("@Unitprice", _unitpriceNonDefault); else oDatabaseHelper.AddParameter("@Unitprice", DBNull.Value ); // Pass the value of '_createdDate' as parameter 'CreatedDate' of the stored procedure. if(_createdDateNonDefault!=null) oDatabaseHelper.AddParameter("@CreatedDate", _createdDateNonDefault); else oDatabaseHelper.AddParameter("@CreatedDate", DBNull.Value ); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if(_createdByNonDefault!=null) oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); else oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value ); // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if(_updateDateNonDefault!=null) oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); else oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value ); // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if(_updatedByNonDefault!=null) oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); else oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value ); // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if(_isDeletedNonDefault!=null) oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault); else oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value ); // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. if(_deleteDateNonDefault!=null) oDatabaseHelper.AddParameter("@DeleteDate", _deleteDateNonDefault); else oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value ); // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if(_deletedByNonDefault!=null) oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault); else oDatabaseHelper.AddParameter("@DeletedBy", 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("gsp_PURPurchaseLine_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); 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; }
public static bool OpenTakingInventory(string TakingName, DateTime TakingDate, int InventoryID, int TakingType, int?ProductID, int?ProductGroupID, string Notes, int UserID) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_transferHeaderID' as parameter 'TransferHeaderID' of the stored procedure. if (TakingName != null) { oDatabaseHelper.AddParameter("@TakingName", TakingName); } else { oDatabaseHelper.AddParameter("@TakingName", DBNull.Value); } // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if (TakingDate != null) { oDatabaseHelper.AddParameter("@TakingDate", TakingDate); } else { oDatabaseHelper.AddParameter("@TakingDate", DBNull.Value); } // Pass the value of '_qty' as parameter 'Qty' of the stored procedure. if (InventoryID != null) { oDatabaseHelper.AddParameter("@InventoryID", InventoryID); } else { oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (TakingType != null) { oDatabaseHelper.AddParameter("@TakingType", TakingType); } else { oDatabaseHelper.AddParameter("@TakingType", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (ProductID != null) { oDatabaseHelper.AddParameter("@ProductID", ProductID); } else { oDatabaseHelper.AddParameter("@ProductID", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (ProductGroupID != null) { oDatabaseHelper.AddParameter("@ProductGroupID", ProductGroupID); } else { oDatabaseHelper.AddParameter("@ProductGroupID", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (Notes != null) { oDatabaseHelper.AddParameter("@Notes", Notes); } else { oDatabaseHelper.AddParameter("@Notes", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (UserID != null) { oDatabaseHelper.AddParameter("@UserID", UserID); } else { oDatabaseHelper.AddParameter("@UserID", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. oDatabaseHelper.ExecuteScalar("usp_INVTakingInventoryline_OpenTakingInventory", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }