Exemple #1
0
 public bool SaveAndCommitTransaction(INVTransferHeader transferHeader, INVTransferLineCollection transferLineCollection)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     int transferHeaderID;
     oDatabaseHelper.BeginTransaction();
     if (InsertHeader(oDatabaseHelper, transferHeader, out transferHeaderID))
     {
         foreach (INVTransferLine transferLine in transferLineCollection)
         {
             if (!InsertDetailsAndCommit(oDatabaseHelper, transferLine, transferHeaderID))
             {
                 ExecutionState = false;
                 break;
             }
             else
                 ExecutionState = true;
         }
         if (ExecutionState)
             oDatabaseHelper.CommitTransaction();
         else
             oDatabaseHelper.RollbackTransaction();
     }
     return ExecutionState;
 }
Exemple #2
0
        public bool SaveAndCommitTransaction(INVTransferHeader transferHeader, INVTransferLineCollection transferLineCollection)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;
            int  transferHeaderID;

            oDatabaseHelper.BeginTransaction();
            if (InsertHeader(oDatabaseHelper, transferHeader, out transferHeaderID))
            {
                foreach (INVTransferLine transferLine in transferLineCollection)
                {
                    if (!InsertDetailsAndCommit(oDatabaseHelper, transferLine, transferHeaderID))
                    {
                        ExecutionState = false;
                        break;
                    }
                    else
                    {
                        ExecutionState = true;
                    }
                }
                if (ExecutionState)
                {
                    oDatabaseHelper.CommitTransaction();
                }
                else
                {
                    oDatabaseHelper.RollbackTransaction();
                }
            }
            return(ExecutionState);
        }
Exemple #3
0
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="INVTransferHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class INVTransferHeader</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:55:57 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static INVTransferHeader SelectOne(INVTransferHeaderPrimaryKey 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_INVTransferHeader_SelectbyPrimaryKey", ref ExecutionState);

            if (dr.Read())
            {
                INVTransferHeader obj = new INVTransferHeader();
                PopulateObjectFromReader(obj, dr);
                dr.Close();
                oDatabaseHelper.Dispose();
                return(obj);
            }
            else
            {
                dr.Close();
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
		/// <summary>
		/// This method will return a list of objects representing all records in the table.
		/// </summary>
		///
		/// <returns>list of objects of class INVTransferHeader in the form of object of INVTransferHeaderCollection </returns>
		public INVTransferHeaderCollection SelectAll()
		{
			INVTransferHeaderCollection iNVTransferHeaderCollection = new INVTransferHeaderCollection();
			foreach (POS.DataLayer.INVTransferHeader _iNVTransferHeader in POS.DataLayer.INVTransferHeaderBase.SelectAll())
			{
				_iNVTransferHeaderWCF = new INVTransferHeader();
				
				_iNVTransferHeaderWCF.INVTransferHeaderID = _iNVTransferHeader.INVTransferHeaderID;
				_iNVTransferHeaderWCF.TransferDate = _iNVTransferHeader.TransferDate;
				_iNVTransferHeaderWCF.FromInventoryID = _iNVTransferHeader.FromInventoryID;
				_iNVTransferHeaderWCF.ToInventoryID = _iNVTransferHeader.ToInventoryID;
				_iNVTransferHeaderWCF.InvoiceNumber = _iNVTransferHeader.InvoiceNumber;
				_iNVTransferHeaderWCF.InvoiceDate = _iNVTransferHeader.InvoiceDate;
				_iNVTransferHeaderWCF.IsVoid = _iNVTransferHeader.IsVoid;
				_iNVTransferHeaderWCF.IsPrinted = _iNVTransferHeader.IsPrinted;
				_iNVTransferHeaderWCF.IsClosed = _iNVTransferHeader.IsClosed;
				_iNVTransferHeaderWCF.CreatedBy = _iNVTransferHeader.CreatedBy;
				_iNVTransferHeaderWCF.CreateDate = _iNVTransferHeader.CreateDate;
				_iNVTransferHeaderWCF.UpdatedBy = _iNVTransferHeader.UpdatedBy;
				_iNVTransferHeaderWCF.UpdateDate = _iNVTransferHeader.UpdateDate;
				_iNVTransferHeaderWCF.IsDeleted = _iNVTransferHeader.IsDeleted;
				_iNVTransferHeaderWCF.DeletedBy = _iNVTransferHeader.DeletedBy;
				_iNVTransferHeaderWCF.DeletedDate = _iNVTransferHeader.DeletedDate;
				
				iNVTransferHeaderCollection.Add(_iNVTransferHeaderWCF);
			}
			return iNVTransferHeaderCollection;
		}
Exemple #5
0
        private static INVTransferHeaderCollection PopulateFromReader(IDataReader rdr)
        {
            INVTransferHeaderCollection INVTransferHeaderCollection = new INVTransferHeaderCollection();

            while (rdr.Read())
            {
                INVTransferHeader obj = new INVTransferHeader();
                obj.INVTransferHeaderID = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.INVTransferHeaderID));
                obj.TransferDate        = rdr.GetDateTime(rdr.GetOrdinal(INVTransferHeaderFields.TransferDate));
                obj.FromInventoryID     = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.FromInventoryID));
                obj.ToInventoryID       = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.ToInventoryID));

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.InvoiceNumber)))
                {
                    obj.InvoiceNumber = rdr.GetString(rdr.GetOrdinal(INVTransferHeaderFields.InvoiceNumber));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.InvoiceDate)))
                {
                    obj.InvoiceDate = rdr.GetDateTime(rdr.GetOrdinal(INVTransferHeaderFields.InvoiceDate));
                }

                obj.IsClosed  = rdr.GetBoolean(rdr.GetOrdinal(INVTransferHeaderFields.IsClosed));
                obj.IsVoid    = rdr.GetBoolean(rdr.GetOrdinal(INVTransferHeaderFields.IsVoid));
                obj.IsPrinted = rdr.GetBoolean(rdr.GetOrdinal(INVTransferHeaderFields.IsPrinted));

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.CreatedBy)))
                {
                    obj.CreatedBy = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.CreatedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.CreateDate)))
                {
                    obj.CreateDate = rdr.GetDateTime(rdr.GetOrdinal(INVTransferHeaderFields.CreateDate));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.UpdatedBy)))
                {
                    obj.UpdatedBy = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.UpdatedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.UpdateDate)))
                {
                    obj.UpdateDate = rdr.GetDateTime(rdr.GetOrdinal(INVTransferHeaderFields.UpdateDate));
                }

                obj.IsDeleted = rdr.GetBoolean(rdr.GetOrdinal(INVTransferHeaderFields.IsDeleted));
                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.DeletedBy)))
                {
                    obj.DeletedBy = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.DeletedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.DeletedDate)))
                {
                    obj.DeletedDate = rdr.GetDateTime(rdr.GetOrdinal(INVTransferHeaderFields.DeletedDate));
                }
                INVTransferHeaderCollection.Add(obj);
            }
            return(INVTransferHeaderCollection);
        }
