Пример #1
0
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="BDCustomerAccountPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class BDCustomerAccount</returns>
        public BDCustomerAccount SelectOne(BDCustomerAccountPrimaryKey pk)
        {
            _bDCustomerAccountWCF = new BDCustomerAccount();
            _bDCustomerAccount    = POS.DataLayer.BDCustomerAccountBase.SelectOne(new POS.DataLayer.BDCustomerAccountPrimaryKey(pk.CustomerAccountNumber));

            _bDCustomerAccountWCF.CustomerAccountNumber = _bDCustomerAccount.CustomerAccountNumber;
            _bDCustomerAccountWCF.CustomerID            = _bDCustomerAccount.CustomerID;
            _bDCustomerAccountWCF.SalesInvoiceId        = _bDCustomerAccount.SalesInvoiceId;
            _bDCustomerAccountWCF.SalesDate             = _bDCustomerAccount.SalesDate;
            _bDCustomerAccountWCF.InvoiceNumber         = _bDCustomerAccount.InvoiceNumber;
            _bDCustomerAccountWCF.TotalPrice            = _bDCustomerAccount.TotalPrice;
            _bDCustomerAccountWCF.PaidAmount            = _bDCustomerAccount.PaidAmount;
            _bDCustomerAccountWCF.RemainingAmount       = _bDCustomerAccount.RemainingAmount;
            _bDCustomerAccountWCF.IsVoid      = _bDCustomerAccount.IsVoid;
            _bDCustomerAccountWCF.CreatedBy   = _bDCustomerAccount.CreatedBy;
            _bDCustomerAccountWCF.CreateDate  = _bDCustomerAccount.CreateDate;
            _bDCustomerAccountWCF.UpdatedBy   = _bDCustomerAccount.UpdatedBy;
            _bDCustomerAccountWCF.UpdateDate  = _bDCustomerAccount.UpdateDate;
            _bDCustomerAccountWCF.IsDeleted   = _bDCustomerAccount.IsDeleted;
            _bDCustomerAccountWCF.DeletedBy   = _bDCustomerAccount.DeletedBy;
            _bDCustomerAccountWCF.DeletedDate = _bDCustomerAccount.DeletedDate;
            _bDCustomerAccountWCF.InvoiceType = _bDCustomerAccount.InvoiceType;

            return(_bDCustomerAccountWCF);
        }
Пример #2
0
        /// <summary>
        /// This method will get row(s) from the database using the value of the field specified
        /// along with the details of the child table.
        /// </summary>
        ///
        /// <param name="pk" type="ADUserPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class ADUser</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			3/7/2015 2:37:27 PM				Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static ADUser SelectOneWithBDCustomerAccountsUsingCreatedBy(ADUserPrimaryKey pk)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool           ExecutionState  = false;
            ADUser         obj             = null;

            // Pass the values of all key parameters to the stored procedure.
            System.Collections.Specialized.NameValueCollection nvc = pk.GetKeysAndValues();
            foreach (string key in nvc.Keys)
            {
                oDatabaseHelper.AddParameter("@" + key, nvc[key]);
            }

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

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

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

                dr.NextResult();

                //Get the child records.
                obj.BDCustomerAccountCollectionUsingCreatedBy = BDCustomerAccount.PopulateObjectsFromReader(dr);
            }
            dr.Close();
            oDatabaseHelper.Dispose();
            return(obj);
        }
