コード例 #1
0
 public void AddTransportationStatus(TransportationStatus transportationStatus)
 {
     if (_calcParameters.Options.Contains(CalcOption.TransportationStatistics))
     {
         _transportationStatuses.Add(transportationStatus);
     }
 }
コード例 #2
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            TransportationStatus transportationStatus = db.TransportationStatus.Find(id);

            db.TransportationStatus.Remove(transportationStatus);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
        // Funkcija "zapri voznjo"
        public ActionResult CloseLog(string idLog)
        {
            //TransportationStatus transportationStatus = db.TransportationStatus.Where(t => t.TransportationLogID == Guid.Parse(idLog));
            //TransportationStatus transportationStatus = new TransportationStatus();
            //var x = db.TransportationStatus.Where(t => t.TransportationLogID == Guid.Parse(idLog));
            //TransportationStatus transportationStatus = db.TransportationStatus.Find(Guid.Parse(idLog));
            //var transportationStatus = db.TransportationStatus.Include(t => t.TransportationLog).Include(t => t.TransportationStatusTypes).Where(x => x.TransportationLogID == Guid.Parse(idLog));

            //TransportationStatus transportationStatus = db.TransportationStatus.Where(t => t.TransportationLogID == Guid.Parse("62416e0c - 2332 - 4836 - bac7 - 3889aaa32491"));
            //var x = db.TransportationStatus.Where(t => t.TransportationLogID == Guid.Parse(idLog));

            //TransportationStatus transportationStatus = new TransportationStatus();

            Guid tempID = Guid.Parse(idLog);
            TransportationStatus transportationStatus = db.TransportationStatus.Where(x => x.TransportationLogID == tempID).Single();

            Guid idOpen = Guid.Parse("cbaa33cc-ed89-448d-a371-72bafa5a4ff8");

            if (transportationStatus.TransportationTypeStatusID == idOpen)
            {
                TransportationStatus transportationStatus1 = new TransportationStatus();
                transportationStatus1.TransportationStatusID = Guid.NewGuid();

                transportationStatus1.DateCreated  = DateTime.Now;
                transportationStatus1.DateModified = transportationStatus1.DateCreated;

                transportationStatus1.CreatedBy  = Guid.Parse(User.Identity.GetUserId());
                transportationStatus1.ModifiedBy = transportationStatus1.CreatedBy;

                transportationStatus1.Date = DateTime.Now;

                transportationStatus1.TransportationTypeStatusID = Guid.Parse("6f754707-37b8-425b-88bd-d1515949e7cd");
                transportationStatus1.TransportationLogID        = Guid.Parse(idLog);

                db.TransportationStatus.Add(transportationStatus1);
                db.SaveChanges();

                // transportation log = neaktiven
                TransportationLog model = db.TransportationLog.Find(tempID);

                model.Active = false;

                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
        }
コード例 #4
0
        // GET: TransportationStatus/Details/5
        public ActionResult Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TransportationStatus transportationStatus = db.TransportationStatus.Find(id);

            if (transportationStatus == null)
            {
                return(HttpNotFound());
            }
            return(View(transportationStatus));
        }
コード例 #5
0
        // GET: TransportationStatus/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TransportationStatus transportationStatus = db.TransportationStatus.Find(id);

            if (transportationStatus == null)
            {
                return(HttpNotFound());
            }
            ViewBag.TransportationLogID        = new SelectList(db.TransportationLog, "TransportationLogID", "Location", transportationStatus.TransportationLogID);
            ViewBag.TransportationTypeStatusID = new SelectList(db.TransportationStatusTypes, "TransportationTypeStatusID", "Name", transportationStatus.TransportationTypeStatusID);
            return(View(transportationStatus));
        }
