Esempio n. 1
0
        private void CollectLinesData()
        {
            pURPurchaseReturnLineCollection.Clear();
            foreach (DataGridViewRow row in dgrd_ReturnOrderLines.Rows)
            {
                if (row.Cells["ProductName"].Value == null || row.Cells["IsAcceptBatch"].Value == null)
                {
                    return;
                }
                VPURPurchaseOrder vPURPurchaseOrder;
                if ((bool)row.Cells["IsAcceptBatch"].Value == true)
                {
                    vPURPurchaseOrder = vPURPurchaseOrderCollection.Where(a => a.ProductID == Convert.ToInt32(row.Cells["ProductName"].Value) &&
                                                                          a.BatchNumber == row.Cells["BatchNumber"].Value).SingleOrDefault();
                }
                else
                {
                    vPURPurchaseOrder = vPURPurchaseOrderCollection.Where(a => a.ProductID == Convert.ToInt32(row.Cells["ProductName"].Value)).SingleOrDefault();
                }


                if (vPURPurchaseOrder != null)
                {
                    PURPurchaseReturnLine line = new PURPurchaseReturnLine();
                    line.OriginalpurchaseLineID = vPURPurchaseOrder.PurchaseLineID;
                    if (row.Cells["returnedQty"].Value != null)
                    {
                        line.Qty = Convert.ToDecimal(row.Cells["returnedQty"].Value);
                    }
                    else
                    {
                        return;
                    }

                    line.BatchNumber = vPURPurchaseOrder.IsAcceptBatch == true ? row.Cells["BatchNumber"].Value.ToString() : null;
                    line.ExpiryDate  = vPURPurchaseOrder.IsAcceptBatch == true?Convert.ToDateTime(row.Cells["ExpiryDate"].Value) : (DateTime?)null;

                    line.Reason = row.Cells["Reason"].Value != null?row.Cells["Reason"].Value.ToString():"";
                    pURPurchaseReturnLineCollection.Add(line);
                }

                else
                {
                    MessageBox.Show("لقد قمت باختيار اصناف غير موجوده بالفاتورة الأصلية");
                    row.Cells["ProductName"].Style.BackColor = Color.Red;
                    return;
                }
            }
        }
        /// <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="PURPurchaseLinePrimaryKey">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 PURPurchaseReturnLineCollection</returns>
        public PURPurchaseReturnLineCollection SelectAllByForeignKeyOriginalpurchaseLineIDPaged(PURPurchaseLinePrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
        {
            PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();

            foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectAllByForeignKeyOriginalpurchaseLineIDPaged(new POS.DataLayer.PURPurchaseLinePrimaryKey(pk.PurchaseLineID), pageSize, skipPages, orderByStatement))
            {
                _pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();
                _pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
                _pURPurchaseReturnLineWCF.Qty    = _pURPurchaseReturnLine.Qty;
                _pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
                _pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
                _pURPurchaseReturnLineWCF.BatchID     = _pURPurchaseReturnLine.BatchID;
                _pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
                _pURPurchaseReturnLineWCF.ExpiryDate  = _pURPurchaseReturnLine.ExpiryDate;

                pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
            }
            return(pURPurchaseReturnLineCollection);
        }
        /// <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="PURPurchaseLinePrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class PURPurchaseReturnLineCollection</returns>
        public PURPurchaseReturnLineCollection SelectAllByForeignKeyOriginalpurchaseLineID(PURPurchaseLinePrimaryKey pk)
        {
            PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();

            foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectAllByForeignKeyOriginalpurchaseLineID(new POS.DataLayer.PURPurchaseLinePrimaryKey(pk.PurchaseLineID)))
            {
                _pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();
                _pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
                _pURPurchaseReturnLineWCF.Qty    = _pURPurchaseReturnLine.Qty;
                _pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
                _pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
                _pURPurchaseReturnLineWCF.BatchID     = _pURPurchaseReturnLine.BatchID;
                _pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
                _pURPurchaseReturnLineWCF.ExpiryDate  = _pURPurchaseReturnLine.ExpiryDate;

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

            foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
            {
                _pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();

                _pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
                _pURPurchaseReturnLineWCF.Qty    = _pURPurchaseReturnLine.Qty;
                _pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
                _pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
                _pURPurchaseReturnLineWCF.BatchID     = _pURPurchaseReturnLine.BatchID;
                _pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
                _pURPurchaseReturnLineWCF.ExpiryDate  = _pURPurchaseReturnLine.ExpiryDate;

                pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
            }
            return(pURPurchaseReturnLineCollection);
        }
