private void stockSearchView_BarcodeSearchStockEvent(object sender, StockSearchEventArgs e) { var subCriteria = new SubObjectCriteria("ProductMaster"); subCriteria.AddLikeCriteria("ProductName", "%" + e.ProductMasterName + "%"); subCriteria.AddEqCriteria("ProductType", e.ProductType); subCriteria.AddEqCriteria("ProductSize", e.ProductSize); subCriteria.AddEqCriteria("ProductColor", e.ProductColor); subCriteria.AddEqCriteria("Country", e.Country); subCriteria.AddEqCriteria("Manufacturer", e.Manufacturer); subCriteria.AddEqCriteria("Packager", e.Packager); subCriteria.AddEqCriteria("Distributor", e.Distributor); var criteria = new ObjectCriteria(true); criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); criteria.AddLikeCriteria("Product.ProductId", e.ProductMasterId + "%"); criteria.AddSubCriteria("ProductMaster", subCriteria); criteria.AddGreaterOrEqualsCriteria("CreateDate", DateUtility.ZeroTime(e.FromDate)); criteria.AddLesserOrEqualsCriteria("CreateDate", DateUtility.MaxTime(e.ToDate)); IList list = StockLogic.FindAll(criteria); e.StockList = list; }
public void _departmentStockOutView_LoadProductSizeEvent(object sender, DepartmentStockOutEventArgs e) { if (e.SelectedDepartmentStockOutDetail != null && e.SelectedDepartmentStockOutDetail.Product != null && !string.IsNullOrEmpty(e.SelectedDepartmentStockOutDetail.Product.ProductMaster.ProductName)) { var subCriteria = new SubObjectCriteria("ProductMasters"); subCriteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); subCriteria.AddEqCriteria("ProductType", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.ProductType); subCriteria.AddEqCriteria("ProductName", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.ProductName); subCriteria.AddEqCriteria("ProductColor", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.ProductColor); subCriteria.AddEqCriteria("Country", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.Country); subCriteria.AddEqCriteria("Manufacturer", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.Manufacturer); subCriteria.AddEqCriteria("Distributor", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.Distributor); subCriteria.AddEqCriteria("Packager", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.Packager); var criteria = new ObjectCriteria(); criteria.AddSubCriteria("ProductMasters", subCriteria); IList productSizes = ProductSizeLogic.FindAll(criteria); e.ProductSizeList = productSizes; } }
public void departmentStockDetailView_SearchDepartmentPriceEvent(object sender, DepartmentPriceUpdateEventArgs e) { var subCriteria = new SubObjectCriteria("ProductMaster"); subCriteria.AddLikeCriteria("ProductMasterId", e.ProductMasterId + "%"); subCriteria.AddLikeCriteria("ProductName", e.ProductMasterName + "%"); subCriteria.AddEqCriteria("ProductType", e.ProductType); subCriteria.AddEqCriteria("ProductSize", e.ProductSize); subCriteria.AddEqCriteria("ProductColor", e.ProductColor); subCriteria.AddEqCriteria("Country", e.Country); subCriteria.AddEqCriteria("Packager", e.Packager); subCriteria.AddEqCriteria("Manufacturer", e.Manufacturer); subCriteria.AddEqCriteria("Distributor", e.Distributor); var criteria = new ObjectCriteria(); criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); criteria.AddSubCriteria("ProductMaster", subCriteria); criteria.AddEqCriteria("DepartmentPricePK.DepartmentId", CurrentDepartment.Get().DepartmentId); e.DepartmentPriceList = DepartmentPriceLogic.FindAll(criteria); }
void departmentStockCheckingView_LoadProductNamesInTypeEvent(object sender, DepartmentStockCheckingEventArgs e) { SubObjectCriteria prdTypeCrit = new SubObjectCriteria("ProductType"); prdTypeCrit.AddEqCriteria("TypeName",e.ScannedType.TypeName); ObjectCriteria criteria = new ObjectCriteria(); criteria.AddSubCriteria("ProductType",prdTypeCrit); IList prdMasterList = ProductMasterLogic.FindAll(criteria); foreach (ProductMaster master in prdMasterList) { string productName = master.ProductName + "_" + master.ProductColor.ColorName + "_" + master.ProductSize.SizeName; if (!HasInList(e.ScannedType.UnscanProducts, productName)) { e.ScannedType.UnscanProducts.Add(productName); } } }
void _departmentStockInView_FillProductToComboEvent(object sender, DepartmentStockInEventArgs e) { ComboBox comboBox = (ComboBox) sender; string originalText = comboBox.Text; if (e.IsFillToComboBox) { ProductMaster searchPM = e.SelectedDepartmentStockInDetail.Product.ProductMaster; var subCrit = new SubObjectCriteria("ProductMaster"); subCrit.AddLikeCriteria("ProductName", "%" + searchPM.ProductName + "%"); subCrit.AddOrder("ProductName", true); var criteria = new ObjectCriteria(true); /*criteria.AddEqCriteria("pm.DelFlg", CommonConstants.DEL_FLG_NO); criteria.AddEqCriteria("stock.DelFlg", CommonConstants.DEL_FLG_NO); criteria.AddLikeCriteria("pm.ProductName", "%" + searchPM.ProductName + "%");*/ criteria.AddSubCriteria("ProductMaster", subCrit); criteria.MaxResult = 200; /*IList list = StockLogic.FindByQueryForStockIn(criteria);*/ IList list = StockLogic.FindAll(criteria); // if (e.ComboBoxDisplayMember.Equals("ProductMasterId")) // { // result = ProductMasterLogic.FindProductMasterById(searchPM.ProductMasterId, 50,true); // } // else // { // result = ProductMasterLogic.FindProductMasterByName(searchPM.ProductName, 50,true); // } if(list ==null || list.Count == 0) { return; } IList result = new ArrayList(); foreach (Stock stock in list) { result.Add(stock.ProductMaster); } IList retlist = RemoveDuplicateName(result); result = new ArrayList(); int count = 0; foreach (var p in retlist) { result.Add(p); count++; } BindingList<ProductMaster> productMasters = new BindingList<ProductMaster>(); if (result != null) { foreach (ProductMaster master in result) { productMasters.Add(master); } } BindingSource bindingSource = new BindingSource(); bindingSource.DataSource = productMasters; comboBox.DataSource = bindingSource; comboBox.DisplayMember = "TypeAndName"; comboBox.ValueMember = e.ComboBoxDisplayMember; comboBox.DropDownWidth = 300; comboBox.DropDownHeight = 200; // keep the original text comboBox.Text = originalText; //comboBox.SelectedIndex = -1; //comboBox.SelectionStart = comboBox.Text.Length; //comboBox.DroppedDown = true; comboBox.MaxDropDownItems = 10; } }
void _productMasterSearchOrCreateView_SearchRelevantProductsEvent(object sender, ProductMasterSearchOrCreateEventArgs e) { var subCriteria = new SubObjectCriteria("ProductMaster"); subCriteria.AddEqCriteria("ProductName", e.ProductMasterName); var criteria = new ObjectCriteria(true); criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); criteria.AddSubCriteria("ProductMaster", subCriteria); IList list = ProductLogic.FindAll(criteria); e.ProductList = list; }
void departmentStockInExtraView_LoadMasterDataForExportEvent(object sender, DepartmentStockInEventArgs e) { e.SyncFromMainToDepartment = new SyncFromMainToDepartment(); if (e.SyncProductMasters) { ObjectCriteria prdCrit = new ObjectCriteria(); prdCrit.AddGreaterOrEqualsCriteria("UpdateDate", e.LastSyncTime); IList masterProductList1 = ProductLogic.FindAll(prdCrit); SubObjectCriteria subCrit = new SubObjectCriteria("ProductMaster"); subCrit.AddGreaterOrEqualsCriteria("UpdateDate", e.LastSyncTime); prdCrit = new ObjectCriteria(); prdCrit.AddSubCriteria("ProductMaster", subCrit); IList masterProductList2 = ProductLogic.FindAll(prdCrit); IList masterProductList = new ArrayList(); if (masterProductList1 != null) { foreach (Product product in masterProductList1) { masterProductList.Add(product); } } if (masterProductList2 != null) { foreach (Product product in masterProductList2) { if (!ExistInList(masterProductList, product)) { masterProductList.Add(product); } } } e.SyncFromMainToDepartment.ProductMasterList = masterProductList; e.HasMasterDataToSync = true; } if (e.SyncPrice) { ObjectCriteria deptPriceCrit = new ObjectCriteria(); deptPriceCrit.AddGreaterOrEqualsCriteria("UpdateDate", e.LastSyncTime); IList masterDeptPriceList = DepartmentPriceLogic.FindAll(deptPriceCrit); e.SyncFromMainToDepartment.DepartmentPriceMasterList = masterDeptPriceList; e.HasMasterDataToSync = true; } if (e.SyncDepartments) { e.SyncFromMainToDepartment.DepartmentList = DepartmentLogic.FindAll(null); e.SyncFromMainToDepartment.EmployeeList = EmployeeLogic.FindAll(null); e.HasMasterDataToSync = true; } }
public void departmentStockDetailView_SearchDepartmentPriceEvent(object sender, DepartmentPriceUpdateEventArgs e) { var subCriteria = new SubObjectCriteria("ProductMaster"); subCriteria.AddLikeCriteria("ProductMasterId", "%" + e.ProductMasterId + "%"); if(e.AbsoluteFinding) { subCriteria.AddEqCriteria("ProductName", e.ProductMasterName); } else { subCriteria.AddLikeCriteria("ProductName", "%" + e.ProductMasterName + "%"); } if(e.ProductType!=null) { subCriteria.AddEqCriteria("ProductType", e.ProductType); } if (e.ProductSize != null) { subCriteria.AddEqCriteria("ProductSize", e.ProductSize); } if (e.ProductColor != null) { subCriteria.AddEqCriteria("ProductColor", e.ProductColor); } if (e.Country != null) { subCriteria.AddEqCriteria("Country", e.Country); } if (e.Packager != null) { subCriteria.AddEqCriteria("Packager", e.Packager); } if (e.Manufacturer != null) { subCriteria.AddEqCriteria("Manufacturer", e.Manufacturer); } if (e.Distributor != null) { subCriteria.AddEqCriteria("Distributor", e.Distributor); } subCriteria.AddOrder("ProductName",false); subCriteria.AddOrder("ProductColor", false); subCriteria.AddOrder("ProductSize", false); var criteria = new ObjectCriteria(); criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); if(e.ZeroPrice) { criteria.AddEqCriteria("Price", (long) 0); } if(e.ZeroWholeSalePrice) { criteria.AddEqCriteria("WholeSalePrice", (long) 0); } criteria.AddSubCriteria("ProductMaster", subCriteria); /*criteria.AddEqCriteria("DepartmentPricePK.DepartmentId", 0);*/ e.DepartmentPriceList = DepartmentPriceLogic.FindAll(criteria); }
public void stockCreateView_SearchStockInDetailEvent(object sender, StockCreateEventArgs e) { // Search StockInDetail var subCriteria = new SubObjectCriteria("StockIn"); subCriteria.AddGreaterOrEqualsCriteria("StockInDate", DateUtility.ZeroTime(e.ImportDateFrom)); subCriteria.AddLesserOrEqualsCriteria("StockInDate", DateUtility.MaxTime(e.ImportDateTo)); subCriteria.AddEqCriteria("DelFlg", (long)0); var criteria = new ObjectCriteria(); criteria.AddEqCriteria("DelFlg", (long)0); criteria.AddEqCriteria("StockInType", (Int64)e.StockInStatus); criteria.AddSubCriteria("StockIn", subCriteria); IList stockInDetailList = StockInDetailLogic.FindAll(criteria); e.StockInDetailList = stockInDetailList; // Search Stock if (stockInDetailList.Count > 0) { // build the Product id list IList productIdList = new ArrayList(); foreach (StockInDetail stockInDetail in stockInDetailList) { productIdList.Add(stockInDetail.Product.ProductId); } criteria = new ObjectCriteria(); criteria.AddSearchInCriteria("Product.ProductId", productIdList); e.StockList = StockLogic.FindAll(criteria); criteria = new ObjectCriteria(); criteria.AddSearchInCriteria("ProductId", productIdList); e.ReturnProductList = ReturnProductLogic.FindAll(criteria); } }
private void stockSearchView_BarcodeSearchStockEvent(object sender, StockSearchEventArgs e) { var subCriteria = new SubObjectCriteria("ProductMaster"); if(!string.IsNullOrEmpty(e.ProductMasterId)) { subCriteria.AddLikeCriteria("ProductMasterId", "%" + e.ProductMasterId + "%"); } if(!string.IsNullOrEmpty(e.ProductMasterName)) { subCriteria.AddLikeCriteria("ProductName", "%" + e.ProductMasterName + "%"); } if (e.ProductType != null) { subCriteria.AddEqCriteria("ProductType", e.ProductType); } if (e.ProductSize != null) { subCriteria.AddEqCriteria("ProductSize", e.ProductSize); } if (e.ProductColor != null) { subCriteria.AddEqCriteria("ProductColor", e.ProductColor); } if (e.Country != null) { subCriteria.AddEqCriteria("Country", e.Country); } if(e.Manufacturer!=null) { subCriteria.AddEqCriteria("Manufacturer", e.Manufacturer); } if(e.Packager!=null) { subCriteria.AddEqCriteria("Packager", e.Packager); } if (e.Distributor != null) { subCriteria.AddEqCriteria("Distributor", e.Distributor); } if (!string.IsNullOrEmpty(e.Description)) { subCriteria.AddLikeCriteria("Description", "%" + e.Description + "%"); } var criteria = new ObjectCriteria(true); criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); bool searchByProductId = !string.IsNullOrEmpty(e.ProductId); if(searchByProductId) { criteria.AddLikeCriteria("Product.ProductId", "%" + e.ProductId + "%"); } criteria.AddSubCriteria("ProductMaster", subCriteria); criteria.AddOrder("ProductMaster.ProductName", true); criteria.AddOrder("Product.ProductId",true); IList list = StockLogic.FindAll(criteria); if(searchByProductId && e.RelevantProductFinding) { if(list!=null && list.Count > 0) { IList extraList = new ArrayList(); foreach (Stock stock in list) { Product product = stock.Product; subCriteria = new SubObjectCriteria("ProductMaster"); subCriteria.AddEqCriteria("ProductName", product.ProductMaster.ProductName); criteria = new ObjectCriteria(true); criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); criteria.AddSubCriteria("ProductMaster", subCriteria); criteria.AddOrder("Product.ProductId", true); IList subList = StockLogic.FindAll(criteria); if(subList!=null && subList.Count > 0 ) { foreach (Stock stock1 in subList) { AddStockToList(extraList, stock1); } } } // add to original list foreach (Stock stock in extraList) { AddStockToList(list,stock); } } } e.StockList = list; }
public void stockSearchView_SearchStockEvent(object sender, DepartmentStockSearchEventArgs e) { var criteria = new SubObjectCriteria("ProductMaster"); if (!string.IsNullOrEmpty(e.ProductMasterId)) { criteria.AddLikeCriteria("ProductMasterId", "%" + e.ProductMasterId + "%"); } criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); criteria.AddLikeCriteria("ProductName", "%" +e.ProductMasterName + "%"); if (e.ProductType != null && e.ProductType.TypeId > 0) { criteria.AddEqCriteria("ProductType.TypeId", e.ProductType.TypeId); } if (e.ProductSize != null && e.ProductSize.SizeId > 0) { criteria.AddEqCriteria("ProductSize.SizeId", e.ProductSize.SizeId); } if (e.ProductColor != null && e.ProductColor.ColorId > 0) { criteria.AddEqCriteria("ProductColor.ColorId", e.ProductColor.ColorId); } if (e.Country != null && e.Country.CountryId > 0) { criteria.AddEqCriteria("Country.CountryId", e.Country.CountryId); } if (!string.IsNullOrEmpty(e.Description)) { criteria.AddLikeCriteria("Description", "%" + e.Description +"%"); } criteria.AddOrder("ProductName",true); var objectCriteria = new ObjectCriteria(true); objectCriteria.AddEqCriteria("DelFlg", (long)0); if (!string.IsNullOrEmpty(e.ProductId)) { objectCriteria.AddLikeCriteria("DepartmentStockPK.ProductId", "%" + e.ProductMasterId + "%"); } objectCriteria.AddEqCriteria("DepartmentStockPK.DepartmentId", CurrentDepartment.Get().DepartmentId); objectCriteria.AddSubCriteria("ProductMaster",criteria); IList departmentStocks = DepartmentStockLogic.FindAll(objectCriteria); IList stockViewList = new ArrayList(); // create stock view if (departmentStocks != null && departmentStocks.Count > 0) { DepartmentStockView stockView = null; foreach (DepartmentStock departmentStock in departmentStocks) { if (stockView!=null) { if(!stockView.ProductMaster.ProductName.Equals( departmentStock.Product.ProductMaster.ProductName)) { stockViewList.Add(stockView); stockView = null; } } if(stockView == null) { stockView = new DepartmentStockView(); stockView.ProductMaster = departmentStock.Product.ProductMaster; stockView.DepartmentStocks = new ArrayList(); } stockView.DepartmentStocks.Add(departmentStock); stockView.Quantity += departmentStock.Quantity; stockView.GoodQuantity += departmentStock.GoodQuantity; } // add last item if(stockView!=null) { stockViewList.Add(stockView); stockView = null; } e.DepartmentStockList = stockViewList; } }