private bool IsInList(DepartmentStockInDetailCollection collection, DepartmentStockInDetail detail) { foreach (DepartmentStockInDetail inDetail in collection) { if(detail.Product.ProductId.Equals(inDetail.Product.ProductId)) { return true; } } return false; }
private void DepartmentStockInExtra_Load(object sender, EventArgs e) { deptSIDetailList = new DepartmentStockInDetailCollection(bdsDeptStockIn); bdsDeptStockIn.DataSource = deptSIDetailList; dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError); // create DepartmentStockIn if (deptSI == null) { deptSI = new DepartmentStockIn(); } Department currentDepartment = CurrentDepartment.Get(); deptSI.CreateDate = DateTime.Now; deptSI.UpdateDate = DateTime.Now; deptSI.CreateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.UpdateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.ExclusiveKey = 0; CreateNewStockInDetail(); deptSI.DepartmentStockInDetails = ObjectConverter.ConvertToNonGenericList<DepartmentStockInDetail>(deptSIDetailList); }
private void DepartmentStockInExtra_Load(object sender, EventArgs e) { var eventArgs = new DepartmentStockInEventArgs(); EventUtility.fireEvent(FillDepartmentEvent, this, eventArgs); IList departmentList = new ArrayList(); departmentList.Add(new Department { DepartmentId = 0, DepartmentName = "--- Hãy chọn cửa hàng xuất ---" }); foreach (Department department in eventArgs.DepartmentList) { departmentList.Add(department); } bdsDept.DataSource = departmentList; deptSIDetailList = new DepartmentStockInDetailCollection(bdsStockIn); bdsStockIn.DataSource = deptSIDetailList; dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError); deptSIDetailList = new DepartmentStockInDetailCollection(bdsStockIn); bdsStockIn.DataSource = deptSIDetailList; dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError); // create DepartmentStockIn if (deptSI == null) { deptSI = new DepartmentStockIn(); deptSI.CreateDate = DateTime.Now; deptSI.UpdateDate = DateTime.Now; deptSI.CreateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.UpdateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.ExclusiveKey = 0; CreateNewStockInDetail(); // load products to extra combo box LoadProductMasterToComboBox(); deptSIDetailList.RemoveAt(0); bdsStockIn.EndEdit(); } else { // btnBarcode.Visible = true; // numericUpDownBarcode.Visible = true; // btnPreview.Visible = true; IList deptStockInDetails = deptSI.DepartmentStockInDetails; foreach (DepartmentStockInDetail detail in deptStockInDetails) { if (detail.DelFlg == CommonConstants.DEL_FLG_NO) { deptSIDetailList.Add(detail); detail.OldQuantity = detail.Quantity; } } for (int i = 0; i < dgvDeptStockIn.Columns.Count; i++) { dgvDeptStockIn.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; if (i != QUANTITY_POS && i != PRICE_POS && i != SELL_PRICE_POS) { dgvDeptStockIn.Columns[i].ReadOnly = true; } } txtDexcription.Text = deptSI.Description; } deptSI.DepartmentStockInDetails = ObjectConverter.ConvertToNonGenericList<DepartmentStockInDetail>(deptSIDetailList); }
private void DepartmentReStockInForm_Load(object sender, EventArgs e) { deptSIDetailList = new DepartmentStockInDetailCollection(bdsStockIn); bdsStockIn.ResetBindings(true); }
private void WriteStockOutList(Worksheet ws, DepartmentStockInDetailCollection collection) { IList list = new ArrayList(); foreach (DepartmentStockInDetail detail in collection) { list.Add(detail); } IList<DepartmentStockInDetail> writeList = GroupDuplicateProductMasterRow(list); int START_ROW = 2; int END_ROW = START_ROW + writeList.Count; if(writeList== null || writeList.Count == 0 ) { return; } for (int i = START_ROW; i < END_ROW; i++) { lblExportStatus.Text = " Dang ghi dong thu " + (i - 1).ToString() + " / " + (END_ROW - 2).ToString(); Range range = ws.get_Range("A" + i, "A" + i); range.set_Value(Missing.Value,writeList[i-2].Product.ProductMaster.ProductType.TypeName); range = ws.get_Range("B" + i, "B" + i); range.set_Value(Missing.Value, writeList[i - 2].Product.ProductMaster.ProductName); range = ws.get_Range("C" + i, "C" + i); range.set_Value(Missing.Value, writeList[i - 2].Product.ProductMaster.ProductColor.ColorName); range = ws.get_Range("D" + i, "D" + i); range.set_Value(Missing.Value, writeList[i - 2].Product.ProductMaster.ProductSize.SizeName); range = ws.get_Range("E" + i, "E" + i); range.set_Value(Missing.Value, writeList[i - 2].StockQuantity); } Range rangeFormat = ws.get_Range("A" + START_ROW, "A" + START_ROW); rangeFormat.Copy(Missing.Value); Range destRange = ws.get_Range("A" + START_ROW, "M" + END_ROW); destRange.PasteSpecial(XlPasteType.xlPasteFormats, XlPasteSpecialOperation.xlPasteSpecialOperationNone, Missing.Value, Missing.Value); }
private void DepartmentStockInExtra_Load(object sender, EventArgs e) { rdoFastStockIn.Checked = true; DepartmentStockInEventArgs eventArgs = new DepartmentStockInEventArgs(); EventUtility.fireEvent(LoadAllDepartments,this,eventArgs); if(eventArgs.DepartmentsList!= null && eventArgs.DepartmentsList.Count > 0) { BindingSource bdsDepartment = new BindingSource(); bdsDepartment.DataSource = typeof (Department); cboDepartment.DataSource = bdsDepartment; cboDepartment.DisplayMember = "DepartmentName"; foreach (Department department in eventArgs.DepartmentsList) { if (department.DepartmentId != CurrentDepartment.Get().DepartmentId) { string deptId = department.DepartmentId.ToString(); string currId = CurrentDepartment.Get().DepartmentId.ToString(); if(currId.StartsWith(deptId)) { bdsDepartment.Add(department); } } if (ClientSetting.MarketDept.Equals(department.DepartmentId.ToString())) { bdsDepartment.Add(department); } } bdsDepartment.EndEdit(); cboDepartment.Refresh(); cboDepartment.Invalidate(); } foreach (Department department in cboDepartment.Items) { string departmentId = department.DepartmentId.ToString(); string currentSubStock = CurrentDepartment.Get().DepartmentId.ToString(); if (currentSubStock.StartsWith(departmentId)) { cboDepartment.SelectedItem = department; cboDepartment.Enabled = false; break; } } deptSODetailList = new DepartmentStockInDetailCollection(bdsStockIn); bdsStockIn.DataSource = deptSODetailList; dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError); UpdateStockOutDescription(); GlobalMessage message = (GlobalMessage)GlobalUtility.GetObject("GlobalMessage"); message.HasNewMessageEvent += new EventHandler<GlobalMessageEventArgs>(Instance_HasNewMessageEvent); }
private void DepartmentGoodsExportReportForm_Load(object sender, EventArgs e) { pSODetResultList = new DepartmentStockInResultDetailCollection(bdsStockOutResultPM); bdsStockOutResultPM.DataSource = pSODetResultList; pSODetList = new DepartmentStockInDetailCollection(bdsStockOutResultDetail); bdsStockOutResultDetail.DataSource = pSODetList; dgvStockProductsDetail.Columns[0].DefaultCellStyle.Format = "dd/MM/yyyy hh:mm:ss"; ReportStockOutEventArgs stockOutEventArgs = new ReportStockOutEventArgs(); EventUtility.fireEvent(LoadAllDeparmentEvent,this,stockOutEventArgs); BindingSource bdsDepartments = new BindingSource(); bdsDepartments.DataSource = stockOutEventArgs.DepartmentsList; cboDepartments.DataSource = bdsDepartments; cboDepartments.DisplayMember = "DepartmentName"; }