Пример #1
0
        private void AddDestination(int jobId)
        {
            DateTime lastUpdateDate = DateTime.Parse(Request.QueryString["LastUpdateDate"]);

            Facade.IJob facJob = new Facade.Job();

            // Define the trunk instruction.
            DateTime bookedDateTime = new DateTime(rdiArrivalDate.SelectedDate.Value.Year, rdiArrivalDate.SelectedDate.Value.Month, rdiArrivalDate.SelectedDate.Value.Day, rdiArrivalTime.SelectedDate.Value.Hour, rdiArrivalTime.SelectedDate.Value.Minute, 0);
            TimeSpan travellingTime = bookedDateTime.Subtract(CurrentJob.Instructions[CurrentJob.Instructions.Count - 1].PlannedDepartureDateTime);

            Entities.CustomPrincipal user   = (Entities.CustomPrincipal)Page.User;
            Entities.FacadeResult    result = facJob.AttachDestination(CurrentJob, ucPoint.PointID, chkDriver.Checked, chkVehicle.Checked, chkTrailer.Checked, travellingTime, true, user.IdentityId, user.UserName);

            if (result.Success)
            {
                Cache.Remove(jobEntityForJobId + JobId.ToString());
                this.ReturnValue = "refresh";
                this.Close();
            }
            else
            {
                infrigementDisplay.Infringements = result.Infringements;
                infrigementDisplay.DisplayInfringments();
            }
        }