Esempio n. 5
0
        /// <summary>
        /// This method will return a list of objects representing all records in the table.
        /// </summary>
        ///
        /// <returns>list of objects of class PURPurchaseReturnLine in the form of object of PURPurchaseReturnLineCollection </returns>
        public PURPurchaseReturnLineCollection SelectAll()
        {
            PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();

            foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectAll())
            {
                _pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();

                _pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
                _pURPurchaseReturnLineWCF.Qty    = _pURPurchaseReturnLine.Qty;
                _pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
                _pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
                _pURPurchaseReturnLineWCF.BatchID                = _pURPurchaseReturnLine.BatchID;
                _pURPurchaseReturnLineWCF.BatchNumber            = _pURPurchaseReturnLine.BatchNumber;
                _pURPurchaseReturnLineWCF.ExpiryDate             = _pURPurchaseReturnLine.ExpiryDate;
                _pURPurchaseReturnLineWCF.PurchaseReturnHeaderID = _pURPurchaseReturnLine.PurchaseReturnHeaderID;

                pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
            }
            return(pURPurchaseReturnLineCollection);
        }
Esempio n. 6
0
        /// <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 PURPurchaseReturnLine in the form of an object of class PURPurchaseReturnLineCollection </returns>
        public PURPurchaseReturnLineCollection SelectAllPaged(int?pageSize, int?skipPages, string orderByStatement)
        {
            PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();

            foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectAllPaged(pageSize, skipPages, orderByStatement))
            {
                _pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();

                _pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
                _pURPurchaseReturnLineWCF.Qty    = _pURPurchaseReturnLine.Qty;
                _pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
                _pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
                _pURPurchaseReturnLineWCF.BatchID                = _pURPurchaseReturnLine.BatchID;
                _pURPurchaseReturnLineWCF.BatchNumber            = _pURPurchaseReturnLine.BatchNumber;
                _pURPurchaseReturnLineWCF.ExpiryDate             = _pURPurchaseReturnLine.ExpiryDate;
                _pURPurchaseReturnLineWCF.PurchaseReturnHeaderID = _pURPurchaseReturnLine.PurchaseReturnHeaderID;

                pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
            }
            return(pURPurchaseReturnLineCollection);
        }
