Exemple #1
0
        public void SetRoute(IList <TransportMethod> meansOfTransport)
        {
            Guard.ArgumentNotNull(() => meansOfTransport, meansOfTransport);

            if (meansOfTransport.Count == 0)
            {
                throw new InvalidOperationException(
                          "Attempted to set means of transport to an empty list. Notification: "
                          + this.NotificationId);
            }

            var             builder       = new StringBuilder();
            TransportMethod previousMeans = default(TransportMethod);

            for (int i = 0; i < meansOfTransport.Count; i++)
            {
                if (previousMeans == meansOfTransport[i])
                {
                    throw new InvalidOperationException(
                              "Attempted to set means of transport with two consecutive means of transport being the same. The sequence was: "
                              + string.Join(string.Empty, meansOfTransport.Select(mot => EnumHelper.GetShortName(mot))));
                }

                builder.Append(EnumHelper.GetShortName(meansOfTransport[i]));

                if (i < meansOfTransport.Count - 1)
                {
                    builder.Append(Separator);
                }

                previousMeans = meansOfTransport[i];
            }

            this.MeansOfTransportInternal = builder.ToString();
        }
        private void TransportComboBox_SelectedIndexChanged(object sender, EventArgs args)
        {
            TransportMethod method = (TransportMethod)TransportComboBox.SelectedItem;

            SetView(method.View);
            SharedData.Instance.Transport = method.Transport;
        }
Exemple #3
0
 public EncoderUnit(string transcoder, string arguments, TransportMethod inputMethod, TransportMethod outputMethod, LogStream logStream)
 {
     this.transcoderPath = transcoder;
     this.arguments      = arguments;
     this.inputMethod    = inputMethod;
     this.outputMethod   = outputMethod;
     this.logStream      = logStream;
 }
Exemple #4
0
 public EncoderUnit(string transcoder, string arguments, TransportMethod inputMethod, TransportMethod outputMethod, LogStream logStream)
 {
     this.transcoderPath = transcoder;
     this.arguments = arguments;
     this.inputMethod = inputMethod;
     this.outputMethod = outputMethod;
     this.logStream = logStream;
 }
Exemple #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            TransportMethod transportMethod = db.TransportMethods.Find(id);

            db.TransportMethods.Remove(transportMethod);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #6
0
 public EncoderConfig(string displayName,bool useTranscoding, string fileName, string args, TransportMethod inputMethod, TransportMethod outputMethod)
 {
     this.displayName = displayName;
       this.useTranscoding = useTranscoding;
       this.fileName = fileName;
       this.args = args;
       this.inputMethod = inputMethod;
       this.outputMethod = outputMethod;
 }
Exemple #7
0
 public EncoderConfig(string displayName, bool useTranscoding, string fileName, string args, TransportMethod inputMethod, TransportMethod outputMethod)
 {
     this.displayName    = displayName;
     this.useTranscoding = useTranscoding;
     this.fileName       = fileName;
     this.args           = args;
     this.inputMethod    = inputMethod;
     this.outputMethod   = outputMethod;
 }
Exemple #8
0
 public ActionResult Edit([Bind(Include = "TransportMethodID,TransportMode,TransportClass,AvgMPG,CityMPG,HwyMPG,CO2Lbs,MakeID,ModelID,YearID,OptionID,Make,Model,Year,Options")] TransportMethod transportMethod)
 {
     if (ModelState.IsValid)
     {
         db.Entry(transportMethod).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MakeID   = new SelectList(db.Makes, "MakeID", "MakeName", transportMethod.MakeID);
     ViewBag.ModelID  = new SelectList(db.Models, "ModelID", "ModelName", transportMethod.ModelID);
     ViewBag.OptionID = new SelectList(db.Options, "OptionID", "OptionName", transportMethod.OptionID);
     ViewBag.YearID   = new SelectList(db.Years, "YearID", "Year1", transportMethod.YearID);
     return(View(transportMethod));
 }
Exemple #9
0
        // GET: TransportMethods/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TransportMethod transportMethod = db.TransportMethods.Find(id);

            if (transportMethod == null)
            {
                return(HttpNotFound());
            }
            return(View(transportMethod));
        }
        public ActionResult Create([Bind(Include = "TransportMethodID,TransportMode,TransportClass,AvgMPG,CityMPG,HwyMPG,CO2Lbs,MakeID,ModelID,YearID,OptionID,Make,Model,Year,Options")] TransportMethod transportMethod)
        {
            if (ModelState.IsValid)
            {
                transportMethod.TransportMode = "Automobile";
                db.TransportMethods.Add(transportMethod);
                db.SaveChanges();
                return(RedirectToAction("Create", "Commutes"));
            }

            ViewBag.MakeID   = new SelectList(db.Makes, "MakeID", "MakeName", transportMethod.MakeID);
            ViewBag.ModelID  = new SelectList(db.Models, "ModelID", "ModelName", transportMethod.ModelID);
            ViewBag.OptionID = new SelectList(db.Options, "OptionID", "OptionName", transportMethod.OptionID);
            ViewBag.YearID   = new SelectList(db.Years, "YearID", "Year1", transportMethod.YearID);
            return(View(transportMethod));
        }
Exemple #11
0
        // GET: TransportMethods/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TransportMethod transportMethod = db.TransportMethods.Find(id);

            if (transportMethod == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MakeID   = new SelectList(db.Makes, "MakeID", "MakeName", transportMethod.MakeID);
            ViewBag.ModelID  = new SelectList(db.Models, "ModelID", "ModelName", transportMethod.ModelID);
            ViewBag.OptionID = new SelectList(db.Options, "OptionID", "OptionName", transportMethod.OptionID);
            ViewBag.YearID   = new SelectList(db.Years, "YearID", "Year1", transportMethod.YearID);
            return(View(transportMethod));
        }
Exemple #12
0
 public EncoderUnit(string transcoder, string arguments, TransportMethod inputMethod, TransportMethod outputMethod, LogStream logStream, StreamContext context)
     : this(transcoder, arguments, inputMethod, outputMethod, logStream)
 {
     this.context = context;
 }
 public EncoderUnit(string transcoder, string arguments, TransportMethod inputMethod, TransportMethod outputMethod, LogStream logStream, StreamContext context)
     : this(transcoder, arguments, inputMethod, outputMethod, logStream)
 {
     this.context = context;
 }