Exemplo n.º 1
0
        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;
            }

        }
Exemplo n.º 2
0
        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;

        }
Exemplo n.º 3
0
        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;

        }
Exemplo n.º 4
0
        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;

        }
Exemplo n.º 5
0
        public INVTakingInventoryCollection GetNotCommittedTaking()
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;

            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            //oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

            IDataReader dr = oDatabaseHelper.ExecuteReader("usp_INVTakingInventory_GetNotCommited", ref ExecutionState);

            INVTakingInventoryCollection list = new INVTakingInventoryCollection();

            while (dr.Read())
            {
                INVTakingInventory obj = new INVTakingInventory();
                 obj.TakingHeaderID = dr.GetInt32(dr.GetOrdinal(INVTakingInventoryFields.TakingHeaderID));
                obj.TakingDate = dr.GetDateTime(dr.GetOrdinal(INVTakingInventoryFields.TakingDate));
                obj.TakingName = dr.GetString(dr.GetOrdinal(INVTakingInventoryFields.TakingName));
                
                if (!dr.IsDBNull(dr.GetOrdinal(INVTakingInventoryFields.Notes)))
                {
                    obj.Notes = dr.GetString(dr.GetOrdinal(INVTakingInventoryFields.Notes));
                }

                if (!dr.IsDBNull(dr.GetOrdinal(INVTakingInventoryFields.InventoryID)))
                {
                    obj.InventoryID = dr.GetInt32(dr.GetOrdinal(INVTakingInventoryFields.InventoryID));
                }
                //if (!dr.IsDBNull(dr.GetOrdinal("UserName")))
                //{
                //    obj.CreatedBy = dr.GetString(dr.GetOrdinal("UserName"));
                //}
                if (!dr.IsDBNull(dr.GetOrdinal("InventoryName")))
                {
                    obj.InventoryName = dr.GetString(dr.GetOrdinal("InventoryName"));
                }
                list.Add(obj);
            }
            
            
            dr.Close();
            oDatabaseHelper.Dispose();
            return list;
            //usp_INVTakingInventory_GetNotCommited
        }
Exemplo n.º 6
0
        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;

        }
Exemplo n.º 7
0
        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;

        }
Exemplo n.º 8
0
        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;

        }
Exemplo n.º 9
0
        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;

        }
Exemplo n.º 10
0
        /// <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 PURPurchaseReturnLine</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 PURPurchaseReturnLine in the form of an object of class PURPurchaseReturnLineCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:14 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static PURPurchaseReturnLineCollection 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_PURPurchaseReturnLine_SelectByFieldPaged", ref ExecutionState);
            PURPurchaseReturnLineCollection PURPurchaseReturnLineCollection = PopulateObjectsFromReader(dr);

            dr.Close();
            oDatabaseHelper.Dispose();
            return(PURPurchaseReturnLineCollection);
        }
Exemplo n.º 11
0
		/// <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;
			
		}
Exemplo n.º 12
0
		/// <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="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		/// <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>object of class PURPurchaseLineCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 2:37:18 PM				Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static PURPurchaseLineCollection SelectAllByForeignKeyPurchaseHeaderIDPaged(PURPurchaseHeaderPrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
		{
			DatabaseHelper oDatabaseHelper = new DatabaseHelper();
			bool ExecutionState = false;
			PURPurchaseLineCollection 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] );
			}
			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_PURPurchaseLine_SelectAllByForeignKeyPurchaseHeaderIDPaged", ref ExecutionState);
			obj = new PURPurchaseLineCollection();
			obj = PURPurchaseLine.PopulateObjectsFromReaderWithCheckingReader(dr, oDatabaseHelper);
			
			dr.Close();  
			oDatabaseHelper.Dispose();
			return obj;
			
		}
Exemplo n.º 13
0
		/// <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="PURPurchaseLinePrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class PURPurchaseLine</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 2:37:18 PM				Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static PURPurchaseLine SelectOneWithPURPurchaseReturnLineUsingOriginalpurchaseLineID(PURPurchaseLinePrimaryKey pk)
		{
			DatabaseHelper oDatabaseHelper = new DatabaseHelper();
			bool ExecutionState = false;
			PURPurchaseLine 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_PURPurchaseLine_SelectOneWithPURPurchaseReturnLineUsingOriginalpurchaseLineID", ref ExecutionState);
			if (dr.Read())
			{
				obj= new PURPurchaseLine();
				PopulateObjectFromReader(obj,dr);
				
				dr.NextResult();
				
				//Get the child records.
				obj.PURPurchaseReturnLineCollectionUsingOriginalpurchaseLineID=PURPurchaseReturnLine.PopulateObjectsFromReader(dr);
			}
			dr.Close();  
			oDatabaseHelper.Dispose();
			return obj;
			
		}
