// ' Public isBookingChange As Boolean = False private void transferButton_Click(object sender, EventArgs e) { MdlLoadingSetting.waitForm.Show(); var selectedCont = new List <int>(); for (int i = 0, loopTo = My.MyProject.Forms.FrmAssignContainer.assignedContainersBunifuDataGridView2.Rows.Count - 1; i <= loopTo; i++) { if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(My.MyProject.Forms.FrmAssignContainer.assignedContainersBunifuDataGridView2.Rows[i].Cells[0].Value, true, false))) { selectedCont.Add(Conversions.ToInteger(My.MyProject.Forms.FrmAssignContainer.assignedContainersBunifuDataGridView2.Rows[i].Cells[11].Value)); } } { var withBlock = My.MyProject.Forms.FrmAssignContainer; var canInOut = new Containers_In_OutService(); foreach (var contNum in selectedCont) { dbCeres.unassignBooking(contNum, true); canInOut.UnassignContainerFromMinibooking(contNum, My.MyProject.Forms.FrmAssignContainer.SelectedMBObj.MiniBookingId, false); EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "CanID: " + contNum.ToString() + " | MbID: " + My.MyProject.Forms.FrmAssignContainer.SelectedMBObj.MiniBookingId.ToString(), "UNASSIGN", "CONTAINER", "Container unassigned from booking"); } saveAssigment(selectedContainers, selectedBookingNumber); } MdlLoadingSetting.waitForm.Close(); My.MyProject.Forms.FrmAssignContainer.selectAllCheckBox.Checked = false; searchBunifuTextBox1.Text = ""; Close(); // End If }
public void unassignbooking(string bookingBumber, List <int> selectedCountainers, bool isBookingChange) { // My.MyProject.Forms.FrmParentScreen.showLOadForm(); string ThisXLSFile = ""; var dbCeres = new DatabaseHelperCeres(); try { // unassign on database var canInOut = new Containers_In_OutService(); foreach (var contNum in selectedCountainers) { dbCeres.unassignBooking(contNum, false); canInOut.UnassignContainerFromMinibooking(contNum, SelectedMBObj.MiniBookingId, false); EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "CanID: " + contNum.ToString() + " | MbID: " + SelectedMBObj.MiniBookingId.ToString(), "UNASSIGN", "CONTAINER", "Container unassigned from booking"); } var cep = new CeresExcelPendingSync(); cep.RecordId = SelectedMBObj.MiniBookingId; cep.EmployeeId = My.MyProject.Forms.FrmLoginWindow._userID; cep.SyncType = "CONTAINER ASSIGNMENT"; cep.ExtraInfo = ""; cep.CurrentStatus = "QUEUE"; cep.QtyOfAttempts = 0; cep.SyncMessage = "ADDED TO QUEUE"; cep.CreatedAt = DateAndTime.Now; CeresExcService.AddOrUpdate(cep); // My.MyProject.Forms.FrmParentScreen.HideLoadForm(); } catch (Exception ex) { MessageBox.Show("An unexpected error occured. Please close this tab and try again. Error: " + ex.Message); // My.MyProject.Forms.FrmParentScreen.HideLoadForm(); } selectedAssgnContainers.Clear(); }