Esempio n. 1
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 INVInventory</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			5/3/2015 10:23:04 PM				Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static INVInventory SelectOneWithSALSalesReturnHeaderUsingInventoryID(INVInventoryPrimaryKey pk)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool           ExecutionState  = false;
            INVInventory   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_INVInventory_SelectOneWithSALSalesReturnHeaderUsingInventoryID", ref ExecutionState);

            if (dr.Read())
            {
                obj = new INVInventory();
                PopulateObjectFromReader(obj, dr);

                dr.NextResult();

                //Get the child records.
                obj.SALSalesReturnHeaderCollectionUsingInventoryID = SALSalesReturnHeader.PopulateObjectsFromReader(dr);
            }
            dr.Close();
            oDatabaseHelper.Dispose();
            return(obj);
        }
		/// <summary>
		/// This method will return a list of objects representing all records in the table.
		/// </summary>
		///
		/// <returns>list of objects of class SALSalesReturnHeader in the form of object of SALSalesReturnHeaderCollection </returns>
		public SALSalesReturnHeaderCollection SelectAll()
		{
			SALSalesReturnHeaderCollection sALSalesReturnHeaderCollection = new SALSalesReturnHeaderCollection();
			foreach (POS.DataLayer.SALSalesReturnHeader _sALSalesReturnHeader in POS.DataLayer.SALSalesReturnHeaderBase.SelectAll())
			{
				_sALSalesReturnHeaderWCF = new SALSalesReturnHeader();
				
				_sALSalesReturnHeaderWCF.SlaesReturnHeaderID = _sALSalesReturnHeader.SlaesReturnHeaderID;
				_sALSalesReturnHeaderWCF.ReturnDate = _sALSalesReturnHeader.ReturnDate;
				_sALSalesReturnHeaderWCF.OriginalSalesHeadeID = _sALSalesReturnHeader.OriginalSalesHeadeID;
				_sALSalesReturnHeaderWCF.CreatedBy = _sALSalesReturnHeader.CreatedBy;
				_sALSalesReturnHeaderWCF.CreateDate = _sALSalesReturnHeader.CreateDate;
				_sALSalesReturnHeaderWCF.UpdatedBy = _sALSalesReturnHeader.UpdatedBy;
				_sALSalesReturnHeaderWCF.UpdateDate = _sALSalesReturnHeader.UpdateDate;
				_sALSalesReturnHeaderWCF.IsDeleted = _sALSalesReturnHeader.IsDeleted;
				_sALSalesReturnHeaderWCF.DeletedBy = _sALSalesReturnHeader.DeletedBy;
				_sALSalesReturnHeaderWCF.DeleteDate = _sALSalesReturnHeader.DeleteDate;
				_sALSalesReturnHeaderWCF.IsClosed = _sALSalesReturnHeader.IsClosed;
				_sALSalesReturnHeaderWCF.IsVoid = _sALSalesReturnHeader.IsVoid;
				_sALSalesReturnHeaderWCF.InventoryID = _sALSalesReturnHeader.InventoryID;
				_sALSalesReturnHeaderWCF.ReturnMoney = _sALSalesReturnHeader.ReturnMoney;
				
				sALSalesReturnHeaderCollection.Add(_sALSalesReturnHeaderWCF);
			}
			return sALSalesReturnHeaderCollection;
		}
Esempio n. 3
0
 public int SaveTransaction(SALSalesReturnHeader sALSalesReturnHeader, SALSalesReturnLineCollection sALSalesReturnLineCollection)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     int salesReturnHeaderID = -1;
     oDatabaseHelper.BeginTransaction();
     if (InsertHeader(oDatabaseHelper, sALSalesReturnHeader, out salesReturnHeaderID))
     {
         foreach (SALSalesReturnLine sALSalesLine in sALSalesReturnLineCollection)
         {
             if (!InsertDetails(oDatabaseHelper, sALSalesLine, salesReturnHeaderID))
             {
                 ExecutionState = false;
                 break;
             }
             else
                 ExecutionState = true;
         }
         if (ExecutionState)
         {
             oDatabaseHelper.CommitTransaction();
         }
         else
         {
             oDatabaseHelper.RollbackTransaction();
             salesReturnHeaderID = -1;
         }
     }
     oDatabaseHelper.Dispose();
     return salesReturnHeaderID;
 }
Esempio n. 4
0
        public int SaveTransaction(SALSalesReturnHeader sALSalesReturnHeader, SALSalesReturnLineCollection sALSalesReturnLineCollection)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState      = false;
            int  salesReturnHeaderID = -1;

            oDatabaseHelper.BeginTransaction();
            if (InsertHeader(oDatabaseHelper, sALSalesReturnHeader, out salesReturnHeaderID))
            {
                foreach (SALSalesReturnLine sALSalesLine in sALSalesReturnLineCollection)
                {
                    if (!InsertDetails(oDatabaseHelper, sALSalesLine, salesReturnHeaderID))
                    {
                        ExecutionState = false;
                        break;
                    }
                    else
                    {
                        ExecutionState = true;
                    }
                }
                if (ExecutionState)
                {
                    oDatabaseHelper.CommitTransaction();
                }
                else
                {
                    oDatabaseHelper.RollbackTransaction();
                    salesReturnHeaderID = -1;
                }
            }
            oDatabaseHelper.Dispose();
            return(salesReturnHeaderID);
        }
