// Private Sub RailList1_ReleaseUnits(UnitList As String) Handles RailList1.ReleaseUnits // Call FrmReleaseRailUnit.TakeUnitsToRelease(UnitList) // End Sub private void RailList1_UnitedSelected(bool Selected) { if (Selected) { manualReleaseBtn.Enabled = true; btnEditUnit.Enabled = true; btnAssociateBooking.Enabled = true; } else { manualReleaseBtn.Enabled = false; btnEditUnit.Enabled = false; btnAssociateBooking.Enabled = false; } RailList1.RequestSelectedUnitNumbers(); }
public void LoadForm(bool Refresh) { if (Refresh == true) { Show(); RailList1.TakeRailList(FetchRailList(true), true); // Call CompareAgainstUnitSources(True) RailList1.Select(); btnAssociateBooking.Enabled = false; btnEditUnit.Enabled = false; } else { RailList1.RequestSelectedUnitNumbers(); MdlLoadingSetting.showDialogForm(My.MyProject.Forms.frmAssignUnitToBooking, ParentForm); } // CarregaUnit() }
private void btnEditUnit_Click(object sender, EventArgs e) { RailList1.RequestSelectedUnitNumbers(); if (SelectedUniSourceId.Count > 1) { var unitList = new List <VW_UnitSource>(); unitList = UnitSourceService.GetByUnitSourceListById(SelectedUniSourceId); My.MyProject.Forms.FrmEditAddRailList.isMultiEdit = true; My.MyProject.Forms.FrmEditAddRailList.isNewRecord = false; My.MyProject.Forms.FrmEditAddRailList.LoadForm(unitList); MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmEditAddRailList, ParentForm); } else { var unit = UnitSourceService.GetVWById(SelectedUniSourceId[0]); var unitList = new List <VW_UnitSource>(); unitList.Add(unit); My.MyProject.Forms.FrmEditAddRailList.isMultiEdit = false; My.MyProject.Forms.FrmEditAddRailList.isNewRecord = false; My.MyProject.Forms.FrmEditAddRailList.LoadForm(unitList); MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmEditAddRailList, ParentForm); } }
private void btnAssociateBooking_Click(object sender, EventArgs e) { RailList1.RequestSelectedUnitNumbers(); var muRow = new VW_UnitSourceMiniUnit(); var mbMU = new DataTable(); var muRowList = new List <VW_UnitSourceMiniUnit>(); var multiMUList = new List <VW_UnitSourceMiniUnit>(); var muListToAssign = new List <VW_UnitSourceMiniUnit>(); string diffCargosList = ""; string diffCustomerList = ""; var SelectedUs = UnitSourceService.GetByUnitSourceListById(SelectedUniSourceId); if (hasSameCargoTypes(SelectedUs, ref diffCargosList) == false) { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Can not proceed:", "It Seems like different cargo types has been selected. Please, select only one type of cargo type to continue." + Constants.vbNewLine + "Units:" + Constants.vbNewLine + diffCargosList, this); return; } else if (hasSameCustomers(SelectedUs, ref diffCustomerList) == false) { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Can not proceed:", "It Seems like different Customers has been selected. Please, select the same customer name to continue." + Constants.vbNewLine + "Units:" + Constants.vbNewLine + diffCustomerList, this); return; } { var withBlock = My.MyProject.Forms.frmMiniUnitToAssign; // Lopp through selected Unit sources for (int i = 0, loopTo = SelectedUniSourceId.Count - 1; i <= loopTo; i++) { // Get All MiniUnits from unitID muRowList = VW_UnitSOurceMiniUnitService.GetByUnitSourceById(SelectedUniSourceId[i]); // If more than one mu, send them to Form where user will pick the mini unit if (muRowList.Count > 1) { foreach (var mu in muRowList) { multiMUList.Add(mu); } withBlock.VWUnitSourceMiniUnitBindingSource.DataSource = multiMUList; } // If theres only one MU, send it straigt to Form where mini unit will be asn to minibooking else if (muRowList.Count == 1) { muListToAssign.Add(muRowList[0]); My.MyProject.Forms.frmAssignUnitToBooking.dgvMiniUnit.DataSource = muListToAssign; } // If there's no mini unit, give the option to edit unit source, and repeat process else if (My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("There is not Mini Unit for this Unit.", "Create Mini Unit ?", My.Resources.Resources.caution, this) == DialogResult.Yes) { // FrmEditAddRailList. var unit = UnitSourceService.GetVWById(SelectedUniSourceId[i]); var unitList = new List <VW_UnitSource>(); unitList.Add(unit); My.MyProject.Forms.FrmEditAddRailList.isNewRecord = false; My.MyProject.Forms.FrmEditAddRailList.isMultiEdit = false; My.MyProject.Forms.FrmEditAddRailList.LoadForm(unitList); RailList1.RequestSelectedUnitNumbers(); MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmEditAddRailList, My.MyProject.Forms.FrmParentScreen); muRowList = VW_UnitSOurceMiniUnitService.GetByUnitSourceById(SelectedUniSourceId[i]); if (muRowList.Count > 1) { foreach (var mu in muRowList) { multiMUList.Add(mu); } withBlock.VWUnitSourceMiniUnitBindingSource.DataSource = multiMUList; } else if (muRowList.Count == 1) { muListToAssign.Add(muRowList[0]); My.MyProject.Forms.frmAssignUnitToBooking.dgvMiniUnit.DataSource = muListToAssign; } } } if (My.MyProject.Forms.frmMiniUnitToAssign.VWUnitSourceMiniUnitBindingSource.Count > 1) { MdlLoadingSetting.showDialogForm(My.MyProject.Forms.frmMiniUnitToAssign, this); } else if (Convert.ToInt32(((List <object>)My.MyProject.Forms.frmAssignUnitToBooking.dgvMiniUnit.DataSource).Count) > 0) { MdlLoadingSetting.showDialogForm(My.MyProject.Forms.frmAssignUnitToBooking, this); } else { RailList1.TakeRailList(FetchRailList(true), true); } } }