Exemple #6
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 INVTransferHeaderCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:55:57 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static INVTransferHeaderCollection PopulateObjectsFromReader(IDataReader rdr)
        {
            INVTransferHeaderCollection list = new INVTransferHeaderCollection();

            while (rdr.Read())
            {
                INVTransferHeader obj = new INVTransferHeader();
                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="iNVTransferHeader" type="INVTransferHeader">This INVTransferHeader  will be inserted in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Insert(INVTransferHeader iNVTransferHeader)
        {
            _iNVTransferHeader = new POS.DataLayer.INVTransferHeader();
            _iNVTransferHeader.INVTransferHeaderID = iNVTransferHeader.INVTransferHeaderID;
            _iNVTransferHeader.TransferDate        = iNVTransferHeader.TransferDate;
            _iNVTransferHeader.FromInventoryID     = iNVTransferHeader.FromInventoryID;
            _iNVTransferHeader.ToInventoryID       = iNVTransferHeader.ToInventoryID;
            _iNVTransferHeader.CreatedBy           = iNVTransferHeader.CreatedBy;
            _iNVTransferHeader.CreateDate          = iNVTransferHeader.CreateDate;
            _iNVTransferHeader.UpdatedBy           = iNVTransferHeader.UpdatedBy;
            _iNVTransferHeader.IsDeleted           = iNVTransferHeader.IsDeleted;
            _iNVTransferHeader.DeletedBy           = iNVTransferHeader.DeletedBy;
            _iNVTransferHeader.DeletedDate         = iNVTransferHeader.DeletedDate;

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

            _iNVTransferHeader.TransferDate    = iNVTransferHeader.TransferDate;
            _iNVTransferHeader.FromInventoryID = iNVTransferHeader.FromInventoryID;
            _iNVTransferHeader.ToInventoryID   = iNVTransferHeader.ToInventoryID;
            _iNVTransferHeader.CreatedBy       = iNVTransferHeader.CreatedBy;
            _iNVTransferHeader.CreateDate      = iNVTransferHeader.CreateDate;
            _iNVTransferHeader.UpdatedBy       = iNVTransferHeader.UpdatedBy;
            _iNVTransferHeader.IsDeleted       = iNVTransferHeader.IsDeleted;
            _iNVTransferHeader.DeletedBy       = iNVTransferHeader.DeletedBy;
            _iNVTransferHeader.DeletedDate     = iNVTransferHeader.DeletedDate;

            return(_iNVTransferHeader.Update());
        }
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="INVTransferHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class INVTransferHeader</returns>
        public INVTransferHeader SelectOne(INVTransferHeaderPrimaryKey pk)
        {
            _iNVTransferHeaderWCF = new INVTransferHeader();
            _iNVTransferHeader    = POS.DataLayer.INVTransferHeaderBase.SelectOne(new POS.DataLayer.INVTransferHeaderPrimaryKey(pk.INVTransferHeaderID));

            _iNVTransferHeaderWCF.INVTransferHeaderID = _iNVTransferHeader.INVTransferHeaderID;
            _iNVTransferHeaderWCF.TransferDate        = _iNVTransferHeader.TransferDate;
            _iNVTransferHeaderWCF.FromInventoryID     = _iNVTransferHeader.FromInventoryID;
            _iNVTransferHeaderWCF.ToInventoryID       = _iNVTransferHeader.ToInventoryID;
            _iNVTransferHeaderWCF.CreatedBy           = _iNVTransferHeader.CreatedBy;
            _iNVTransferHeaderWCF.CreateDate          = _iNVTransferHeader.CreateDate;
            _iNVTransferHeaderWCF.UpdatedBy           = _iNVTransferHeader.UpdatedBy;
            _iNVTransferHeaderWCF.IsDeleted           = _iNVTransferHeader.IsDeleted;
            _iNVTransferHeaderWCF.DeletedBy           = _iNVTransferHeader.DeletedBy;
            _iNVTransferHeaderWCF.DeletedDate         = _iNVTransferHeader.DeletedDate;

            return(_iNVTransferHeaderWCF);
        }
Exemple #10
0
        public bool UpdateTransaction(INVTransferHeader transferHeader, INVTransferLineCollection transferLineCollection)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;

            oDatabaseHelper.BeginTransaction();
            if (UpdateHeader(oDatabaseHelper, transferHeader))
            {
                if (DeleteDetails(oDatabaseHelper, (int)transferHeader.INVTransferHeaderID, (int)transferHeader.CreatedBy))
                {
                    foreach (INVTransferLine transferLine in transferLineCollection)
                    {
                        if (!InsertDetailsAndCommit(oDatabaseHelper, transferLine, (int)transferHeader.INVTransferHeaderID))
                        {
                            ExecutionState = false;
                            break;
                        }
                        else
                        {
                            ExecutionState = true;
                        }
                    }
                    if (ExecutionState)
                    {
                        oDatabaseHelper.CommitTransaction();
                    }
                    else
                    {
                        oDatabaseHelper.RollbackTransaction();
                    }
                }
                else
                {
                    ExecutionState = false;
                }
            }
            else
            {
                ExecutionState = false;
            }
            return(ExecutionState);
        }
Exemple #11
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 INVTransferHeaderCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:55:57 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static INVTransferHeaderCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper)
        {
            INVTransferHeaderCollection list = new INVTransferHeaderCollection();

            if (rdr.Read())
            {
                INVTransferHeader obj = new INVTransferHeader();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
                while (rdr.Read())
                {
                    obj = new INVTransferHeader();
                    PopulateObjectFromReader(obj, rdr);
                    list.Add(obj);
                }
                oDatabaseHelper.Dispose();
                return(list);
            }
            else
            {
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="INVTransferHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class INVTransferHeader</returns>
		public INVTransferHeader SelectOne(INVTransferHeaderPrimaryKey pk)
		{
			_iNVTransferHeaderWCF = new INVTransferHeader();
			_iNVTransferHeader = POS.DataLayer.INVTransferHeaderBase.SelectOne(new POS.DataLayer.INVTransferHeaderPrimaryKey(pk.INVTransferHeaderID));
			
				_iNVTransferHeaderWCF.INVTransferHeaderID = _iNVTransferHeader.INVTransferHeaderID;
				_iNVTransferHeaderWCF.TransferDate = _iNVTransferHeader.TransferDate;
				_iNVTransferHeaderWCF.FromInventoryID = _iNVTransferHeader.FromInventoryID;
				_iNVTransferHeaderWCF.ToInventoryID = _iNVTransferHeader.ToInventoryID;
				_iNVTransferHeaderWCF.InvoiceNumber = _iNVTransferHeader.InvoiceNumber;
				_iNVTransferHeaderWCF.InvoiceDate = _iNVTransferHeader.InvoiceDate;
				_iNVTransferHeaderWCF.IsVoid = _iNVTransferHeader.IsVoid;
				_iNVTransferHeaderWCF.IsPrinted = _iNVTransferHeader.IsPrinted;
				_iNVTransferHeaderWCF.IsClosed = _iNVTransferHeader.IsClosed;
				_iNVTransferHeaderWCF.CreatedBy = _iNVTransferHeader.CreatedBy;
				_iNVTransferHeaderWCF.CreateDate = _iNVTransferHeader.CreateDate;
				_iNVTransferHeaderWCF.UpdatedBy = _iNVTransferHeader.UpdatedBy;
				_iNVTransferHeaderWCF.UpdateDate = _iNVTransferHeader.UpdateDate;
				_iNVTransferHeaderWCF.IsDeleted = _iNVTransferHeader.IsDeleted;
				_iNVTransferHeaderWCF.DeletedBy = _iNVTransferHeader.DeletedBy;
				_iNVTransferHeaderWCF.DeletedDate = _iNVTransferHeader.DeletedDate;
				
			return _iNVTransferHeaderWCF;
		}
Exemple #13
0
        private bool InsertHeader(DatabaseHelper oDatabaseHelper, INVTransferHeader transferHeader, out int pK)
        {
            bool ExecutionState = false;

            // Pass the value of 'TransferDate' as parameter 'TransferDate' of the stored procedure.

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

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

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

            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (transferHeader.CreatedBy != null)
            {
                oDatabaseHelper.AddParameter("@CreatedBy", transferHeader.CreatedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            }
            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            if (transferHeader.CreateDate != null)
            {
                oDatabaseHelper.AddParameter("@CreateDate", transferHeader.CreateDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value);
            }
            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (transferHeader.UpdatedBy != null)
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", transferHeader.UpdatedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            }
            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (transferHeader.UpdateDate != null)
            {
                oDatabaseHelper.AddParameter("@UpdateDate", transferHeader.UpdateDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            }
            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (transferHeader.IsDeleted != null)
            {
                oDatabaseHelper.AddParameter("@IsDeleted", transferHeader.IsDeleted);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            }
            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            if (transferHeader.DeletedBy != null)
            {
                oDatabaseHelper.AddParameter("@DeletedBy", transferHeader.DeletedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value);
            }
            // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure.
            if (transferHeader.DeletedDate != null)
            {
                oDatabaseHelper.AddParameter("@DeletedDate", transferHeader.DeletedDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeletedDate", DBNull.Value);
            }
            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

            try
            {
                pK = Convert.ToInt32(oDatabaseHelper.ExecuteScalar("usp_INVTransferHeader_Insert", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState));
                //    oDatabaseHelper.Dispose();
            }
            catch (Exception ex)
            {
                throw;
            }
            return(ExecutionState);
        }
		/// <summary>
		/// 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 INVTransferHeaderCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 2:36:58 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static INVTransferHeaderCollection PopulateObjectsFromReader(IDataReader rdr) 
		{
			INVTransferHeaderCollection list = new INVTransferHeaderCollection();
			
			while (rdr.Read())
			{
				INVTransferHeader obj = new INVTransferHeader();
				PopulateObjectFromReader(obj,rdr);
				list.Add(obj);
			}
			return list;
			
		}
Exemple #15
0
        private bool UpdateHeader(DatabaseHelper oDatabaseHelper, INVTransferHeader transferHeader)
        {
            bool ExecutionState = false;

            oDatabaseHelper.AddParameter("@INVTransferHeaderID", transferHeader.INVTransferHeaderID);

            // Pass the value of '_transferHeaderID' as parameter 'INVTransferHeaderID' of the stored procedure.
            oDatabaseHelper.AddParameter("@TransferDate", transferHeader.TransferDate);
            // Pass the value of 'FromInventoryID' as parameter 'FromInventoryID' of the stored procedure.
            if (transferHeader.FromInventoryID != null)
            {
                oDatabaseHelper.AddParameter("@FromInventoryID", transferHeader.FromInventoryID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@FromInventoryID", DBNull.Value);
            }
            // Pass the value of 'ToInventoryID' as parameter 'ToInventoryID' of the stored procedure.
            if (transferHeader.ToInventoryID != null)
            {
                oDatabaseHelper.AddParameter("@ToInventoryID", transferHeader.ToInventoryID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ToInventoryID", DBNull.Value);
            }
            oDatabaseHelper.AddParameter("@InvoiceNumber", transferHeader.InvoiceNumber);
            // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure.
            if (transferHeader.InvoiceDate != null)
            {
                oDatabaseHelper.AddParameter("@InvoiceDate", transferHeader.InvoiceDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value);
            }
            // Pass the value of '_sellerID' as parameter 'SellerID' of the stored procedure.

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

            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (transferHeader.CreatedBy != null)
            {
                oDatabaseHelper.AddParameter("@CreatedBy", transferHeader.CreatedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            }
            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            if (transferHeader.CreateDate != null)
            {
                oDatabaseHelper.AddParameter("@CreateDate", transferHeader.CreateDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value);
            }
            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (transferHeader.UpdatedBy != null)
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", transferHeader.UpdatedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            }
            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (transferHeader.UpdateDate != null)
            {
                oDatabaseHelper.AddParameter("@UpdateDate", transferHeader.UpdateDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            }
            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (transferHeader.IsDeleted != null)
            {
                oDatabaseHelper.AddParameter("@IsDeleted", transferHeader.IsDeleted);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            }
            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            if (transferHeader.DeletedBy != null)
            {
                oDatabaseHelper.AddParameter("@DeletedBy", transferHeader.DeletedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value);
            }
            // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure.
            if (transferHeader.DeletedDate != null)
            {
                oDatabaseHelper.AddParameter("@DeletedDate", transferHeader.DeletedDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeletedDate", DBNull.Value);
            }
            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

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

            return(ExecutionState);
        }
Exemple #16
0
        private bool UpdateHeader(DatabaseHelper oDatabaseHelper, INVTransferHeader transferHeader)
        {
            bool ExecutionState = false;

            oDatabaseHelper.AddParameter("@INVTransferHeaderID", transferHeader.INVTransferHeaderID);

            // Pass the value of '_transferHeaderID' as parameter 'INVTransferHeaderID' of the stored procedure.
            oDatabaseHelper.AddParameter("@TransferDate", transferHeader.TransferDate);
            // Pass the value of 'FromInventoryID' as parameter 'FromInventoryID' of the stored procedure.
            if (transferHeader.FromInventoryID != null)
                oDatabaseHelper.AddParameter("@FromInventoryID", transferHeader.FromInventoryID);
            else
                oDatabaseHelper.AddParameter("@FromInventoryID", DBNull.Value);
            // Pass the value of 'ToInventoryID' as parameter 'ToInventoryID' of the stored procedure.
            if (transferHeader.ToInventoryID != null)
                oDatabaseHelper.AddParameter("@ToInventoryID", transferHeader.ToInventoryID);
            else
                oDatabaseHelper.AddParameter("@ToInventoryID", DBNull.Value);
            oDatabaseHelper.AddParameter("@InvoiceNumber", transferHeader.InvoiceNumber);
            // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure.
            if (transferHeader.InvoiceDate != null)
                oDatabaseHelper.AddParameter("@InvoiceDate", transferHeader.InvoiceDate);
            else
                oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value);
            // Pass the value of '_sellerID' as parameter 'SellerID' of the stored procedure.
           
            // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
            if (transferHeader.IsClosed != null)
                oDatabaseHelper.AddParameter("@IsClosed", transferHeader.IsClosed);
            else
                oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value);
            // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
            if (transferHeader.IsVoid != null)
                oDatabaseHelper.AddParameter("@IsVoid", transferHeader.IsVoid);
            else
                oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value);
            // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure.
            if (transferHeader.IsPrinted != null)
                oDatabaseHelper.AddParameter("@IsPrinted", transferHeader.IsPrinted);
            else
                oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value);
           
            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (transferHeader.CreatedBy != null)
                oDatabaseHelper.AddParameter("@CreatedBy", transferHeader.CreatedBy);
            else
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            if (transferHeader.CreateDate != null)
                oDatabaseHelper.AddParameter("@CreateDate", transferHeader.CreateDate);
            else
                oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value);
            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (transferHeader.UpdatedBy != null)
                oDatabaseHelper.AddParameter("@UpdatedBy", transferHeader.UpdatedBy);
            else
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (transferHeader.UpdateDate != null)
                oDatabaseHelper.AddParameter("@UpdateDate", transferHeader.UpdateDate);
            else
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (transferHeader.IsDeleted != null)
                oDatabaseHelper.AddParameter("@IsDeleted", transferHeader.IsDeleted);
            else
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            if (transferHeader.DeletedBy != null)
                oDatabaseHelper.AddParameter("@DeletedBy", transferHeader.DeletedBy);
            else
                oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value);
            // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure.
            if (transferHeader.DeletedDate != null)
                oDatabaseHelper.AddParameter("@DeletedDate", transferHeader.DeletedDate);
            else
                oDatabaseHelper.AddParameter("@DeletedDate", DBNull.Value);
            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

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

            return ExecutionState;

        }
Exemple #17
0
        private bool InsertHeader(DatabaseHelper oDatabaseHelper, INVTransferHeader transferHeader, out int pK)
        {
            bool ExecutionState = false;
            // Pass the value of 'TransferDate' as parameter 'TransferDate' of the stored procedure.

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

            oDatabaseHelper.AddParameter("@InvoiceNumber", DBNull.Value);
            // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure.
            if (transferHeader.InvoiceDate != null)
                oDatabaseHelper.AddParameter("@InvoiceDate", transferHeader.InvoiceDate);
            else
                oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value);
           
            // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
            if (transferHeader.IsClosed != null)
                oDatabaseHelper.AddParameter("@IsClosed", transferHeader.IsClosed);
            else
                oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value);
            // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
            if (transferHeader.IsVoid != null)
                oDatabaseHelper.AddParameter("@IsVoid", transferHeader.IsVoid);
            else
                oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value);
            // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure.
            if (transferHeader.IsPrinted != null)
                oDatabaseHelper.AddParameter("@IsPrinted", transferHeader.IsPrinted);
            else
                oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value);
            
            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (transferHeader.CreatedBy != null)
                oDatabaseHelper.AddParameter("@CreatedBy", transferHeader.CreatedBy);
            else
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            if (transferHeader.CreateDate != null)
                oDatabaseHelper.AddParameter("@CreateDate", transferHeader.CreateDate);
            else
                oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value);
            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (transferHeader.UpdatedBy != null)
                oDatabaseHelper.AddParameter("@UpdatedBy", transferHeader.UpdatedBy);
            else
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (transferHeader.UpdateDate != null)
                oDatabaseHelper.AddParameter("@UpdateDate", transferHeader.UpdateDate);
            else
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (transferHeader.IsDeleted != null)
                oDatabaseHelper.AddParameter("@IsDeleted", transferHeader.IsDeleted);
            else
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            if (transferHeader.DeletedBy != null)
                oDatabaseHelper.AddParameter("@DeletedBy", transferHeader.DeletedBy);
            else
                oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value);
            // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure.
            if (transferHeader.DeletedDate != null)
                oDatabaseHelper.AddParameter("@DeletedDate", transferHeader.DeletedDate);
            else
                oDatabaseHelper.AddParameter("@DeletedDate", DBNull.Value);
            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

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

                throw;
            }
            return ExecutionState;
        }