Esempio n. 5
0
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="SALSalesReturnHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class SALSalesReturnHeader</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:05 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static SALSalesReturnHeader SelectOne(SALSalesReturnHeaderPrimaryKey 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_SALSalesReturnHeader_SelectbyPrimaryKey", ref ExecutionState);

            if (dr.Read())
            {
                SALSalesReturnHeader obj = new SALSalesReturnHeader();
                PopulateObjectFromReader(obj, dr);
                dr.Close();
                oDatabaseHelper.Dispose();
                return(obj);
            }
            else
            {
                dr.Close();
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
Esempio n. 6
0
 public bool UpdateTransaction(SALSalesReturnHeader sALSalesReturnHeader, SALSalesReturnLineCollection sALSalesReturnLineCollection)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     oDatabaseHelper.BeginTransaction();
     if (UpdateHeader(oDatabaseHelper, sALSalesReturnHeader))
     {
         if (DeleteDetails(oDatabaseHelper, (int)sALSalesReturnHeader.SlaesReturnHeaderID, (int)sALSalesReturnHeader.UpdatedBy))
         {
             foreach (SALSalesReturnLine sALSalesReturnLine in sALSalesReturnLineCollection)
             {
                 if (!InsertDetails(oDatabaseHelper, sALSalesReturnLine, (int)sALSalesReturnHeader.SlaesReturnHeaderID))
                 {
                     ExecutionState = false;
                     break;
                 }
                 else
                     ExecutionState = true;
             }
             if (ExecutionState)
                 oDatabaseHelper.CommitTransaction();
             else
                 oDatabaseHelper.RollbackTransaction();
         }
         else
             ExecutionState = false;
     }
     else
         ExecutionState = false;
     oDatabaseHelper.Dispose();
     return ExecutionState;
 }
Esempio n. 7
0
        /// <summary>
        /// Populates the fields for multiple objects from the columns found in an open reader.
        /// </summary>
        ///
        /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param>
        ///
        /// <returns>Object of SALSalesReturnHeaderCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:05 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static SALSalesReturnHeaderCollection PopulateObjectsFromReader(IDataReader rdr)
        {
            SALSalesReturnHeaderCollection list = new SALSalesReturnHeaderCollection();

            while (rdr.Read())
            {
                SALSalesReturnHeader obj = new SALSalesReturnHeader();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
            }
            return(list);
        }
        /// <summary>
        /// This method will insert one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="sALSalesReturnHeader" type="SALSalesReturnHeader">This SALSalesReturnHeader  will be inserted in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Insert(SALSalesReturnHeader sALSalesReturnHeader)
        {
            _sALSalesReturnHeader = new POS.DataLayer.SALSalesReturnHeader();
            _sALSalesReturnHeader.SlaesReturnHeaderID  = sALSalesReturnHeader.SlaesReturnHeaderID;
            _sALSalesReturnHeader.ReturnDate           = sALSalesReturnHeader.ReturnDate;
            _sALSalesReturnHeader.OriginalSalesHeadeID = sALSalesReturnHeader.OriginalSalesHeadeID;
            _sALSalesReturnHeader.CreatedBy            = sALSalesReturnHeader.CreatedBy;
            _sALSalesReturnHeader.CreateDate           = sALSalesReturnHeader.CreateDate;
            _sALSalesReturnHeader.UpdatedBy            = sALSalesReturnHeader.UpdatedBy;
            _sALSalesReturnHeader.UpdateDate           = sALSalesReturnHeader.UpdateDate;
            _sALSalesReturnHeader.IsDeleted            = sALSalesReturnHeader.IsDeleted;
            _sALSalesReturnHeader.DeletedBy            = sALSalesReturnHeader.DeletedBy;
            _sALSalesReturnHeader.DeleteDate           = sALSalesReturnHeader.DeleteDate;

            return(_sALSalesReturnHeader.Insert());
        }
        ///<summary>
        /// This method will update one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="sALSalesReturnHeader" type="SALSalesReturnHeader">This SALSalesReturnHeader  will be updated in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Update(SALSalesReturnHeader sALSalesReturnHeader)
        {
            _sALSalesReturnHeader = POS.DataLayer.SALSalesReturnHeader.SelectOne(new POS.DataLayer.SALSalesReturnHeaderPrimaryKey(sALSalesReturnHeader.SlaesReturnHeaderID));

            _sALSalesReturnHeader.ReturnDate           = sALSalesReturnHeader.ReturnDate;
            _sALSalesReturnHeader.OriginalSalesHeadeID = sALSalesReturnHeader.OriginalSalesHeadeID;
            _sALSalesReturnHeader.CreatedBy            = sALSalesReturnHeader.CreatedBy;
            _sALSalesReturnHeader.CreateDate           = sALSalesReturnHeader.CreateDate;
            _sALSalesReturnHeader.UpdatedBy            = sALSalesReturnHeader.UpdatedBy;
            _sALSalesReturnHeader.UpdateDate           = sALSalesReturnHeader.UpdateDate;
            _sALSalesReturnHeader.IsDeleted            = sALSalesReturnHeader.IsDeleted;
            _sALSalesReturnHeader.DeletedBy            = sALSalesReturnHeader.DeletedBy;
            _sALSalesReturnHeader.DeleteDate           = sALSalesReturnHeader.DeleteDate;

            return(_sALSalesReturnHeader.Update());
        }