Exemplo n.º 14
0
		/// <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;
			
		}
Exemplo n.º 15
0
		/// <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;
			
		}
Exemplo n.º 16
0
		/// <summary>
		/// This method will insert one new row into the database using the property Information
		/// </summary>
		/// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param>
		/// <returns>True if succeeded</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 2:37:16 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public bool InsertWithDefaultValues(bool getBackValues) 
		{
			bool ExecutionState = false;
			oDatabaseHelper = new DatabaseHelper();
			
			// Pass the value of '_salesHeaderID' as parameter 'SalesHeaderID' of the stored procedure.
			if(_salesHeaderIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@SalesHeaderID", _salesHeaderIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@SalesHeaderID", DBNull.Value );
			  
			// Pass the value of '_productID' as parameter 'ProductID' of the stored procedure.
			if(_productIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@ProductID", DBNull.Value );
			  
			// Pass the value of '_totalQty' as parameter 'TotalQty' of the stored procedure.
			if(_totalQtyNonDefault!=null)
			  oDatabaseHelper.AddParameter("@TotalQty", _totalQtyNonDefault);
			else
			  oDatabaseHelper.AddParameter("@TotalQty", DBNull.Value );
			  
			// Pass the value of '_totalBonus' as parameter 'TotalBonus' of the stored procedure.
			if(_totalBonusNonDefault!=null)
			  oDatabaseHelper.AddParameter("@TotalBonus", _totalBonusNonDefault);
			else
			  oDatabaseHelper.AddParameter("@TotalBonus", DBNull.Value );
			  
			// Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure.
			if(_discountAmountNonDefault!=null)
			  oDatabaseHelper.AddParameter("@DiscountAmount", _discountAmountNonDefault);
			else
			  oDatabaseHelper.AddParameter("@DiscountAmount", DBNull.Value );
			  
			// Pass the value of '_discountRatio' as parameter 'DiscountRatio' of the stored procedure.
			if(_discountRatioNonDefault!=null)
			  oDatabaseHelper.AddParameter("@DiscountRatio", _discountRatioNonDefault);
			else
			  oDatabaseHelper.AddParameter("@DiscountRatio", DBNull.Value );
			  
			// Pass the value of '_unitPrice' as parameter 'UnitPrice' of the stored procedure.
			if(_unitPriceNonDefault!=null)
			  oDatabaseHelper.AddParameter("@UnitPrice", _unitPriceNonDefault);
			else
			  oDatabaseHelper.AddParameter("@UnitPrice", DBNull.Value );
			  
			// Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
			if(_createdByNonDefault!=null)
			  oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault);
			else
			  oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value );
			  
			// Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
			if(_createDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value );
			  
			// Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
			if(_updatedByNonDefault!=null)
			  oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault);
			else
			  oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value );
			  
			// Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
			if(_updateDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value );
			  
			// Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
			if(_isDeletedNonDefault!=null)
			  oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault);
			else
			  oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value );
			  
			// Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
			if(_deletedByNonDefault!=null)
			  oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault);
			else
			  oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value );
			  
			// Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure.
			if(_deleteDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@DeleteDate", _deleteDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value );
			  
			// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
			oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
			
			if(!getBackValues )
			{
				oDatabaseHelper.ExecuteScalar("gsp_SALSalesLine_Insert_WithDefaultValues", ref ExecutionState);
			}
			else
			{
				IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_SALSalesLine_Insert_WithDefaultValues_AndReturn", ref ExecutionState);
				if (dr.Read())
				{
					PopulateObjectFromReader(this,dr);
				}
				dr.Close();
			}
			oDatabaseHelper.Dispose();	
			return ExecutionState;
			
		}
