Example #1
0
 private ResultInfo.Result SubmitIO(Guid endPointKeyPass, EndPointIOType IOTypeID, string Valu, DateTime executionTimeStamp)
 {
     try
     {
         List <Endpoint> ends = db.Endpoints.Where(e => e.GUID == endPointKeyPass).ToList();
         if (ends.Count == 1)
         {
             return(Add(ends[0].ID, Valu, IOTypeID, executionTimeStamp));
         }
         else
         {
             return(ResultInfo.GetResultByID(1));
         }
     }
     catch
     {
         return(ResultInfo.GetResultByID(1));
     }
 }
Example #2
0
 public ResultInfo.Result Add(long endPointID, string value, EndPointIOType ioType, DateTime executionTime, DateTime scheduleTimeStamp)
 {
     try
     {
         Endpoint   end   = db.Endpoints.Find(endPointID);
         EndPointIO endIO = new EndPointIO();
         endIO.EndPointID        = endPointID;
         endIO.Valu              = value;
         endIO.IOTypeID          = long.Parse(ioType.GetHashCode().ToString());
         endIO.TimeStamp         = executionTime;
         endIO.ExecTimeStamp     = executionTime;
         endIO.ScheduleTimeStamp = scheduleTimeStamp;
         endIO.ThingID           = end.ThingID;
         db.EndPointIOs.Add(endIO);
         db.SaveChanges();
         return(ResultInfo.GenerateOKResult("Saved", endIO.ID));
     }
     catch
     {
         return(ResultInfo.GetResultByID(1));
     }
 }
Example #3
0
        public ResultInfo.Result Add(long endPointID, string value, EndPointIOType ioType)
        {
            //try
            //{
            Endpoint ep = db.Endpoints.Find(endPointID);

            EndPointIO endIO = new EndPointIO();

            endIO.EndPointID = endPointID;
            endIO.Valu       = value;
            endIO.IOTypeID   = long.Parse(ioType.GetHashCode().ToString());
            DateTime execTime = DateTime.UtcNow.AddHours(double.Parse(ep.Device.UTC_Diff.ToString()));

            endIO.TimeStamp = execTime;
            endIO.ThingID   = ep.ThingID;
            db.EndPointIOs.Add(endIO);
            db.SaveChanges();
            return(ResultInfo.GenerateOKResult("Saved", endIO.ID));
            //}
            //catch (Exception ex)
            //{
            //    return ResultInfo.GenerateErrorResult(ex.Message + " :: " + ex.InnerException);
            //}
        }
 private ResultInfo.Result SubmitIO(Guid endPointKeyPass, EndPointIOType IOTypeID, string Valu, DateTime executionTimeStamp)
 {
     try
     {
         List<Endpoint> ends = db.Endpoints.Where(e => e.GUID == endPointKeyPass).ToList();
         if (ends.Count == 1)
         {
             return Add(ends[0].ID, Valu, IOTypeID, executionTimeStamp);
         }
         else
         {
             return ResultInfo.GetResultByID(1);
         }
     }
     catch
     {
         return ResultInfo.GetResultByID(1);
     }
 }
        public ResultInfo.Result Add(long endPointID, string value, EndPointIOType ioType)
        {
            //try
            //{
            Endpoint ep = db.Endpoints.Find(endPointID);

            EndPointIO endIO = new EndPointIO();
            endIO.EndPointID = endPointID;
            endIO.Valu = value;
            endIO.IOTypeID = long.Parse(ioType.GetHashCode().ToString());
            DateTime execTime = DateTime.UtcNow.AddHours(double.Parse(ep.Device.UTC_Diff.ToString()));
            endIO.TimeStamp = execTime;
            endIO.ThingID = ep.ThingID;
            db.EndPointIOs.Add(endIO);
            db.SaveChanges();
            return ResultInfo.GenerateOKResult("Saved", endIO.ID);
            //}
            //catch (Exception ex)
            //{
            //    return ResultInfo.GenerateErrorResult(ex.Message + " :: " + ex.InnerException);
            //}
        }
 public ResultInfo.Result Add(long endPointID, string value, EndPointIOType ioType, DateTime executionTime, DateTime scheduleTimeStamp)
 {
     try
     {
         Endpoint end = db.Endpoints.Find(endPointID);
         EndPointIO endIO = new EndPointIO();
         endIO.EndPointID = endPointID;
         endIO.Valu = value;
         endIO.IOTypeID = long.Parse(ioType.GetHashCode().ToString());
         endIO.TimeStamp = executionTime;
         endIO.ExecTimeStamp = executionTime;
         endIO.ScheduleTimeStamp = scheduleTimeStamp;
         endIO.ThingID = end.ThingID;
         db.EndPointIOs.Add(endIO);
         db.SaveChanges();
         return ResultInfo.GenerateOKResult("Saved", endIO.ID);
     }
     catch
     {
         return ResultInfo.GetResultByID(1);
     }
 }