Esempio n. 1
0
        public bool AddOrUpdate(ReleaseOrder releaseDetail)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    rd = releaseDetail;
                    if (releaseDetail.ReleaseOrderId == 0)
                    {
                        db.ReleaseOrder.Add(rd);
                    }
                    else
                    {
                        db.ReleaseOrder.AddOrUpdate(rd);
                    }
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    string msg = ex.Message;
                    isSaved = false;
                }
            }
            return(isSaved);
        }
Esempio n. 2
0
        private void btnAddBooking_Click(object sender, EventArgs e)
        {
            ReleaseOrder SelectedRelDetail = (ReleaseOrder)dgvReleaseDetail.CurrentRow.DataBoundItem;

            My.MyProject.Forms.FrmAddEditReleaseMb.LoadForm(ReleaseDetMinibooking, SelectedRelDetail.ReleaseOrderId);
            MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmAddEditReleaseMb, this);
            ReleaseDetMinibooking        = ReleaseOrderMinibookingService.GetAllVWByRelOrderId(SelectedRelDetail.ReleaseOrderId);
            dgvBookingRelease.DataSource = null;
            dgvBookingRelease.DataSource = ReleaseDetMinibooking;
        }
Esempio n. 3
0
        private void btnComplete_Click(object sender, EventArgs e)
        {
            if (isNewRecord)
            {
                updatedRelDetail           = new ReleaseOrder();
                updatedRelDetail.CreatedAt = DateAndTime.Now;
            }

            updatedRelDetail.QtyAccepted  = (int)Math.Round(nudQtyCans.Value);
            updatedRelDetail.DateAccepted = dpReleaseDate.Value;
            relOrderServ.AddOrUpdate(updatedRelDetail);
            Close();
        }
Esempio n. 4
0
        public void PopulateInfo(ReleaseOrder relDetail)
        {
            LoadForm();
            updatedRelDetail = relDetail;
            if (!Information.IsNothing(relDetail.DateAccepted))
            {
                dpReleaseDate.Value = (DateTime)relDetail.DateAccepted;
            }
            else
            {
                dpReleaseDate.Value = DateAndTime.Now;
            }

            nudQtyCans.Value = relDetail.QtyAccepted;
        }
Esempio n. 5
0
 private void dgvReleaseDetail_SelectionChanged(object sender, EventArgs e)
 {
     if (dgvReleaseDetail.Rows.Count > 0)
     {
         try
         {
             relOrder = (ReleaseOrder)dgvReleaseDetail.CurrentRow.DataBoundItem;
             ReleaseDetMinibooking        = ReleaseOrderMinibookingService.GetAllVWByRelOrderId(relOrder.ReleaseOrderId);
             dgvBookingRelease.DataSource = null;
             dgvBookingRelease.DataSource = ReleaseDetMinibooking;
         }
         catch (Exception ex)
         {
         }
     }
 }
Esempio n. 6
0
        private void dgvReleaseDetail_DoubleClick(object sender, EventArgs e)
        {
            ReleaseOrder relDist = (ReleaseOrder)dgvReleaseDetail.CurrentRow.DataBoundItem;

            My.MyProject.Forms.FrmAddEditReleaseDetail.isNewRecord = false;
            My.MyProject.Forms.FrmAddEditReleaseDetail.PopulateInfo(relDist);
            MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmAddEditReleaseDetail, this);
            if (!Information.IsNothing(My.MyProject.Forms.FrmAddEditReleaseDetail.updatedRelDetail.ReleaseOrderId))
            {
                RelOrderList[dgvReleaseDetail.CurrentRow.Index] = My.MyProject.Forms.FrmAddEditReleaseDetail.updatedRelDetail;
                ReleaseOrderBindingSource.DataSource            = RelOrderList;
            }

            RelReq = InboundRequestService.GetVWById(Release.InboundRequestId);
            CalculateQtys();
            CheckButtons();
        }
Esempio n. 7
0
        public bool Delete(int ReleaseOrderId)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    rd = db.ReleaseOrder.Find(ReleaseOrderId);
                    db.ReleaseOrder.Remove(rd);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    string msg = ex.Message;
                    isSaved = false;
                }
            }
            return(isSaved);
        }