Exemplo n.º 17
0
        /// <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:03 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public bool InsertWithDefaultValues(bool getBackValues)
        {
            bool ExecutionState = false;

            oDatabaseHelper = new DatabaseHelper();

            // Pass the value of '_salesHeaderID' as parameter 'SalesHeaderID' of the stored procedure.
            if (_salesHeaderIDNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@SalesHeaderID", _salesHeaderIDNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@SalesHeaderID", DBNull.Value);
            }

            // Pass the value of '_productID' as parameter 'ProductID' of the stored procedure.
            if (_productIDNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@ProductID", _productIDNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ProductID", DBNull.Value);
            }

            // Pass the value of '_totalQty' as parameter 'TotalQty' of the stored procedure.
            if (_totalQtyNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@TotalQty", _totalQtyNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TotalQty", DBNull.Value);
            }

            // Pass the value of '_totalBonus' as parameter 'TotalBonus' of the stored procedure.
            if (_totalBonusNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@TotalBonus", _totalBonusNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TotalBonus", DBNull.Value);
            }

            // Pass the value of '_discountAmount' as parameter 'DiscountAmount' of the stored procedure.
            if (_discountAmountNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@DiscountAmount", _discountAmountNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DiscountAmount", DBNull.Value);
            }

            // Pass the value of '_discountRatio' as parameter 'DiscountRatio' of the stored procedure.
            if (_discountRatioNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@DiscountRatio", _discountRatioNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DiscountRatio", DBNull.Value);
            }

            // Pass the value of '_unitPrice' as parameter 'UnitPrice' of the stored procedure.
            if (_unitPriceNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@UnitPrice", _unitPriceNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UnitPrice", DBNull.Value);
            }

            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (_createdByNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            }

            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            if (_createDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value);
            }

            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (_updatedByNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            }

            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (_updateDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            }

            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (_isDeletedNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            }

            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            if (_deletedByNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value);
            }

            // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure.
            if (_deleteDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@DeleteDate", _deleteDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value);
            }

            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

            if (!getBackValues)
            {
                oDatabaseHelper.ExecuteScalar("gsp_SALSalesLine_Insert_WithDefaultValues", ref ExecutionState);
            }
            else
            {
                IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_SALSalesLine_Insert_WithDefaultValues_AndReturn", ref ExecutionState);
                if (dr.Read())
                {
                    PopulateObjectFromReader(this, dr);
                }
                dr.Close();
            }
            oDatabaseHelper.Dispose();
            return(ExecutionState);
        }
Exemplo n.º 18
0
		/// <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			11/4/2015 8:46:45 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public bool InsertWithDefaultValues(bool getBackValues) 
		{
			bool ExecutionState = false;
			oDatabaseHelper = new DatabaseHelper();
			
			// Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure.
			if(_returnDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@ReturnDate", _returnDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@ReturnDate", DBNull.Value );
			  
			// Pass the value of '_originalHeaderID' as parameter 'OriginalHeaderID' of the stored procedure.
			if(_originalHeaderIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@OriginalHeaderID", _originalHeaderIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@OriginalHeaderID", DBNull.Value );
			  
			// Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
			if(_createdByNonDefault!=null)
			  oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault);
			else
			  oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value );
			  
			// Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
			if(_createDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value );
			  
			// Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
			if(_updatedByNonDefault!=null)
			  oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault);
			else
			  oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value );
			  
			// Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
			if(_updateDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value );
			  
			// Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
			if(_isDeletedNonDefault!=null)
			  oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault);
			else
			  oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value );
			  
			// Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
			if(_deletedByNonDefault!=null)
			  oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault);
			else
			  oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value );
			  
			// Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure.
			if(_deleteDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@DeleteDate", _deleteDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value );
			  
			// Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
			if(_isClosedNonDefault!=null)
			  oDatabaseHelper.AddParameter("@IsClosed", _isClosedNonDefault);
			else
			  oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value );
			  
			// Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
			if(_isVoidNonDefault!=null)
			  oDatabaseHelper.AddParameter("@IsVoid", _isVoidNonDefault);
			else
			  oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value );
			  
			// Pass the value of '_returnMoney' as parameter 'ReturnMoney' of the stored procedure.
			if(_returnMoneyNonDefault!=null)
			  oDatabaseHelper.AddParameter("@ReturnMoney", _returnMoneyNonDefault);
			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);
			
			if(!getBackValues )
			{
				oDatabaseHelper.ExecuteScalar("gsp_PURPurchaseReturnHeader_Insert_WithDefaultValues", ref ExecutionState);
			}
			else
			{
				IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_PURPurchaseReturnHeader_Insert_WithDefaultValues_AndReturn", ref ExecutionState);
				if (dr.Read())
				{
					PopulateObjectFromReader(this,dr);
				}
				dr.Close();
			}
			oDatabaseHelper.Dispose();	
			return ExecutionState;
			
		}
