예제 #1
0
        private void CreateStageCollections(List <double> pressure, List <double> water, List <double> sand, List <double> duration)
        {
            bool matchSize = pressure.Count == water.Count && pressure.Count == sand.Count && pressure.Count == duration.Count;

            if (!matchSize)
            {
                return;
            }

            for (int i = 0; i < pressure.Count; i++)
            {
                DateTime plotTime = JobDate.AddMilliseconds(duration[i]);
                if (pressureData.ContainsKey(plotTime))
                {
                    var average = (pressureData[plotTime] + pressure[i]) / 2;
                    pressureData[plotTime] = average;
                }
                else
                {
                    pressureData.Add(plotTime, pressure[i]);
                }

                if (waterData.ContainsKey(plotTime))
                {
                    var average = (waterData[plotTime] + water[i]) / 2;
                    waterData[plotTime] = average;
                }
                else
                {
                    waterData.Add(plotTime, water[i]);
                }

                if (sandData.ContainsKey(plotTime))
                {
                    var average = (sandData[plotTime] + sand[i]) / 2;
                    sandData[plotTime] = average;
                }
                else
                {
                    sandData.Add(plotTime, sand[i]);
                }
                JobDate = plotTime;
            }
        }
예제 #2
0
        public ActionResult ChangeDate(JobDate job, DateTime jobdate, TimeSpan jobtime)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    job.jobstatusid     = 6;
                    job.jobdate1        = jobdate.Add(jobtime);
                    db.Entry(job).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();

                    return(RedirectToAction("detail/" + job.jobid));
                }
                catch (Exception e)
                {
                    return(RedirectToAction("Error500", "Home", new { errormsg = e.Message }));
                }
            }
            else
            {
                return(RedirectToAction("Error500", "Home", new { errormsg = "There is an error processing your input/request!" }));
            }
        }