void grdClient_UpdateCommand(object source, GridCommandEventArgs e)
        {
            if (Page.IsValid)
            {
                GridEditableItem  editiedItem            = e.Item as GridEditableItem;
                RadNumericTextBox rntClientPalletBalance = e.Item.FindControl("rntClientPalletBalance") as RadNumericTextBox;
                HiddenField       hidWoodenPallets       = e.Item.FindControl("hidWoodenPallets") as HiddenField;

                // Update the Pallet balance for the Client
                int identityID   = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["IdentityId"].ToString());
                int palletTypeID = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["PalletTypeId"].ToString());
                int balance      = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Balance"].ToString());
                int PaperPallets = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["PaperPallets"].ToString());

                int oldWoodenBalance = int.Parse(hidWoodenPallets.Value);
                int newWoodenBalance = Convert.ToInt32(rntClientPalletBalance.Value);

                int oldBalance = oldWoodenBalance + PaperPallets;
                int newBalance = newWoodenBalance + PaperPallets;
                int difference = oldBalance - newBalance;

                using (Facade.IPalletBalance facPalletBalance = new Facade.Pallet())
                {
                    facPalletBalance.UpdateClientPalletBalance(null, null, null, identityID, palletTypeID, difference, ((Entities.CustomPrincipal)Page.User).UserName);
                }

                grdClient.Rebind();
            }
        }
        protected void btnPalletMove_Click(object sender, EventArgs e)
        {
            Button btnPalletMove    = sender as Button;
            int    listItemIndex    = int.Parse(btnPalletMove.Attributes["ListItemIndex"]);
            int    sourceResourceID = int.Parse(btnPalletMove.Attributes["ResourceID"]);
            int    targetResourceID = -1;

            RadComboBox rcbAlternateResources = lvEmptyPallets.Items[listItemIndex].FindControl("rcbAlternateResources") as RadComboBox;
            ListView    lvItems = lvEmptyPallets.Items[listItemIndex].FindControl("lvItems") as ListView;

            targetResourceID = int.Parse(rcbAlternateResources.SelectedValue);

            IList <KeyValuePair <int, int> > palletTypeCount = new List <KeyValuePair <int, int> >();

            foreach (ListViewDataItem lvdi in lvItems.Items)
            {
                HiddenField       hdnPalletType  = lvdi.FindControl("hdnPalletType") as HiddenField;
                RadNumericTextBox rntNoOfPallets = lvdi.FindControl("rntNoOfPallets") as RadNumericTextBox;

                int palletTypeID = int.Parse(hdnPalletType.Value);
                int palletCount  = (int)rntNoOfPallets.Value;

                palletTypeCount.Add(new KeyValuePair <int, int>(palletTypeID, palletCount));
            }

            Facade.IPalletBalance facPalletBalance = new Facade.Pallet();
            if (facPalletBalance.MovePalletsFromSourcetoTargetResource(m_job.JobId, sourceResourceID, targetResourceID, palletTypeCount, ((Entities.CustomPrincipal)Page.User).UserName))
            {
                ConfigureDisplay();
            }
        }
Exemple #3
0
 private void Rebind()
 {
     using (Facade.IPalletBalance facPalletBalance = new Facade.Pallet())
     {
         lvTrailerAudit.DataSource = facPalletBalance.GetRunAuditTrail(JobId);
         lvTrailerAudit.DataBind();
     }
 }
        private void performSearch()
        {
            // Configure the report settings collection
            NameValueCollection reportParams = new NameValueCollection();

            int clientId = 0;

            if (cboClient.Text != "")
            {
                clientId = Convert.ToInt32(cboClient.SelectedValue);
                reportParams.Add("Client", cboClient.Text);
                reportParams.Add("IdentityId", clientId.ToString());
            }

            reportParams.Add("startDate", dteStartDate.SelectedDate.Value.ToString("dd/MM/yy"));

            reportParams.Add("endDate", dteEndDate.SelectedDate.Value.ToString("dd/MM/yy"));

            DataSet dsPallets;

            DateTime start = dteStartDate.SelectedDate.Value;

            start = start.Subtract(start.TimeOfDay);

            DateTime end = dteEndDate.SelectedDate.Value;

            end = end.Subtract(end.TimeOfDay).Add(new TimeSpan(23, 59, 59));

            bool PCVRequired = false;

            if (chkPCVRequired.Checked)
            {
                PCVRequired = true;
            }
            else
            {
                PCVRequired = false;
            }

            Facade.IPallet facPallet = new Facade.Pallet();

            dsPallets = facPallet.GetPalletLogforIdentityId(clientId, start, end, PCVRequired);

            // Configure the Session variables used to pass data to the report
            Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable]       = eReportType.PalletLog;
            Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable]  = dsPallets;
            Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable]   = String.Empty;
            Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table";
            Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable]     = reportParams;

            reportViewer.IdentityId = clientId;
            // Show the user control
            reportViewer.Visible = true;
        }
        void grdTrailers_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            GridColumn alterTrailerPallets = grdTrailers.Columns.FindByUniqueNameSafe("AlterTrailerPallets");

            if (alterTrailerPallets != null)
            {
                alterTrailerPallets.Visible = false; // UpdatePalletBalances;
            }
            using (Facade.IPalletBalance facPalletBalance = new Facade.Pallet())
                grdTrailers.DataSource = facPalletBalance.GetTrailerBalances();
        }
        void grdClient_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            GridColumn alterClientPallets = grdClient.Columns.FindByUniqueNameSafe("AlterClientPallets");

            if (alterClientPallets != null)
            {
                alterClientPallets.Visible = UpdatePalletBalances;
            }

            using (Facade.IPalletBalance facPalletBalance = new Facade.Pallet())
                grdClient.DataSource = facPalletBalance.GetClientBalances();
        }