Exemplo n.º 19
0
        /// <summary>
        /// This method will insert one new row into the database using the property Information
        /// </summary>
        /// <param name="getBackValues" type="bool">Whether to get the default values inserted, from the database</param>
        /// <returns>True if succeeded</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			3/7/2015 2:36:58 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public bool InsertWithDefaultValues(bool getBackValues)
        {
            bool ExecutionState = false;

            oDatabaseHelper = new DatabaseHelper();

            // Pass the value of '_transferDate' as parameter 'TransferDate' of the stored procedure.
            if (_transferDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@TransferDate", _transferDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TransferDate", DBNull.Value);
            }

            // Pass the value of '_fromInventoryID' as parameter 'FromInventoryID' of the stored procedure.
            if (_fromInventoryIDNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@FromInventoryID", _fromInventoryIDNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@FromInventoryID", DBNull.Value);
            }

            // Pass the value of '_toInventoryID' as parameter 'ToInventoryID' of the stored procedure.
            if (_toInventoryIDNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@ToInventoryID", _toInventoryIDNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ToInventoryID", DBNull.Value);
            }

            // Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure.
            if (_invoiceNumberNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@InvoiceNumber", _invoiceNumberNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@InvoiceNumber", DBNull.Value);
            }

            // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure.
            if (_invoiceDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@InvoiceDate", _invoiceDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value);
            }

            // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
            if (_isVoidNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@IsVoid", _isVoidNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value);
            }

            // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure.
            if (_isPrintedNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@IsPrinted", _isPrintedNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value);
            }

            // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
            if (_isClosedNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@IsClosed", _isClosedNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value);
            }

            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (_createdByNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            }

            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            if (_createDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@CreateDate", _createDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value);
            }

            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (_updatedByNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            }

            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (_updateDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            }

            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (_isDeletedNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@IsDeleted", _isDeletedNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            }

            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            if (_deletedByNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@DeletedBy", _deletedByNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value);
            }

            // Pass the value of '_deletedDate' as parameter 'DeletedDate' of the stored procedure.
            if (_deletedDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@DeletedDate", _deletedDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeletedDate", DBNull.Value);
            }

            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

            if (!getBackValues)
            {
                oDatabaseHelper.ExecuteScalar("gsp_INVTransferHeader_Insert_WithDefaultValues", ref ExecutionState);
            }
            else
            {
                IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_INVTransferHeader_Insert_WithDefaultValues_AndReturn", ref ExecutionState);
                if (dr.Read())
                {
                    PopulateObjectFromReader(this, dr);
                }
                dr.Close();
            }
            oDatabaseHelper.Dispose();
            return(ExecutionState);
        }
Exemplo n.º 20
0
		/// <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			4/4/2015 1:32:30 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 '_batchID' as parameter 'BatchID' of the stored procedure.
			if(_batchIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@BatchID", _batchIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@BatchID", DBNull.Value );
			  
			// Pass the value of '_qty' as parameter 'Qty' of the stored procedure.
			if(_qtyNonDefault!=null)
			  oDatabaseHelper.AddParameter("@Qty", _qtyNonDefault);
			else
			  oDatabaseHelper.AddParameter("@Qty", DBNull.Value );
			  
			// Pass the value of '_adjustReasonID' as parameter 'AdjustReasonID' of the stored procedure.
			if(_adjustReasonIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@AdjustReasonID", _adjustReasonIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@AdjustReasonID", DBNull.Value );
			  
			// Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
			if(_createdByNonDefault!=null)
			  oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault);
			else
			  oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value );
			  
			// Pass the value of '_credateDate' as parameter 'CredateDate' of the stored procedure.
			if(_credateDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@CredateDate", _credateDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@CredateDate", DBNull.Value );
			  
			// Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
			if(_updatedByNonDefault!=null)
			  oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault);
			else
			  oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value );
			  
			// Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
			if(_updateDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value );
			  
			// Pass the value of '_stockTypeID' as parameter 'StockTypeID' of the stored procedure.
			if(_stockTypeIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@StockTypeID", _stockTypeIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@StockTypeID", DBNull.Value );
			  
			// Pass the value of '_oldStockTypeID' as parameter 'OldStockTypeID' of the stored procedure.
			if(_oldStockTypeIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@OldStockTypeID", _oldStockTypeIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@OldStockTypeID", DBNull.Value );
			  
			// Pass the value of '_inventoryID' as parameter 'InventoryID' of the stored procedure.
			if(_inventoryIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@InventoryID", _inventoryIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value );
			  
			// Pass the value of '_expiryDate' as parameter 'ExpiryDate' of the stored procedure.
			if(_expiryDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@ExpiryDate", _expiryDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@ExpiryDate", DBNull.Value );
			  
			// Pass the value of '_batchNumber' as parameter 'BatchNumber' of the stored procedure.
			if(_batchNumberNonDefault!=null)
			  oDatabaseHelper.AddParameter("@BatchNumber", _batchNumberNonDefault);
			else
			  oDatabaseHelper.AddParameter("@BatchNumber", DBNull.Value );
			  
			// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
			oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
			
			if(!getBackValues )
			{
				oDatabaseHelper.ExecuteScalar("gsp_INVAdjustStock_Insert_WithDefaultValues", ref ExecutionState);
			}
			else
			{
				IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_INVAdjustStock_Insert_WithDefaultValues_AndReturn", ref ExecutionState);
				if (dr.Read())
				{
					PopulateObjectFromReader(this,dr);
				}
				dr.Close();
			}
			oDatabaseHelper.Dispose();	
			return ExecutionState;
			
		}
