public void departmentStockDetailView_SaveDepartmentPriceEvent(object sender, DepartmentStockDetailEventArgs e) { if (e.IsNewPrice) { DepartmentPriceLogic.Add(e.ProductPrice); } else { DepartmentPriceLogic.Update(e.ProductPrice); } }
public void departmentStockDetailView_SearchDepartmentStockInDetailEvent(object sender, DepartmentStockDetailEventArgs e) { long deptId = CurrentDepartment.Get().DepartmentId; var objectCriteria = new ObjectCriteria(true); objectCriteria.AddEqCriteria("s.DelFlg", CommonConstants.DEL_FLG_NO); objectCriteria.AddEqCriteria("pm.ProductMasterId", e.ProductMasterId); objectCriteria.AddEqCriteria("s.DepartmentStockInDetailPK.DepartmentId", deptId); objectCriteria.AddGreaterOrEqualsCriteria("deptStockIn.StockInDate", e.StockInDateFrom); objectCriteria.AddLesserOrEqualsCriteria("deptStockIn.StockInDate", e.StockInDateTo); e.DepartmentStockInDetailList = DepartmentStockInDetailLogic.FindByQuery(objectCriteria); e.ProductPrice = DepartmentPriceLogic.FindById(new DepartmentPricePK { ProductMasterId = e.ProductMasterId, DepartmentId = deptId }); }
private void SearchDepartmentStock(DepartmentStockDetailEventArgs eventArgs) { EventUtility.fireEvent(SearchDepartmentStockInDetailEvent, this, eventArgs); DepartmentStockInDetailList = eventArgs.DepartmentStockInDetailList; DepartmentPrice = eventArgs.ProductPrice; if (eventArgs.ProductPrice != null) { txtSellPrice.Text = eventArgs.ProductPrice.Price.ToString(); } PopulateDataGrid(); }
private void DepartmentStockInDetailSearchForm_Load(object sender, EventArgs e) { productMasterSearchControl.txtProductMasterId.ReadOnly = true; productMasterSearchControl.txtProductName.ReadOnly = true; productMasterSearchControl.cbbProductType.Enabled = false; productMasterSearchControl.cbbProductSize.Enabled = false; productMasterSearchControl.cbbProductColor.Enabled = false; productMasterSearchControl.cbbPackager.Enabled = false; productMasterSearchControl.cbbManufacturer.Enabled = false; productMasterSearchControl.cbbDistributor.Enabled = false; productMasterSearchControl.cbbCountry.Enabled = false; productMasterSearchControl.txtProductMasterId.Text = ProductMaster.ProductMasterId; productMasterSearchControl.txtProductName.Text = ProductMaster.ProductName; if (ProductMaster.ProductType != null) { SetDataToCombo(productMasterSearchControl.cbbProductType, ProductMaster.ProductType.TypeName); } if (ProductMaster.ProductSize != null) { SetDataToCombo(productMasterSearchControl.cbbProductSize, ProductMaster.ProductSize.SizeName); } if (ProductMaster.ProductColor != null) { SetDataToCombo(productMasterSearchControl.cbbProductColor, ProductMaster.ProductColor.ColorName); } if (ProductMaster.Packager != null) { SetDataToCombo(productMasterSearchControl.cbbPackager, ProductMaster.Packager.PackagerName); } if (ProductMaster.Manufacturer != null) { SetDataToCombo(productMasterSearchControl.cbbManufacturer, ProductMaster.Manufacturer.ManufacturerName); } if (ProductMaster.Distributor != null) { SetDataToCombo(productMasterSearchControl.cbbDistributor, ProductMaster.Distributor.DistributorName); } if (ProductMaster.Country != null) { SetDataToCombo(productMasterSearchControl.cbbCountry, ProductMaster.Country.CountryName); } var eventArgs = new DepartmentStockDetailEventArgs { ProductMasterId = ProductMaster.ProductMasterId, StockInDateFrom = DateTime.MinValue, StockInDateTo = DateTime.MaxValue }; SearchDepartmentStock(eventArgs); }
private void btnSearch_Click(object sender, EventArgs e) { var eventArgs = new DepartmentStockDetailEventArgs { ProductMasterId = ProductMaster.ProductMasterId, StockInDateFrom = chkStockDateFrom.Checked ? DateUtility.ZeroTime(dtpStockDateFrom.Value) : DateTime.MinValue, StockInDateTo = chkStockDateTo.Checked ? DateUtility.MaxTime(dtpStockDateTo.Value) : DateTime.MaxValue }; SearchDepartmentStock(eventArgs); }
private void btnSave_Click(object sender, EventArgs e) { string newPrice = txtSellPrice.Text; if (string.IsNullOrEmpty(newPrice)) { errorProvider.SetError(txtSellPrice, "Giá niêm yết phải được nhập và lớn hơn 0"); } else { long sellPrice = 0; if (!NumberUtility.CheckLong(newPrice.Replace(".", ""), out sellPrice)) { errorProvider.SetError(txtSellPrice, "Giá niêm yết phải là số nguyên"); } else { var eventArgs = new DepartmentStockDetailEventArgs(); if (DepartmentPrice != null) { DepartmentPrice.Price = sellPrice; } else { eventArgs.IsNewPrice = true; DepartmentPrice = new DepartmentPrice{DepartmentPricePK = new DepartmentPricePK{DepartmentId = 0, ProductMasterId = ProductMaster.ProductMasterId}, Price = sellPrice}; } eventArgs.ProductPrice = DepartmentPrice; EventUtility.fireEvent(SaveDepartmentPriceEvent, this, eventArgs); MessageBox.Show("Lưu thành công"); } } }