Exemple #18
0
 public bool UpdateTransaction(INVTransferHeader transferHeader, INVTransferLineCollection transferLineCollection)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     oDatabaseHelper.BeginTransaction();
     if (UpdateHeader(oDatabaseHelper, transferHeader))
     {
         if (DeleteDetails(oDatabaseHelper, (int)transferHeader.INVTransferHeaderID, (int)transferHeader.CreatedBy))
         {
             foreach (INVTransferLine transferLine in transferLineCollection)
             {
                 if (!InsertDetailsAndCommit(oDatabaseHelper, transferLine, (int)transferHeader.INVTransferHeaderID))
                 {
                     ExecutionState = false;
                     break;
                 }
                 else
                     ExecutionState = true;
             }
             if (ExecutionState)
                 oDatabaseHelper.CommitTransaction();
             else
                 oDatabaseHelper.RollbackTransaction();
         }
         else
             ExecutionState = false;
     }
     else
         ExecutionState = false;
     return ExecutionState;
 }
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="INVTransferHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class INVTransferHeader</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 2:36:58 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static INVTransferHeader SelectOne(INVTransferHeaderPrimaryKey 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_INVTransferHeader_SelectbyPrimaryKey", ref ExecutionState);
			if (dr.Read())
			{
				INVTransferHeader obj=new INVTransferHeader();	
				PopulateObjectFromReader(obj,dr);
				dr.Close();              
				oDatabaseHelper.Dispose();
				return obj;
			}
			else
			{
				dr.Close();
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
		/// <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 INVTransferHeaderCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 2:36:58 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static INVTransferHeaderCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) 
		{

			INVTransferHeaderCollection list = new INVTransferHeaderCollection();
			
            if (rdr.Read())
			{
				INVTransferHeader obj = new INVTransferHeader();
				PopulateObjectFromReader(obj, rdr);
				list.Add(obj);
				while (rdr.Read())
				{
					obj = new INVTransferHeader();
					PopulateObjectFromReader(obj, rdr);
					list.Add(obj);
				}
				oDatabaseHelper.Dispose();
				return list;
			}
			else
			{
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
		/// <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 INVTransferHeader</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 INVTransferHeader in the form of an object of class INVTransferHeaderCollection</returns>
		public INVTransferHeaderCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
		{
			INVTransferHeaderCollection iNVTransferHeaderCollection = new INVTransferHeaderCollection();
			foreach (POS.DataLayer.INVTransferHeader _iNVTransferHeader in POS.DataLayer.INVTransferHeaderBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
			{
				_iNVTransferHeaderWCF = new INVTransferHeader();
				
				_iNVTransferHeaderWCF.INVTransferHeaderID = _iNVTransferHeader.INVTransferHeaderID;
				_iNVTransferHeaderWCF.TransferDate = _iNVTransferHeader.TransferDate;
				_iNVTransferHeaderWCF.FromInventoryID = _iNVTransferHeader.FromInventoryID;
				_iNVTransferHeaderWCF.ToInventoryID = _iNVTransferHeader.ToInventoryID;
				_iNVTransferHeaderWCF.InvoiceNumber = _iNVTransferHeader.InvoiceNumber;
				_iNVTransferHeaderWCF.InvoiceDate = _iNVTransferHeader.InvoiceDate;
				_iNVTransferHeaderWCF.IsVoid = _iNVTransferHeader.IsVoid;
				_iNVTransferHeaderWCF.IsPrinted = _iNVTransferHeader.IsPrinted;
				_iNVTransferHeaderWCF.IsClosed = _iNVTransferHeader.IsClosed;
				_iNVTransferHeaderWCF.CreatedBy = _iNVTransferHeader.CreatedBy;
				_iNVTransferHeaderWCF.CreateDate = _iNVTransferHeader.CreateDate;
				_iNVTransferHeaderWCF.UpdatedBy = _iNVTransferHeader.UpdatedBy;
				_iNVTransferHeaderWCF.UpdateDate = _iNVTransferHeader.UpdateDate;
				_iNVTransferHeaderWCF.IsDeleted = _iNVTransferHeader.IsDeleted;
				_iNVTransferHeaderWCF.DeletedBy = _iNVTransferHeader.DeletedBy;
				_iNVTransferHeaderWCF.DeletedDate = _iNVTransferHeader.DeletedDate;
				
				iNVTransferHeaderCollection.Add(_iNVTransferHeaderWCF);
			}
			return iNVTransferHeaderCollection;
		}
			///<summary>
		/// This method will update one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="iNVTransferHeader" type="INVTransferHeader">This INVTransferHeader  will be updated in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Update(INVTransferHeader iNVTransferHeader)
		{
			_iNVTransferHeader=POS.DataLayer.INVTransferHeader.SelectOne(new POS.DataLayer.INVTransferHeaderPrimaryKey(iNVTransferHeader.INVTransferHeaderID));
			
			_iNVTransferHeader.TransferDate=iNVTransferHeader.TransferDate;
			_iNVTransferHeader.FromInventoryID=iNVTransferHeader.FromInventoryID;
			_iNVTransferHeader.ToInventoryID=iNVTransferHeader.ToInventoryID;
			_iNVTransferHeader.InvoiceNumber=iNVTransferHeader.InvoiceNumber;
			_iNVTransferHeader.InvoiceDate=iNVTransferHeader.InvoiceDate;
			_iNVTransferHeader.IsVoid=iNVTransferHeader.IsVoid;
			_iNVTransferHeader.IsPrinted=iNVTransferHeader.IsPrinted;
			_iNVTransferHeader.IsClosed=iNVTransferHeader.IsClosed;
			_iNVTransferHeader.CreatedBy=iNVTransferHeader.CreatedBy;
			_iNVTransferHeader.CreateDate=iNVTransferHeader.CreateDate;
			_iNVTransferHeader.UpdatedBy=iNVTransferHeader.UpdatedBy;
			_iNVTransferHeader.UpdateDate=iNVTransferHeader.UpdateDate;
			_iNVTransferHeader.IsDeleted=iNVTransferHeader.IsDeleted;
			_iNVTransferHeader.DeletedBy=iNVTransferHeader.DeletedBy;
			_iNVTransferHeader.DeletedDate=iNVTransferHeader.DeletedDate;
			
			return _iNVTransferHeader.Update();
		}
Exemple #23
0
        private static INVTransferHeaderCollection PopulateFromReader(IDataReader rdr)
        {
            INVTransferHeaderCollection INVTransferHeaderCollection = new INVTransferHeaderCollection();
            while (rdr.Read())
            {
                INVTransferHeader obj = new INVTransferHeader();
                obj.INVTransferHeaderID = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.INVTransferHeaderID));
                obj.TransferDate = rdr.GetDateTime(rdr.GetOrdinal(INVTransferHeaderFields.TransferDate));
                obj.FromInventoryID = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.FromInventoryID));
                obj.ToInventoryID = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.ToInventoryID));
                
                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.InvoiceNumber)))
                {
                    obj.InvoiceNumber = rdr.GetString(rdr.GetOrdinal(INVTransferHeaderFields.InvoiceNumber));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.InvoiceDate)))
                {
                    obj.InvoiceDate = rdr.GetDateTime(rdr.GetOrdinal(INVTransferHeaderFields.InvoiceDate));
                }

                obj.IsClosed = rdr.GetBoolean(rdr.GetOrdinal(INVTransferHeaderFields.IsClosed));
                obj.IsVoid = rdr.GetBoolean(rdr.GetOrdinal(INVTransferHeaderFields.IsVoid));
                obj.IsPrinted = rdr.GetBoolean(rdr.GetOrdinal(INVTransferHeaderFields.IsPrinted));

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.CreatedBy)))
                {
                    obj.CreatedBy = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.CreatedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.CreateDate)))
                {
                    obj.CreateDate = rdr.GetDateTime(rdr.GetOrdinal(INVTransferHeaderFields.CreateDate));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.UpdatedBy)))
                {
                    obj.UpdatedBy = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.UpdatedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.UpdateDate)))
                {
                    obj.UpdateDate = rdr.GetDateTime(rdr.GetOrdinal(INVTransferHeaderFields.UpdateDate));
                }

                obj.IsDeleted = rdr.GetBoolean(rdr.GetOrdinal(INVTransferHeaderFields.IsDeleted));
                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.DeletedBy)))
                {
                    obj.DeletedBy = rdr.GetInt32(rdr.GetOrdinal(INVTransferHeaderFields.DeletedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(INVTransferHeaderFields.DeletedDate)))
                {
                    obj.DeletedDate = rdr.GetDateTime(rdr.GetOrdinal(INVTransferHeaderFields.DeletedDate));
                }
                INVTransferHeaderCollection.Add(obj);
            }
            return INVTransferHeaderCollection;
        }
		/// <summary>
		/// This method will insert one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="iNVTransferHeader" type="INVTransferHeader">This INVTransferHeader  will be inserted in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Insert(INVTransferHeader iNVTransferHeader)
		{
			_iNVTransferHeader = new POS.DataLayer.INVTransferHeader();
			_iNVTransferHeader.INVTransferHeaderID=iNVTransferHeader.INVTransferHeaderID;
			_iNVTransferHeader.TransferDate=iNVTransferHeader.TransferDate;
			_iNVTransferHeader.FromInventoryID=iNVTransferHeader.FromInventoryID;
			_iNVTransferHeader.ToInventoryID=iNVTransferHeader.ToInventoryID;
			_iNVTransferHeader.InvoiceNumber=iNVTransferHeader.InvoiceNumber;
			_iNVTransferHeader.InvoiceDate=iNVTransferHeader.InvoiceDate;
			_iNVTransferHeader.IsVoid=iNVTransferHeader.IsVoid;
			_iNVTransferHeader.IsPrinted=iNVTransferHeader.IsPrinted;
			_iNVTransferHeader.IsClosed=iNVTransferHeader.IsClosed;
			_iNVTransferHeader.CreatedBy=iNVTransferHeader.CreatedBy;
			_iNVTransferHeader.CreateDate=iNVTransferHeader.CreateDate;
			_iNVTransferHeader.UpdatedBy=iNVTransferHeader.UpdatedBy;
			_iNVTransferHeader.UpdateDate=iNVTransferHeader.UpdateDate;
			_iNVTransferHeader.IsDeleted=iNVTransferHeader.IsDeleted;
			_iNVTransferHeader.DeletedBy=iNVTransferHeader.DeletedBy;
			_iNVTransferHeader.DeletedDate=iNVTransferHeader.DeletedDate;
			
			return _iNVTransferHeader.Insert();
		}