Esempio n. 7
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 PURPurchaseReturnLine</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 PURPurchaseReturnLine in the form of an object of class PURPurchaseReturnLineCollection</returns>
        public PURPurchaseReturnLineCollection SelectByField(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation)
        {
            PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();

            foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectByField(field, fieldValue, fieldValue2, typeOperation))
            {
                _pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();

                _pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
                _pURPurchaseReturnLineWCF.Qty    = _pURPurchaseReturnLine.Qty;
                _pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
                _pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
                _pURPurchaseReturnLineWCF.BatchID                = _pURPurchaseReturnLine.BatchID;
                _pURPurchaseReturnLineWCF.BatchNumber            = _pURPurchaseReturnLine.BatchNumber;
                _pURPurchaseReturnLineWCF.ExpiryDate             = _pURPurchaseReturnLine.ExpiryDate;
                _pURPurchaseReturnLineWCF.PurchaseReturnHeaderID = _pURPurchaseReturnLine.PurchaseReturnHeaderID;

                pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
            }
            return(pURPurchaseReturnLineCollection);
        }
		/// <summary>
		/// This method will return a list of objects representing all records in the table.
		/// </summary>
		///
		/// <returns>list of objects of class PURPurchaseReturnLine in the form of object of PURPurchaseReturnLineCollection </returns>
		public PURPurchaseReturnLineCollection SelectAll()
		{
			PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();
			foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectAll())
			{
				_pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();
				
				_pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
				_pURPurchaseReturnLineWCF.Qty = _pURPurchaseReturnLine.Qty;
				_pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
				_pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
				_pURPurchaseReturnLineWCF.BatchID = _pURPurchaseReturnLine.BatchID;
				_pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
				_pURPurchaseReturnLineWCF.ExpiryDate = _pURPurchaseReturnLine.ExpiryDate;
				_pURPurchaseReturnLineWCF.PurchaseReturnHeaderID = _pURPurchaseReturnLine.PurchaseReturnHeaderID;
				
				pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
			}
			return pURPurchaseReturnLineCollection;
		}
		/// <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 PURPurchaseReturnLine</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 PURPurchaseReturnLine in the form of an object of class PURPurchaseReturnLineCollection</returns>
		public PURPurchaseReturnLineCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
		{
			PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();
			foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
			{
				_pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();
				
				_pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
				_pURPurchaseReturnLineWCF.Qty = _pURPurchaseReturnLine.Qty;
				_pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
				_pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
				_pURPurchaseReturnLineWCF.BatchID = _pURPurchaseReturnLine.BatchID;
				_pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
				_pURPurchaseReturnLineWCF.ExpiryDate = _pURPurchaseReturnLine.ExpiryDate;
				_pURPurchaseReturnLineWCF.PurchaseReturnHeaderID = _pURPurchaseReturnLine.PurchaseReturnHeaderID;
				
				pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
			}
			return pURPurchaseReturnLineCollection;
		}
		/// <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 PURPurchaseReturnLine in the form of an object of class PURPurchaseReturnLineCollection </returns>
		public PURPurchaseReturnLineCollection SelectAllPaged(int? pageSize, int? skipPages, string orderByStatement)
		{
			PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();
			foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectAllPaged(pageSize, skipPages, orderByStatement))
			{
				_pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();
				
				_pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
				_pURPurchaseReturnLineWCF.Qty = _pURPurchaseReturnLine.Qty;
				_pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
				_pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
				_pURPurchaseReturnLineWCF.BatchID = _pURPurchaseReturnLine.BatchID;
				_pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
				_pURPurchaseReturnLineWCF.ExpiryDate = _pURPurchaseReturnLine.ExpiryDate;
				_pURPurchaseReturnLineWCF.PurchaseReturnHeaderID = _pURPurchaseReturnLine.PurchaseReturnHeaderID;
				
				pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
			}
			return pURPurchaseReturnLineCollection;
		}
Esempio n. 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 PURPurchaseReturnLineCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			11/4/2015 8:46:46 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static PURPurchaseReturnLineCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) 
		{

			PURPurchaseReturnLineCollection list = new PURPurchaseReturnLineCollection();
			
            if (rdr.Read())
			{
				PURPurchaseReturnLine obj = new PURPurchaseReturnLine();
				PopulateObjectFromReader(obj, rdr);
				list.Add(obj);
				while (rdr.Read())
				{
					obj = new PURPurchaseReturnLine();
					PopulateObjectFromReader(obj, rdr);
					list.Add(obj);
				}
				oDatabaseHelper.Dispose();
				return list;
			}
			else
			{
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
Esempio n. 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 PURPurchaseReturnLineCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			11/4/2015 8:46:46 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static PURPurchaseReturnLineCollection PopulateObjectsFromReader(IDataReader rdr) 
		{
			PURPurchaseReturnLineCollection list = new PURPurchaseReturnLineCollection();
			
			while (rdr.Read())
			{
				PURPurchaseReturnLine obj = new PURPurchaseReturnLine();
				PopulateObjectFromReader(obj,rdr);
				list.Add(obj);
			}
			return list;
			
		}