Beispiel #1
0
        /*
         * 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());
            }
        }
Beispiel #2
0
        /*
         * 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());
            }
        }
Beispiel #3
0
        /*
         * This method will add/update a supplier
         * @author nazmul hasan on 5th january 2016
         */
        private void OnAdd()
        {
            if (!ValidateSupplier())
            {
                MessageBox.Show(ErrorMessage);
                return;
            }
            ProfileInfo profileInfo = new ProfileInfo();

            profileInfo.setId(SupplierInfoNJ.ProfileInfoNJ.Id);
            profileInfo.setFirstName(SupplierInfoNJ.ProfileInfoNJ.FirstName);
            profileInfo.setLastName(SupplierInfoNJ.ProfileInfoNJ.LastName);
            profileInfo.setEmail(SupplierInfoNJ.ProfileInfoNJ.Email);
            profileInfo.setPhone(SupplierInfoNJ.ProfileInfoNJ.Phone);
            profileInfo.setFax(SupplierInfoNJ.ProfileInfoNJ.Fax);
            profileInfo.setWebsite(SupplierInfoNJ.ProfileInfoNJ.Website);

            SupplierInfo supplierInfo = new SupplierInfo();

            supplierInfo.setProfileInfo(profileInfo);
            SupplierManager supplierManager = new SupplierManager();

            SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ();

            supplierInfoNJ.ProfileInfoNJ.Id        = SupplierInfoNJ.ProfileInfoNJ.Id;
            supplierInfoNJ.ProfileInfoNJ.FirstName = SupplierInfoNJ.ProfileInfoNJ.FirstName;
            supplierInfoNJ.ProfileInfoNJ.LastName  = SupplierInfoNJ.ProfileInfoNJ.LastName;
            supplierInfoNJ.ProfileInfoNJ.Email     = SupplierInfoNJ.ProfileInfoNJ.Email;
            supplierInfoNJ.ProfileInfoNJ.Phone     = SupplierInfoNJ.ProfileInfoNJ.Phone;
            supplierInfoNJ.ProfileInfoNJ.Fax       = SupplierInfoNJ.ProfileInfoNJ.Fax;
            supplierInfoNJ.ProfileInfoNJ.Website   = SupplierInfoNJ.ProfileInfoNJ.Website;
            supplierInfoNJ.Remarks = supplierInfo.getRemarks();

            ResultEvent resultEvent = new ResultEvent();

            if (SupplierInfoNJ.ProfileInfoNJ.Id > 0)
            {
                resultEvent = supplierManager.updateSupplier(supplierInfo);
            }
            else
            {
                resultEvent = supplierManager.createSupplier(supplierInfo);
            }
            if (resultEvent.getResponseCode() == Responses.RESPONSE_CODE_SUCCESS)
            {
                if (SupplierInfoNJ.ProfileInfoNJ.Id > 0)
                {
                    for (int counter = 0; counter < SupplierList.Count; counter++)
                    {
                        SupplierInfoNJ tempSupplierInfoNJ = SupplierList.ElementAt(counter);

                        if (tempSupplierInfoNJ.ProfileInfoNJ.Id == SupplierInfoNJ.ProfileInfoNJ.Id)
                        {
                            SupplierList.RemoveAt(counter);
                            SupplierList.Insert(counter, supplierInfoNJ);
                        }
                    }
                }
                else
                {
                    SupplierInfo responseSupplierInfo = (SupplierInfo)resultEvent.getResult();
                    SupplierInfoNJ.ProfileInfoNJ.Id = responseSupplierInfo.getProfileInfo().getId();
                    supplierInfoNJ.ProfileInfoNJ.Id = SupplierInfoNJ.ProfileInfoNJ.Id;
                    if (SupplierList.Count == 0)
                    {
                        SupplierList.Add(supplierInfoNJ);
                    }
                    else
                    {
                        SupplierList.Insert(0, supplierInfoNJ);
                    }
                }
            }
            MessageBox.Show(resultEvent.getMessage());
            //resetting supplier info fields
            OnReset();
        }