Esempio n. 10
0
        private bool UpdateHeader(DatabaseHelper oDatabaseHelper, SALSalesReturnHeader sALSalesReturnHeader)
        {
            bool ExecutionState = false;

            // Pass the value of '_slaesReturnHeaderID' as parameter 'SlaesReturnHeaderID' of the stored procedure.
            oDatabaseHelper.AddParameter("@SlaesReturnHeaderID", sALSalesReturnHeader.SlaesReturnHeaderID);

            // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure.
            oDatabaseHelper.AddParameter("@ReturnDate", sALSalesReturnHeader.ReturnDate);

            // Pass the value of '_originalSalesHeadeID' as parameter 'OriginalSalesHeadeID' of the stored procedure.
            oDatabaseHelper.AddParameter("@OriginalSalesHeadeID", sALSalesReturnHeader.OriginalSalesHeadeID);

            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            oDatabaseHelper.AddParameter("@CreatedBy", sALSalesReturnHeader.CreatedBy);

            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            oDatabaseHelper.AddParameter("@CreateDate", sALSalesReturnHeader.CreateDate);

            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            oDatabaseHelper.AddParameter("@UpdatedBy", sALSalesReturnHeader.UpdatedBy);

            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            oDatabaseHelper.AddParameter("@UpdateDate", sALSalesReturnHeader.UpdateDate);

            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            oDatabaseHelper.AddParameter("@IsDeleted", sALSalesReturnHeader.IsDeleted);

            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            oDatabaseHelper.AddParameter("@DeletedBy", sALSalesReturnHeader.DeletedBy);

            // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure.
            oDatabaseHelper.AddParameter("@DeleteDate", sALSalesReturnHeader.DeleteDate);

            // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
            oDatabaseHelper.AddParameter("@IsClosed", sALSalesReturnHeader.IsClosed);

            // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
            oDatabaseHelper.AddParameter("@IsVoid", sALSalesReturnHeader.IsVoid);

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

            oDatabaseHelper.ExecuteScalar("usp_SALSalesReturnHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);

            return(ExecutionState);
        }
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="SALSalesReturnHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class SALSalesReturnHeader</returns>
        public SALSalesReturnHeader SelectOne(SALSalesReturnHeaderPrimaryKey pk)
        {
            _sALSalesReturnHeaderWCF = new SALSalesReturnHeader();
            _sALSalesReturnHeader    = POS.DataLayer.SALSalesReturnHeaderBase.SelectOne(new POS.DataLayer.SALSalesReturnHeaderPrimaryKey(pk.SlaesReturnHeaderID));

            _sALSalesReturnHeaderWCF.SlaesReturnHeaderID  = _sALSalesReturnHeader.SlaesReturnHeaderID;
            _sALSalesReturnHeaderWCF.ReturnDate           = _sALSalesReturnHeader.ReturnDate;
            _sALSalesReturnHeaderWCF.OriginalSalesHeadeID = _sALSalesReturnHeader.OriginalSalesHeadeID;
            _sALSalesReturnHeaderWCF.CreatedBy            = _sALSalesReturnHeader.CreatedBy;
            _sALSalesReturnHeaderWCF.CreateDate           = _sALSalesReturnHeader.CreateDate;
            _sALSalesReturnHeaderWCF.UpdatedBy            = _sALSalesReturnHeader.UpdatedBy;
            _sALSalesReturnHeaderWCF.UpdateDate           = _sALSalesReturnHeader.UpdateDate;
            _sALSalesReturnHeaderWCF.IsDeleted            = _sALSalesReturnHeader.IsDeleted;
            _sALSalesReturnHeaderWCF.DeletedBy            = _sALSalesReturnHeader.DeletedBy;
            _sALSalesReturnHeaderWCF.DeleteDate           = _sALSalesReturnHeader.DeleteDate;

            return(_sALSalesReturnHeaderWCF);
        }
Esempio n. 12
0
        public bool UpdateTransaction(SALSalesReturnHeader sALSalesReturnHeader, SALSalesReturnLineCollection sALSalesReturnLineCollection)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;

            oDatabaseHelper.BeginTransaction();
            if (UpdateHeader(oDatabaseHelper, sALSalesReturnHeader))
            {
                if (DeleteDetails(oDatabaseHelper, (int)sALSalesReturnHeader.SlaesReturnHeaderID, (int)sALSalesReturnHeader.UpdatedBy))
                {
                    foreach (SALSalesReturnLine sALSalesReturnLine in sALSalesReturnLineCollection)
                    {
                        if (!InsertDetails(oDatabaseHelper, sALSalesReturnLine, (int)sALSalesReturnHeader.SlaesReturnHeaderID))
                        {
                            ExecutionState = false;
                            break;
                        }
                        else
                        {
                            ExecutionState = true;
                        }
                    }
                    if (ExecutionState)
                    {
                        oDatabaseHelper.CommitTransaction();
                    }
                    else
                    {
                        oDatabaseHelper.RollbackTransaction();
                    }
                }
                else
                {
                    ExecutionState = false;
                }
            }
            else
            {
                ExecutionState = false;
            }
            oDatabaseHelper.Dispose();
            return(ExecutionState);
        }
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="SALSalesReturnHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class SALSalesReturnHeader</returns>
		public SALSalesReturnHeader SelectOne(SALSalesReturnHeaderPrimaryKey pk)
		{
			_sALSalesReturnHeaderWCF = new SALSalesReturnHeader();
			_sALSalesReturnHeader = POS.DataLayer.SALSalesReturnHeaderBase.SelectOne(new POS.DataLayer.SALSalesReturnHeaderPrimaryKey(pk.SlaesReturnHeaderID));
			
				_sALSalesReturnHeaderWCF.SlaesReturnHeaderID = _sALSalesReturnHeader.SlaesReturnHeaderID;
				_sALSalesReturnHeaderWCF.ReturnDate = _sALSalesReturnHeader.ReturnDate;
				_sALSalesReturnHeaderWCF.OriginalSalesHeadeID = _sALSalesReturnHeader.OriginalSalesHeadeID;
				_sALSalesReturnHeaderWCF.CreatedBy = _sALSalesReturnHeader.CreatedBy;
				_sALSalesReturnHeaderWCF.CreateDate = _sALSalesReturnHeader.CreateDate;
				_sALSalesReturnHeaderWCF.UpdatedBy = _sALSalesReturnHeader.UpdatedBy;
				_sALSalesReturnHeaderWCF.UpdateDate = _sALSalesReturnHeader.UpdateDate;
				_sALSalesReturnHeaderWCF.IsDeleted = _sALSalesReturnHeader.IsDeleted;
				_sALSalesReturnHeaderWCF.DeletedBy = _sALSalesReturnHeader.DeletedBy;
				_sALSalesReturnHeaderWCF.DeleteDate = _sALSalesReturnHeader.DeleteDate;
				_sALSalesReturnHeaderWCF.IsClosed = _sALSalesReturnHeader.IsClosed;
				_sALSalesReturnHeaderWCF.IsVoid = _sALSalesReturnHeader.IsVoid;
				_sALSalesReturnHeaderWCF.InventoryID = _sALSalesReturnHeader.InventoryID;
				_sALSalesReturnHeaderWCF.ReturnMoney = _sALSalesReturnHeader.ReturnMoney;
				
			return _sALSalesReturnHeaderWCF;
		}
