//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 OnSearch() { SaleManager saleManager = new SaleManager(); SaleOrderList.Clear(); for (Iterator i = saleManager.searchAllSaleOrders(SearchSaleByOderNo).iterator(); i.hasNext();) { SaleInfo saleInfo = (SaleInfo)i.next(); SaleInfoNJ saleInfoNJ = new SaleInfoNJ(); saleInfoNJ.OrderNo = saleInfo.getOrderNo(); saleInfoNJ.CustomerUserId = saleInfo.getCustomerUserId(); saleInfoNJ.StatusId = saleInfo.getStatusId(); saleInfoNJ.SaleDate = saleInfo.getSaleDate(); saleInfoNJ.Discount = saleInfo.getDiscount(); saleInfoNJ.Remarks = saleInfo.getRemarks(); SaleOrderList.Add(saleInfoNJ); } }
/* * 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()); } }
/// <summary> /// Called when Button SendToViewModel is clicked /// </summary> private void OnAdd() { ProductInfo productInfo = new ProductInfo(); productInfo.setUnitPrice(Price); productInfo.setQuantity(OrderItemQuantity); productInfo.setDiscount(OrderItemDiscount); productInfo.setPurchaseOrderNo(productInfo.getPurchaseOrderNo()); List productList = new ArrayList(); productList.add(productInfo); SaleInfo saleInfo = new SaleInfo(); CustomerInfo customerInfo = new CustomerInfo(); saleInfo.setProductList(productList); saleInfo.setCustomerUserId(customerInfo.getUserInfo().getId()); saleInfo.setOrderNo(saleInfo.getOrderNo()); saleInfo.setStatusId(saleInfo.getStatusId()); saleInfo.setRemarks(saleInfo.getRemarks()); SaleManager saleManager = new SaleManager(); saleManager.addSaleOrder(saleInfo); MessageBox.Show("Save Successfully"); }