Exemplo n.º 21
0
		/// <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:11 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 );
			  
			// Pass the value of '_inventoryID' as parameter 'InventoryID' of the stored procedure.
			if(_inventoryIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@InventoryID", _inventoryIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value );
			  
			// 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;
			
		}
Exemplo n.º 22
0
         public  PURPurchaseLineCollection SelectByHeaderID(int HeaderID)
                {
                    DatabaseHelper oDatabaseHelper = new DatabaseHelper();
                    bool ExecutionState = false;
                    oDatabaseHelper.AddParameter("@HeaderID", HeaderID);
                    oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

                    IDataReader rdr = oDatabaseHelper.ExecuteReader("usp_PURPurchaseLine_SelectByHeaderID", ref ExecutionState);
                    PURPurchaseLineCollection lines = new PURPurchaseLineCollection();
                    while(rdr.Read())
                    {
                        PURPurchaseLine obj = new PURPurchaseLine();
                        obj.PurchaseLineID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseLineFields.PurchaseLineID));
                        //obj.PurchaseHeaderID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseLineFields.PurchaseHeaderID));
                        obj.ProductID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseLineFields.ProductID));
                        obj.TotalQty = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseLineFields.TotalQty));
                        obj.BonusQty = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseLineFields.BonusQty));
                        obj.DiscountRatio = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseLineFields.DiscountRatio));
                        obj.IsAcceptBatch = rdr.GetBoolean(rdr.GetOrdinal("IsAcceptBatch"));
                        //obj.DiscountAmount = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseLineFields.DiscountAmount));
                        obj.Unitprice = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseLineFields.Unitprice));
                        if (rdr.GetOrdinal("PurchaseLineBatchID") != null && rdr.GetInt32(rdr.GetOrdinal("PurchaseLineBatchID")) !=0)
                            obj.PurchaseLineBatchID = rdr.GetInt32(rdr.GetOrdinal("PurchaseLineBatchID"));
                        if (rdr.GetOrdinal("BatchID") != null && rdr.GetInt32(rdr.GetOrdinal("BatchID")) != 0)
                        {
                            obj.BatchID = rdr.GetInt32(rdr.GetOrdinal("BatchID"));
                            obj.BatchNumber = rdr.GetString(rdr.GetOrdinal("BatchNumber"));
                            obj.ExpiryDate = rdr.GetDateTime(rdr.GetOrdinal("ExpiryDate"));
                        }
                        lines.Add(obj);
                    }
                   
                        rdr.Close();
                        return lines;
         }
Exemplo n.º 23
0
        public INVTakingInventoryLineCollection GetLines(int HeaderID)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;

            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("TakingHeaderID", HeaderID);
           // oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

            IDataReader dr = oDatabaseHelper.ExecuteReader("usp_INVTakingInventory_GetLines", ref ExecutionState);

            INVTakingInventoryLineCollection list = new INVTakingInventoryLineCollection();

            while (dr.Read())
            {
                INVTakingInventoryLine obj = new INVTakingInventoryLine();
                 obj.TakingLineID = dr.GetInt32(dr.GetOrdinal(INVTakingInventoryLineFields.TakingLineID));
                 if (!dr.IsDBNull(dr.GetOrdinal("TakingLineBatchID")))
                 {
                     obj.TakingLineBatchID = dr.GetInt32(dr.GetOrdinal("TakingLineBatchID"));
                 }
                obj.ProductID = dr.GetInt32(dr.GetOrdinal(INVTakingInventoryLineFields.ProductID));
                obj.ProductName= dr.GetString(dr.GetOrdinal("ProductName"));
                obj.StockTypeName = dr.GetString(dr.GetOrdinal("StockTypeName"));
                obj.ExpectedQty = dr.GetDecimal(dr.GetOrdinal(INVTakingInventoryLineFields.ExpectedQty));
                obj.ActualQty = dr.GetDecimal(dr.GetOrdinal(INVTakingInventoryLineFields.ActualQty));
                obj.IsAcceptBatch = dr.GetBoolean(dr.GetOrdinal("IsAcceptBatch"));
                if (!dr.IsDBNull(dr.GetOrdinal("BatchNumber")))
                    obj.BatchNumber = dr.GetString(dr.GetOrdinal("BatchNumber"));
                if (!dr.IsDBNull(dr.GetOrdinal("ExpiryDate")))
                obj.ExpiryDate = dr.GetDateTime(dr.GetOrdinal("ExpiryDate"));
                list.Add(obj);
            }


            dr.Close();
            oDatabaseHelper.Dispose();
            return list;
            //usp_INVTakingInventory_GetNotCommited
        }