Пример #3
0
        ///<summary>
        /// This method will update one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="bDCustomerAccount" type="BDCustomerAccount">This BDCustomerAccount  will be updated in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Update(BDCustomerAccount bDCustomerAccount)
        {
            _bDCustomerAccount = POS.DataLayer.BDCustomerAccount.SelectOne(new POS.DataLayer.BDCustomerAccountPrimaryKey(bDCustomerAccount.CustomerAccountNumber));

            _bDCustomerAccount.CustomerID      = bDCustomerAccount.CustomerID;
            _bDCustomerAccount.SalesInvoiceId  = bDCustomerAccount.SalesInvoiceId;
            _bDCustomerAccount.SalesDate       = bDCustomerAccount.SalesDate;
            _bDCustomerAccount.InvoiceNumber   = bDCustomerAccount.InvoiceNumber;
            _bDCustomerAccount.TotalPrice      = bDCustomerAccount.TotalPrice;
            _bDCustomerAccount.PaidAmount      = bDCustomerAccount.PaidAmount;
            _bDCustomerAccount.RemainingAmount = bDCustomerAccount.RemainingAmount;
            _bDCustomerAccount.IsVoid          = bDCustomerAccount.IsVoid;
            _bDCustomerAccount.CreatedBy       = bDCustomerAccount.CreatedBy;
            _bDCustomerAccount.CreateDate      = bDCustomerAccount.CreateDate;
            _bDCustomerAccount.UpdatedBy       = bDCustomerAccount.UpdatedBy;
            _bDCustomerAccount.UpdateDate      = bDCustomerAccount.UpdateDate;
            _bDCustomerAccount.IsDeleted       = bDCustomerAccount.IsDeleted;
            _bDCustomerAccount.DeletedBy       = bDCustomerAccount.DeletedBy;
            _bDCustomerAccount.DeletedDate     = bDCustomerAccount.DeletedDate;
            _bDCustomerAccount.Depit           = bDCustomerAccount.Depit;
            _bDCustomerAccount.Credit          = bDCustomerAccount.Credit;
            _bDCustomerAccount.ChequeNumber    = bDCustomerAccount.ChequeNumber;
            _bDCustomerAccount.InvoiceType     = bDCustomerAccount.InvoiceType;
            _bDCustomerAccount.LstDayToPay     = bDCustomerAccount.LstDayToPay;

            return(_bDCustomerAccount.Update());
        }
Пример #4
0
        public bool SaveAccountUpdates(SALSalesHeader salesHeader, BDCustomerAccount customerAccount)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;

            oDatabaseHelper.BeginTransaction();
            ExecutionState = UpdateCustomerAccount(oDatabaseHelper, customerAccount, ExecutionState);
            if (!UpdateSalesHeader(oDatabaseHelper, salesHeader))
            {
                ExecutionState = false;
            }
            else
            {
                ExecutionState = true;
            }
            if (ExecutionState)
            {
                oDatabaseHelper.CommitTransaction();
            }
            else
            {
                oDatabaseHelper.RollbackTransaction();
            }
            oDatabaseHelper.Dispose();
            return(ExecutionState);
        }
Пример #5
0
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="BDCustomerAccountPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class BDCustomerAccount</returns>
		public BDCustomerAccount SelectOne(BDCustomerAccountPrimaryKey pk)
		{
			_bDCustomerAccountWCF = new BDCustomerAccount();
			_bDCustomerAccount = POS.DataLayer.BDCustomerAccountBase.SelectOne(new POS.DataLayer.BDCustomerAccountPrimaryKey(pk.CustomerAccountNumber));
			
				_bDCustomerAccountWCF.CustomerAccountNumber = _bDCustomerAccount.CustomerAccountNumber;
				_bDCustomerAccountWCF.CustomerID = _bDCustomerAccount.CustomerID;
				_bDCustomerAccountWCF.SalesInvoiceId = _bDCustomerAccount.SalesInvoiceId;
				_bDCustomerAccountWCF.SalesDate = _bDCustomerAccount.SalesDate;
				_bDCustomerAccountWCF.InvoiceNumber = _bDCustomerAccount.InvoiceNumber;
				_bDCustomerAccountWCF.TotalPrice = _bDCustomerAccount.TotalPrice;
				_bDCustomerAccountWCF.PaidAmount = _bDCustomerAccount.PaidAmount;
				_bDCustomerAccountWCF.RemainingAmount = _bDCustomerAccount.RemainingAmount;
				_bDCustomerAccountWCF.IsVoid = _bDCustomerAccount.IsVoid;
				_bDCustomerAccountWCF.CreatedBy = _bDCustomerAccount.CreatedBy;
				_bDCustomerAccountWCF.CreateDate = _bDCustomerAccount.CreateDate;
				_bDCustomerAccountWCF.UpdatedBy = _bDCustomerAccount.UpdatedBy;
				_bDCustomerAccountWCF.UpdateDate = _bDCustomerAccount.UpdateDate;
				_bDCustomerAccountWCF.IsDeleted = _bDCustomerAccount.IsDeleted;
				_bDCustomerAccountWCF.DeletedBy = _bDCustomerAccount.DeletedBy;
				_bDCustomerAccountWCF.DeletedDate = _bDCustomerAccount.DeletedDate;
				_bDCustomerAccountWCF.Depit = _bDCustomerAccount.Depit;
				_bDCustomerAccountWCF.Credit = _bDCustomerAccount.Credit;
				_bDCustomerAccountWCF.ChequeNumber = _bDCustomerAccount.ChequeNumber;
				_bDCustomerAccountWCF.InvoiceType = _bDCustomerAccount.InvoiceType;
				_bDCustomerAccountWCF.LstDayToPay = _bDCustomerAccount.LstDayToPay;
				
			return _bDCustomerAccountWCF;
		}