Esempio n. 8
0
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
        /* TODO ERROR: Skipped RegionDirectiveTrivia */
        private void btnAddReleaseDetail_Click(object sender, EventArgs e)
        {
            var relService = new ReleaseService();
            var rel        = new Release();
            int lastRelId;
            int lastRelOrderId;

            My.MyProject.Forms.FrmAddEditReleaseDetail.isNewRecord = true;
            My.MyProject.Forms.FrmAddEditReleaseDetail.LoadForm();
            MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmAddEditReleaseDetail, this);
            RelOrderList.Add(My.MyProject.Forms.FrmAddEditReleaseDetail.updatedRelDetail);
            if (isNewRelease)
            {
                rel.ReleaseNumber = tbReleaseNumber.Text;
                relService.AddOrUpdate(rel);
                lastRelId = relService.GetLastReleaseId();
            }
            else
            {
                VW_Release relVW = (VW_Release)My.MyProject.Forms.FrmUpdateReqStatus.dgvRelease.CurrentRow.DataBoundItem;
                lastRelId = relVW.ReleaseId;
            }

            ReleaseId = lastRelId;
            // Save ReleaseOrders
            foreach (var currentRelOrder in RelOrderList)
            {
                relOrder                  = currentRelOrder;
                relOrder.ReleaseId        = lastRelId;
                relOrder.InboundRequestId = My.MyProject.Forms.FrmUpdateReqStatus.RelReq.InboundRequestId;
                relOrderService.AddOrUpdate(relOrder);
                // '   lastRelOrderId = relOrderService.GetLastReleaseOrderId()
            }
            // FrmUpdateReqStatus.RelReq = InboundRequestService.GetVWById(RelReq.InboundRequestId)

            dgvReleaseDetail.DataSource = null;
            dgvReleaseDetail.DataSource = RelOrderList;
            CalculateQtys();
            CheckButtons();
        }
Esempio n. 9
0
        public void LoadInfo(VW_InboundRequest inReq)
        {
            loadForm();
            firstLoad = true;
            inRequest = InboundRequestService.GetById(inReq.InboundRequestId);
            cboSSLine.SelectedValue      = inRequest.ShippingLineId;
            nudQtyCans.Value             = inRequest.QtyRequested;
            cboReleaseType.SelectedValue = inRequest.BookingTypeId;
            cboCanState.SelectedItem     = inRequest.ContainerState;
            cboCanSize.SelectedValue     = inRequest.ContainerSizeId;
            lblTitle.Text = "Update Request";
            if (!inReq.ReleaseType.Equals("REPO"))
            {
                relOrder = ReleaseOrderService.GetAllByInboundRequestId(inReq.InboundRequestId).ToList()[0];
                rel      = ReleaseService.GetByReleaseId(relOrder.ReleaseId);

                // RelOrderMbList = ReleaseOrderMinibookingService.GetAllByReleaseOrderId(relOrder.ReleaseOrderId)
                // relOrderMb = RelOrderMbList.Where(Function(r) r.AssignmentOrder = 1).ToList(0)

                cboBooking.SelectedText = rel.ReleaseNumber;
            }

            firstLoad = false;
        }
Esempio n. 10
0
 public void PopulateInfo(VW_Release rel)
 {
     LoadForm();
     firstLoad                   = true;
     Release                     = rel;
     ReleaseId                   = rel.ReleaseId;
     RelReq                      = InboundRequestService.GetVWById(rel.InboundRequestId);
     lblReleaseType.Text         = rel.ReleaseType;
     tbReleaseNumber.Text        = rel.ReleaseNumber;
     lblReqRelease.Text          = RelReq.TotalQtyAccptOfRequest.ToString();
     RelOrderList                = ReleaseOrderService.GetAllByReleaseId(rel.ReleaseId);
     dgvReleaseDetail.DataSource = RelOrderList;
     if (dgvReleaseDetail.Rows.Count > 0)
     {
         ReleaseOrder relOrder = (ReleaseOrder)dgvReleaseDetail.Rows[0].DataBoundItem;
         ReleaseDetMinibooking        = ReleaseOrderMinibookingService.GetAllVWByRelOrderId(relOrder.ReleaseOrderId);
         dgvBookingRelease.DataSource = null;
         dgvBookingRelease.DataSource = ReleaseDetMinibooking;
     }
     // UpdateBookingCbo()
     firstLoad = false;
     CalculateQtys();
     CheckButtons();
 }