Exemplo n.º 24
0
		/// <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="INVInventoryPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class SALSalesReturnHeaderCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			4/4/2015 6:56:38 PM				Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static SALSalesReturnHeaderCollection SelectAllByForeignKeyInventoryID(INVInventoryPrimaryKey pk)
		{
			DatabaseHelper oDatabaseHelper = new DatabaseHelper();
			bool ExecutionState = false;
			SALSalesReturnHeaderCollection 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_SALSalesReturnHeader_SelectAllByForeignKeyInventoryID", ref ExecutionState);
			obj = new SALSalesReturnHeaderCollection();
			obj = SALSalesReturnHeader.PopulateObjectsFromReaderWithCheckingReader(dr, oDatabaseHelper);
			
			dr.Close();  
			oDatabaseHelper.Dispose();
			return obj;
			
		}
Exemplo n.º 25
0
        /// <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);
        }
Exemplo n.º 26
0
		/// <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 '_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 );
			  
			// Pass the value of '_inventoryID' as parameter 'InventoryID' of the stored procedure.
			if(_inventoryIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@InventoryID", _inventoryIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value );
			  
			// Pass the value of '_isBlocked' as parameter 'IsBlocked' of the stored procedure.
			if(_isBlockedNonDefault!=null)
			  oDatabaseHelper.AddParameter("@IsBlocked", _isBlockedNonDefault);
			else
			  oDatabaseHelper.AddParameter("@IsBlocked", 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;
			
		}
Exemplo n.º 27
0
        /// <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);
        }
Exemplo n.º 28
0
		/// <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;
			
		}
Exemplo n.º 29
0
		/// <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;
			
		}
