//constructor public ManagePurchaseOrderList() { //loading purchase list PurchaseManager purchaseManager = new PurchaseManager(); for (Iterator i = purchaseManager.getAllPurchaseOrders().iterator(); i.hasNext();) { PurchaseInfo purchaseInfo = (PurchaseInfo)i.next(); PurchaseInfoNJ purchaseInfoNJ = new PurchaseInfoNJ(); purchaseInfoNJ.OrderNo = purchaseInfo.getOrderNo(); purchaseInfoNJ.StatusId = purchaseInfo.getStatusId(); purchaseInfoNJ.Remarks = purchaseInfo.getRemarks(); for (Iterator j = purchaseInfo.getProductList().iterator(); j.hasNext();) { ProductInfo productInfo = (ProductInfo)j.next(); ProductInfoNJ productInfoNJ = new ProductInfoNJ(); productInfoNJ.Id = productInfo.getId(); productInfoNJ.Name = productInfo.getName(); productInfoNJ.Code = productInfo.getCode(); productInfoNJ.UnitPrice = productInfo.getUnitPrice(); productInfoNJ.Quantity = productInfo.getQuantity(); purchaseInfoNJ.ProductList.Add(productInfoNJ); } SupplierInfo supplierInfo = new SupplierInfo(); SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ(); supplierInfoNJ.ProfileInfoNJ.Id = purchaseInfo.getSupplierInfo().getProfileInfo().getId(); supplierInfoNJ.ProfileInfoNJ.FirstName = purchaseInfo.getSupplierInfo().getProfileInfo().getFirstName(); supplierInfoNJ.ProfileInfoNJ.LastName = purchaseInfo.getSupplierInfo().getProfileInfo().getLastName(); purchaseInfoNJ.SupplierInfoNJ = supplierInfoNJ; PurchaseOrderList.Add(purchaseInfoNJ); } }
//constructor public ManageSalesOrderList() { //loading sale list SaleManager saleManager = new SaleManager(); for (Iterator i = saleManager.getAllSaleOrders().iterator(); i.hasNext();) { SaleInfo saleInfo = (SaleInfo)i.next(); SaleInfoNJ saleInfoNJ = new SaleInfoNJ(); saleInfoNJ.OrderNo = saleInfo.getOrderNo(); saleInfoNJ.StatusId = saleInfo.getStatusId(); saleInfoNJ.Remarks = saleInfo.getRemarks(); for (Iterator j = saleInfo.getProductList().iterator(); j.hasNext();) { ProductInfo productInfo = (ProductInfo)j.next(); ProductInfoNJ productInfoNJ = new ProductInfoNJ(); productInfoNJ.Id = productInfo.getId(); productInfoNJ.Name = productInfo.getName(); productInfoNJ.Code = productInfo.getCode(); productInfoNJ.UnitPrice = productInfo.getUnitPrice(); productInfoNJ.Quantity = productInfo.getQuantity(); saleInfoNJ.ProductList.Add(productInfoNJ); } CustomerInfo customerInfo = new CustomerInfo(); CustomerInfoNJ customerInfoNJ = new CustomerInfoNJ(); customerInfoNJ.ProfileInfoNJ.Id = saleInfo.getCustomerInfo().getProfileInfo().getId(); customerInfoNJ.ProfileInfoNJ.FirstName = saleInfo.getCustomerInfo().getProfileInfo().getFirstName(); customerInfoNJ.ProfileInfoNJ.LastName = saleInfo.getCustomerInfo().getProfileInfo().getLastName(); saleInfoNJ.CustomerInfoNJ = customerInfoNJ; SaleOrderList.Add(saleInfoNJ); } }
private void productSaleOrderGrid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e) { DataGrid grid = (DataGrid)sender; ProductInfoNJ productInfo = (ProductInfoNJ)e.Row.Item; if (String.IsNullOrEmpty(productInfo.Name)) { Popup productSelector = (Popup)grid.FindName("productSelector"); productSelector.PlacementTarget = grid.GetCell(e.Row.GetIndex(), e.Column.DisplayIndex); productSelector.IsOpen = true; } }
private void OnSearch() { ProductManager productManager = new ProductManager(); _productList.Clear(); for (Iterator i = productManager.searchProduct(SearchProductByName).iterator(); i.hasNext();) { ProductInfo productInfo = (ProductInfo)i.next(); ProductInfoNJ productInfoNJ = new ProductInfoNJ(); productInfoNJ.Id = productInfo.getId(); productInfoNJ.Name = productInfo.getName(); productInfoNJ.Code = productInfo.getCode(); productInfoNJ.UnitPrice = productInfo.getUnitPrice(); ProductList.Add(productInfoNJ); } }
//constructor public ManageProductList() { //loading product list ProductManager productManager = new ProductManager(); for (Iterator i = productManager.getAllProducts().iterator(); i.hasNext();) { ProductInfo productInfo = (ProductInfo)i.next(); ProductInfoNJ productInfoNJ = new ProductInfoNJ(); productInfoNJ.Id = productInfo.getId(); productInfoNJ.Name = productInfo.getName(); productInfoNJ.Code = productInfo.getCode(); productInfoNJ.UnitPrice = productInfo.getUnitPrice(); ProductList.Add(productInfoNJ); } }
//constructor public ManagePurchaseOrder() { //loading purchase list on left panel PurchaseManager purchaseManager = new PurchaseManager(); for (Iterator i = purchaseManager.getAllPurchaseOrders().iterator(); i.hasNext();) { PurchaseInfo purchaseInfo = (PurchaseInfo)i.next(); PurchaseInfoNJ purchaseInfoNJ = new PurchaseInfoNJ(); //We will display order no in grid view on left panel purchaseInfoNJ.OrderNo = purchaseInfo.getOrderNo(); //right now after clicking on item on left panel purchase info is again retrived from the database //so we can ignore rest of the part right now if required. purchaseInfoNJ.StatusId = purchaseInfo.getStatusId(); purchaseInfoNJ.Remarks = purchaseInfo.getRemarks(); for (Iterator j = purchaseInfo.getProductList().iterator(); j.hasNext();) { ProductInfo productInfo = (ProductInfo)j.next(); ProductInfoNJ productInfoNJ = new ProductInfoNJ(); productInfoNJ.Id = productInfo.getId(); productInfoNJ.Name = productInfo.getName(); productInfoNJ.Code = productInfo.getCode(); productInfoNJ.UnitPrice = productInfo.getUnitPrice(); productInfoNJ.Quantity = productInfo.getQuantity(); purchaseInfoNJ.ProductList.Add(productInfoNJ); } SupplierInfo supplierInfo = new SupplierInfo(); SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ(); supplierInfoNJ.ProfileInfoNJ.Id = purchaseInfo.getSupplierInfo().getProfileInfo().getId(); supplierInfoNJ.ProfileInfoNJ.FirstName = purchaseInfo.getSupplierInfo().getProfileInfo().getFirstName(); supplierInfoNJ.ProfileInfoNJ.LastName = purchaseInfo.getSupplierInfo().getProfileInfo().getLastName(); purchaseInfoNJ.SupplierInfoNJ = supplierInfoNJ; PurchaseOrderList.Add(purchaseInfoNJ); } //Setting a default random Order No for Purchase Info PurchaseInfoNJ.OrderNo = Guid.NewGuid().ToString().ToUpper();; }
/* * This method will display selected purchase info * @author nazmul hasan on 26th january 2016 */ public void OnSelectPurchaseOrderEvent(PurchaseInfoNJ purchaseInfoNJ) { PurchaseManager purchaseManager = new PurchaseManager(); ResultEvent resultEvent = purchaseManager.getPurchaseOrderInfo(purchaseInfoNJ.OrderNo); if (resultEvent.getResponseCode() == Responses.RESPONSE_CODE_SUCCESS) { PurchaseInfo purchaseInfo = (PurchaseInfo)resultEvent.getResult(); PurchaseInfoNJ tempPurchaseInfoNJ = new PurchaseInfoNJ(); tempPurchaseInfoNJ.OrderNo = purchaseInfo.getOrderNo(); tempPurchaseInfoNJ.StatusId = purchaseInfo.getStatusId(); tempPurchaseInfoNJ.Remarks = purchaseInfo.getRemarks(); for (Iterator j = purchaseInfo.getProductList().iterator(); j.hasNext();) { ProductInfo productInfo = (ProductInfo)j.next(); ProductInfoNJ productInfoNJ = new ProductInfoNJ(); productInfoNJ.Id = productInfo.getId(); productInfoNJ.Name = productInfo.getName(); productInfoNJ.Code = productInfo.getCode(); productInfoNJ.UnitPrice = productInfo.getUnitPrice(); productInfoNJ.Quantity = productInfo.getQuantity(); tempPurchaseInfoNJ.ProductList.Add(productInfoNJ); } SupplierInfo supplierInfo = new SupplierInfo(); SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ(); supplierInfoNJ.ProfileInfoNJ.Id = purchaseInfo.getSupplierInfo().getProfileInfo().getId(); supplierInfoNJ.ProfileInfoNJ.FirstName = purchaseInfo.getSupplierInfo().getProfileInfo().getFirstName(); supplierInfoNJ.ProfileInfoNJ.LastName = purchaseInfo.getSupplierInfo().getProfileInfo().getLastName(); tempPurchaseInfoNJ.SupplierInfoNJ = supplierInfoNJ; PurchaseInfoNJ = tempPurchaseInfoNJ; } else { MessageBox.Show(resultEvent.getMessage()); } }
/* * This method will display selected sale info * @author A.K.M. Nazmul Islam on 26th january 2016 */ public void OnSelectSaleOrderEvent(SaleInfoNJ saleInfoNJ) { SaleManager saleManager = new SaleManager(); ResultEvent resultEvent = saleManager.getSaleOrderInfo(saleInfoNJ.OrderNo); if (resultEvent.getResponseCode() == Responses.RESPONSE_CODE_SUCCESS) { SaleInfo saleInfo = (SaleInfo)resultEvent.getResult(); SaleInfoNJ tempSaleInfoNJ = new SaleInfoNJ(); tempSaleInfoNJ.OrderNo = saleInfo.getOrderNo(); tempSaleInfoNJ.StatusId = saleInfo.getStatusId(); tempSaleInfoNJ.Remarks = saleInfo.getRemarks(); for (Iterator j = saleInfo.getProductList().iterator(); j.hasNext();) { ProductInfo productInfo = (ProductInfo)j.next(); ProductInfoNJ productInfoNJ = new ProductInfoNJ(); productInfoNJ.Id = productInfo.getId(); productInfoNJ.Name = productInfo.getName(); productInfoNJ.Code = productInfo.getCode(); productInfoNJ.UnitPrice = productInfo.getUnitPrice(); productInfoNJ.Quantity = productInfo.getQuantity(); tempSaleInfoNJ.ProductList.Add(productInfoNJ); } CustomerInfo customerInfo = new CustomerInfo(); CustomerInfoNJ customerInfoNJ = new CustomerInfoNJ(); customerInfoNJ.ProfileInfoNJ.Id = saleInfo.getCustomerInfo().getProfileInfo().getId(); customerInfoNJ.ProfileInfoNJ.FirstName = saleInfo.getCustomerInfo().getProfileInfo().getFirstName(); customerInfoNJ.ProfileInfoNJ.LastName = saleInfo.getCustomerInfo().getProfileInfo().getLastName(); tempSaleInfoNJ.CustomerInfoNJ = customerInfoNJ; SaleInfoNJ = tempSaleInfoNJ; } else { MessageBox.Show(resultEvent.getMessage()); } }
public void selectProductEvent(ProductInfoNJ p) { this.ProductName = p.Name; this.ProductCode = p.Code; this.Price = p.Price; }
/* * This method will reset product info * @author nazmul hasan on 4th january 2017 */ private void OnReset() { ProductInfoNJ = new ProductInfoNJ(); }
/* * This method will add/save product * @author nazmul hasan on 4th january 2017 */ private void OnAdd() { if (!validateProduct()) { MessageBox.Show(ErrorMessage); return; } ProductInfo productInfo = new ProductInfo(); productInfo.setId(ProductInfoNJ.Id); productInfo.setName(ProductInfoNJ.Name); productInfo.setCode(ProductInfoNJ.Code); productInfo.setUnitPrice(ProductInfoNJ.UnitPrice); ProductInfoNJ productInfoNJ = ProductInfoNJ; productInfoNJ.Name = ProductInfoNJ.Name; productInfoNJ.Code = ProductInfoNJ.Code; productInfoNJ.UnitPrice = ProductInfoNJ.UnitPrice; ResultEvent resultEvent = new ResultEvent(); ProductManager productManager = new ProductManager(); if (ProductInfoNJ.Id > 0) { resultEvent = productManager.updateProduct(productInfo); } else { resultEvent = productManager.createProduct(productInfo); } if (resultEvent.getResponseCode() == Responses.RESPONSE_CODE_SUCCESS) { if (ProductInfoNJ.Id > 0) { for (int counter = 0; counter < ProductList.Count; counter++) { productInfoNJ.Id = ProductInfoNJ.Id; ProductInfoNJ tempProductInfoNJ = ProductList.ElementAt(counter); if (tempProductInfoNJ.Id == ProductInfoNJ.Id) { ProductList.RemoveAt(counter); ProductList.Insert(counter, productInfoNJ); } } } else { ProductInfo responseProductInfo = (ProductInfo)resultEvent.getResult(); productInfoNJ.Id = responseProductInfo.getId(); if (ProductList.Count == 0) { //appending product info in product list on left panel ProductList.Add(productInfoNJ); } else { //appending productinfo at first index in product list on left panel ProductList.Insert(0, productInfoNJ); } } } MessageBox.Show(resultEvent.getMessage()); //reset create product fields OnReset(); }
/* * This method will set product info based on selected product from left panel * @author nazmul hasan */ public void OnSelectProductEvent(ProductInfoNJ productInfoNJ) { ProductInfoNJ = productInfoNJ; }