/// <summary>
        /// This method will return a list of objects representing all records in the table.
        /// </summary>
        ///
        /// <returns>list of objects of class PURPurchaseLine in the form of object of PURPurchaseLineCollection </returns>
        public PURPurchaseLineCollection SelectAll()
        {
            PURPurchaseLineCollection pURPurchaseLineCollection = new PURPurchaseLineCollection();

            foreach (POS.DataLayer.PURPurchaseLine _pURPurchaseLine in POS.DataLayer.PURPurchaseLineBase.SelectAll())
            {
                _pURPurchaseLineWCF = new PURPurchaseLine();

                _pURPurchaseLineWCF.PurchaseLineID   = _pURPurchaseLine.PurchaseLineID;
                _pURPurchaseLineWCF.PurchaseHeaderID = _pURPurchaseLine.PurchaseHeaderID;
                _pURPurchaseLineWCF.ProductID        = _pURPurchaseLine.ProductID;
                _pURPurchaseLineWCF.TotalQty         = _pURPurchaseLine.TotalQty;
                _pURPurchaseLineWCF.BonusQty         = _pURPurchaseLine.BonusQty;
                _pURPurchaseLineWCF.DiscountRatio    = _pURPurchaseLine.DiscountRatio;
                _pURPurchaseLineWCF.DiscountAmount   = _pURPurchaseLine.DiscountAmount;
                _pURPurchaseLineWCF.Unitprice        = _pURPurchaseLine.Unitprice;
                _pURPurchaseLineWCF.CreatedDate      = _pURPurchaseLine.CreatedDate;
                _pURPurchaseLineWCF.CreatedBy        = _pURPurchaseLine.CreatedBy;
                _pURPurchaseLineWCF.UpdateDate       = _pURPurchaseLine.UpdateDate;
                _pURPurchaseLineWCF.UpdatedBy        = _pURPurchaseLine.UpdatedBy;
                _pURPurchaseLineWCF.IsDeleted        = _pURPurchaseLine.IsDeleted;
                _pURPurchaseLineWCF.DeleteDate       = _pURPurchaseLine.DeleteDate;
                _pURPurchaseLineWCF.DeletedBy        = _pURPurchaseLine.DeletedBy;

                pURPurchaseLineCollection.Add(_pURPurchaseLineWCF);
            }
            return(pURPurchaseLineCollection);
        }
        /// <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 PURPurchaseLine</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 PURPurchaseLine in the form of an object of class PURPurchaseLineCollection</returns>
        public PURPurchaseLineCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
        {
            PURPurchaseLineCollection pURPurchaseLineCollection = new PURPurchaseLineCollection();

            foreach (POS.DataLayer.PURPurchaseLine _pURPurchaseLine in POS.DataLayer.PURPurchaseLineBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
            {
                _pURPurchaseLineWCF = new PURPurchaseLine();

                _pURPurchaseLineWCF.PurchaseLineID   = _pURPurchaseLine.PurchaseLineID;
                _pURPurchaseLineWCF.PurchaseHeaderID = _pURPurchaseLine.PurchaseHeaderID;
                _pURPurchaseLineWCF.ProductID        = _pURPurchaseLine.ProductID;
                _pURPurchaseLineWCF.TotalQty         = _pURPurchaseLine.TotalQty;
                _pURPurchaseLineWCF.BonusQty         = _pURPurchaseLine.BonusQty;
                _pURPurchaseLineWCF.DiscountRatio    = _pURPurchaseLine.DiscountRatio;
                _pURPurchaseLineWCF.DiscountAmount   = _pURPurchaseLine.DiscountAmount;
                _pURPurchaseLineWCF.Unitprice        = _pURPurchaseLine.Unitprice;
                _pURPurchaseLineWCF.CreatedDate      = _pURPurchaseLine.CreatedDate;
                _pURPurchaseLineWCF.CreatedBy        = _pURPurchaseLine.CreatedBy;
                _pURPurchaseLineWCF.UpdateDate       = _pURPurchaseLine.UpdateDate;
                _pURPurchaseLineWCF.UpdatedBy        = _pURPurchaseLine.UpdatedBy;
                _pURPurchaseLineWCF.IsDeleted        = _pURPurchaseLine.IsDeleted;
                _pURPurchaseLineWCF.DeleteDate       = _pURPurchaseLine.DeleteDate;
                _pURPurchaseLineWCF.DeletedBy        = _pURPurchaseLine.DeletedBy;

                pURPurchaseLineCollection.Add(_pURPurchaseLineWCF);
            }
            return(pURPurchaseLineCollection);
        }
        /// <summary>
        /// This method will get row(s) from the database using the value of the field specified
        /// along with the details of the child table.
        /// </summary>
        ///
        /// <param name="pk" type="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        /// <param name="pageSize" type="int">Number of records returned.</param>
        /// <param name="skipPages" type="int">The number of missing pages.</param>
        /// <param name="orderByStatement" type="string">The field value to number.</param>
        ///
        /// <returns>object of class PURPurchaseLineCollection</returns>
        public PURPurchaseLineCollection SelectAllByForeignKeyPurchaseHeaderIDPaged(PURPurchaseHeaderPrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
        {
            PURPurchaseLineCollection pURPurchaseLineCollection = new PURPurchaseLineCollection();

            foreach (POS.DataLayer.PURPurchaseLine _pURPurchaseLine in POS.DataLayer.PURPurchaseLineBase.SelectAllByForeignKeyPurchaseHeaderIDPaged(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pk.PurcaseHeaderID), pageSize, skipPages, orderByStatement))
            {
                _pURPurchaseLineWCF = new PURPurchaseLine();
                _pURPurchaseLineWCF.PurchaseLineID   = _pURPurchaseLine.PurchaseLineID;
                _pURPurchaseLineWCF.PurchaseHeaderID = _pURPurchaseLine.PurchaseHeaderID;
                _pURPurchaseLineWCF.ProductID        = _pURPurchaseLine.ProductID;
                _pURPurchaseLineWCF.TotalQty         = _pURPurchaseLine.TotalQty;
                _pURPurchaseLineWCF.BonusQty         = _pURPurchaseLine.BonusQty;
                _pURPurchaseLineWCF.DiscountRatio    = _pURPurchaseLine.DiscountRatio;
                _pURPurchaseLineWCF.DiscountAmount   = _pURPurchaseLine.DiscountAmount;
                _pURPurchaseLineWCF.Unitprice        = _pURPurchaseLine.Unitprice;
                _pURPurchaseLineWCF.CreatedDate      = _pURPurchaseLine.CreatedDate;
                _pURPurchaseLineWCF.CreatedBy        = _pURPurchaseLine.CreatedBy;
                _pURPurchaseLineWCF.UpdateDate       = _pURPurchaseLine.UpdateDate;
                _pURPurchaseLineWCF.UpdatedBy        = _pURPurchaseLine.UpdatedBy;
                _pURPurchaseLineWCF.IsDeleted        = _pURPurchaseLine.IsDeleted;
                _pURPurchaseLineWCF.DeleteDate       = _pURPurchaseLine.DeleteDate;
                _pURPurchaseLineWCF.DeletedBy        = _pURPurchaseLine.DeletedBy;

                pURPurchaseLineCollection.Add(_pURPurchaseLineWCF);
            }
            return(pURPurchaseLineCollection);
        }
        ///<summary>
        /// This method will update one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="pURPurchaseLine" type="PURPurchaseLine">This PURPurchaseLine  will be updated in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Update(PURPurchaseLine pURPurchaseLine)
        {
            _pURPurchaseLine = POS.DataLayer.PURPurchaseLine.SelectOne(new POS.DataLayer.PURPurchaseLinePrimaryKey(pURPurchaseLine.PurchaseLineID));

            _pURPurchaseLine.PurchaseHeaderID = pURPurchaseLine.PurchaseHeaderID;
            _pURPurchaseLine.ProductID        = pURPurchaseLine.ProductID;
            _pURPurchaseLine.TotalQty         = pURPurchaseLine.TotalQty;
            _pURPurchaseLine.BonusQty         = pURPurchaseLine.BonusQty;
            _pURPurchaseLine.DiscountRatio    = pURPurchaseLine.DiscountRatio;
            _pURPurchaseLine.DiscountAmount   = pURPurchaseLine.DiscountAmount;
            _pURPurchaseLine.Unitprice        = pURPurchaseLine.Unitprice;
            _pURPurchaseLine.CreatedDate      = pURPurchaseLine.CreatedDate;
            _pURPurchaseLine.CreatedBy        = pURPurchaseLine.CreatedBy;
            _pURPurchaseLine.UpdateDate       = pURPurchaseLine.UpdateDate;
            _pURPurchaseLine.UpdatedBy        = pURPurchaseLine.UpdatedBy;
            _pURPurchaseLine.IsDeleted        = pURPurchaseLine.IsDeleted;
            _pURPurchaseLine.DeleteDate       = pURPurchaseLine.DeleteDate;
            _pURPurchaseLine.DeletedBy        = pURPurchaseLine.DeletedBy;

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

            _pURPurchaseLineWCF.PurchaseLineID   = _pURPurchaseLine.PurchaseLineID;
            _pURPurchaseLineWCF.PurchaseHeaderID = _pURPurchaseLine.PurchaseHeaderID;
            _pURPurchaseLineWCF.ProductID        = _pURPurchaseLine.ProductID;
            _pURPurchaseLineWCF.TotalQty         = _pURPurchaseLine.TotalQty;
            _pURPurchaseLineWCF.BonusQty         = _pURPurchaseLine.BonusQty;
            _pURPurchaseLineWCF.DiscountRatio    = _pURPurchaseLine.DiscountRatio;
            _pURPurchaseLineWCF.DiscountAmount   = _pURPurchaseLine.DiscountAmount;
            _pURPurchaseLineWCF.Unitprice        = _pURPurchaseLine.Unitprice;
            _pURPurchaseLineWCF.CreatedDate      = _pURPurchaseLine.CreatedDate;
            _pURPurchaseLineWCF.CreatedBy        = _pURPurchaseLine.CreatedBy;
            _pURPurchaseLineWCF.UpdateDate       = _pURPurchaseLine.UpdateDate;
            _pURPurchaseLineWCF.UpdatedBy        = _pURPurchaseLine.UpdatedBy;
            _pURPurchaseLineWCF.IsDeleted        = _pURPurchaseLine.IsDeleted;
            _pURPurchaseLineWCF.DeleteDate       = _pURPurchaseLine.DeleteDate;
            _pURPurchaseLineWCF.DeletedBy        = _pURPurchaseLine.DeletedBy;

            return(_pURPurchaseLineWCF);
        }
Esempio n. 6
0
        private bool SaveInvoice()
        {
            //save lines
            for (int i = 0; i < dgrd_OrderLines.Rows.Count; i++)
            {
                PURPurchaseLine _line = new PURPurchaseLine();
                _line.ProductID = Convert.ToInt32(dgrd_OrderLines.Rows[i].Cells["ProductName"].Value);
                _line.TotalQty = Convert.ToDecimal(dgrd_OrderLines.Rows[i].Cells["TotalQty"].Value);
                _line.BonusQty = 0;
                _line.Unitprice = Convert.ToDecimal(dgrd_OrderLines.Rows[i].Cells["PurchasePrice"].Value);
                _line.DiscountRatio = 0;
                _line.DiscountAmount = 0;
                if ((bool)dgrd_OrderLines.Rows[i].Cells["IsAcceptBatch"].Value == true)
                {
                    _line.BatchNumber = dgrd_OrderLines.Rows[i].Cells["BatchNumber"].Value.ToString();
                    DateTime _expiryDate;
                    if (DateTime.TryParse(dgrd_OrderLines.Rows[i].Cells["ExpiryDate"].Value.ToString(), out _expiryDate))
                    {
                        _line.ExpiryDate = _expiryDate;
                        dgrd_OrderLines.Rows[i].Cells["ExpiryDate"].Style.BackColor = Color.White;
                    }
                    else
                    {
                        dgrd_OrderLines.Rows[i].Cells["ExpiryDate"].Style.BackColor = Color.Red;
                        return false;

                    }
                    _line.BatchQty = Convert.ToDecimal(dgrd_OrderLines.Rows[i].Cells["TotalQty"].Value);
                }

                pURPurchaseLineCollection.Add(_line);
            }
            if (CurrentHeaderID != 0 && CurrentHeaderID != null)
            {
                _pURPurchaseLinerWrapper.UpdatePurchaseOrder(CollectHeaderData(), pURPurchaseLineCollection);
            }
            else
            {
              CurrentHeaderID=  _pURPurchaseLinerWrapper.SavePURPurchaseOrder(CollectHeaderData(), pURPurchaseLineCollection);
            }
            return true;
        }
Esempio n. 7
0
        private PURPurchaseLine CollectScreenData()
        {
            pURPurchaseLine = new PURPurchaseLine();
            pURPurchaseLine.DiscountAmount = 0;//(decimal)((float.Parse(tbx_Discount.Text.Trim(new char[] { '%' })) / 100) * float.Parse(tbx_Price.Text));
            pURPurchaseLine.DiscountRatio = 0;//Convert.ToDecimal(float.Parse(tbx_Discount.Text.Trim(new char[] { '%' })) / 100);
            pURPurchaseLine.ProductID = Convert.ToInt32(cbx_Product.SelectedValue);
            pURPurchaseLine.ProductName = cbx_Product.Text;
            pURPurchaseLine.BonusQty = 0;
            pURPurchaseLine.TotalQty = Convert.ToInt32(num_Quantity.Text);
            pURPurchaseLine.Unitprice = Convert.ToDecimal(tbx_Price.Text);
            pURPurchaseLine.CreatedBy = GlobalVariables.CurrentUser.UserID;

            return pURPurchaseLine;
        }