Esempio n. 14
0
        /// <summary>
        /// Populates the fields for multiple objects from the columns found in an open reader.
        /// </summary>
        ///
        /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param>
        ///
        /// <returns>Object of SALSalesReturnHeaderCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:05 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static SALSalesReturnHeaderCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper)
        {
            SALSalesReturnHeaderCollection list = new SALSalesReturnHeaderCollection();

            if (rdr.Read())
            {
                SALSalesReturnHeader obj = new SALSalesReturnHeader();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
                while (rdr.Read())
                {
                    obj = new SALSalesReturnHeader();
                    PopulateObjectFromReader(obj, rdr);
                    list.Add(obj);
                }
                oDatabaseHelper.Dispose();
                return(list);
            }
            else
            {
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
Esempio n. 15
0
        private bool UpdateHeader(DatabaseHelper oDatabaseHelper, SALSalesReturnHeader sALSalesReturnHeader)
        {
            bool ExecutionState = false;
            // Pass the value of '_slaesReturnHeaderID' as parameter 'SlaesReturnHeaderID' of the stored procedure.
            oDatabaseHelper.AddParameter("@SlaesReturnHeaderID", sALSalesReturnHeader.SlaesReturnHeaderID);

            // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure.
            oDatabaseHelper.AddParameter("@ReturnDate", sALSalesReturnHeader.ReturnDate);

            // Pass the value of '_originalSalesHeadeID' as parameter 'OriginalSalesHeadeID' of the stored procedure.
            oDatabaseHelper.AddParameter("@OriginalSalesHeadeID", sALSalesReturnHeader.OriginalSalesHeadeID);

            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            oDatabaseHelper.AddParameter("@CreatedBy", sALSalesReturnHeader.CreatedBy);

            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            oDatabaseHelper.AddParameter("@CreateDate", sALSalesReturnHeader.CreateDate);

            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            oDatabaseHelper.AddParameter("@UpdatedBy", sALSalesReturnHeader.UpdatedBy);

            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            oDatabaseHelper.AddParameter("@UpdateDate", sALSalesReturnHeader.UpdateDate);

            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            oDatabaseHelper.AddParameter("@IsDeleted", sALSalesReturnHeader.IsDeleted);

            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            oDatabaseHelper.AddParameter("@DeletedBy", sALSalesReturnHeader.DeletedBy);

            // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure.
            oDatabaseHelper.AddParameter("@DeleteDate", sALSalesReturnHeader.DeleteDate);

            // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
            oDatabaseHelper.AddParameter("@IsClosed", sALSalesReturnHeader.IsClosed);

            // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
            oDatabaseHelper.AddParameter("@IsVoid", sALSalesReturnHeader.IsVoid);


            if (sALSalesReturnHeader.InventoryID != null)
                oDatabaseHelper.AddParameter("@InventoryID", sALSalesReturnHeader.InventoryID);
            else
                oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value);

            if (sALSalesReturnHeader.ReturnMoney != null)
                oDatabaseHelper.AddParameter("@ReturnMoney", sALSalesReturnHeader.ReturnMoney);
            else
                oDatabaseHelper.AddParameter("@ReturnMoney", DBNull.Value);

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

            oDatabaseHelper.ExecuteScalar("usp_SALSalesReturnHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);

            return ExecutionState;

        }
Esempio n. 16
0
        private bool InsertHeader(DatabaseHelper oDatabaseHelper, SALSalesReturnHeader sALSalesReturnHeader, out int pK)
        {
            bool ExecutionState = false;
            // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure.
            if (sALSalesReturnHeader.ReturnDate != null)
                oDatabaseHelper.AddParameter("@ReturnDate", sALSalesReturnHeader.ReturnDate);
            else
                oDatabaseHelper.AddParameter("@ReturnDate", DBNull.Value);
            // Pass the value of '_originalSalesHeadeID' as parameter 'OriginalSalesHeadeID' of the stored procedure.
            if (sALSalesReturnHeader.OriginalSalesHeadeID != null)
                oDatabaseHelper.AddParameter("@OriginalSalesHeadeID", sALSalesReturnHeader.OriginalSalesHeadeID);
            else
                oDatabaseHelper.AddParameter("@OriginalSalesHeadeID", DBNull.Value);
            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (sALSalesReturnHeader.CreatedBy != null)
                oDatabaseHelper.AddParameter("@CreatedBy", sALSalesReturnHeader.CreatedBy);
            else
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            if (sALSalesReturnHeader.CreateDate != null)
                oDatabaseHelper.AddParameter("@CreateDate", sALSalesReturnHeader.CreateDate);
            else
                oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value);
            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (sALSalesReturnHeader.UpdatedBy != null)
                oDatabaseHelper.AddParameter("@UpdatedBy", sALSalesReturnHeader.UpdatedBy);
            else
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (sALSalesReturnHeader.UpdateDate != null)
                oDatabaseHelper.AddParameter("@UpdateDate", sALSalesReturnHeader.UpdateDate);
            else
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (sALSalesReturnHeader.IsDeleted != null)
                oDatabaseHelper.AddParameter("@IsDeleted", sALSalesReturnHeader.IsDeleted);
            else
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            if (sALSalesReturnHeader.DeletedBy != null)
                oDatabaseHelper.AddParameter("@DeletedBy", sALSalesReturnHeader.DeletedBy);
            else
                oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value);
            // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure.
            if (sALSalesReturnHeader.DeleteDate != null)
                oDatabaseHelper.AddParameter("@DeleteDate", sALSalesReturnHeader.DeleteDate);
            else
                oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value);
            // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
            if (sALSalesReturnHeader.IsClosed != null)
                oDatabaseHelper.AddParameter("@IsClosed", sALSalesReturnHeader.IsClosed);
            else
                oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value);
            // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
            if (sALSalesReturnHeader.IsVoid != null)
                oDatabaseHelper.AddParameter("@IsVoid", sALSalesReturnHeader.IsVoid);
            else
                oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value);

            if (sALSalesReturnHeader.InventoryID != null)
                oDatabaseHelper.AddParameter("@InventoryID", sALSalesReturnHeader.InventoryID);
            else
                oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value);

            if (sALSalesReturnHeader.ReturnMoney != null)
                oDatabaseHelper.AddParameter("@ReturnMoney", sALSalesReturnHeader.ReturnMoney);
            else
                oDatabaseHelper.AddParameter("@ReturnMoney", DBNull.Value);


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

            try
            {
                pK = Convert.ToInt32(oDatabaseHelper.ExecuteScalar("usp_SALSalesReturnHeader_Insert", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState));
                //    oDatabaseHelper.Dispose();
            }
            catch (Exception ex)
            {

                throw;
            }
            return ExecutionState;
        }
