Exemplo n.º 1
0
        protected string stopEvent()
        {
            int time = 0;

            int.TryParse(Request.Form["time"], out time);

            string line = Request.Form["line"];
            int intLine = 0;
            int.TryParse(line, out intLine);

            decimal minutes = time;

            DateTime startdatetime = DateTime.Now;
            DateTime enddatetime = DateTime.Now.AddMinutes((double)minutes);

            /*
            DowntimeReason downtime = DCSDashboardDemoHelper.GetRandomReason("admin");

            string reason = downtime.Level1;

            if (!string.IsNullOrEmpty(downtime.Level2))
                reason += " > " + downtime.Level2;

            if (!string.IsNullOrEmpty(downtime.Level3))
                reason += " > " + downtime.Level3;

            string comment = DCSDashboardDemoHelper.GetRandomComment(reason);

            int reasonId = downtime.ID;

            */

            bool result = false;
            using (DB db = new DB())
            {
                DowntimeData dd = new DowntimeData();
                dd.EventStart = startdatetime;
                dd.EventStop = enddatetime;
                dd.Minutes = minutes;
                dd.Line = line;
                dd.Client = "admin";
                db.AddToDowntimeDataSet(dd);

                result = db.SaveChanges() > 0;
            }

              //      stopEventLine();

            return result.ToString();
        }