Exemplo n.º 30
0
		/// <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 10:40:24 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public bool InsertWithDefaultValues(bool getBackValues) 
		{
			bool ExecutionState = false;
			oDatabaseHelper = new DatabaseHelper();
			
			// Pass the value of '_salesDate' as parameter 'SalesDate' of the stored procedure.
			if(_salesDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@SalesDate", _salesDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@SalesDate", DBNull.Value );
			  
			// Pass the value of '_customerID' as parameter 'CustomerID' of the stored procedure.
			if(_customerIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@CustomerID", _customerIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@CustomerID", DBNull.Value );
			  
			// Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure.
			if(_invoiceNumberNonDefault!=null)
			  oDatabaseHelper.AddParameter("@InvoiceNumber", _invoiceNumberNonDefault);
			else
			  oDatabaseHelper.AddParameter("@InvoiceNumber", DBNull.Value );
			  
			// Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure.
			if(_invoiceDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@InvoiceDate", _invoiceDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value );
			  
			// Pass the value of '_sellerID' as parameter 'SellerID' of the stored procedure.
			if(_sellerIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@SellerID", _sellerIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@SellerID", DBNull.Value );
			  
			// Pass the value of '_paymentTypeID' as parameter 'PaymentTypeID' of the stored procedure.
			if(_paymentTypeIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@PaymentTypeID", _paymentTypeIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@PaymentTypeID", DBNull.Value );
			  
			// Pass the value of '_totalPrice' as parameter 'TotalPrice' of the stored procedure.
			if(_totalPriceNonDefault!=null)
			  oDatabaseHelper.AddParameter("@TotalPrice", _totalPriceNonDefault);
			else
			  oDatabaseHelper.AddParameter("@TotalPrice", DBNull.Value );
			  
			// Pass the value of '_paidAmount' as parameter 'PaidAmount' of the stored procedure.
			if(_paidAmountNonDefault!=null)
			  oDatabaseHelper.AddParameter("@PaidAmount", _paidAmountNonDefault);
			else
			  oDatabaseHelper.AddParameter("@PaidAmount", DBNull.Value );
			  
			// Pass the value of '_remainingAmount' as parameter 'RemainingAmount' of the stored procedure.
			if(_remainingAmountNonDefault!=null)
			  oDatabaseHelper.AddParameter("@RemainingAmount", _remainingAmountNonDefault);
			else
			  oDatabaseHelper.AddParameter("@RemainingAmount", DBNull.Value );
			  
			// Pass the value of '_lastDayToPay' as parameter 'LastDayToPay' of the stored procedure.
			if(_lastDayToPayNonDefault!=null)
			  oDatabaseHelper.AddParameter("@LastDayToPay", _lastDayToPayNonDefault);
			else
			  oDatabaseHelper.AddParameter("@LastDayToPay", DBNull.Value );
			  
			// Pass the value of '_totalDiscountAmount' as parameter 'TotalDiscountAmount' of the stored procedure.
			if(_totalDiscountAmountNonDefault!=null)
			  oDatabaseHelper.AddParameter("@TotalDiscountAmount", _totalDiscountAmountNonDefault);
			else
			  oDatabaseHelper.AddParameter("@TotalDiscountAmount", DBNull.Value );
			  
			// Pass the value of '_totalDiscountRatio' as parameter 'TotalDiscountRatio' of the stored procedure.
			if(_totalDiscountRatioNonDefault!=null)
			  oDatabaseHelper.AddParameter("@TotalDiscountRatio", _totalDiscountRatioNonDefault);
			else
			  oDatabaseHelper.AddParameter("@TotalDiscountRatio", DBNull.Value );
			  
			// Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
			if(_isClosedNonDefault!=null)
			  oDatabaseHelper.AddParameter("@IsClosed", _isClosedNonDefault);
			else
			  oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value );
			  
			// Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
			if(_isVoidNonDefault!=null)
			  oDatabaseHelper.AddParameter("@IsVoid", _isVoidNonDefault);
			else
			  oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value );
			  
			// Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure.
			if(_isPrintedNonDefault!=null)
			  oDatabaseHelper.AddParameter("@IsPrinted", _isPrintedNonDefault);
			else
			  oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value );
			  
			// Pass the value of '_servicePrice' as parameter 'ServicePrice' of the stored procedure.
			if(_servicePriceNonDefault!=null)
			  oDatabaseHelper.AddParameter("@ServicePrice", _servicePriceNonDefault);
			else
			  oDatabaseHelper.AddParameter("@ServicePrice", DBNull.Value );
			  
			// Pass the value of '_taxTypeID' as parameter 'TaxTypeID' of the stored procedure.
			if(_taxTypeIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@TaxTypeID", _taxTypeIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@TaxTypeID", DBNull.Value );
			  
			// Pass the value of '_refuseReasonID' as parameter 'RefuseReasonID' of the stored procedure.
			if(_refuseReasonIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@RefuseReasonID", _refuseReasonIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@RefuseReasonID", 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 '_deletDate' as parameter 'DeletDate' of the stored procedure.
			if(_deletDateNonDefault!=null)
			  oDatabaseHelper.AddParameter("@DeletDate", _deletDateNonDefault);
			else
			  oDatabaseHelper.AddParameter("@DeletDate", DBNull.Value );
			  
			// Pass the value of '_inventoryID' as parameter 'InventoryID' of the stored procedure.
			if(_inventoryIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@InventoryID", _inventoryIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value );
			  
			// Pass the value of '_finalPrice' as parameter 'FinalPrice' of the stored procedure.
			if(_finalPriceNonDefault!=null)
			  oDatabaseHelper.AddParameter("@FinalPrice", _finalPriceNonDefault);
			else
			  oDatabaseHelper.AddParameter("@FinalPrice", DBNull.Value );
			  
			// Pass the value of '_chequeNumber' as parameter 'ChequeNumber' of the stored procedure.
			if(_chequeNumberNonDefault!=null)
			  oDatabaseHelper.AddParameter("@ChequeNumber", _chequeNumberNonDefault);
			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);
			
			if(!getBackValues )
			{
				oDatabaseHelper.ExecuteScalar("gsp_SALSalesHeader_Insert_WithDefaultValues", ref ExecutionState);
			}
			else
			{
				IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_SALSalesHeader_Insert_WithDefaultValues_AndReturn", ref ExecutionState);
				if (dr.Read())
				{
					PopulateObjectFromReader(this,dr);
				}
				dr.Close();
			}
			oDatabaseHelper.Dispose();	
			return ExecutionState;
			
		}
Exemplo n.º 31
0
        /// <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);
        }
Exemplo n.º 32
0
        /// <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);
        }
Exemplo n.º 33
0
		/// <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;
			
		}
Exemplo n.º 34
0
		/// <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:28 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public bool InsertWithDefaultValues(bool getBackValues) 
		{
			bool ExecutionState = false;
			oDatabaseHelper = new DatabaseHelper();
			
			// Pass the value of '_purchaseLineID' as parameter 'PurchaseLineID' of the stored procedure.
			if(_purchaseLineIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@PurchaseLineID", _purchaseLineIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@PurchaseLineID", DBNull.Value );
			  
			// Pass the value of '_batchID' as parameter 'BatchID' of the stored procedure.
			if(_batchIDNonDefault!=null)
			  oDatabaseHelper.AddParameter("@BatchID", _batchIDNonDefault);
			else
			  oDatabaseHelper.AddParameter("@BatchID", DBNull.Value );
			  
			// Pass the value of '_qty' as parameter 'Qty' of the stored procedure.
			if(_qtyNonDefault!=null)
			  oDatabaseHelper.AddParameter("@Qty", _qtyNonDefault);
			else
			  oDatabaseHelper.AddParameter("@Qty", DBNull.Value );
			  
			// The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
			oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
			
			if(!getBackValues )
			{
				oDatabaseHelper.ExecuteScalar("gsp_PURPurchaseLineBatch_Insert_WithDefaultValues", ref ExecutionState);
			}
			else
			{
				IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_PURPurchaseLineBatch_Insert_WithDefaultValues_AndReturn", ref ExecutionState);
				if (dr.Read())
				{
					PopulateObjectFromReader(this,dr);
				}
				dr.Close();
			}
			oDatabaseHelper.Dispose();	
			return ExecutionState;
			
		}