Exemple #7
0
        private void LoadTrailerAuditTrail()
        {
            pnlTrailer.Visible = true;

            Facade.ITrailer  facTrailer     = new Facade.Resource();
            Entities.Trailer currentTrailer = facTrailer.GetForTrailerId(currentID);

            lblPalletBalanceType.Text = "Trailer Pallet Audit Trail : " + currentTrailer.TrailerRef;

            Facade.IPalletBalance facPalletBalance = new Facade.Pallet();
            lvTrailerAudit.DataSource = facPalletBalance.GetTrailerAuditTrail(currentID, int.Parse(rcbPalletType.SelectedValue), rdiStartDate.SelectedDate.Value, rdiEndDate.SelectedDate.Value);
            lvTrailerAudit.DataBind();
        }
Exemple #8
0
        private void LoadPointAuditTrail()
        {
            pnlPoint.Visible = true;

            Facade.IPoint  facPoint     = new Facade.Point();
            Entities.Point currentPoint = facPoint.GetPointForPointId(currentID);

            lblPalletBalanceType.Text = "Point Pallet Audit Trail : " + currentPoint.Description;

            Facade.IPalletBalance facPalletBalance = new Facade.Pallet();
            lvPointAudit.DataSource = facPalletBalance.GetPointAuditTrail(currentID, int.Parse(rcbPalletType.SelectedValue), rdiStartDate.SelectedDate.Value, rdiEndDate.SelectedDate.Value);
            lvPointAudit.DataBind();
        }
Exemple #9
0
        private void LoadClientAuditTrail()
        {
            pnlClient.Visible = true;

            Facade.IOrganisation  facOrganisation = new Facade.Organisation();
            Entities.Organisation currentOrg      = facOrganisation.GetForIdentityId(currentID);

            lblPalletBalanceType.Text = "Client Pallet Audit Trail : " + currentOrg.OrganisationName;

            Facade.IPalletBalance facPalletBalance = new Facade.Pallet();
            lvClientAudit.DataSource = facPalletBalance.GetClientAuditTrail(currentID, int.Parse(rcbPalletType.SelectedValue), rdiStartDate.SelectedDate.Value, rdiEndDate.SelectedDate.Value);
            lvClientAudit.DataBind();
        }
        void btnUpdate_Click(object sender, EventArgs e)
        {
            Entities.FacadeResult    result          = null;
            Entities.CustomPrincipal user            = (Entities.CustomPrincipal)Page.User;
            Facade.IPalletReturn     facPalletReturn = new Facade.Pallet();

            result = facPalletReturn.UpdatePalletHandlingInstructions(m_job, UpdatedPalletDeliveries, PalletDeliveries, user.IdentityId, user.UserName);

            if (result != null && result.Success)
            {
                this.ReturnValue        = bool.TrueString;
                PalletDeliveries        = null;
                UpdatedPalletDeliveries = null;
                this.Close();
            }
            else
            {
                idErrors.Infringements = result.Infringements;
                idErrors.DisplayInfringments();
            }
        }