コード例 #6
0
        public ActionResult Create([Bind(Include = "TransportationTypeStatusID,TransportationLogID,Date,Note,Description")] TransportationStatus transportationStatus)
        {
            if (ModelState.IsValid)
            {
                transportationStatus.TransportationStatusID = Guid.NewGuid();

                transportationStatus.DateCreated  = DateTime.Now;
                transportationStatus.DateModified = transportationStatus.DateCreated;

                transportationStatus.CreatedBy  = Guid.Parse(User.Identity.GetUserId());
                transportationStatus.ModifiedBy = transportationStatus.CreatedBy;

                db.TransportationStatus.Add(transportationStatus);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.TransportationLogID        = new SelectList(db.TransportationLog, "TransportationLogID", "Location", transportationStatus.TransportationLogID);
            ViewBag.TransportationTypeStatusID = new SelectList(db.TransportationStatusTypes, "TransportationTypeStatusID", "Name", transportationStatus.TransportationTypeStatusID);
            return(View(transportationStatus));
        }
コード例 #7
0
        public ActionResult Edit([Bind(Include = "TransportationStatusID,TransportationTypeStatusID,TransportationLogID,Date,Note,Description")] TransportationStatusViewModel TransportationStatusViewModel)
        {
            if (ModelState.IsValid)
            {
                TransportationStatus model = db.TransportationStatus.Find(TransportationStatusViewModel.TransportationStatusID);

                model.Date        = TransportationStatusViewModel.Date;
                model.Note        = TransportationStatusViewModel.Note;
                model.Description = TransportationStatusViewModel.Description;

                model.DateModified = DateTime.Now;
                model.ModifiedBy   = Guid.Parse(User.Identity.GetUserId());

                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.TransportationLogID        = new SelectList(db.TransportationLog, "TransportationLogID", "Location", TransportationStatusViewModel.TransportationLogID);
            ViewBag.TransportationTypeStatusID = new SelectList(db.TransportationStatusTypes, "TransportationTypeStatusID", "Name", TransportationStatusViewModel.TransportationTypeStatusID);
            return(View(TransportationStatusViewModel));
        }
コード例 #8
0
        public ActionResult Create([Bind(Include = "ContainerID,VehicleID,CargoID,CustomerID,CostID,Date,Location,Note,Description")] TransportationLog transportationLog, bool checkHousehold = false, bool checkCosts = false)
        {
            if (ModelState.IsValid)
            {
                transportationLog.TransportationLogID = Guid.NewGuid();

                transportationLog.DateCreated  = DateTime.Now;
                transportationLog.DateModified = transportationLog.DateCreated;

                transportationLog.CreatedBy  = Guid.Parse(User.Identity.GetUserId());
                transportationLog.ModifiedBy = transportationLog.CreatedBy;

                transportationLog.Active = true;

                db.TransportationLog.Add(transportationLog);
                db.SaveChanges();


                // CHECKBOX za COSTS!

                /*if (checkCosts == true)
                 * {
                 *  Costs costs = new Costs();
                 *  costs.CostID = Guid.NewGuid();
                 *
                 *  costs.DateCreated = transportationLog.DateCreated;
                 *  costs.DateModified = transportationLog.DateModified;
                 *
                 *  costs.CreatedBy = transportationLog.CreatedBy;
                 *  costs.ModifiedBy = transportationLog.ModifiedBy;
                 *
                 *  costs.Amount = amount;
                 *  costs.Date = transportationLog.Date;
                 *  costs.Note = note;
                 *  costs.CostTypeID
                 *
                 *
                 *
                 *  db.Costs.Add(costs);
                 *  db.SaveChanges();
                 * }*/

                // tukaj dodaj za transporation status zapis
                //Guid latestTransporationLogID = transportationLog.TransportationLogID;
                TransportationStatus transportationStatus = new TransportationStatus();
                transportationStatus.TransportationStatusID = Guid.NewGuid();

                transportationStatus.DateCreated  = transportationLog.DateCreated;
                transportationStatus.DateModified = transportationLog.DateModified;

                transportationStatus.CreatedBy  = transportationLog.CreatedBy;
                transportationStatus.ModifiedBy = transportationLog.ModifiedBy;

                transportationStatus.Date = DateTime.Now;

                transportationStatus.TransportationTypeStatusID = Guid.Parse("cbaa33cc-ed89-448d-a371-72bafa5a4ff8");
                transportationStatus.TransportationLogID        = transportationLog.TransportationLogID;

                db.TransportationStatus.Add(transportationStatus);
                db.SaveChanges();

                // CHECKBOX za HOUSEHOLD!
                if (checkHousehold == true)
                {
                    return(RedirectToAction("Create", "HouseholdTransportation", new { LogID = transportationLog.TransportationLogID }));
                }

                return(RedirectToAction("Index"));
            }

            ViewBag.CargoID     = new SelectList(db.CargoTypes, "CargoID", "Name", transportationLog.CargoID);
            ViewBag.ContainerID = new SelectList(db.Containers, "ContainerID", "Name", transportationLog.ContainerID);
            //ViewBag.CostID = new SelectList(db.Costs, "CostID", "Note", transportationLog.CostID);
            ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "Description", transportationLog.CustomerID);
            ViewBag.VehicleID  = new SelectList(db.Vehicles, "VehicleID", "Name", transportationLog.VehicleID);
            return(View(transportationLog));
        }
コード例 #9
0
 public virtual void CreateOperation(Warehouse warehouseSrc, Warehouse warehouseDst, DateTime time, TransportationStatus status)
 {
     CounterpartyMovementOperation = null;
     WarehouseMovementOperation = new WarehouseMovementOperation
         {
             WriteoffWarehouse = warehouseSrc,
             IncomingWarehouse = status == TransportationStatus.WithoutTransportation ?  warehouseDst : null,
             Amount = Amount,
             OperationTime = time,
             Nomenclature = Nomenclature,
             Equipment = Equipment
         };
     if (status == TransportationStatus.Delivered)
         CreateOperation(warehouseDst, Document.DeliveredTime.Value);
 }
コード例 #10
0
        public virtual void TransportationCompleted()
        {
            if (Category != MovementDocumentCategory.Transportation)
                throw new InvalidOperationException("Нельзя завершить доставку для документа не имеющего тип транспортировка.");
            DeliveredTime = DateTime.Now;
            TransportationStatus = TransportationStatus.Delivered;

            foreach(var item in Items)
            {
                item.CreateOperation(ToWarehouse, DeliveredTime.Value);
            }
        }
コード例 #11
0
        public virtual void AddItem(Nomenclature nomenclature, decimal amount, decimal inStock)
        {
            var item = new MovementDocumentItem
            {
                    Nomenclature = nomenclature,
                    Amount = amount,
                    AmountOnSource = inStock,
                    Document = this
            };
            if (Category == MovementDocumentCategory.counterparty)
                item.CreateOperation(FromClient, FromDeliveryPoint, ToClient, ToDeliveryPoint, TimeStamp);
            else if (Category == MovementDocumentCategory.warehouse)
                item.CreateOperation(FromWarehouse, ToWarehouse, TimeStamp, TransportationStatus);
            else
            {
                if (TransportationStatus == TransportationStatus.WithoutTransportation)
                    TransportationStatus = TransportationStatus.Submerged;
                item.CreateOperation(FromWarehouse, ToWarehouse, TimeStamp, TransportationStatus);
            }

            ObservableItems.Add (item);
        }