Esempio n. 11
0
        private void btnComplete_Click(object sender, EventArgs e)
        {
            if (GoodToGo())
            {
                var  relOrderService = new ReleaseOrderService();
                var  relService      = new ReleaseService();
                bool isInserted;
                int  relReqId;
                if (isNewRequest)
                {
                    inRequest = new InboundRequest();
                    inRequest.RequestStatusId = (int)MdlEnum.RequestStatus.PENDING_REPLY;
                    inRequest.DateRequested   = DateAndTime.Now;
                    inRequest.IsOpenRequest   = true;
                }

                inRequest.ShippingLineId  = Conversions.ToInteger(cboSSLine.SelectedValue);
                inRequest.QtyRequested    = (int)Math.Round(nudQtyCans.Value);
                inRequest.ContainerSizeId = Conversions.ToInteger(cboCanSize.SelectedValue);
                inRequest.ContainerState  = Conversions.ToString(cboCanState.SelectedItem);
                inRequest.BookingTypeId   = Conversions.ToInteger(cboReleaseType.SelectedValue);
                isInserted = inReqServ.AddOrUpdate(inRequest);
                relReqId   = inReqServ.GetLastInboundRequestId();
                if (isInserted)
                {
                    if (isExportRelease)
                    {
                        if (isNewRequest)
                        {
                            rel = new Release();
                            isChangeOfExportBooking = false;
                            relOrder = new ReleaseOrder();
                        }

                        rel.ReleaseNumber = Strings.Trim(cboBooking.Text);
                        if (relService.AddOrUpdate(rel))
                        {
                            relOrder.ReleaseId        = relService.GetLastReleaseId();
                            relOrder.DateAccepted     = default;
                            relOrder.CreatedAt        = DateAndTime.Now;
                            relOrder.InboundRequestId = inReqServ.GetLastInboundRequestId();
                            relOrder.QtyAccepted      = 0;
                            if (relOrderService.AddOrUpdate(relOrder))
                            {
                                if (isChangeOfExportBooking)
                                {
                                    ReplaceExportBookingNumber();
                                }
                                else
                                {
                                    var newRelMb      = new ReleaseOrderMinibooking();
                                    var relOrdService = new ReleaseOrderMinibookingService();
                                    newRelMb.ReleaseOrderId  = relOrderService.GetLastReleaseOrderId();
                                    newRelMb.MinibookingId   = MinibookingService.GetByBookingAndMbOrder(Strings.Trim(cboBooking.Text), 1).MiniBookingId;
                                    newRelMb.CreatedAt       = DateAndTime.Now;
                                    newRelMb.QtyRequested    = inRequest.QtyRequested;
                                    newRelMb.AssignmentOrder = 1;
                                    relOrdService.AddOrUpdate(newRelMb);
                                }

                                Close();
                            }
                            else
                            {
                                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Booking export not saved", "Something went wrong and the export booking request was not saved." + Constants.vbNewLine + "Please try again.", this);
                            }
                        }
                        else
                        {
                            My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Booking export not saved", "Something went wrong and the export booking request was not saved." + Constants.vbNewLine + "Please try again.", this);
                        }
                    }
                    else
                    {
                        Close();
                    }
                }
                else
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Request not saved", "Something went wrong and the request was not saved." + Constants.vbNewLine + "Please try again.", this);
                }
            }
        }
Esempio n. 12
0
        public void loadForm()
        {
            firstLoad = true;
            {
                var withBlock = cboSSLine;
                withBlock.DataSource    = CompanyService.GetAllByCompanyTypeId((int)MdlEnum.CompanyType.Steamship_Line, new WTCCeresEntities());
                withBlock.DisplayMember = "CompanyName";
                withBlock.ValueMember   = "CompanyId";
                withBlock.SelectedValue = 0;
            }

            {
                var withBlock1    = cboBooking;
                var NewRowBooking = new Booking();
                BookingList                 = BusinessLayer.WTC_Ceres.BookingService.GetAllByActiveStatus(true);
                NewRowBooking.BookingId     = 0;
                NewRowBooking.BookingNumber = "";
                BookingList.Insert(0, NewRowBooking);
                if (cboReleaseType.Text.Equals("IMPORT"))
                {
                    withBlock1.DataSource = BookingList.Where(b => b.BookingTypeId == (int)MdlEnum.BookingType.IMPORT).ToList();
                }
                else
                {
                    withBlock1.DataSource = BookingList.Where(b => b.BookingTypeId != (int)MdlEnum.BookingType.IMPORT).ToList();
                }

                withBlock1.DisplayMember = "BookingNumber";
                withBlock1.ValueMember   = "BookingId";
                withBlock1.SelectedValue = 0;
            }

            {
                var withBlock2 = cboReleaseType;
                withBlock2.DataSource    = BookingTypeService.GetAll();
                withBlock2.DisplayMember = "TypeName";
                withBlock2.ValueMember   = "BookingTypeId";
                withBlock2.SelectedValue = 0;
            }

            {
                var withBlock3 = cboCanState;
                withBlock3.Items.Clear();
                withBlock3.Items.Add("EMPTY");
                withBlock3.Items.Add("LOADED");
                withBlock3.SelectedIndex = 0;
            }

            {
                var withBlock4 = cboCanSize;
                withBlock4.DataSource    = ContainerSizeService.GetAll();
                withBlock4.DisplayMember = "ContainerSizeName";
                withBlock4.ValueMember   = "ContainerSizeId";
                withBlock4.SelectedValue = 1;
            }

            nudQtyCans.Value = 0m;
            lblWarning.Text  = "";
            lblTitle.Text    = "Create Request";
            relOrder         = null;
            rel       = null;
            firstLoad = false;
        }
Esempio n. 13
0
 public bool AddOrUpdate(ReleaseOrder releaseOrder)
 {
     return(repository.AddOrUpdate(releaseOrder));
 }