Esempio n. 17
0
		/// <summary>
		/// Populates the fields for multiple objects from the columns found in an open reader.
		/// </summary>
		///
		/// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param>
		///
		/// <returns>Object of SALSalesReturnHeaderCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			4/4/2015 6:56:38 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static SALSalesReturnHeaderCollection PopulateObjectsFromReader(IDataReader rdr) 
		{
			SALSalesReturnHeaderCollection list = new SALSalesReturnHeaderCollection();
			
			while (rdr.Read())
			{
				SALSalesReturnHeader obj = new SALSalesReturnHeader();
				PopulateObjectFromReader(obj,rdr);
				list.Add(obj);
			}
			return list;
			
		}
			///<summary>
		/// This method will update one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="sALSalesReturnHeader" type="SALSalesReturnHeader">This SALSalesReturnHeader  will be updated in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Update(SALSalesReturnHeader sALSalesReturnHeader)
		{
			_sALSalesReturnHeader=POS.DataLayer.SALSalesReturnHeader.SelectOne(new POS.DataLayer.SALSalesReturnHeaderPrimaryKey(sALSalesReturnHeader.SlaesReturnHeaderID));
			
			_sALSalesReturnHeader.ReturnDate=sALSalesReturnHeader.ReturnDate;
			_sALSalesReturnHeader.OriginalSalesHeadeID=sALSalesReturnHeader.OriginalSalesHeadeID;
			_sALSalesReturnHeader.CreatedBy=sALSalesReturnHeader.CreatedBy;
			_sALSalesReturnHeader.CreateDate=sALSalesReturnHeader.CreateDate;
			_sALSalesReturnHeader.UpdatedBy=sALSalesReturnHeader.UpdatedBy;
			_sALSalesReturnHeader.UpdateDate=sALSalesReturnHeader.UpdateDate;
			_sALSalesReturnHeader.IsDeleted=sALSalesReturnHeader.IsDeleted;
			_sALSalesReturnHeader.DeletedBy=sALSalesReturnHeader.DeletedBy;
			_sALSalesReturnHeader.DeleteDate=sALSalesReturnHeader.DeleteDate;
			_sALSalesReturnHeader.IsClosed=sALSalesReturnHeader.IsClosed;
			_sALSalesReturnHeader.IsVoid=sALSalesReturnHeader.IsVoid;
			_sALSalesReturnHeader.InventoryID=sALSalesReturnHeader.InventoryID;
			_sALSalesReturnHeader.ReturnMoney=sALSalesReturnHeader.ReturnMoney;
			
			return _sALSalesReturnHeader.Update();
		}
		/// <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 SALSalesReturnHeader</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 SALSalesReturnHeader in the form of an object of class SALSalesReturnHeaderCollection</returns>
		public SALSalesReturnHeaderCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
		{
			SALSalesReturnHeaderCollection sALSalesReturnHeaderCollection = new SALSalesReturnHeaderCollection();
			foreach (POS.DataLayer.SALSalesReturnHeader _sALSalesReturnHeader in POS.DataLayer.SALSalesReturnHeaderBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
			{
				_sALSalesReturnHeaderWCF = new SALSalesReturnHeader();
				
				_sALSalesReturnHeaderWCF.SlaesReturnHeaderID = _sALSalesReturnHeader.SlaesReturnHeaderID;
				_sALSalesReturnHeaderWCF.ReturnDate = _sALSalesReturnHeader.ReturnDate;
				_sALSalesReturnHeaderWCF.OriginalSalesHeadeID = _sALSalesReturnHeader.OriginalSalesHeadeID;
				_sALSalesReturnHeaderWCF.CreatedBy = _sALSalesReturnHeader.CreatedBy;
				_sALSalesReturnHeaderWCF.CreateDate = _sALSalesReturnHeader.CreateDate;
				_sALSalesReturnHeaderWCF.UpdatedBy = _sALSalesReturnHeader.UpdatedBy;
				_sALSalesReturnHeaderWCF.UpdateDate = _sALSalesReturnHeader.UpdateDate;
				_sALSalesReturnHeaderWCF.IsDeleted = _sALSalesReturnHeader.IsDeleted;
				_sALSalesReturnHeaderWCF.DeletedBy = _sALSalesReturnHeader.DeletedBy;
				_sALSalesReturnHeaderWCF.DeleteDate = _sALSalesReturnHeader.DeleteDate;
				_sALSalesReturnHeaderWCF.IsClosed = _sALSalesReturnHeader.IsClosed;
				_sALSalesReturnHeaderWCF.IsVoid = _sALSalesReturnHeader.IsVoid;
				_sALSalesReturnHeaderWCF.InventoryID = _sALSalesReturnHeader.InventoryID;
				_sALSalesReturnHeaderWCF.ReturnMoney = _sALSalesReturnHeader.ReturnMoney;
				
				sALSalesReturnHeaderCollection.Add(_sALSalesReturnHeaderWCF);
			}
			return sALSalesReturnHeaderCollection;
		}
		/// <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 SALSalesReturnHeader in the form of an object of class SALSalesReturnHeaderCollection </returns>
		public SALSalesReturnHeaderCollection SelectAllPaged(int? pageSize, int? skipPages, string orderByStatement)
		{
			SALSalesReturnHeaderCollection sALSalesReturnHeaderCollection = new SALSalesReturnHeaderCollection();
			foreach (POS.DataLayer.SALSalesReturnHeader _sALSalesReturnHeader in POS.DataLayer.SALSalesReturnHeaderBase.SelectAllPaged(pageSize, skipPages, orderByStatement))
			{
				_sALSalesReturnHeaderWCF = new SALSalesReturnHeader();
				
				_sALSalesReturnHeaderWCF.SlaesReturnHeaderID = _sALSalesReturnHeader.SlaesReturnHeaderID;
				_sALSalesReturnHeaderWCF.ReturnDate = _sALSalesReturnHeader.ReturnDate;
				_sALSalesReturnHeaderWCF.OriginalSalesHeadeID = _sALSalesReturnHeader.OriginalSalesHeadeID;
				_sALSalesReturnHeaderWCF.CreatedBy = _sALSalesReturnHeader.CreatedBy;
				_sALSalesReturnHeaderWCF.CreateDate = _sALSalesReturnHeader.CreateDate;
				_sALSalesReturnHeaderWCF.UpdatedBy = _sALSalesReturnHeader.UpdatedBy;
				_sALSalesReturnHeaderWCF.UpdateDate = _sALSalesReturnHeader.UpdateDate;
				_sALSalesReturnHeaderWCF.IsDeleted = _sALSalesReturnHeader.IsDeleted;
				_sALSalesReturnHeaderWCF.DeletedBy = _sALSalesReturnHeader.DeletedBy;
				_sALSalesReturnHeaderWCF.DeleteDate = _sALSalesReturnHeader.DeleteDate;
				_sALSalesReturnHeaderWCF.IsClosed = _sALSalesReturnHeader.IsClosed;
				_sALSalesReturnHeaderWCF.IsVoid = _sALSalesReturnHeader.IsVoid;
				_sALSalesReturnHeaderWCF.InventoryID = _sALSalesReturnHeader.InventoryID;
				_sALSalesReturnHeaderWCF.ReturnMoney = _sALSalesReturnHeader.ReturnMoney;
				
				sALSalesReturnHeaderCollection.Add(_sALSalesReturnHeaderWCF);
			}
			return sALSalesReturnHeaderCollection;
		}
		/// <summary>
		/// This method will insert one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="sALSalesReturnHeader" type="SALSalesReturnHeader">This SALSalesReturnHeader  will be inserted in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Insert(SALSalesReturnHeader sALSalesReturnHeader)
		{
			_sALSalesReturnHeader = new POS.DataLayer.SALSalesReturnHeader();
			_sALSalesReturnHeader.SlaesReturnHeaderID=sALSalesReturnHeader.SlaesReturnHeaderID;
			_sALSalesReturnHeader.ReturnDate=sALSalesReturnHeader.ReturnDate;
			_sALSalesReturnHeader.OriginalSalesHeadeID=sALSalesReturnHeader.OriginalSalesHeadeID;
			_sALSalesReturnHeader.CreatedBy=sALSalesReturnHeader.CreatedBy;
			_sALSalesReturnHeader.CreateDate=sALSalesReturnHeader.CreateDate;
			_sALSalesReturnHeader.UpdatedBy=sALSalesReturnHeader.UpdatedBy;
			_sALSalesReturnHeader.UpdateDate=sALSalesReturnHeader.UpdateDate;
			_sALSalesReturnHeader.IsDeleted=sALSalesReturnHeader.IsDeleted;
			_sALSalesReturnHeader.DeletedBy=sALSalesReturnHeader.DeletedBy;
			_sALSalesReturnHeader.DeleteDate=sALSalesReturnHeader.DeleteDate;
			_sALSalesReturnHeader.IsClosed=sALSalesReturnHeader.IsClosed;
			_sALSalesReturnHeader.IsVoid=sALSalesReturnHeader.IsVoid;
			_sALSalesReturnHeader.InventoryID=sALSalesReturnHeader.InventoryID;
			_sALSalesReturnHeader.ReturnMoney=sALSalesReturnHeader.ReturnMoney;
			
			return _sALSalesReturnHeader.Insert();
		}
Esempio n. 22
0
		/// <summary>
		/// Populates the fields for multiple objects from the columns found in an open reader.
		/// </summary>
		///
		/// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param>
		///
		/// <returns>Object of SALSalesReturnHeaderCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			4/4/2015 6:56:38 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static SALSalesReturnHeaderCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) 
		{

			SALSalesReturnHeaderCollection list = new SALSalesReturnHeaderCollection();
			
            if (rdr.Read())
			{
				SALSalesReturnHeader obj = new SALSalesReturnHeader();
				PopulateObjectFromReader(obj, rdr);
				list.Add(obj);
				while (rdr.Read())
				{
					obj = new SALSalesReturnHeader();
					PopulateObjectFromReader(obj, rdr);
					list.Add(obj);
				}
				oDatabaseHelper.Dispose();
				return list;
			}
			else
			{
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
Esempio n. 23
0
        private bool InsertHeader(DatabaseHelper oDatabaseHelper, SALSalesReturnHeader sALSalesReturnHeader, out int pK)
        {
            bool ExecutionState = false;

            // Pass the value of '_returnDate' as parameter 'ReturnDate' of the stored procedure.
            if (sALSalesReturnHeader.ReturnDate != null)
            {
                oDatabaseHelper.AddParameter("@ReturnDate", sALSalesReturnHeader.ReturnDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ReturnDate", DBNull.Value);
            }
            // Pass the value of '_originalSalesHeadeID' as parameter 'OriginalSalesHeadeID' of the stored procedure.
            if (sALSalesReturnHeader.OriginalSalesHeadeID != null)
            {
                oDatabaseHelper.AddParameter("@OriginalSalesHeadeID", sALSalesReturnHeader.OriginalSalesHeadeID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@OriginalSalesHeadeID", DBNull.Value);
            }
            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (sALSalesReturnHeader.CreatedBy != null)
            {
                oDatabaseHelper.AddParameter("@CreatedBy", sALSalesReturnHeader.CreatedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            }
            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            if (sALSalesReturnHeader.CreateDate != null)
            {
                oDatabaseHelper.AddParameter("@CreateDate", sALSalesReturnHeader.CreateDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value);
            }
            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (sALSalesReturnHeader.UpdatedBy != null)
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", sALSalesReturnHeader.UpdatedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            }
            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (sALSalesReturnHeader.UpdateDate != null)
            {
                oDatabaseHelper.AddParameter("@UpdateDate", sALSalesReturnHeader.UpdateDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            }
            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (sALSalesReturnHeader.IsDeleted != null)
            {
                oDatabaseHelper.AddParameter("@IsDeleted", sALSalesReturnHeader.IsDeleted);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            }
            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            if (sALSalesReturnHeader.DeletedBy != null)
            {
                oDatabaseHelper.AddParameter("@DeletedBy", sALSalesReturnHeader.DeletedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value);
            }
            // Pass the value of '_deleteDate' as parameter 'DeleteDate' of the stored procedure.
            if (sALSalesReturnHeader.DeleteDate != null)
            {
                oDatabaseHelper.AddParameter("@DeleteDate", sALSalesReturnHeader.DeleteDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeleteDate", DBNull.Value);
            }
            // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
            if (sALSalesReturnHeader.IsClosed != null)
            {
                oDatabaseHelper.AddParameter("@IsClosed", sALSalesReturnHeader.IsClosed);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value);
            }
            // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
            if (sALSalesReturnHeader.IsVoid != null)
            {
                oDatabaseHelper.AddParameter("@IsVoid", sALSalesReturnHeader.IsVoid);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value);
            }

            if (sALSalesReturnHeader.InventoryID != null)
            {
                oDatabaseHelper.AddParameter("@InventoryID", sALSalesReturnHeader.InventoryID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value);
            }

            if (sALSalesReturnHeader.ReturnMoney != null)
            {
                oDatabaseHelper.AddParameter("@ReturnMoney", sALSalesReturnHeader.ReturnMoney);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ReturnMoney", DBNull.Value);
            }


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

            try
            {
                pK = Convert.ToInt32(oDatabaseHelper.ExecuteScalar("usp_SALSalesReturnHeader_Insert", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState));
                //    oDatabaseHelper.Dispose();
            }
            catch (Exception ex)
            {
                throw;
            }
            return(ExecutionState);
        }
Esempio n. 24
0
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="SALSalesReturnHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class SALSalesReturnHeader</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			4/4/2015 6:56:38 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static SALSalesReturnHeader SelectOne(SALSalesReturnHeaderPrimaryKey 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_SALSalesReturnHeader_SelectbyPrimaryKey", ref ExecutionState);
			if (dr.Read())
			{
				SALSalesReturnHeader obj=new SALSalesReturnHeader();	
				PopulateObjectFromReader(obj,dr);
				dr.Close();              
				oDatabaseHelper.Dispose();
				return obj;
			}
			else
			{
				dr.Close();
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}