Esempio n. 1
0
        private void fastPendingPallets_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                if (this.EditableMode && this.pickupViewModel.Editable && this.pickupViewModel.IsValid && !this.pickupViewModel.IsDirty)
                {
                    this.timerLoadPending.Enabled = false;
                    PendingPallet pendingPallet = (PendingPallet)this.fastPendingPallets.SelectedObject;
                    if (pendingPallet != null)
                    {
                        PickupDetailDTO pickupDetailDTO = this.InitPickupDetailDTO(pendingPallet);
                        WizardDetail    wizardDetail    = new WizardDetail(pickupDetailDTO);
                        TabletMDI       tabletMDI       = new TabletMDI(wizardDetail);

                        if (tabletMDI.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            if (this.fastPendingPallets.CheckedObjects.Count > 0) //this.pickupViewModel.FillingLineID == (int)GlobalVariables.FillingLine.Drum &&
                            {
                                this.pickupViewModel.ViewDetails.RaiseListChangedEvents = false;
                                foreach (var checkedObjects in this.fastPendingPallets.CheckedObjects)
                                {
                                    PickupDetailDTO pDTO = this.InitPickupDetailDTO((PendingPallet)checkedObjects);
                                    pDTO.BinLocationID   = pickupDetailDTO.BinLocationID;
                                    pDTO.BinLocationCode = pickupDetailDTO.BinLocationCode;
                                    this.pickupViewModel.ViewDetails.Add(pDTO);
                                }
                                this.pickupViewModel.ViewDetails.RaiseListChangedEvents = true;
                                this.pickupViewModel.ViewDetails.ResetBindings();
                            }
                            else
                            {
                                this.pickupViewModel.ViewDetails.Add(pickupDetailDTO);
                            }

                            this.callAutoSave();
                        }

                        wizardDetail.Dispose(); tabletMDI.Dispose();
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
            finally
            {
                if (!this.pickupViewModel.ViewDetails.RaiseListChangedEvents)
                {
                    this.pickupViewModel.ViewDetails.RaiseListChangedEvents = true;
                    this.pickupViewModel.ViewDetails.ResetBindings();
                }
                this.timerLoadPending.Enabled = true;
            }
        }
Esempio n. 2
0
 private void buttonRemoveDetailItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.EditableMode && this.pickupViewModel.Editable)
         {
             PickupDetailDTO pickupDetailDTO = this.gridexPalletDetails.CurrentRow.DataBoundItem as PickupDetailDTO;
             if (pickupDetailDTO != null && CustomMsgBox.Show(this, "Xác nhận xóa pallet:" + (char)13 + (char)13 + pickupDetailDTO.PalletCode + (char)13 + (char)13 + "Tại vi trí: " + (char)13 + (char)13 + pickupDetailDTO.BinLocationCode, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
             {
                 this.pickupViewModel.ViewDetails.Remove(pickupDetailDTO);
                 this.callAutoSave();
             }
         }
     }
     catch (Exception exception)
     {
         ExceptionHandlers.ShowExceptionMessageBox(this, exception);
     }
 }