Пример #6
0
 public bool SaveAccountUpdates(SALSalesHeader salesHeader, BDCustomerAccount customerAccount)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     oDatabaseHelper.BeginTransaction();
     ExecutionState = UpdateCustomerAccount(oDatabaseHelper, customerAccount, ExecutionState);
     if (!UpdateSalesHeader(oDatabaseHelper, salesHeader))
     {
         ExecutionState = false;
     }
     else
         ExecutionState = true;
     if (ExecutionState)
         oDatabaseHelper.CommitTransaction();
     else
         oDatabaseHelper.RollbackTransaction();
     oDatabaseHelper.Dispose();
     return ExecutionState;
 }
Пример #7
0
 private bool UpdateCustomerAccount(DatabaseHelper oDatabaseHelper, BDCustomerAccount customerAccount, bool ExecutionState)
 {
     oDatabaseHelper.AddParameter("@CustomerAccountNumber", customerAccount.CustomerAccountNumber);
     oDatabaseHelper.AddParameter("@SalesInvoiceId", customerAccount.SalesInvoiceId);
     oDatabaseHelper.AddParameter("@SalesDate", customerAccount.SalesDate);
     oDatabaseHelper.AddParameter("@CustomerID", customerAccount.CustomerID);
     oDatabaseHelper.AddParameter("@InvoiceNumber", customerAccount.InvoiceNumber);
     oDatabaseHelper.AddParameter("@TotalPrice", customerAccount.TotalPrice);
     oDatabaseHelper.AddParameter("@PaidAmount", customerAccount.PaidAmount);
     oDatabaseHelper.AddParameter("@IsVoid", customerAccount.IsVoid);
     oDatabaseHelper.AddParameter("@RemainingAmount", customerAccount.RemainingAmount);
     oDatabaseHelper.AddParameter("@CreateDate", customerAccount.CreateDate);
     oDatabaseHelper.AddParameter("@CreatedBy", customerAccount.CreatedBy);
     oDatabaseHelper.AddParameter("@UpdateDate", customerAccount.UpdateDate);
     oDatabaseHelper.AddParameter("@UpdatedBy", customerAccount.UpdatedBy);
     oDatabaseHelper.AddParameter("@IsDeleted", customerAccount.IsDeleted);
     oDatabaseHelper.AddParameter("@DeletedDate", customerAccount.DeletedDate);
     oDatabaseHelper.AddParameter("@DeletedBy", customerAccount.DeletedBy);
     oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
     oDatabaseHelper.ExecuteScalar("gsp_BDCustomerAccounts_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);
     return(ExecutionState);
 }
Пример #8
0
 private bool UpdateCustomerAccount(DatabaseHelper oDatabaseHelper, BDCustomerAccount customerAccount, bool ExecutionState)
 {
     oDatabaseHelper.AddParameter("@CustomerAccountNumber", customerAccount.CustomerAccountNumber);
     oDatabaseHelper.AddParameter("@SalesInvoiceId", customerAccount.SalesInvoiceId);
     oDatabaseHelper.AddParameter("@SalesDate", customerAccount.SalesDate);
     oDatabaseHelper.AddParameter("@CustomerID", customerAccount.CustomerID);
     oDatabaseHelper.AddParameter("@InvoiceNumber", customerAccount.InvoiceNumber);
     oDatabaseHelper.AddParameter("@TotalPrice", customerAccount.TotalPrice);
     oDatabaseHelper.AddParameter("@PaidAmount", customerAccount.PaidAmount);
     oDatabaseHelper.AddParameter("@IsVoid", customerAccount.IsVoid);
     oDatabaseHelper.AddParameter("@RemainingAmount", customerAccount.RemainingAmount);
     oDatabaseHelper.AddParameter("@CreateDate", customerAccount.CreateDate);
     oDatabaseHelper.AddParameter("@CreatedBy", customerAccount.CreatedBy);
     oDatabaseHelper.AddParameter("@UpdateDate", customerAccount.UpdateDate);
     oDatabaseHelper.AddParameter("@UpdatedBy", customerAccount.UpdatedBy);
     oDatabaseHelper.AddParameter("@IsDeleted", customerAccount.IsDeleted);
     oDatabaseHelper.AddParameter("@DeletedDate", customerAccount.DeletedDate);
     oDatabaseHelper.AddParameter("@DeletedBy", customerAccount.DeletedBy);
     oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
     oDatabaseHelper.ExecuteScalar("gsp_BDCustomerAccounts_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);
     return ExecutionState;
 }
Пример #9
0
        /// <summary>
        /// This method will insert one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="bDCustomerAccount" type="BDCustomerAccount">This BDCustomerAccount  will be inserted in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Insert(BDCustomerAccount bDCustomerAccount)
        {
            _bDCustomerAccount = new POS.DataLayer.BDCustomerAccount();
            _bDCustomerAccount.CustomerAccountNumber = bDCustomerAccount.CustomerAccountNumber;
            _bDCustomerAccount.CustomerID            = bDCustomerAccount.CustomerID;
            _bDCustomerAccount.SalesInvoiceId        = bDCustomerAccount.SalesInvoiceId;
            _bDCustomerAccount.SalesDate             = bDCustomerAccount.SalesDate;
            _bDCustomerAccount.InvoiceNumber         = bDCustomerAccount.InvoiceNumber;
            _bDCustomerAccount.TotalPrice            = bDCustomerAccount.TotalPrice;
            _bDCustomerAccount.PaidAmount            = bDCustomerAccount.PaidAmount;
            _bDCustomerAccount.RemainingAmount       = bDCustomerAccount.RemainingAmount;
            _bDCustomerAccount.IsVoid      = bDCustomerAccount.IsVoid;
            _bDCustomerAccount.CreatedBy   = bDCustomerAccount.CreatedBy;
            _bDCustomerAccount.CreateDate  = bDCustomerAccount.CreateDate;
            _bDCustomerAccount.UpdatedBy   = bDCustomerAccount.UpdatedBy;
            _bDCustomerAccount.UpdateDate  = bDCustomerAccount.UpdateDate;
            _bDCustomerAccount.IsDeleted   = bDCustomerAccount.IsDeleted;
            _bDCustomerAccount.DeletedBy   = bDCustomerAccount.DeletedBy;
            _bDCustomerAccount.DeletedDate = bDCustomerAccount.DeletedDate;
            _bDCustomerAccount.InvoiceType = bDCustomerAccount.InvoiceType;

            return(_bDCustomerAccount.Insert());
        }
Пример #10
0
			///<summary>
		/// This method will update one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="bDCustomerAccount" type="BDCustomerAccount">This BDCustomerAccount  will be updated in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Update(BDCustomerAccount bDCustomerAccount)
		{
			_bDCustomerAccount=POS.DataLayer.BDCustomerAccount.SelectOne(new POS.DataLayer.BDCustomerAccountPrimaryKey(bDCustomerAccount.CustomerAccountNumber));
			
			_bDCustomerAccount.CustomerID=bDCustomerAccount.CustomerID;
			_bDCustomerAccount.SalesInvoiceId=bDCustomerAccount.SalesInvoiceId;
			_bDCustomerAccount.SalesDate=bDCustomerAccount.SalesDate;
			_bDCustomerAccount.InvoiceNumber=bDCustomerAccount.InvoiceNumber;
			_bDCustomerAccount.TotalPrice=bDCustomerAccount.TotalPrice;
			_bDCustomerAccount.PaidAmount=bDCustomerAccount.PaidAmount;
			_bDCustomerAccount.RemainingAmount=bDCustomerAccount.RemainingAmount;
			_bDCustomerAccount.IsVoid=bDCustomerAccount.IsVoid;
			_bDCustomerAccount.CreatedBy=bDCustomerAccount.CreatedBy;
			_bDCustomerAccount.CreateDate=bDCustomerAccount.CreateDate;
			_bDCustomerAccount.UpdatedBy=bDCustomerAccount.UpdatedBy;
			_bDCustomerAccount.UpdateDate=bDCustomerAccount.UpdateDate;
			_bDCustomerAccount.IsDeleted=bDCustomerAccount.IsDeleted;
			_bDCustomerAccount.DeletedBy=bDCustomerAccount.DeletedBy;
			_bDCustomerAccount.DeletedDate=bDCustomerAccount.DeletedDate;
			_bDCustomerAccount.Depit=bDCustomerAccount.Depit;
			_bDCustomerAccount.Credit=bDCustomerAccount.Credit;
			_bDCustomerAccount.ChequeNumber=bDCustomerAccount.ChequeNumber;
			_bDCustomerAccount.InvoiceType=bDCustomerAccount.InvoiceType;
			_bDCustomerAccount.LstDayToPay=bDCustomerAccount.LstDayToPay;
			
			return _bDCustomerAccount.Update();
		}
Пример #11
0
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="BDCustomerAccountPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class BDCustomerAccount</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			6/13/2015 10:16:22 AM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static BDCustomerAccount SelectOne(BDCustomerAccountPrimaryKey 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_BDCustomerAccounts_SelectbyPrimaryKey", ref ExecutionState);
			if (dr.Read())
			{
				BDCustomerAccount obj=new BDCustomerAccount();	
				PopulateObjectFromReader(obj,dr);
				dr.Close();              
				oDatabaseHelper.Dispose();
				return obj;
			}
			else
			{
				dr.Close();
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
Пример #12
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 BDCustomerAccountCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			6/13/2015 10:16:22 AM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static BDCustomerAccountCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) 
		{

			BDCustomerAccountCollection list = new BDCustomerAccountCollection();
			
            if (rdr.Read())
			{
				BDCustomerAccount obj = new BDCustomerAccount();
				PopulateObjectFromReader(obj, rdr);
				list.Add(obj);
				while (rdr.Read())
				{
					obj = new BDCustomerAccount();
					PopulateObjectFromReader(obj, rdr);
					list.Add(obj);
				}
				oDatabaseHelper.Dispose();
				return list;
			}
			else
			{
				oDatabaseHelper.Dispose();
                return list;
			}
			
		}
Пример #13
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 BDCustomerAccountCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			6/13/2015 10:16:22 AM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static BDCustomerAccountCollection PopulateObjectsFromReader(IDataReader rdr) 
		{
			BDCustomerAccountCollection list = new BDCustomerAccountCollection();
			
			while (rdr.Read())
			{
				BDCustomerAccount obj = new BDCustomerAccount();
				PopulateObjectFromReader(obj,rdr);
				list.Add(obj);
			}
			return list;
			
		}