private void FillScreenData() { //if (vPURPurchaseOrderCollection.Count ()>1) //{ // //List <PURPurchaseHeader> purchaseHader = new // frmSelectSinglePurchaseOrder frm = new frmSelectSinglePurchaseOrder(vPURPurchaseOrderCollection.Select( // p => new PURPurchaseHeaderCollection() {p.PurcaseHeaderID} // )); // // frm. // frm.ShowDialog(); //} _vPURPurchaseOrder = vPURPurchaseOrderCollection.FirstOrDefault(); tbx_CustomerName.Text = _vPURPurchaseOrder.SupplierName; tbxPurchaseMan.Text = _vPURPurchaseOrder.UserFullName; dtb_InvoiceDate.Value = (DateTime)_vPURPurchaseOrder.InvoiceDate; dtb_PurchaseDate.Value = (DateTime)_vPURPurchaseOrder.PurchaseDate; invoiceDescount = (double)_vPURPurchaseOrder.TotalDiscountRatio; if (_vPURPurchaseOrder.TaxValue != null) { invoiceTax = (double)_vPURPurchaseOrder.TaxValue; } }
/// <summary> /// This method will Delete row(s) from the database using the value of the field specified /// </summary> /// /// <param name="field" type="VPURPurchaseOrderFields">Field of the class VPURPurchaseOrder</param> /// <param name="fieldValue" type="object">Value for the field specified.</param> /// <returns>True if succeeded</returns> //public bool DeleteByField(string field, object fieldValue) //{ // //return POS.DataLayer.VPURPurchaseOrderBase.DeleteByField(field, fieldValue); //} ///<summary> ///This method will Delete the object from the database ///</summary> ///<param name="pk" type="VPURPurchaseOrderPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// <returns>True if succeeded</returns> //public bool Delete(VPURPurchaseOrderPrimaryKey pk) //{ // return POS.DataLayer.VPURPurchaseOrderBase.Delete(new POS.DataLayer.VPURPurchaseOrderPrimaryKey(pk.SupplierID, pk.PurchaseLineID, pk.PurcaseHeaderID, pk.ProductID)); //} /// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="VPURPurchaseOrderPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class VPURPurchaseOrder</returns> public VPURPurchaseOrder SelectOne(VPURPurchaseOrderPrimaryKey pk) { _vPURPurchaseOrderWCF = new VPURPurchaseOrder(); _vPURPurchaseOrder = POS.DataLayer.VPURPurchaseOrderBase.SelectOne(new POS.DataLayer.VPURPurchaseOrderPrimaryKey(pk.SupplierID, pk.PurchaseLineID, pk.PurcaseHeaderID, pk.ProductID)); _vPURPurchaseOrderWCF.SupplierID = _vPURPurchaseOrder.SupplierID; _vPURPurchaseOrderWCF.SupplierName = _vPURPurchaseOrder.SupplierName; _vPURPurchaseOrderWCF.Qty = _vPURPurchaseOrder.Qty; _vPURPurchaseOrderWCF.PurchaseLineID = _vPURPurchaseOrder.PurchaseLineID; _vPURPurchaseOrderWCF.TotalQty = _vPURPurchaseOrder.TotalQty; _vPURPurchaseOrderWCF.UnitPrice = _vPURPurchaseOrder.UnitPrice; _vPURPurchaseOrderWCF.BatchNumber = _vPURPurchaseOrder.BatchNumber; _vPURPurchaseOrderWCF.ExpiryDate = _vPURPurchaseOrder.ExpiryDate; _vPURPurchaseOrderWCF.TaxValue = _vPURPurchaseOrder.TaxValue; _vPURPurchaseOrderWCF.PurcaseHeaderID = _vPURPurchaseOrder.PurcaseHeaderID; _vPURPurchaseOrderWCF.PurchaseDate = _vPURPurchaseOrder.PurchaseDate; _vPURPurchaseOrderWCF.InvoiceNumber = _vPURPurchaseOrder.InvoiceNumber; _vPURPurchaseOrderWCF.InvoiceDate = _vPURPurchaseOrder.InvoiceDate; _vPURPurchaseOrderWCF.PaymentTypeID = _vPURPurchaseOrder.PaymentTypeID; _vPURPurchaseOrderWCF.TotalDiscountRatio = _vPURPurchaseOrder.TotalDiscountRatio; _vPURPurchaseOrderWCF.TaxTypeName = _vPURPurchaseOrder.TaxTypeName; _vPURPurchaseOrderWCF.IsClosed = _vPURPurchaseOrder.IsClosed; _vPURPurchaseOrderWCF.IsVoid = _vPURPurchaseOrder.IsVoid; _vPURPurchaseOrderWCF.ChequeNumber = _vPURPurchaseOrder.ChequeNumber; _vPURPurchaseOrderWCF.ProductName = _vPURPurchaseOrder.ProductName; _vPURPurchaseOrderWCF.ProductCode = _vPURPurchaseOrder.ProductCode; _vPURPurchaseOrderWCF.IsAcceptBatch = _vPURPurchaseOrder.IsAcceptBatch; _vPURPurchaseOrderWCF.UserFullName = _vPURPurchaseOrder.UserFullName; _vPURPurchaseOrderWCF.ProductID = _vPURPurchaseOrder.ProductID; return(_vPURPurchaseOrderWCF); }
private void dgrd_ReturnOrderLines_CellValueChanged(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; //if column = product name if (e.RowIndex != -1 && e.ColumnIndex == senderGrid.Columns["ProductName"].Index) { List <VPURPurchaseOrder> vPURPurchaseOrder = vPURPurchaseOrderCollection.Where(a => a.ProductID == Convert.ToInt32(senderGrid.Rows[e.RowIndex].Cells["ProductName"].Value)).ToList(); if (vPURPurchaseOrder.Count == 0) { MessageBox.Show("هذا الصنف غير موجود بالفاتورة الاصليه"); senderGrid.Rows[e.RowIndex].ErrorText = "هذا الصنف غير موجود بالفاتورة الاصليه"; senderGrid.Rows[e.RowIndex].Cells["ProductName"].Style.BackColor = Color.Red; return; } else { ((DataGridViewComboBoxCell)senderGrid.Rows[e.RowIndex].Cells["BatchNumber"]).DataSource = vPURPurchaseOrder; ((DataGridViewComboBoxCell)senderGrid.Rows[e.RowIndex].Cells["BatchNumber"]).ValueMember = "BatchNumber"; ((DataGridViewComboBoxCell)senderGrid.Rows[e.RowIndex].Cells["BatchNumber"]).DisplayMember = "BatchNumber"; //senderGrid.Rows[e.RowIndex].Cells["SaledQty"].Value = vPURPurchaseOrder.TotalQty; senderGrid.Rows[e.RowIndex].Cells["IsAcceptBatch"].Value = vPURPurchaseOrder.First().IsAcceptBatch; senderGrid.Rows[e.RowIndex].Cells["UnitPrice"].Value = vPURPurchaseOrder.First().UnitPrice; senderGrid.Rows[e.RowIndex].Cells["BatchNumber"].ReadOnly = !(bool)vPURPurchaseOrder.First().IsAcceptBatch; senderGrid.Rows[e.RowIndex].Cells["ExpiryDate"].ReadOnly = !(bool)vPURPurchaseOrder.First().IsAcceptBatch; if (vPURPurchaseOrder.First().IsAcceptBatch == false) { senderGrid.Rows[e.RowIndex].Cells["SaledQty"].Value = vPURPurchaseOrder.First().TotalQty; } } } //if column = BatchNumber if (e.RowIndex != -1 && e.ColumnIndex == senderGrid.Columns["BatchNumber"].Index) { VPURPurchaseOrder vPURPurchaseOrder = vPURPurchaseOrderCollection.Where(a => a.ProductID == Convert.ToInt32(senderGrid.Rows[e.RowIndex].Cells["ProductName"].Value) && a.BatchNumber == senderGrid.Rows[e.RowIndex].Cells["BatchNumber"].Value.ToString()).FirstOrDefault(); if (vPURPurchaseOrder == null) { MessageBox.Show("هذا الصنف غير موجود بالفاتورة الاصليه"); senderGrid.Rows[e.RowIndex].ErrorText = "هذا الصنف غير موجود بالفاتورة الاصليه"; senderGrid.Rows[e.RowIndex].Cells["ProductName"].Style.BackColor = Color.Red; return; } else { senderGrid.Rows[e.RowIndex].Cells["SaledQty"].Value = vPURPurchaseOrder.Qty != null ? vPURPurchaseOrder.Qty : vPURPurchaseOrder.TotalQty; senderGrid.Rows[e.RowIndex].Cells["ExpiryDate"].Value = vPURPurchaseOrder.ExpiryDate.Value.Date; // senderGrid.Rows[e.RowIndex].Cells["IsAcceptBatch"].Value = vPURPurchaseOrder.IsAcceptBatch; } } if (e.RowIndex != -1 && (e.ColumnIndex == senderGrid.Columns["ReturnedQty"].Index || e.ColumnIndex == senderGrid.Columns["UnitPrice"].Index)) { CalculateTotal(); } }
/// <summary> /// This method will return a list of objects representing all records in the table. /// </summary> /// /// <returns>list of objects of class VPURPurchaseOrder in the form of object of VPURPurchaseOrderCollection </returns> public VPURPurchaseOrderCollection SelectAll() { VPURPurchaseOrderCollection vPURPurchaseOrderCollection = new VPURPurchaseOrderCollection(); foreach (POS.DataLayer.VPURPurchaseOrder _vPURPurchaseOrder in POS.DataLayer.VPURPurchaseOrderBase.SelectAll()) { _vPURPurchaseOrderWCF = new VPURPurchaseOrder(); _vPURPurchaseOrderWCF.SupplierID = _vPURPurchaseOrder.SupplierID; _vPURPurchaseOrderWCF.SupplierName = _vPURPurchaseOrder.SupplierName; _vPURPurchaseOrderWCF.Qty = _vPURPurchaseOrder.Qty; _vPURPurchaseOrderWCF.PurchaseLineID = _vPURPurchaseOrder.PurchaseLineID; _vPURPurchaseOrderWCF.TotalQty = _vPURPurchaseOrder.TotalQty; _vPURPurchaseOrderWCF.UnitPrice = _vPURPurchaseOrder.UnitPrice; _vPURPurchaseOrderWCF.BatchNumber = _vPURPurchaseOrder.BatchNumber; _vPURPurchaseOrderWCF.ExpiryDate = _vPURPurchaseOrder.ExpiryDate; _vPURPurchaseOrderWCF.TaxValue = _vPURPurchaseOrder.TaxValue; _vPURPurchaseOrderWCF.PurcaseHeaderID = _vPURPurchaseOrder.PurcaseHeaderID; _vPURPurchaseOrderWCF.PurchaseDate = _vPURPurchaseOrder.PurchaseDate; _vPURPurchaseOrderWCF.InvoiceNumber = _vPURPurchaseOrder.InvoiceNumber; _vPURPurchaseOrderWCF.InvoiceDate = _vPURPurchaseOrder.InvoiceDate; _vPURPurchaseOrderWCF.PaymentTypeID = _vPURPurchaseOrder.PaymentTypeID; _vPURPurchaseOrderWCF.TotalDiscountRatio = _vPURPurchaseOrder.TotalDiscountRatio; _vPURPurchaseOrderWCF.TaxTypeName = _vPURPurchaseOrder.TaxTypeName; _vPURPurchaseOrderWCF.IsClosed = _vPURPurchaseOrder.IsClosed; _vPURPurchaseOrderWCF.IsVoid = _vPURPurchaseOrder.IsVoid; _vPURPurchaseOrderWCF.ChequeNumber = _vPURPurchaseOrder.ChequeNumber; _vPURPurchaseOrderWCF.ProductName = _vPURPurchaseOrder.ProductName; _vPURPurchaseOrderWCF.ProductCode = _vPURPurchaseOrder.ProductCode; _vPURPurchaseOrderWCF.IsAcceptBatch = _vPURPurchaseOrder.IsAcceptBatch; _vPURPurchaseOrderWCF.UserFullName = _vPURPurchaseOrder.UserFullName; _vPURPurchaseOrderWCF.ProductID = _vPURPurchaseOrder.ProductID; vPURPurchaseOrderCollection.Add(_vPURPurchaseOrderWCF); } return(vPURPurchaseOrderCollection); }
/// <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 VPURPurchaseOrder</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 VPURPurchaseOrder in the form of an object of class VPURPurchaseOrderCollection</returns> public VPURPurchaseOrderCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement) { VPURPurchaseOrderCollection vPURPurchaseOrderCollection = new VPURPurchaseOrderCollection(); foreach (POS.DataLayer.VPURPurchaseOrder _vPURPurchaseOrder in POS.DataLayer.VPURPurchaseOrderBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement)) { _vPURPurchaseOrderWCF = new VPURPurchaseOrder(); _vPURPurchaseOrderWCF.SupplierID = _vPURPurchaseOrder.SupplierID; _vPURPurchaseOrderWCF.SupplierName = _vPURPurchaseOrder.SupplierName; _vPURPurchaseOrderWCF.Qty = _vPURPurchaseOrder.Qty; _vPURPurchaseOrderWCF.PurchaseLineID = _vPURPurchaseOrder.PurchaseLineID; _vPURPurchaseOrderWCF.TotalQty = _vPURPurchaseOrder.TotalQty; _vPURPurchaseOrderWCF.UnitPrice = _vPURPurchaseOrder.UnitPrice; _vPURPurchaseOrderWCF.BatchNumber = _vPURPurchaseOrder.BatchNumber; _vPURPurchaseOrderWCF.ExpiryDate = _vPURPurchaseOrder.ExpiryDate; _vPURPurchaseOrderWCF.TaxValue = _vPURPurchaseOrder.TaxValue; _vPURPurchaseOrderWCF.PurcaseHeaderID = _vPURPurchaseOrder.PurcaseHeaderID; _vPURPurchaseOrderWCF.PurchaseDate = _vPURPurchaseOrder.PurchaseDate; _vPURPurchaseOrderWCF.InvoiceNumber = _vPURPurchaseOrder.InvoiceNumber; _vPURPurchaseOrderWCF.InvoiceDate = _vPURPurchaseOrder.InvoiceDate; _vPURPurchaseOrderWCF.PaymentTypeID = _vPURPurchaseOrder.PaymentTypeID; _vPURPurchaseOrderWCF.TotalDiscountRatio = _vPURPurchaseOrder.TotalDiscountRatio; _vPURPurchaseOrderWCF.TaxTypeName = _vPURPurchaseOrder.TaxTypeName; _vPURPurchaseOrderWCF.IsClosed = _vPURPurchaseOrder.IsClosed; _vPURPurchaseOrderWCF.IsVoid = _vPURPurchaseOrder.IsVoid; _vPURPurchaseOrderWCF.ChequeNumber = _vPURPurchaseOrder.ChequeNumber; _vPURPurchaseOrderWCF.ProductName = _vPURPurchaseOrder.ProductName; _vPURPurchaseOrderWCF.ProductCode = _vPURPurchaseOrder.ProductCode; _vPURPurchaseOrderWCF.IsAcceptBatch = _vPURPurchaseOrder.IsAcceptBatch; _vPURPurchaseOrderWCF.UserFullName = _vPURPurchaseOrder.UserFullName; _vPURPurchaseOrderWCF.ProductID = _vPURPurchaseOrder.ProductID; vPURPurchaseOrderCollection.Add(_vPURPurchaseOrderWCF); } return(vPURPurchaseOrderCollection); }
private void FillScreenData() { //if (vPURPurchaseOrderCollection.Count ()>1) //{ // //List <PURPurchaseHeader> purchaseHader = new // frmSelectSinglePurchaseOrder frm = new frmSelectSinglePurchaseOrder(vPURPurchaseOrderCollection.Select( // p => new PURPurchaseHeaderCollection() {p.PurcaseHeaderID} // )); // // frm. // frm.ShowDialog(); //} _vPURPurchaseOrder = vPURPurchaseOrderCollection.FirstOrDefault(); tbx_CustomerName.Text = _vPURPurchaseOrder.SupplierName; tbxPurchaseMan.Text = _vPURPurchaseOrder.UserFullName; dtb_InvoiceDate.Value = (DateTime)_vPURPurchaseOrder.InvoiceDate; dtb_PurchaseDate.Value = (DateTime)_vPURPurchaseOrder.PurchaseDate; invoiceDescount = (double)_vPURPurchaseOrder.TotalDiscountRatio; if (_vPURPurchaseOrder.TaxValue != null) invoiceTax = (double)_vPURPurchaseOrder.TaxValue; }