Exemplo n.º 35
0
		/// <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;
			}
			
		}
Exemplo n.º 36
0
        /// <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);
        }
Exemplo n.º 37
0
		/// <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;
			
		}
Exemplo n.º 38
0
        public static INVProductStockCollection GetInventoryStock(int? ProductStockID, string productCode, string productName, bool? IsAcceptBatch, bool getWithBatch,int? InventoryID)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;

            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@ProductStockID", ProductStockID);
            oDatabaseHelper.AddParameter("@ProductCode", productCode);
            oDatabaseHelper.AddParameter("@ProductName", productName);
            oDatabaseHelper.AddParameter("@IsAcceptBatch", IsAcceptBatch);
            if (InventoryID != null)
            {
                oDatabaseHelper.AddParameter("@InventoryID", InventoryID); 
            }
            IDataReader dr = oDatabaseHelper.ExecuteReader("USP_GetInventoryStock", ref ExecutionState);
            INVProductStockCollection INVProductStockCollection = Fill(dr, getWithBatch);
            dr.Close();
            oDatabaseHelper.Dispose();
            return INVProductStockCollection;

        }
Exemplo n.º 39
0
        /// <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);
        }
Exemplo n.º 40
0
        /// <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			4/4/2015 1:32:30 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 '_batchID' as parameter 'BatchID' of the stored procedure.
            if (_batchIDNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@BatchID", _batchIDNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@BatchID", DBNull.Value);
            }

            // Pass the value of '_qty' as parameter 'Qty' of the stored procedure.
            if (_qtyNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@Qty", _qtyNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@Qty", DBNull.Value);
            }

            // Pass the value of '_adjustReasonID' as parameter 'AdjustReasonID' of the stored procedure.
            if (_adjustReasonIDNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@AdjustReasonID", _adjustReasonIDNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@AdjustReasonID", DBNull.Value);
            }

            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (_createdByNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@CreatedBy", _createdByNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            }

            // Pass the value of '_credateDate' as parameter 'CredateDate' of the stored procedure.
            if (_credateDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@CredateDate", _credateDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CredateDate", DBNull.Value);
            }

            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (_updatedByNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", _updatedByNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            }

            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (_updateDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@UpdateDate", _updateDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            }

            // Pass the value of '_stockTypeID' as parameter 'StockTypeID' of the stored procedure.
            if (_stockTypeIDNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@StockTypeID", _stockTypeIDNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@StockTypeID", DBNull.Value);
            }

            // Pass the value of '_oldStockTypeID' as parameter 'OldStockTypeID' of the stored procedure.
            if (_oldStockTypeIDNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@OldStockTypeID", _oldStockTypeIDNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@OldStockTypeID", DBNull.Value);
            }

            // Pass the value of '_inventoryID' as parameter 'InventoryID' of the stored procedure.
            if (_inventoryIDNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@InventoryID", _inventoryIDNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value);
            }

            // Pass the value of '_expiryDate' as parameter 'ExpiryDate' of the stored procedure.
            if (_expiryDateNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@ExpiryDate", _expiryDateNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ExpiryDate", DBNull.Value);
            }

            // Pass the value of '_batchNumber' as parameter 'BatchNumber' of the stored procedure.
            if (_batchNumberNonDefault != null)
            {
                oDatabaseHelper.AddParameter("@BatchNumber", _batchNumberNonDefault);
            }
            else
            {
                oDatabaseHelper.AddParameter("@BatchNumber", DBNull.Value);
            }

            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

            if (!getBackValues)
            {
                oDatabaseHelper.ExecuteScalar("gsp_INVAdjustStock_Insert_WithDefaultValues", ref ExecutionState);
            }
            else
            {
                IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_INVAdjustStock_Insert_WithDefaultValues_AndReturn", ref ExecutionState);
                if (dr.Read())
                {
                    PopulateObjectFromReader(this, dr);
                }
                dr.Close();
            }
            oDatabaseHelper.Dispose();
            return(ExecutionState);
        }