Exemple #11
0
        public static string CreatePalletDeliveryRun(string userID)
        {
            System.Web.SessionState.HttpSessionState currentSession = HttpContext.Current.Session;
            string retVal = string.Empty;

            List <Entities.PalletTypeCount> palletTypeCountCollections = (List <Entities.PalletTypeCount>)currentSession[s_selectedPalletTypeCounts];
            List <PalletDelivery>           palletDeliveries           = (List <PalletDelivery>)currentSession[s_palletDeliveries];
            List <KeyValuePair <Entities.Order, eInstructionType> > specifiedDeliveries = new List <KeyValuePair <Entities.Order, eInstructionType> >();

            foreach (PalletDelivery pd in palletDeliveries)
            {
                specifiedDeliveries.Add(new KeyValuePair <Entities.Order, eInstructionType>(pd.PalletOrder, pd.PalletAction));
            }

            try
            {
                Facade.IPalletReturn facPalletReturn = new Facade.Pallet();
                int runId = facPalletReturn.Create(palletTypeCountCollections, specifiedDeliveries, userID);
                retVal = string.Format("{0}", runId);
            }
            catch (Exception ex)
            {
                WebUI.Global.UnhandledException(ex);

                string sensibleErrorMessage = ex.Message;
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                    sensibleErrorMessage += "\n" + ex.Message;
                }

                throw new ApplicationException(sensibleErrorMessage);
            }

            return(retVal);
        }
        void grdPoints_UpdateCommand(object source, GridCommandEventArgs e)
        {
            GridEditableItem  editiedItem           = e.Item as GridEditableItem;
            RadNumericTextBox rntPointPalletBalance = e.Item.FindControl("rntPointPalletBalance") as RadNumericTextBox;

            // Update the Pallet balance for the Client
            int pointID      = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["PointID"].ToString());
            int palletTypeID = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["PalletTypeId"].ToString());
            int newBalance   = Convert.ToInt32(rntPointPalletBalance.Value);

            int oldBalance = 0;

            using (Facade.IPalletBalance facPalletBalance = new Facade.Pallet())
                oldBalance = facPalletBalance.GetPalletBalanceAtPointId(pointID, palletTypeID);

            int interimBalance = newBalance - oldBalance;

            newBalance = interimBalance;

            using (Facade.IPalletBalance facPalletBalance = new Facade.Pallet())
                facPalletBalance.UpdatePointPalletBalance(null, null, null, pointID, palletTypeID, newBalance, ((Entities.CustomPrincipal)Page.User).UserName);

            grdPoints.Rebind();
        }
Exemple #13
0
        private void DehirePallets()
        {
            int    noOfPallets = (int)rntNoDehirePallets.Value;
            string userID      = ((Page.User) as Orchestrator.Entities.CustomPrincipal).UserName;

            Entities.Order           dehireOrder   = new Entities.Order();
            Entities.DehiringReceipt dehireReceipt = new Entities.DehiringReceipt();

            #region Generate De-hire Order

            // Setting default values for the Order.
            dehireOrder.Cases               = 0;
            dehireOrder.Weight              = 0;
            dehireOrder.GoodsTypeID         = 1; // This REALLY needs to be Pallets ( hint hint system definition ).
            dehireOrder.PalletSpaceID       = (int)ePalletSize.Normal;
            dehireOrder.CustomerOrderNumber = "palletHandling";
            dehireOrder.DeliveryOrderNumber = "palletHandling";
            dehireOrder.OrderStatus         = eOrderStatus.Delivered; //This is because the order will not be on a run so it is assumed its at the dehire point at time of creation.
            dehireOrder.OrderType           = eOrderType.PalletHandling;
            dehireOrder.OrderInstructionID  = 3;                      // Find out what this is?
            dehireOrder.CustomerIdentityID  = int.Parse(rcbDeHireOrganisation.SelectedValue);
            dehireOrder.PalletTypeID        = PalletTypeId;
            dehireOrder.NoPallets           = noOfPallets;
            dehireOrder.PalletSpaces        = dehireOrder.NoPallets;
            dehireOrder.CollectionPointID   = dehireOrder.DeliveryPointID = ucDeliveryPoint.SelectedPoint.PointId;

            dehireOrder.ForeignRate = dehireOrder.Rate = rntPalletDeliveryCharge.Value.HasValue ? (decimal)rntPalletDeliveryCharge.Value : 0m;

            dehireOrder.CollectionDateTime   = dehireOrder.DeliveryFromDateTime = new DateTime(dteDeliveryFromDate.SelectedDate.Value.Year, dteDeliveryFromDate.SelectedDate.Value.Month, dteDeliveryFromDate.SelectedDate.Value.Day, dteDeliveryFromTime.SelectedDate.Value.Hour, dteDeliveryFromTime.SelectedDate.Value.Minute, 0);
            dehireOrder.CollectionByDateTime = dehireOrder.DeliveryDateTime = new DateTime(dteDeliveryByDate.SelectedDate.Value.Year, dteDeliveryByDate.SelectedDate.Value.Month, dteDeliveryByDate.SelectedDate.Value.Day, dteDeliveryByTime.SelectedDate.Value.Hour, dteDeliveryByTime.SelectedDate.Value.Minute, 0);
            dehireOrder.CollectionIsAnytime  = dehireOrder.DeliveryIsAnytime = rdDeliveryIsAnytime.Checked;

            dehireOrder.FuelSurchargePercentage = 0m;
            dehireOrder.FuelSurchargeAmount     = dehireOrder.FuelSurchargeForeignAmount = 0m;

            dehireOrder.LastRunId = JobId;

            #endregion

            #region Generation De-hire Receipt

            eDehiringReceiptType dehireReceiptType = (eDehiringReceiptType)Enum.Parse(typeof(eDehiringReceiptType), rcbDehireRecieptType.SelectedValue.Replace(" ", ""));

            dehireReceipt.JobID           = JobId;
            dehireReceipt.ReceiptNumber   = txtDeHireReceipt.Text;
            dehireReceipt.ReceiptType     = dehireReceiptType;
            dehireReceipt.NumberOfPallets = noOfPallets;
            dehireReceipt.DateIssued      = dehireOrder.DeliveryFromDateTime;

            #endregion

            Facade.IPalletBalance facPalletBalance = new Facade.Pallet();
            facPalletBalance.DehirePalletsWithNoLeg(dehireOrder, dehireReceipt, ResourceId, userID);

            int currentBalance = NoOfPallets;

            // Have any pallets been handled ?
            NoOfPalletsUpdated = (currentBalance - noOfPallets) < NoOfPallets;

            if (NoOfPalletsUpdated)
            {
                NoOfPallets = (currentBalance - noOfPallets);
            }

            if (NoOfPallets == 0)
            {
                DisplayControls();
            }
            else
            {
                ResetControls();
            }
        }