Beispiel #4
0
        /*
         * This method will add/update a customer
         * @author nazmul hasan on 5th january 2016
         */
        private void OnAdd()
        {
            if (!ValidateCustomer())
            {
                MessageBox.Show(ErrorMessage);
                return;
            }
            ProfileInfo profileInfo = new ProfileInfo();

            profileInfo.setId(CustomerInfoNJ.ProfileInfoNJ.Id);
            profileInfo.setFirstName(CustomerInfoNJ.ProfileInfoNJ.FirstName);
            profileInfo.setLastName(CustomerInfoNJ.ProfileInfoNJ.LastName);
            profileInfo.setEmail(CustomerInfoNJ.ProfileInfoNJ.Email);
            profileInfo.setPhone(CustomerInfoNJ.ProfileInfoNJ.Phone);
            profileInfo.setFax(CustomerInfoNJ.ProfileInfoNJ.Fax);
            profileInfo.setWebsite(CustomerInfoNJ.ProfileInfoNJ.Website);
            CustomerInfo customerInfo = new CustomerInfo();

            customerInfo.setProfileInfo(profileInfo);
            CustomerManager customerManager = new CustomerManager();

            CustomerInfoNJ customerInfoNJ = new CustomerInfoNJ();

            customerInfoNJ.ProfileInfoNJ.Id        = CustomerInfoNJ.ProfileInfoNJ.Id;
            customerInfoNJ.ProfileInfoNJ.FirstName = CustomerInfoNJ.ProfileInfoNJ.FirstName;
            customerInfoNJ.ProfileInfoNJ.LastName  = CustomerInfoNJ.ProfileInfoNJ.LastName;
            customerInfoNJ.ProfileInfoNJ.Email     = CustomerInfoNJ.ProfileInfoNJ.Email;
            customerInfoNJ.ProfileInfoNJ.Phone     = CustomerInfoNJ.ProfileInfoNJ.Phone;
            customerInfoNJ.ProfileInfoNJ.Fax       = CustomerInfoNJ.ProfileInfoNJ.Fax;
            customerInfoNJ.ProfileInfoNJ.Website   = CustomerInfoNJ.ProfileInfoNJ.Website;

            ResultEvent resultEvent = new ResultEvent();

            if (CustomerInfoNJ.ProfileInfoNJ.Id > 0)
            {
                resultEvent = customerManager.updateCustomer(customerInfo);
            }
            else
            {
                resultEvent = customerManager.createCustomer(customerInfo);
            }
            if (resultEvent.getResponseCode() == Responses.RESPONSE_CODE_SUCCESS)
            {
                if (CustomerInfoNJ.ProfileInfoNJ.Id > 0)
                {
                    for (int counter = 0; counter < CustomerList.Count; counter++)
                    {
                        CustomerInfoNJ tempCustomerInfoNJ = CustomerList.ElementAt(counter);

                        if (tempCustomerInfoNJ.ProfileInfoNJ.Id == CustomerInfoNJ.ProfileInfoNJ.Id)
                        {
                            CustomerList.RemoveAt(counter);
                            CustomerList.Insert(counter, customerInfoNJ);
                        }
                    }
                }
                else
                {
                    CustomerInfo responseCustomerInfo = (CustomerInfo)resultEvent.getResult();
                    CustomerInfoNJ.ProfileInfoNJ.Id = responseCustomerInfo.getProfileInfo().getId();
                    customerInfoNJ.ProfileInfoNJ.Id = CustomerInfoNJ.ProfileInfoNJ.Id;
                    if (CustomerList.Count == 0)
                    {
                        CustomerList.Add(customerInfoNJ);
                    }
                    else
                    {
                        CustomerList.Insert(0, customerInfoNJ);
                    }
                }
            }
            MessageBox.Show(resultEvent.getMessage());
            //reset create Customer fields
            OnReset();
        }
Beispiel #5
0
        /*
         * 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();
        }