public static ADUser SelectByUserNameAndPassword(string UserName, string Password) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; oDatabaseHelper.AddParameter("@UserName", UserName); oDatabaseHelper.AddParameter("@Password", Password); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_ADUser_SelectUserNameAndPassword", ref ExecutionState); if (dr.Read()) { ADUser obj = new ADUser(); PopulateObjectFromReader(obj, dr); dr.Close(); oDatabaseHelper.Dispose(); return obj; } else { dr.Close(); oDatabaseHelper.Dispose(); return null; } }
public 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; }
public bool InsertProductStockBatches(int userID, INVBatch iNVBatch) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); oDatabaseHelper.AddParameter("@ProductStockID", iNVBatch.ProductStockID); oDatabaseHelper.AddParameter("@BatchNumber", iNVBatch.BatchNumber); oDatabaseHelper.AddParameter("@ExpiryDate", iNVBatch.ExpiryDate); oDatabaseHelper.AddParameter("@Qty", iNVBatch.Qty); oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("usp_INVBatch_ProductStockBatch", ref ExecutionState); oDatabaseHelper.Dispose(); return ExecutionState; }
public static VPurchaseReturnHeaderCollection SearchByriteria(string CustomerName, DateTime FromDate, DateTime ToDate, string InvoiceNumber) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; oDatabaseHelper.AddParameter("@SupplierName", CustomerName); oDatabaseHelper.AddParameter("@FromDate", FromDate); oDatabaseHelper.AddParameter("@DateTo", ToDate); oDatabaseHelper.AddParameter("@InvoiceNumber", InvoiceNumber); oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr = oDatabaseHelper.ExecuteReader("usp_VPurchaseReturnHeader_SearchByCriteria", ref ExecutionState); VPurchaseReturnHeaderCollection VPurchaseReturnHeaderCollection = PopulateObjectsFromReader(dr); dr.Close(); oDatabaseHelper.Dispose(); return VPurchaseReturnHeaderCollection; }
public static BDProductGroupCollection SearcByCriteria(string ProductGroupName) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // Pass the specified field and its value to the stored procedure. oDatabaseHelper.AddParameter("@ProductGroupName", ProductGroupName); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr = oDatabaseHelper.ExecuteReader("usp_ProductGroup_SearchByCriteria", ref ExecutionState); BDProductGroupCollection BDProductGroupCollection = PopulateObjectsFromReader(dr); dr.Close(); oDatabaseHelper.Dispose(); return BDProductGroupCollection; }
public static BDProductCollection SelectAllProductsByGroupID(int InventoryID, BDProductGroupPrimaryKey pk) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; BDProductCollection obj = null; oDatabaseHelper.AddParameter("@ProductGroupID", pk.ProductGroupID); oDatabaseHelper.AddParameter("@InventoryID", InventoryID); oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr = oDatabaseHelper.ExecuteReader("usp_SelectAllByGroupID", ref ExecutionState); obj = new BDProductCollection(); obj = PopulateObjectsFromReaderWithCheckingReader(dr, oDatabaseHelper); dr.Close(); oDatabaseHelper.Dispose(); return obj; }
public static SALSalesHeaderCollection HeaderSearch(string CustomerName, string InvoiceNumber) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // Pass the specified field and its value to the stored procedure. oDatabaseHelper.AddParameter("@CustomerName", CustomerName); oDatabaseHelper.AddParameter("@InvoiceDate", null); oDatabaseHelper.AddParameter("@InvoiceNumber", InvoiceNumber); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr = oDatabaseHelper.ExecuteReader("usp_SALSalesHeader_SearchByCriteria", ref ExecutionState); SALSalesHeaderCollection SALSalesHeaderCollection = PopulateFromReader(dr); dr.Close(); oDatabaseHelper.Dispose(); return SALSalesHeaderCollection; }
public static VSALSalesOrderCollection SelectByInvoiceNumber(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // Pass the specified field and its value to the stored procedure. oDatabaseHelper.AddParameter("@Field", field); oDatabaseHelper.AddParameter("@Value", fieldValue); oDatabaseHelper.AddParameter("@Value2", fieldValue2); oDatabaseHelper.AddParameter("@Operation", OperationCollection.Operation[(int)typeOperation]); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_VSALSalesOrder_SelectByField", ref ExecutionState); VSALSalesOrderCollection VSALSalesOrderCollection = PopulateObjectsFromReader(dr); dr.Close(); oDatabaseHelper.Dispose(); return VSALSalesOrderCollection; }
public static PURPurchaseHeaderCollection HeaderSearch(int InventoryID, DateTime FromDate, DateTime ToDate, string SupplierName, string InvoiceNumber) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // Pass the specified field and its value to the stored procedure. oDatabaseHelper.AddParameter("@InventoryID", InventoryID ); oDatabaseHelper.AddParameter("@FromDate", FromDate); oDatabaseHelper.AddParameter("@ToDate", ToDate ); if (SupplierName!="") { oDatabaseHelper.AddParameter("@SupplierName", SupplierName); } if (InvoiceNumber != "") { oDatabaseHelper.AddParameter("@InvoiceNumber", InvoiceNumber); } // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr = oDatabaseHelper.ExecuteReader("usp_PURPurchaseHeader_SearchByCriteria", ref ExecutionState); PURPurchaseHeaderCollection PURPurchaseHeaderCollection = PopulateFromReader(dr); dr.Close(); oDatabaseHelper.Dispose(); return PURPurchaseHeaderCollection; }
public static BDProductCollection GetAllProductsForOpenningQuantities(int InventoryID) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; oDatabaseHelper.AddParameter("@InventoryID", InventoryID); IDataReader dr = oDatabaseHelper.ExecuteReader("usp_GetopeningStockLine", ref ExecutionState); BDProductCollection BDProductCollection = BDProductBase.PopulateObjectsFromReader(dr); dr.Close(); oDatabaseHelper.Dispose(); return BDProductCollection; }
public static PURPurchaseHeaderCollection HeaderSearch(int InventoryID, DateTime FromDate, DateTime ToDate, string SupplierName, string InvoiceNumber) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // Pass the specified field and its value to the stored procedure. oDatabaseHelper.AddParameter("@InventoryID", InventoryID); oDatabaseHelper.AddParameter("@FromDate", FromDate); oDatabaseHelper.AddParameter("@ToDate", ToDate); oDatabaseHelper.AddParameter("@SupplierName", SupplierName); oDatabaseHelper.AddParameter("@InvoiceNumber", InvoiceNumber); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr = oDatabaseHelper.ExecuteReader("usp_PURPurchaseHeader_SearchByCriteria", ref ExecutionState); PURPurchaseHeaderCollection PURPurchaseHeaderCollection = PopulateFromReader(dr); dr.Close(); oDatabaseHelper.Dispose(); return(PURPurchaseHeaderCollection); }
/// <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 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:04 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 '_originalSalesLineID' as parameter 'OriginalSalesLineID' of the stored procedure. if (_originalSalesLineIDNonDefault != null) { oDatabaseHelper.AddParameter("@OriginalSalesLineID", _originalSalesLineIDNonDefault); } else { oDatabaseHelper.AddParameter("@OriginalSalesLineID", 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_SALSalesReturnLine_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: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> /// <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:00 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_customerName' as parameter 'CustomerName' of the stored procedure. if (_customerNameNonDefault != null) { oDatabaseHelper.AddParameter("@CustomerName", _customerNameNonDefault); } else { oDatabaseHelper.AddParameter("@CustomerName", DBNull.Value); } // Pass the value of '_customerCode' as parameter 'CustomerCode' of the stored procedure. if (_customerCodeNonDefault != null) { oDatabaseHelper.AddParameter("@CustomerCode", _customerCodeNonDefault); } else { oDatabaseHelper.AddParameter("@CustomerCode", 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_BDCustomer_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_BDCustomer_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 12/27/2014 6:55:58 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_takingHeaderID' as parameter 'TakingHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@TakingHeaderID", _takingHeaderIDNonDefault); // Pass the value of '_takingDate' as parameter 'TakingDate' of the stored procedure. oDatabaseHelper.AddParameter("@TakingDate", _takingDateNonDefault); // Pass the value of '_takingName' as parameter 'TakingName' of the stored procedure. oDatabaseHelper.AddParameter("@TakingName", _takingNameNonDefault); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); // Pass the value of '_createdDate' as parameter 'CreatedDate' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedDate", _createdDateNonDefault); // 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); // 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_INVTakingInventory_Update", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <summary> /// This method will return a list of objects representing the specified number of entries from the specified record number in the table /// using the value of the field specified /// </summary> /// /// <param name="field" type="string">Field of the class ADUser</param> /// <param name="fieldValue" type="object">Value for the field specified.</param> /// <param name="fieldValue2" type="object">Value for the field specified.</param> /// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param> /// <param name="orderByStatement" type="string">The field value to number.</param> /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// /// <returns>List of object of class ADUser in the form of an object of class ADUserCollection</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static ADUserCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // Pass the specified field and its value to the stored procedure. oDatabaseHelper.AddParameter("@Field",field); oDatabaseHelper.AddParameter("@Value", fieldValue ); oDatabaseHelper.AddParameter("@Value2", fieldValue2 ); oDatabaseHelper.AddParameter("@Operation", OperationCollection.Operation[(int)typeOperation] ); oDatabaseHelper.AddParameter("@PageSize",pageSize); oDatabaseHelper.AddParameter("@SkipPages", skipPages ); oDatabaseHelper.AddParameter("@OrderByStatement", orderByStatement ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_ADUser_SelectByFieldPaged", ref ExecutionState); ADUserCollection ADUserCollection = PopulateObjectsFromReader(dr); dr.Close(); oDatabaseHelper.Dispose(); return ADUserCollection; }
/// <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 UpdateHeader(DatabaseHelper oDatabaseHelper, PURPurchaseHeader pURPurchaseHeader) { bool ExecutionState = false; // Pass the value of '_salesDate' as parameter 'PurchaseDate' of the stored procedure. oDatabaseHelper.AddParameter("@PurcaseHeaderID", pURPurchaseHeader.PurcaseHeaderID); oDatabaseHelper.AddParameter("@PurchaseDate", pURPurchaseHeader.PurchaseDate); // Pass the value of '_customerID' as parameter 'SupplierID' of the stored procedure. if (pURPurchaseHeader.SupplierID != null) { oDatabaseHelper.AddParameter("@SupplierID", pURPurchaseHeader.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 (pURPurchaseHeader.InvoiceDate != null) { oDatabaseHelper.AddParameter("@InvoiceDate", pURPurchaseHeader.InvoiceDate); } else { oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value); } // Pass the value of '_sellerID' as parameter 'SellerID' of the stored procedure. //if (pURPurchaseHeader.SellerID != null) // oDatabaseHelper.AddParameter("@SellerID", pURPurchaseHeader.SellerID); //else // oDatabaseHelper.AddParameter("@SellerID", DBNull.Value); // Pass the value of '_paymentTypeID' as parameter 'PaymentTypeID' of the stored procedure. if (pURPurchaseHeader.PaymentTypeID != null) { oDatabaseHelper.AddParameter("@PaymentTypeID", pURPurchaseHeader.PaymentTypeID); } else { oDatabaseHelper.AddParameter("@PaymentTypeID", DBNull.Value); } if (pURPurchaseHeader.InventoryID != null) { oDatabaseHelper.AddParameter("@InventoryID", pURPurchaseHeader.InventoryID); } else { oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value); } // Pass the value of '_totalPrice' as parameter 'TotalPrice' of the stored procedure. if (pURPurchaseHeader.TotalPrice != null) { oDatabaseHelper.AddParameter("@TotalPrice", pURPurchaseHeader.TotalPrice); } else { oDatabaseHelper.AddParameter("@TotalPrice", DBNull.Value); } // Pass the value of '_paidAmount' as parameter 'PaidAmount' of the stored procedure. if (pURPurchaseHeader.PaidAmount != null) { oDatabaseHelper.AddParameter("@PaidAmount", pURPurchaseHeader.PaidAmount); } else { oDatabaseHelper.AddParameter("@PaidAmount", DBNull.Value); } // Pass the value of '_remainingAmount' as parameter 'RemainingAmount' of the stored procedure. if (pURPurchaseHeader.RemainingAmount != null) { oDatabaseHelper.AddParameter("@RemainingAmount", pURPurchaseHeader.RemainingAmount); } else { oDatabaseHelper.AddParameter("@RemainingAmount", DBNull.Value); } // Pass the value of '_lastDayToPay' as parameter 'LastDayToPay' of the stored procedure. if (pURPurchaseHeader.LastDayToPay != null) { oDatabaseHelper.AddParameter("@LastDayToPay", pURPurchaseHeader.LastDayToPay); } else { oDatabaseHelper.AddParameter("@LastDayToPay", DBNull.Value); } if (pURPurchaseHeader.ChequeNumber != null) { oDatabaseHelper.AddParameter("@ChequeNumber", pURPurchaseHeader.ChequeNumber); } else { oDatabaseHelper.AddParameter("@ChequeNumber", DBNull.Value); } // Pass the value of '_totalDiscountAmount' as parameter 'TotalDiscountAmount' of the stored procedure. if (pURPurchaseHeader.TotalDiscountAmount != null) { oDatabaseHelper.AddParameter("@TotalDiscountAmount", pURPurchaseHeader.TotalDiscountAmount); } else { oDatabaseHelper.AddParameter("@TotalDiscountAmount", DBNull.Value); } // Pass the value of '_totalDiscountRatio' as parameter 'TotalDiscountRatio' of the stored procedure. if (pURPurchaseHeader.TotalDiscountRatio != null) { oDatabaseHelper.AddParameter("@TotalDiscountRatio", pURPurchaseHeader.TotalDiscountRatio); } else { oDatabaseHelper.AddParameter("@TotalDiscountRatio", DBNull.Value); } // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. if (pURPurchaseHeader.IsClosed != null) { oDatabaseHelper.AddParameter("@IsClosed", pURPurchaseHeader.IsClosed); } else { oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value); } // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. if (pURPurchaseHeader.IsVoid != null) { oDatabaseHelper.AddParameter("@IsVoid", pURPurchaseHeader.IsVoid); } else { oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value); } // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure. if (pURPurchaseHeader.IsPrinted != null) { oDatabaseHelper.AddParameter("@IsPrinted", pURPurchaseHeader.IsPrinted); } else { oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value); } // Pass the value of '_servicePrice' as parameter 'ServicePrice' of the stored procedure. if (pURPurchaseHeader.ServicePrice != null) { oDatabaseHelper.AddParameter("@ServicePrice", pURPurchaseHeader.ServicePrice); } else { oDatabaseHelper.AddParameter("@ServicePrice", DBNull.Value); } // Pass the value of '_taxTypeID' as parameter 'TaxTypeID' of the stored procedure. if (pURPurchaseHeader.TaxTypeID != null) { oDatabaseHelper.AddParameter("@TaxTypeID", pURPurchaseHeader.TaxTypeID); } else { oDatabaseHelper.AddParameter("@TaxTypeID", DBNull.Value); } // Pass the value of '_refuseReasonID' as parameter 'RefuseReasonID' of the stored procedure. if (pURPurchaseHeader.RefuseReasonID != null) { oDatabaseHelper.AddParameter("@RefuseReasonID", pURPurchaseHeader.RefuseReasonID); } else { oDatabaseHelper.AddParameter("@RefuseReasonID", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (pURPurchaseHeader.UpdatedBy != null) { oDatabaseHelper.AddParameter("@UpdatedBy", pURPurchaseHeader.UpdatedBy); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (pURPurchaseHeader.updateDate != null) { oDatabaseHelper.AddParameter("@UpdateDate", pURPurchaseHeader.updateDate); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (pURPurchaseHeader.IsDeleted != null) { oDatabaseHelper.AddParameter("@IsDeleted", pURPurchaseHeader.IsDeleted); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("usp_PURPurchaseHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return(ExecutionState); }
private bool InsertDetails(DatabaseHelper oDatabaseHelper, PURPurchaseLine sALPurchaseLine, int salesHeaderID) { bool ExecutionState = false; // Pass the value of '_salesHeaderID' as parameter 'PurchaseHeaderID' of the stored procedure. if (salesHeaderID != null) { oDatabaseHelper.AddParameter("@PurchaseHeaderID", salesHeaderID); } else { oDatabaseHelper.AddParameter("@PurchaseHeaderID", DBNull.Value); } // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. if (sALPurchaseLine.ProductID != null) { oDatabaseHelper.AddParameter("@ProductID", sALPurchaseLine.ProductID); } else { oDatabaseHelper.AddParameter("@ProductID", DBNull.Value); } // Pass the value of '_totalQty' as parameter 'TotalQty' of the stored procedure. if (sALPurchaseLine.TotalQty != null) { oDatabaseHelper.AddParameter("@BatchQty", sALPurchaseLine.TotalQty); } else { oDatabaseHelper.AddParameter("@BatchQty", DBNull.Value); } // Pass the value of '_totalBonus' as parameter 'TotalBonus' of the stored procedure. if (sALPurchaseLine.BonusQty != null) { oDatabaseHelper.AddParameter("@BonusQty", sALPurchaseLine.BonusQty); } else { oDatabaseHelper.AddParameter("@BonusQty", DBNull.Value); } // Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure. if (sALPurchaseLine.DiscountAmount != null) { oDatabaseHelper.AddParameter("@DiscountAmount", sALPurchaseLine.DiscountAmount); } else { oDatabaseHelper.AddParameter("@DiscountAmount", DBNull.Value); } // Pass the value of '_discountRatio' as parameter 'DiscountRatio' of the stored procedure. if (sALPurchaseLine.DiscountRatio != null) { oDatabaseHelper.AddParameter("@DiscountRatio", sALPurchaseLine.DiscountRatio); } else { oDatabaseHelper.AddParameter("@DiscountRatio", DBNull.Value); } // Pass the value of '_unitPrice' as parameter 'UnitPrice' of the stored procedure. if (sALPurchaseLine.Unitprice != null) { oDatabaseHelper.AddParameter("@UnitPrice", sALPurchaseLine.Unitprice); } else { oDatabaseHelper.AddParameter("@UnitPrice", DBNull.Value); } if (sALPurchaseLine.BatchNumber != null || sALPurchaseLine.BatchNumber != "") { oDatabaseHelper.AddParameter("@BatchNumber", sALPurchaseLine.BatchNumber); } if (sALPurchaseLine.ExpiryDate != null || sALPurchaseLine.ExpiryDate != null) { oDatabaseHelper.AddParameter("@ExpiryDate", sALPurchaseLine.ExpiryDate); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (sALPurchaseLine.CreatedBy != null) { oDatabaseHelper.AddParameter("@CreatedBy", sALPurchaseLine.CreatedBy); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (sALPurchaseLine.CreatedDate != null) { oDatabaseHelper.AddParameter("@CreateDate", sALPurchaseLine.CreatedDate); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); try { oDatabaseHelper.ExecuteScalar("usp_PURPurchaseLine_SaveLine", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); } catch (Exception ex) { } 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); }
/// <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:23 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_purchaseReturnID' as parameter 'PurchaseReturnID' of the stored procedure. oDatabaseHelper.AddParameter("@PurchaseReturnID", _purchaseReturnIDNonDefault); // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure. oDatabaseHelper.AddParameter("@ReturnDate", _returnDateNonDefault); // Pass the value of '_originalHeaderID' as parameter 'OriginalHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@OriginalHeaderID", _originalHeaderIDNonDefault); // 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_PURPurchaseReturnHeader_Update", ref ExecutionState); oDatabaseHelper.Dispose(); 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); }
private bool InsertHeader(DatabaseHelper oDatabaseHelper, SALSalesHeader sALSalesHeader, out int pK) { bool ExecutionState = false; oDatabaseHelper.AddParameter("@InventoryID", sALSalesHeader.InventoryID); // Pass the value of '_salesDate' as parameter 'SalesDate' 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", DBNull.Value); // 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 '_totalPrice' 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); } if (sALSalesHeader.ChequeNumber != null) { oDatabaseHelper.AddParameter("@ChequeNumber", sALSalesHeader.ChequeNumber); } else { oDatabaseHelper.AddParameter("@ChequeNumber", 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_SALSalesHeader_Insert", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState)); // oDatabaseHelper.Dispose(); } catch (Exception ex) { throw; } 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 12/27/2014 6:56:07 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_productStockID' as parameter 'ProductStockID' of the stored procedure. oDatabaseHelper.AddParameter("@ProductStockID", _productStockIDNonDefault); // 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 '_stockTypeID' as parameter 'StockTypeID' of the stored procedure. oDatabaseHelper.AddParameter("@StockTypeID", _stockTypeIDNonDefault); // Pass the value of '_openingQty' as parameter 'OpeningQty' of the stored procedure. oDatabaseHelper.AddParameter("@OpeningQty", _openingQtyNonDefault); // Pass the value of '_opennigDate' as parameter 'OpennigDate' of the stored procedure. oDatabaseHelper.AddParameter("@OpennigDate", _opennigDateNonDefault); // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault); // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault); // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_INVProductStock_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: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; }
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 return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="ADUserPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class ADUser</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static ADUser SelectOne(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); IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_ADUser_SelectbyPrimaryKey", ref ExecutionState); if (dr.Read()) { ADUser obj=new ADUser(); PopulateObjectFromReader(obj,dr); dr.Close(); oDatabaseHelper.Dispose(); return obj; } else { dr.Close(); oDatabaseHelper.Dispose(); return null; } }
/// <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:58 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { 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); oDatabaseHelper.ExecuteScalar("gsp_INVTakingInventoryLine_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="ADUserPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class ADUser</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static ADUser SelectOneWithBDCustomerAccountsUsingCreatedBy(ADUserPrimaryKey pk) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; ADUser obj=null; // Pass the values of all key parameters to the stored procedure. System.Collections.Specialized.NameValueCollection nvc = pk.GetKeysAndValues(); foreach (string key in nvc.Keys) { oDatabaseHelper.AddParameter("@" + key,nvc[key] ); } // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_ADUser_SelectOneWithBDCustomerAccountsUsingCreatedBy", ref ExecutionState); if (dr.Read()) { obj= new ADUser(); PopulateObjectFromReader(obj,dr); dr.NextResult(); //Get the child records. obj.BDCustomerAccountCollectionUsingCreatedBy=BDCustomerAccount.PopulateObjectsFromReader(dr); } dr.Close(); oDatabaseHelper.Dispose(); return obj; }
private bool InsertHeader(DatabaseHelper oDatabaseHelper, INVTransferHeader transferHeader, out int pK) { bool ExecutionState = false; // Pass the value of 'TransferDate' as parameter 'TransferDate' of the stored procedure. oDatabaseHelper.AddParameter("@TransferDate", transferHeader.TransferDate); // Pass the value of 'FromInventoryID' as parameter 'FromInventoryID' of the stored procedure. if (transferHeader.FromInventoryID != null) { oDatabaseHelper.AddParameter("@FromInventoryID", transferHeader.FromInventoryID); } else { oDatabaseHelper.AddParameter("@FromInventoryID", DBNull.Value); } // Pass the value of 'ToInventoryID' as parameter 'ToInventoryID' of the stored procedure. if (transferHeader.ToInventoryID != null) { oDatabaseHelper.AddParameter("@ToInventoryID", transferHeader.ToInventoryID); } else { oDatabaseHelper.AddParameter("@ToInventoryID", 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 (transferHeader.InvoiceDate != null) { oDatabaseHelper.AddParameter("@InvoiceDate", transferHeader.InvoiceDate); } else { oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value); } // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. if (transferHeader.IsClosed != null) { oDatabaseHelper.AddParameter("@IsClosed", transferHeader.IsClosed); } else { oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value); } // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. if (transferHeader.IsVoid != null) { oDatabaseHelper.AddParameter("@IsVoid", transferHeader.IsVoid); } else { oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value); } // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure. if (transferHeader.IsPrinted != null) { oDatabaseHelper.AddParameter("@IsPrinted", transferHeader.IsPrinted); } else { oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (transferHeader.CreatedBy != null) { oDatabaseHelper.AddParameter("@CreatedBy", transferHeader.CreatedBy); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (transferHeader.CreateDate != null) { oDatabaseHelper.AddParameter("@CreateDate", transferHeader.CreateDate); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (transferHeader.UpdatedBy != null) { oDatabaseHelper.AddParameter("@UpdatedBy", transferHeader.UpdatedBy); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (transferHeader.UpdateDate != null) { oDatabaseHelper.AddParameter("@UpdateDate", transferHeader.UpdateDate); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (transferHeader.IsDeleted != null) { oDatabaseHelper.AddParameter("@IsDeleted", transferHeader.IsDeleted); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (transferHeader.DeletedBy != null) { oDatabaseHelper.AddParameter("@DeletedBy", transferHeader.DeletedBy); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure. if (transferHeader.DeletedDate != null) { oDatabaseHelper.AddParameter("@DeletedDate", transferHeader.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); try { pK = Convert.ToInt32(oDatabaseHelper.ExecuteScalar("usp_INVTransferHeader_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> /// <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:07 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { 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 '_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 '_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 '_openingQty' as parameter 'OpeningQty' of the stored procedure. if (_openingQtyNonDefault != null) { oDatabaseHelper.AddParameter("@OpeningQty", _openingQtyNonDefault); } else { oDatabaseHelper.AddParameter("@OpeningQty", DBNull.Value); } // Pass the value of '_opennigDate' as parameter 'OpennigDate' of the stored procedure. if (_opennigDateNonDefault != null) { oDatabaseHelper.AddParameter("@OpennigDate", _opennigDateNonDefault); } else { oDatabaseHelper.AddParameter("@OpennigDate", 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 '_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); } // 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_INVProductStock_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_INVProductStock_Insert_WithDefaultValues_AndReturn", ref ExecutionState); if (dr.Read()) { PopulateObjectFromReader(this, dr); } dr.Close(); } oDatabaseHelper.Dispose(); return(ExecutionState); }
private bool UpdateHeader(DatabaseHelper oDatabaseHelper, INVTransferHeader transferHeader) { bool ExecutionState = false; oDatabaseHelper.AddParameter("@INVTransferHeaderID", transferHeader.INVTransferHeaderID); // Pass the value of '_transferHeaderID' as parameter 'INVTransferHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@TransferDate", transferHeader.TransferDate); // Pass the value of 'FromInventoryID' as parameter 'FromInventoryID' of the stored procedure. if (transferHeader.FromInventoryID != null) { oDatabaseHelper.AddParameter("@FromInventoryID", transferHeader.FromInventoryID); } else { oDatabaseHelper.AddParameter("@FromInventoryID", DBNull.Value); } // Pass the value of 'ToInventoryID' as parameter 'ToInventoryID' of the stored procedure. if (transferHeader.ToInventoryID != null) { oDatabaseHelper.AddParameter("@ToInventoryID", transferHeader.ToInventoryID); } else { oDatabaseHelper.AddParameter("@ToInventoryID", DBNull.Value); } oDatabaseHelper.AddParameter("@InvoiceNumber", transferHeader.InvoiceNumber); // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure. if (transferHeader.InvoiceDate != null) { oDatabaseHelper.AddParameter("@InvoiceDate", transferHeader.InvoiceDate); } else { oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value); } // Pass the value of '_sellerID' as parameter 'SellerID' of the stored procedure. // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. if (transferHeader.IsClosed != null) { oDatabaseHelper.AddParameter("@IsClosed", transferHeader.IsClosed); } else { oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value); } // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. if (transferHeader.IsVoid != null) { oDatabaseHelper.AddParameter("@IsVoid", transferHeader.IsVoid); } else { oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value); } // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure. if (transferHeader.IsPrinted != null) { oDatabaseHelper.AddParameter("@IsPrinted", transferHeader.IsPrinted); } else { oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (transferHeader.CreatedBy != null) { oDatabaseHelper.AddParameter("@CreatedBy", transferHeader.CreatedBy); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (transferHeader.CreateDate != null) { oDatabaseHelper.AddParameter("@CreateDate", transferHeader.CreateDate); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (transferHeader.UpdatedBy != null) { oDatabaseHelper.AddParameter("@UpdatedBy", transferHeader.UpdatedBy); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (transferHeader.UpdateDate != null) { oDatabaseHelper.AddParameter("@UpdateDate", transferHeader.UpdateDate); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (transferHeader.IsDeleted != null) { oDatabaseHelper.AddParameter("@IsDeleted", transferHeader.IsDeleted); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (transferHeader.DeletedBy != null) { oDatabaseHelper.AddParameter("@DeletedBy", transferHeader.DeletedBy); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure. if (transferHeader.DeletedDate != null) { oDatabaseHelper.AddParameter("@DeletedDate", transferHeader.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("gsp_INVTransferHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); 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 12/27/2014 6:56:00 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_customerID' as parameter 'CustomerID' of the stored procedure. oDatabaseHelper.AddParameter("@CustomerID", _customerIDNonDefault); // Pass the value of '_customerName' as parameter 'CustomerName' of the stored procedure. oDatabaseHelper.AddParameter("@CustomerName", _customerNameNonDefault); // Pass the value of '_customerCode' as parameter 'CustomerCode' of the stored procedure. oDatabaseHelper.AddParameter("@CustomerCode", _customerCodeNonDefault); // Pass the value of '_address' as parameter 'Address' of the stored procedure. oDatabaseHelper.AddParameter("@Address", _addressNonDefault); // Pass the value of '_phone1' as parameter 'Phone1' of the stored procedure. oDatabaseHelper.AddParameter("@Phone1", _phone1NonDefault); // Pass the value of '_phone2' as parameter 'Phone2' of the stored procedure. oDatabaseHelper.AddParameter("@Phone2", _phone2NonDefault); // Pass the value of '_mobile1' as parameter 'Mobile1' of the stored procedure. oDatabaseHelper.AddParameter("@Mobile1", _mobile1NonDefault); // Pass the value of '_mobile2' as parameter 'Mobile2' of the stored procedure. oDatabaseHelper.AddParameter("@Mobile2", _mobile2NonDefault); // Pass the value of '_email' as parameter 'Email' of the stored procedure. oDatabaseHelper.AddParameter("@Email", _emailNonDefault); // Pass the value of '_isActive' as parameter 'IsActive' of the stored procedure. oDatabaseHelper.AddParameter("@IsActive", _isActiveNonDefault); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_BDCustomer_Update", ref ExecutionState); oDatabaseHelper.Dispose(); 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 12/27/2014 6:56:04 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 '_originalSalesLineID' as parameter 'OriginalSalesLineID' of the stored procedure. if (_originalSalesLineIDNonDefault != null) { oDatabaseHelper.AddParameter("@OriginalSalesLineID", _originalSalesLineIDNonDefault); } else { oDatabaseHelper.AddParameter("@OriginalSalesLineID", 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_SALSalesReturnLine_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_SALSalesReturnLine_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: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 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; }
/// <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 return a list of objects representing the specified number of entries from the specified record number in the table. /// </summary> /// /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// <param name="orderByStatement" type="string">The field value to number</param> /// /// <returns>list of objects of class INVAdjustStockReason in the form of object of INVAdjustStockReasonCollection </returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:09 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static INVAdjustStockReasonCollection SelectAllPaged(int? pageSize, int? skipPages, string orderByStatement) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // Pass the specified field and its value to the stored procedure. oDatabaseHelper.AddParameter("@PageSize",pageSize); oDatabaseHelper.AddParameter("@SkipPages", skipPages); oDatabaseHelper.AddParameter("@OrderByStatement", orderByStatement ); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_INVAdjustStockReason_SelectAllPaged", ref ExecutionState); INVAdjustStockReasonCollection INVAdjustStockReasonCollection = PopulateObjectsFromReader(dr); dr.Close(); oDatabaseHelper.Dispose(); return INVAdjustStockReasonCollection; }
/// <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> /// <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:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Insert() { 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); oDatabaseHelper.ExecuteScalar("gsp_ADUser_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; }
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 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; }
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; }
/// <summary> /// This method will return a list of objects representing all records in the table. /// </summary> /// /// <returns>list of objects of class ADUser in the form of object of ADUserCollection </returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static ADUserCollection SelectAll() { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_ADUser_SelectAll", ref ExecutionState); ADUserCollection ADUserCollection = PopulateObjectsFromReader(dr); dr.Close(); oDatabaseHelper.Dispose(); return ADUserCollection; }
private bool UpdateCustomerAccount(DatabaseHelper oDatabaseHelper, BDCustomerAccount customerAccount, bool ExecutionState) { oDatabaseHelper.AddParameter("@CustomerAccountNumber", customerAccount.CustomerAccountNumber); oDatabaseHelper.AddParameter("@SalesInvoiceId", customerAccount.SalesInvoiceId); oDatabaseHelper.AddParameter("@SalesDate", customerAccount.SalesDate); oDatabaseHelper.AddParameter("@CustomerID", customerAccount.CustomerID); oDatabaseHelper.AddParameter("@InvoiceNumber", customerAccount.InvoiceNumber); oDatabaseHelper.AddParameter("@TotalPrice", customerAccount.TotalPrice); oDatabaseHelper.AddParameter("@PaidAmount", customerAccount.PaidAmount); oDatabaseHelper.AddParameter("@IsVoid", customerAccount.IsVoid); oDatabaseHelper.AddParameter("@RemainingAmount", customerAccount.RemainingAmount); oDatabaseHelper.AddParameter("@CreateDate", customerAccount.CreateDate); oDatabaseHelper.AddParameter("@CreatedBy", customerAccount.CreatedBy); oDatabaseHelper.AddParameter("@UpdateDate", customerAccount.UpdateDate); oDatabaseHelper.AddParameter("@UpdatedBy", customerAccount.UpdatedBy); oDatabaseHelper.AddParameter("@IsDeleted", customerAccount.IsDeleted); oDatabaseHelper.AddParameter("@DeletedDate", customerAccount.DeletedDate); oDatabaseHelper.AddParameter("@DeletedBy", customerAccount.DeletedBy); oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("gsp_BDCustomerAccounts_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); 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; }
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; }
/// <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:58 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool InsertWithDefaultValues(bool getBackValues) { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_takingDate' as parameter 'TakingDate' of the stored procedure. if (_takingDateNonDefault != null) { oDatabaseHelper.AddParameter("@TakingDate", _takingDateNonDefault); } else { oDatabaseHelper.AddParameter("@TakingDate", DBNull.Value); } // Pass the value of '_takingName' as parameter 'TakingName' of the stored procedure. if (_takingNameNonDefault != null) { oDatabaseHelper.AddParameter("@TakingName", _takingNameNonDefault); } else { oDatabaseHelper.AddParameter("@TakingName", 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 '_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 '_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); } // 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); } // 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_INVTakingInventory_Insert_WithDefaultValues", ref ExecutionState); } else { IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_INVTakingInventory_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:01 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public bool Update() { bool ExecutionState = false; oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_transferLineID' as parameter 'TransferLineID' of the stored procedure. oDatabaseHelper.AddParameter("@TransferLineID", _transferLineIDNonDefault); // Pass the value of '_transferHeaderID' as parameter 'TransferHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@TransferHeaderID", _transferHeaderIDNonDefault); // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure. oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault); // Pass the value of '_qty' as parameter 'Qty' of the stored procedure. oDatabaseHelper.AddParameter("@Qty", _qtyNonDefault); // 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_INVTransferLine_Update", ref ExecutionState); oDatabaseHelper.Dispose(); return(ExecutionState); }
private bool InsertHeader(DatabaseHelper oDatabaseHelper, PURPurchaseReturnHeader pURPurchaseReturnHeader, out int pK) { bool ExecutionState = false; // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure. if (pURPurchaseReturnHeader.ReturnDate != null) { oDatabaseHelper.AddParameter("@ReturnDate", pURPurchaseReturnHeader.ReturnDate); } else { oDatabaseHelper.AddParameter("@ReturnDate", DBNull.Value); } // Pass the value of '_originalPurchaseHeadeID' as parameter 'OriginalPurchaseHeadeID' of the stored procedure. if (pURPurchaseReturnHeader.OriginalHeaderID != null) { oDatabaseHelper.AddParameter("@OriginalPurchaseHeadeID", pURPurchaseReturnHeader.OriginalHeaderID); } else { oDatabaseHelper.AddParameter("@OriginalPurchaseHeadeID", DBNull.Value); } // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. if (pURPurchaseReturnHeader.CreatedBy != null) { oDatabaseHelper.AddParameter("@CreatedBy", pURPurchaseReturnHeader.CreatedBy); } else { oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value); } // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. if (pURPurchaseReturnHeader.CreateDate != null) { oDatabaseHelper.AddParameter("@CreateDate", pURPurchaseReturnHeader.CreateDate); } else { oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value); } // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. if (pURPurchaseReturnHeader.UpdatedBy != null) { oDatabaseHelper.AddParameter("@UpdatedBy", pURPurchaseReturnHeader.UpdatedBy); } else { oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value); } // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. if (pURPurchaseReturnHeader.UpdateDate != null) { oDatabaseHelper.AddParameter("@UpdateDate", pURPurchaseReturnHeader.UpdateDate); } else { oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value); } // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. if (pURPurchaseReturnHeader.IsDeleted != null) { oDatabaseHelper.AddParameter("@IsDeleted", pURPurchaseReturnHeader.IsDeleted); } else { oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value); } // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. if (pURPurchaseReturnHeader.DeletedBy != null) { oDatabaseHelper.AddParameter("@DeletedBy", pURPurchaseReturnHeader.DeletedBy); } else { oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value); } // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. if (pURPurchaseReturnHeader.DeleteDate != null) { oDatabaseHelper.AddParameter("@DeleteDate", pURPurchaseReturnHeader.DeleteDate); } else { oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value); } // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. if (pURPurchaseReturnHeader.IsClosed != null) { oDatabaseHelper.AddParameter("@IsClosed", pURPurchaseReturnHeader.IsClosed); } else { oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value); } // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. if (pURPurchaseReturnHeader.IsVoid != null) { oDatabaseHelper.AddParameter("@IsVoid", pURPurchaseReturnHeader.IsVoid); } else { oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value); } if (pURPurchaseReturnHeader.ReturnMoney != null) { oDatabaseHelper.AddParameter("@ReturnMoney", pURPurchaseReturnHeader.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_PURPurchaseReturnHeader_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:05 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); } // Pass the value of '_debit' as parameter 'Debit' of the stored procedure. if (_debitNonDefault != null) { oDatabaseHelper.AddParameter("@Debit", _debitNonDefault); } else { oDatabaseHelper.AddParameter("@Debit", DBNull.Value); } // Pass the value of '_credit' as parameter 'Credit' of the stored procedure. if (_creditNonDefault != null) { oDatabaseHelper.AddParameter("@Credit", _creditNonDefault); } else { oDatabaseHelper.AddParameter("@Credit", 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); }
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 InsertDetails(DatabaseHelper oDatabaseHelper, PURPurchaseReturnLine pURPurchaseReturnLine, int purchaseReturnHeaderID) { bool ExecutionState = false; // Pass the value of '_qty' as parameter 'Qty' of the stored procedure. if (pURPurchaseReturnLine.Qty != null) { oDatabaseHelper.AddParameter("@Qty", pURPurchaseReturnLine.Qty); } else { oDatabaseHelper.AddParameter("@Qty", DBNull.Value); } // Pass the value of '_reason' as parameter 'Reason' of the stored procedure. if (pURPurchaseReturnLine.Reason != null) { oDatabaseHelper.AddParameter("@Reason", pURPurchaseReturnLine.Reason); } else { oDatabaseHelper.AddParameter("@Reason", DBNull.Value); } // Pass the value of '_originalPurchaseLineID' as parameter 'OriginalPurchaseLineID' of the stored procedure. if (pURPurchaseReturnLine.OriginalpurchaseLineID != null) { oDatabaseHelper.AddParameter("@OriginalPurchaseLineID", pURPurchaseReturnLine.OriginalpurchaseLineID); } else { oDatabaseHelper.AddParameter("@OriginalPurchaseLineID", DBNull.Value); } // Pass the value of '_batchID' as parameter 'BatchID' of the stored procedure. if (pURPurchaseReturnLine.BatchID != null) { oDatabaseHelper.AddParameter("@BatchID", pURPurchaseReturnLine.BatchID); } else { oDatabaseHelper.AddParameter("@BatchID", DBNull.Value); } // Pass the value of '_batchNumber' as parameter 'BatchNumber' of the stored procedure. if (pURPurchaseReturnLine.BatchNumber != null) { oDatabaseHelper.AddParameter("@BatchNumber", pURPurchaseReturnLine.BatchNumber); } else { oDatabaseHelper.AddParameter("@BatchNumber", DBNull.Value); } // Pass the value of '_expiryDate' as parameter 'ExpiryDate' of the stored procedure. if (pURPurchaseReturnLine.ExpiryDate != null) { oDatabaseHelper.AddParameter("@ExpiryDate", pURPurchaseReturnLine.ExpiryDate); } else { oDatabaseHelper.AddParameter("@ExpiryDate", DBNull.Value); } // Pass the value of '_salesReturnHeaderID' as parameter 'PurchaseReturnHeaderID' of the stored procedure. if (purchaseReturnHeaderID != null) { oDatabaseHelper.AddParameter("@PurchaseReturnHeaderID", purchaseReturnHeaderID); } else { oDatabaseHelper.AddParameter("@PurchaseReturnHeaderID", 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_PURPurchaseReturnLine_InsertCommit", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return(ExecutionState); }
private bool DeleteDetails(DatabaseHelper oDatabaseHelper, int SalesReturnHeaderID, int UserID) { bool ExecutionState = false; oDatabaseHelper.AddParameter("@UserID", UserID); oDatabaseHelper.AddParameter("@SalesReturnHeaderID", SalesReturnHeaderID); oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("usp_SALSalesReturnLine_DeleteLines", ref ExecutionState); return ExecutionState; }
private bool UpdateHeader(DatabaseHelper oDatabaseHelper, PURPurchaseReturnHeader pURPurchaseReturnHeader) { bool ExecutionState = false; // Pass the value of '_slaesReturnHeaderID' as parameter 'SlaesReturnHeaderID' of the stored procedure. oDatabaseHelper.AddParameter("@SlaesReturnHeaderID", pURPurchaseReturnHeader.PurchaseReturnID); // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure. oDatabaseHelper.AddParameter("@ReturnDate", pURPurchaseReturnHeader.ReturnDate); // Pass the value of '_originalPurchaseHeadeID' as parameter 'OriginalPurchaseHeadeID' of the stored procedure. oDatabaseHelper.AddParameter("@OriginalPurchaseHeadeID", pURPurchaseReturnHeader.OriginalHeaderID); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedBy", pURPurchaseReturnHeader.CreatedBy); // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure. oDatabaseHelper.AddParameter("@CreateDate", pURPurchaseReturnHeader.CreateDate); // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@UpdatedBy", pURPurchaseReturnHeader.UpdatedBy); // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure. oDatabaseHelper.AddParameter("@UpdateDate", pURPurchaseReturnHeader.UpdateDate); // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure. oDatabaseHelper.AddParameter("@IsDeleted", pURPurchaseReturnHeader.IsDeleted); // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure. oDatabaseHelper.AddParameter("@DeletedBy", pURPurchaseReturnHeader.DeletedBy); // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure. oDatabaseHelper.AddParameter("@DeleteDate", pURPurchaseReturnHeader.DeleteDate); // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure. oDatabaseHelper.AddParameter("@IsClosed", pURPurchaseReturnHeader.IsClosed); // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure. oDatabaseHelper.AddParameter("@IsVoid", pURPurchaseReturnHeader.IsVoid); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("usp_PURPurchaseReturnHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState); return(ExecutionState); }