/// <summary>
        /// This method will insert one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="sALSalesReturnLine" type="SALSalesReturnLine">This SALSalesReturnLine  will be inserted in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Insert(SALSalesReturnLine sALSalesReturnLine)
        {
            _sALSalesReturnLine = new POS.DataLayer.SALSalesReturnLine();
            _sALSalesReturnLine.SalesReturnLineID = sALSalesReturnLine.SalesReturnLineID;
            _sALSalesReturnLine.Qty    = sALSalesReturnLine.Qty;
            _sALSalesReturnLine.Reason = sALSalesReturnLine.Reason;
            _sALSalesReturnLine.OriginalSalesLineID = sALSalesReturnLine.OriginalSalesLineID;
            _sALSalesReturnLine.BatchID             = sALSalesReturnLine.BatchID;
            _sALSalesReturnLine.BatchNumber         = sALSalesReturnLine.BatchNumber;
            _sALSalesReturnLine.ExpiryDate          = sALSalesReturnLine.ExpiryDate;

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

            _sALSalesReturnLine.Qty    = sALSalesReturnLine.Qty;
            _sALSalesReturnLine.Reason = sALSalesReturnLine.Reason;
            _sALSalesReturnLine.OriginalSalesLineID = sALSalesReturnLine.OriginalSalesLineID;
            _sALSalesReturnLine.BatchID             = sALSalesReturnLine.BatchID;
            _sALSalesReturnLine.BatchNumber         = sALSalesReturnLine.BatchNumber;
            _sALSalesReturnLine.ExpiryDate          = sALSalesReturnLine.ExpiryDate;

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

            _sALSalesReturnLineWCF.SalesReturnLineID = _sALSalesReturnLine.SalesReturnLineID;
            _sALSalesReturnLineWCF.Qty    = _sALSalesReturnLine.Qty;
            _sALSalesReturnLineWCF.Reason = _sALSalesReturnLine.Reason;
            _sALSalesReturnLineWCF.OriginalSalesLineID = _sALSalesReturnLine.OriginalSalesLineID;
            _sALSalesReturnLineWCF.BatchID             = _sALSalesReturnLine.BatchID;
            _sALSalesReturnLineWCF.BatchNumber         = _sALSalesReturnLine.BatchNumber;
            _sALSalesReturnLineWCF.ExpiryDate          = _sALSalesReturnLine.ExpiryDate;

            return(_sALSalesReturnLineWCF);
        }
        /// <summary>
        /// This method will return a list of objects representing all records in the table.
        /// </summary>
        ///
        /// <returns>list of objects of class SALSalesReturnLine in the form of object of SALSalesReturnLineCollection </returns>
        public SALSalesReturnLineCollection SelectAll()
        {
            SALSalesReturnLineCollection sALSalesReturnLineCollection = new SALSalesReturnLineCollection();

            foreach (POS.DataLayer.SALSalesReturnLine _sALSalesReturnLine in POS.DataLayer.SALSalesReturnLineBase.SelectAll())
            {
                _sALSalesReturnLineWCF = new SALSalesReturnLine();

                _sALSalesReturnLineWCF.SalesReturnLineID = _sALSalesReturnLine.SalesReturnLineID;
                _sALSalesReturnLineWCF.Qty    = _sALSalesReturnLine.Qty;
                _sALSalesReturnLineWCF.Reason = _sALSalesReturnLine.Reason;
                _sALSalesReturnLineWCF.OriginalSalesLineID = _sALSalesReturnLine.OriginalSalesLineID;
                _sALSalesReturnLineWCF.BatchID             = _sALSalesReturnLine.BatchID;
                _sALSalesReturnLineWCF.BatchNumber         = _sALSalesReturnLine.BatchNumber;
                _sALSalesReturnLineWCF.ExpiryDate          = _sALSalesReturnLine.ExpiryDate;

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

            foreach (POS.DataLayer.SALSalesReturnLine _sALSalesReturnLine in POS.DataLayer.SALSalesReturnLineBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
            {
                _sALSalesReturnLineWCF = new SALSalesReturnLine();

                _sALSalesReturnLineWCF.SalesReturnLineID = _sALSalesReturnLine.SalesReturnLineID;
                _sALSalesReturnLineWCF.Qty    = _sALSalesReturnLine.Qty;
                _sALSalesReturnLineWCF.Reason = _sALSalesReturnLine.Reason;
                _sALSalesReturnLineWCF.OriginalSalesLineID = _sALSalesReturnLine.OriginalSalesLineID;
                _sALSalesReturnLineWCF.BatchID             = _sALSalesReturnLine.BatchID;
                _sALSalesReturnLineWCF.BatchNumber         = _sALSalesReturnLine.BatchNumber;
                _sALSalesReturnLineWCF.ExpiryDate          = _sALSalesReturnLine.ExpiryDate;

                sALSalesReturnLineCollection.Add(_sALSalesReturnLineWCF);
            }
            return(sALSalesReturnLineCollection);
        }
        /// <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 SALSalesReturnLine in the form of an object of class SALSalesReturnLineCollection </returns>
        public SALSalesReturnLineCollection SelectAllPaged(int?pageSize, int?skipPages, string orderByStatement)
        {
            SALSalesReturnLineCollection sALSalesReturnLineCollection = new SALSalesReturnLineCollection();

            foreach (POS.DataLayer.SALSalesReturnLine _sALSalesReturnLine in POS.DataLayer.SALSalesReturnLineBase.SelectAllPaged(pageSize, skipPages, orderByStatement))
            {
                _sALSalesReturnLineWCF = new SALSalesReturnLine();

                _sALSalesReturnLineWCF.SalesReturnLineID = _sALSalesReturnLine.SalesReturnLineID;
                _sALSalesReturnLineWCF.Qty    = _sALSalesReturnLine.Qty;
                _sALSalesReturnLineWCF.Reason = _sALSalesReturnLine.Reason;
                _sALSalesReturnLineWCF.OriginalSalesLineID = _sALSalesReturnLine.OriginalSalesLineID;
                _sALSalesReturnLineWCF.BatchID             = _sALSalesReturnLine.BatchID;
                _sALSalesReturnLineWCF.BatchNumber         = _sALSalesReturnLine.BatchNumber;
                _sALSalesReturnLineWCF.ExpiryDate          = _sALSalesReturnLine.ExpiryDate;

                sALSalesReturnLineCollection.Add(_sALSalesReturnLineWCF);
            }
            return(sALSalesReturnLineCollection);
        }
Ejemplo n.º 7
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="SALSalesReturnHeaderPrimaryKey">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 SALSalesReturnLineCollection</returns>
        public SALSalesReturnLineCollection SelectAllByForeignKeySalesReturnHeaderIDPaged(SALSalesReturnHeaderPrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
        {
            SALSalesReturnLineCollection sALSalesReturnLineCollection = new SALSalesReturnLineCollection();

            foreach (POS.DataLayer.SALSalesReturnLine _sALSalesReturnLine in POS.DataLayer.SALSalesReturnLineBase.SelectAllByForeignKeySalesReturnHeaderIDPaged(new POS.DataLayer.SALSalesReturnHeaderPrimaryKey(pk.SlaesReturnHeaderID), pageSize, skipPages, orderByStatement))
            {
                _sALSalesReturnLineWCF = new SALSalesReturnLine();
                _sALSalesReturnLineWCF.SalesReturnLineID = _sALSalesReturnLine.SalesReturnLineID;
                _sALSalesReturnLineWCF.Qty    = _sALSalesReturnLine.Qty;
                _sALSalesReturnLineWCF.Reason = _sALSalesReturnLine.Reason;
                _sALSalesReturnLineWCF.OriginalSalesLineID = _sALSalesReturnLine.OriginalSalesLineID;
                _sALSalesReturnLineWCF.BatchID             = _sALSalesReturnLine.BatchID;
                _sALSalesReturnLineWCF.BatchNumber         = _sALSalesReturnLine.BatchNumber;
                _sALSalesReturnLineWCF.ExpiryDate          = _sALSalesReturnLine.ExpiryDate;
                _sALSalesReturnLineWCF.SalesReturnHeaderID = _sALSalesReturnLine.SalesReturnHeaderID;

                sALSalesReturnLineCollection.Add(_sALSalesReturnLineWCF);
            }
            return(sALSalesReturnLineCollection);
        }
Ejemplo n.º 8
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="SALSalesReturnHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class SALSalesReturnLineCollection</returns>
        public SALSalesReturnLineCollection SelectAllByForeignKeySalesReturnHeaderID(SALSalesReturnHeaderPrimaryKey pk)
        {
            SALSalesReturnLineCollection sALSalesReturnLineCollection = new SALSalesReturnLineCollection();

            foreach (POS.DataLayer.SALSalesReturnLine _sALSalesReturnLine in POS.DataLayer.SALSalesReturnLineBase.SelectAllByForeignKeySalesReturnHeaderID(new POS.DataLayer.SALSalesReturnHeaderPrimaryKey(pk.SlaesReturnHeaderID)))
            {
                _sALSalesReturnLineWCF = new SALSalesReturnLine();
                _sALSalesReturnLineWCF.SalesReturnLineID = _sALSalesReturnLine.SalesReturnLineID;
                _sALSalesReturnLineWCF.Qty    = _sALSalesReturnLine.Qty;
                _sALSalesReturnLineWCF.Reason = _sALSalesReturnLine.Reason;
                _sALSalesReturnLineWCF.OriginalSalesLineID = _sALSalesReturnLine.OriginalSalesLineID;
                _sALSalesReturnLineWCF.BatchID             = _sALSalesReturnLine.BatchID;
                _sALSalesReturnLineWCF.BatchNumber         = _sALSalesReturnLine.BatchNumber;
                _sALSalesReturnLineWCF.ExpiryDate          = _sALSalesReturnLine.ExpiryDate;
                _sALSalesReturnLineWCF.SalesReturnHeaderID = _sALSalesReturnLine.SalesReturnHeaderID;

                sALSalesReturnLineCollection.Add(_sALSalesReturnLineWCF);
            }
            return(sALSalesReturnLineCollection);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// This method will get row(s) from the database using the value of the field specified
        /// </summary>
        ///
        /// <param name="field" type="string">Field of the class SALSalesReturnLine</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>
        ///
        /// <returns>List of object of class SALSalesReturnLine in the form of an object of class SALSalesReturnLineCollection</returns>
        public SALSalesReturnLineCollection SelectByField(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation)
        {
            SALSalesReturnLineCollection sALSalesReturnLineCollection = new SALSalesReturnLineCollection();

            foreach (POS.DataLayer.SALSalesReturnLine _sALSalesReturnLine in POS.DataLayer.SALSalesReturnLineBase.SelectByField(field, fieldValue, fieldValue2, typeOperation))
            {
                _sALSalesReturnLineWCF = new SALSalesReturnLine();

                _sALSalesReturnLineWCF.SalesReturnLineID = _sALSalesReturnLine.SalesReturnLineID;
                _sALSalesReturnLineWCF.Qty    = _sALSalesReturnLine.Qty;
                _sALSalesReturnLineWCF.Reason = _sALSalesReturnLine.Reason;
                _sALSalesReturnLineWCF.OriginalSalesLineID = _sALSalesReturnLine.OriginalSalesLineID;
                _sALSalesReturnLineWCF.BatchID             = _sALSalesReturnLine.BatchID;
                _sALSalesReturnLineWCF.BatchNumber         = _sALSalesReturnLine.BatchNumber;
                _sALSalesReturnLineWCF.ExpiryDate          = _sALSalesReturnLine.ExpiryDate;
                _sALSalesReturnLineWCF.SalesReturnHeaderID = _sALSalesReturnLine.SalesReturnHeaderID;

                sALSalesReturnLineCollection.Add(_sALSalesReturnLineWCF);
            }
            return(sALSalesReturnLineCollection);
        }
Ejemplo n.º 10
0
        private void CollectLinesData()
        {
            SALSalesReturnLine _sALSalesReturnLine;
            sALSalesReturnLineCollection.Clear();
            foreach (DataGridViewRow row in dgrd_ReturnOrderLines.Rows)
            {
                if (row.Index == dgrd_ReturnOrderLines.Rows.Count - 1)
                    break;

                VSALSalesOrder vSALSalesOrder = vSALSalesOrderCollection.Where(a => a.ProductID == Convert.ToInt32(row.Cells["ProductName"].Value)).SingleOrDefault();
                if (vSALSalesOrder != null)
                {
                    _sALSalesReturnLine = new SALSalesReturnLine();
                    _sALSalesReturnLine.OriginalSalesLineID = vSALSalesOrder.SalesLineID;
                    _sALSalesReturnLine.Qty = Convert.ToDecimal(row.Cells["TotalQty"].Value);
                    _sALSalesReturnLine.BatchNumber = vSALSalesOrder.IsAcceptBatch == true ? row.Cells["BatchNumber"].Value.ToString() : null;
                    _sALSalesReturnLine.ExpiryDate = vSALSalesOrder.IsAcceptBatch == true ? Convert.ToDateTime(row.Cells["ExpiryDate"].Value) : (DateTime?)null;
                    _sALSalesReturnLine.Reason = row.Cells["Reason"].Value != null ? row.Cells["Reason"].Value.ToString() : null;
                    _sALSalesReturnLine.StockTypeID = Convert.ToInt32(row.Cells["StockType"].Value);
                    sALSalesReturnLineCollection.Add(_sALSalesReturnLine);
                }
                //sALSalesReturnLineCollection.Add(new SALSalesReturnLine()
                //                      {
                //                          OriginalSalesLineID = vSALSalesOrder.SalesLineID,
                //                          Qty = Convert.ToDecimal(row.Cells["TotalQty"].Value),
                //                          BatchNumber = vSALSalesOrder.IsAcceptBatch == true ? row.Cells["BatchNumber"].Value.ToString() : null,
                //                          ExpiryDate = vSALSalesOrder.IsAcceptBatch == true ? Convert.ToDateTime(row.Cells["ExpiryDate"].Value) : (DateTime?)null,
                //                          Reason = row.Cells["Reason"].Value.ToString(),

                //                      });

                else
                {
                    MessageBox.Show("لقد قمت باختيار اصناف غير موجوده بالفاتورة الأصلية");
                    row.Cells["ProductName"].Style.BackColor = Color.Red;
                    return;
                }
            }
        }