Exemple #14
0
        private void LeavePallets()
        {
            int    pointId, noOfPallets;
            string userID = ((Page.User) as Orchestrator.Entities.CustomPrincipal).UserName;

            Entities.Order leaveOrder = new Entities.Order();

            pointId     = ucLeavePoint.SelectedPoint.PointId;
            noOfPallets = (int)rntNoLeavePallets.Value.Value;

            #region Generate Leave Order

            // Setting default values for the Order.
            leaveOrder.Cases               = 0;
            leaveOrder.Weight              = 0;
            leaveOrder.GoodsTypeID         = 1; // This REALLY needs to be Pallets ( hint hint system definition ).
            leaveOrder.PalletSpaceID       = (int)ePalletSize.Normal;
            leaveOrder.CustomerOrderNumber = "palletHandling";
            leaveOrder.DeliveryOrderNumber = "palletHandling";
            leaveOrder.OrderStatus         = eOrderStatus.Delivered; //This is because the order will not be on a run so it is assumed its at the dehire point at time of creation.
            leaveOrder.OrderType           = eOrderType.PalletHandling;
            leaveOrder.OrderInstructionID  = 3;                      // Find out what this is?
            leaveOrder.CustomerIdentityID  = Orchestrator.Globals.Configuration.IdentityId;
            leaveOrder.PalletTypeID        = PalletTypeId;
            leaveOrder.NoPallets           = noOfPallets;
            leaveOrder.PalletSpaces        = leaveOrder.NoPallets;
            leaveOrder.CollectionPointID   = leaveOrder.DeliveryPointID = pointId;

            leaveOrder.ForeignRate = leaveOrder.Rate = 0m;

            leaveOrder.CollectionByDateTime = leaveOrder.DeliveryDateTime = leaveOrder.CollectionDateTime = leaveOrder.DeliveryFromDateTime = DateTime.Now;
            leaveOrder.CollectionIsAnytime  = leaveOrder.DeliveryIsAnytime = false;

            leaveOrder.FuelSurchargePercentage = 0m;
            leaveOrder.FuelSurchargeAmount     = leaveOrder.FuelSurchargeForeignAmount = 0m;

            leaveOrder.LastRunId = JobId;

            #endregion

            Facade.IPalletBalance facPalletBalance = new Facade.Pallet();
            NoOfPalletsUpdated = facPalletBalance.LeavePalletsAtPointWithNoLeg(leaveOrder, ResourceId, userID);

            int currentBalance = NoOfPallets;

            // Have any pallets been handled ?
            NoOfPalletsUpdated = (currentBalance - noOfPallets) < NoOfPallets;

            if (NoOfPalletsUpdated)
            {
                NoOfPallets = (currentBalance - noOfPallets);
            }

            if (NoOfPallets == 0)
            {
                DisplayControls();
            }
            else
            {
                ResetControls();
            }
        }