private void dgvDetails_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { var selectedCell = dgvDetails.Rows[e.RowIndex].Cells[1]; selectedCell.Style.Font = new Font("Microsoft Sans Serif", 11.0f, FontStyle.Bold); selectedCell.Style.SelectionForeColor = Color.White; selectedCell.Style.ForeColor = Color.White; if (selectedCell.Value.Equals("RECEIVE")) { selectedCell.Style.BackColor = Color.Green; selectedCell.Style.SelectionBackColor = Color.Green; } else if (selectedCell.Value.Equals("USE")) { selectedCell.Style.BackColor = Color.DarkGoldenrod; selectedCell.Style.SelectionBackColor = Color.DarkGoldenrod; } else if (selectedCell.Value.Equals("ADJUST")) { selectedCell.Style.BackColor = Color.IndianRed; selectedCell.Style.SelectionBackColor = Color.IndianRed; } else { selectedCell.Style.BackColor = Color.RosyBrown; selectedCell.Style.SelectionBackColor = Color.RosyBrown; } VWGrainInventoryBindingSource.DataSource = GrainInventoryService.GetGrainInventoryByFilets("", "", "", "", ""); }
private void btnSave_Click(object sender, EventArgs e) { if (GoodToGo()) { var giService = new GrainInventoryService(); // '1 - RECEIVE // '2 - SEND // '3 - USE // '4 - ADJUST if (isNewInventory) { if (!Information.IsNothing(SelectedBag)) { giService.InsertGrainInventory(UnitObj.CustomerId, SelectedBag.BagId, Conversions.ToSingle(lblTotalQuantity.Text), UnitObj.MiniUnitId); } else { giService.InsertGrainInventory(UnitObj.CustomerId, 0, Conversions.ToSingle(lblTotalQuantity.Text), UnitObj.MiniUnitId); } foreach (var grainLoc in GrainLocationList) { giService.InsertGrainInvStorageLocation(giService.GetLastGrainInvetoryId(), grainLoc.StorageTypeId, grainLoc.StorageId, (float)grainLoc.QtyInStorage, DateAndTime.Now); giService.InsertGrainInventoryTransaction(giService.GetLastGrainInvetoryId(), 1, (float)grainLoc.QtyInStorage, DateAndTime.Now); giService.InsertGrainInvTransactionGrainStorageLocation(giService.GetLastGrainInventoryTransactionId(), giService.GetLastGrainInvStorageLocationId()); } } My.MyProject.Forms.FrmGrainInvList.dgvInventory.DataSource = GrainInventoryService.GetAllGrainInventory(); Close(); } }
private void cboCustomer_SelectedIndexChanged(object sender, EventArgs e) { if (!firstLoad) { VWGrainInventoryBindingSource.DataSource = GrainInventoryService.GetGrainInventoryByFilets(cboCustomer.Text, cboCommodity.Text, cboGrade.Text, cboUnitNumber.Text, ""); } }
private void btnNewInventory_Click(object sender, EventArgs e) { My.MyProject.Forms.FrmAddEditGrainInventory.LoadForm(); My.MyProject.Forms.FrmAddEditGrainInventory.isNewInventory = true; MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmAddEditGrainInventory, this); dgvInventory.DataSource = GrainInventoryService.GetAllGrainInventory(); }
private void FrmGrainInvList_Load(object sender, EventArgs e) { firstLoad = true; var giService = new GrainInventoryService(); dgvInventory.DataSource = GrainInventoryService.GetAllGrainInventory(); using (var db = new WTCCeresEntities()) { { var withBlock = cboCustomer; var categories = new List <int>(); categories.Add((int)MdlEnum.CompanyCategory.CUSTOMER); categories.Add((int)MdlEnum.CompanyCategory.CUSTOMER_VENDOR); withBlock.DataSource = CompanyService.GetByCompanyCategoryId(categories, db); withBlock.DisplayMember = "CompanyName"; withBlock.ValueMember = "CompanyId"; } var exclusionList = new List <string>(); exclusionList.Add("RELEASED"); { var withBlock1 = cboUnitNumber; var newUs = new VW_UnitSourceMiniUnit(); newUs.MiniunitNumber = ""; newUs.MiniUnitId = 0; var uslist = MiniUnitService.GetAll(exclusionList, db); uslist.Insert(0, newUs); withBlock1.DataSource = uslist; withBlock1.DisplayMember = "MiniUnitNumber"; withBlock1.ValueMember = "MiniUnitId"; withBlock1.SelectedIndex = -1; } { var withBlock2 = cboCommodity; withBlock2.DataSource = CommodityService.GetAll(db); withBlock2.DisplayMember = "CommodityCode"; withBlock2.ValueMember = "CommodityId"; } { var withBlock3 = cboGrade; withBlock3.DataSource = GradeService.GetAll(db); withBlock3.DisplayMember = "GradeCode"; withBlock3.ValueMember = "GradeId"; } } firstLoad = false; }
private void getMatchingUnits() { if (tabUnits.SelectedIndex == 0) { // Dim selectedMBRow As VW_BookingMinibooking = dgvSelectedBkg.Rows(0).DataBoundItem // VWUnitSourceMiniUnitBindingSource.DataSource = VW_UnitSOurceMiniUnitService.GetByFilter(selectedMBRow.CustomerName, BkServicesList, Trim(tbSearchUnits.Text)) foreach (DataGridViewRow row in dgvMiniUnits.Rows) { if (row.Cells[1].Value.ToString().Contains(tbSearchUnits.Text)) { dgvMiniUnits.CurrentCell = row.Cells[1]; } } } else { VW_BookingMinibooking selectedMBRow = (VW_BookingMinibooking)dgvSelectedBkg.Rows[0].DataBoundItem; VWGrainUnitStorageBindingSource.DataSource = GrainInventoryService.GetAllGrainInventoryUnitsByFilter(selectedMBRow.CustomerName, BkServicesList, Strings.Trim(tbSearchStorageUnit.Text)); } }
private void populateMiniUnits() { BkServicesList.Clear(); if (OriginalMBSelectedList.Count > 0) { var selectedMBRow = OriginalMBSelectedList[0]; if (selectedMBRow.ServiceCode.Equals("BAG")) { BkServicesList.Add("BAG"); } else { BkServicesList.Add("BLK"); BkServicesList.Add("OTHER"); } UnitMUList = VW_UnitSOurceMiniUnitService.GetByFilter(selectedMBRow.CustomerName, BkServicesList, ""); VWUnitSourceMiniUnitBindingSource.DataSource = UnitMUList; VWGrainUnitStorageBindingSource.DataSource = GrainInventoryService.GetAllGrainInventoryUnitsByFilter(selectedMBRow.CustomerName, BkServicesList, Strings.Trim(tbSearchStorageUnit.Text)); } }
private void AssignUnitsToBookings() { string muIDmbID; var bus = new MinibookingMiniUnitAssignmentService(); var gis = new GrainInventoryService(); VW_BookingMinibooking mbRow; VW_UnitSourceMiniUnit unitRowUnit; VW_GrainUnitStorage unitRowStorage; for (int i = 0, loopTo = dgvSelectedBkg.Rows.Count - 1; i <= loopTo; i++) { mbRow = (VW_BookingMinibooking)dgvSelectedBkg.Rows[i].DataBoundItem; if (tabUnits.SelectedIndex == 0) { for (int s = 0, loopTo1 = dgvMiniUnits.Rows.Count - 1; s <= loopTo1; s++) { if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(dgvMiniUnits.Rows[s].Cells[0].Value, true, false))) { unitRowUnit = (VW_UnitSourceMiniUnit)dgvMiniUnits.Rows[s].DataBoundItem; muIDmbID = unitRowUnit.MiniUnitId.ToString() + "|" + mbRow.MiniBookingId.ToString(); // If mini munit key and mini booking key is not on the should not assign list, // then assign unit to bkg if (!shouldNotAssignList.Contains(muIDmbID)) { // 'dbCeres.assignUnitsToMiniBkgs(unitID, mbID, bkgNumber, unitNumber, recordKey) bus.Insert(mbRow.MiniBookingId, unitRowUnit.MiniUnitId); EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "UnitId: " + unitRowUnit.MiniUnitId.ToString() + " | MbId: " + mbRow.MiniBookingId.ToString(), "ASSIGN", "UNIT", "Unit Source " + unitRowUnit.MiniunitNumber + " assigned to booking " + mbRow.BookingNumber); } } } } else { for (int s = 0, loopTo2 = dgvStorageUnits.Rows.Count - 1; s <= loopTo2; s++) { if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(dgvStorageUnits.Rows[s].Cells[0].Value, true, false))) { unitRowStorage = (VW_GrainUnitStorage)dgvStorageUnits.Rows[s].DataBoundItem; muIDmbID = unitRowStorage.MiniUnitId.ToString() + "|" + mbRow.MiniBookingId.ToString(); // If mini munit key and mini booking key is not on the should not assign list, // then assign unit to bkg if (!shouldNotAssignList.Contains(muIDmbID)) { gis.InsertGrainInvMinibookingAssignment(mbRow.MiniBookingId, unitRowStorage.GrainInvStorageLocationId, (float)unitRowStorage.QtyInStorage, DateAndTime.Now); gis.InsertGrainInventoryTransaction(unitRowStorage.GrainInventoryId, (int)MdlEnum.TransactionType.ASSIGNMENT, (float)unitRowStorage.QtyInStorage, DateAndTime.Now); gis.InsertGrainInvMinibookingTransaction(mbRow.MiniBookingId, gis.GetLastGrainInventoryTransactionId()); EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "UnitId: " + unitRowStorage.MiniUnitId.ToString() + " | MbId: " + mbRow.MiniBookingId.ToString(), "ASSIGN", "UNIT", "Storage Unit Source " + unitRowStorage.StorageUnitNumber + " assigned to booking " + mbRow.BookingNumber); } } } } var cep = new CeresExcelPendingSync(); cep.RecordId = mbRow.MiniBookingId; cep.EmployeeId = My.MyProject.Forms.FrmLoginWindow._userID; cep.SyncType = "UNIT ASSIGNMENT"; cep.ExtraInfo = ""; cep.CurrentStatus = "QUEUE"; cep.QtyOfAttempts = 0; cep.SyncMessage = "ADDED TO QUEUE"; cep.CreatedAt = DateAndTime.Now; CeresExcService.AddOrUpdate(cep); } shouldNotAssignList.Clear(); assignBunifuButton1.Update(); checkAsnButton(); }
private void dgvInventory_SelectionChanged(object sender, EventArgs e) { VW_GrainInventory GrainInvObj = (VW_GrainInventory)dgvInventory.CurrentRow.DataBoundItem; dgvDetails.DataSource = GrainInventoryService.GetGrainInventoryTransactionByGrainInvId(GrainInvObj.GrainInventoryId); }