Ejemplo n.º 1
0
        public PartialViewResult EditPV(long id)
        {
            EndPointCommand Command = uof_repos.repoEndPointCommands.Find(id);

            ViewBag.EndPointID = new SelectList(uof_repos.repoEndpoints.GetList(), "ID", "Title", Command.EndPointID);
            return(PartialView("_Edit", Command));
        }
Ejemplo n.º 2
0
        public PartialViewResult DeletePV(long id)
        {
            EndPointCommand Command = UnitOfWork_Repositories.repoEndPointCommands.Find(id);

            ViewBag.EndPointID = new SelectList(UnitOfWork_Repositories.repoEndpoints.GetList(), "ID", "Title", Command.EndPointID);
            return(PartialView("_Delete", Command));
        }
Ejemplo n.º 3
0
 public ActionResult DeletePV([Bind(Include = "ID,Title,Description,EndPointID")] EndPointCommand Command)
 {
     ResultInfo.Result res = ResultInfo.GetResultByID(1);
     if (ModelState.IsValid)
     {
         res = uof_repos.repoEndPointCommands.Detele(Command.ID);
         return(Json(res));
     }
     return(Json(res));
 }
Ejemplo n.º 4
0
 public ActionResult ExecutePV([Bind(Include = "ID,EndPointID,CommandCode")] EndPointCommand Command)
 {
     ResultInfo.Result res = ResultInfo.GetResultByID(1);
     if (ModelState.IsValid)
     {
         res = uof_repos.repoEndPointCommands.Execute(Command.ID, Command.CommandCode, User.Identity.ToString());
         return(Json(res));
     }
     return(Json(res));
 }
Ejemplo n.º 5
0
        public ActionResult Details(long id)
        {
            if (ValidateUserPermissions(true, false) == false)
            {
                return(RedirectToAction("Login", "Account"));
            }
            EndPointCommand cmd = uof_repos.repoEndPointCommands.Find(id);

            return(View(cmd));
        }
Ejemplo n.º 6
0
 public ActionResult EditPV([Bind(Include = "ID,Title,Description,EndPointID,CommandCode")] EndPointCommand Command)
 {
     ResultInfo.Result res = ResultInfo.GetResultByID(1);
     if (ModelState.IsValid)
     {
         res = uof_repos.repoEndPointCommands.Edit(Command.ID, Command.Title, Command.Description, long.Parse(Command.EndPointID.ToString()), Command.CommandCode);
         return(Json(res));
     }
     return(Json(res));
 }
Ejemplo n.º 7
0
 public ActionResult AddPV([Bind(Include = "Title,EndPointID,Description,CommandCode")] EndPointCommand command)
 {
     ResultInfo.Result res = ResultInfo.GetResultByID(1);
     if (ModelState.IsValid)
     {
         long cmd = long.Parse(command.EndPointID.ToString());
         res = uof_repos.repoEndPointCommands.Add(command.Title, long.Parse(command.EndPointID.ToString()), command.Description, command.CommandCode, "1");
         return(Json(res));
     }
     return(Json(res));
 }
Ejemplo n.º 8
0
 public ActionResult ExecutePV([Bind(Include = "ID,EndPointID")] EndPointCommand Command)
 {
     ResultInfo.Result res = ResultInfo.GetResultByID(1);
     if (ModelState.IsValid)
     {
         Endpoint end = UnitOfWork_Repositories.repoEndpoints.Find((long)Command.EndPointID);
         res = UnitOfWork_Repositories.repoEndPointCommands.Execute(Command.ID, Guid.Parse(end.KeyPass.ToString()), User.Identity.ToString());
         return(Json(res));
     }
     return(Json(res));
 }
        public static APIEndPointCommand fromEndpointCommand(EndPointCommand sourceEndpointCommand)
        {
            APIEndPointCommand result = new APIEndPointCommand();

            result.ID          = sourceEndpointCommand.ID;
            result.Title       = sourceEndpointCommand.Title;
            result.Description = sourceEndpointCommand.Description;
            result.CommandCode = sourceEndpointCommand.CommandCode;
            result.EndPointID  = sourceEndpointCommand.EndPointID;

            return(result);
        }
Ejemplo n.º 10
0
 public ResultInfo.Result Detele(long id)
 {
     try
     {
         EndPointCommand cmd = db.EndPointCommands.Find(id);
         db.EndPointCommands.Remove(cmd);
         db.SaveChanges();
         return(ResultInfo.GenerateOKResult("Deleted", cmd.ID));
     }
     catch
     {
         return(ResultInfo.GetResultByID(1));
     }
 }
 public ResultInfo.Result Detele(long id)
 {
     try
     {
         EndPointCommand cmd = db.EndPointCommands.Find(id);
         db.EndPointCommands.Remove(cmd);
         db.SaveChanges();
         return(Result.GenerateOKResult("Deleted", cmd.ID.ToString()));
     }
     catch
     {
         return(Result.GenerateFailedResult());
     }
 }
        public ResultInfo.Result Execute(long commandID, string command, string userID)
        {
            try
            {
                EndPointCommand cmd = Find(commandID);
                db.SubmitEndpointCommand(cmd.ID, command, null);
            }
            catch
            {
                return(ResultInfo.GetResultByID(1));
            }

            return(ResultInfo.GenerateOKResult());
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Find Command by ID
        /// </summary>
        /// <param name="id">Command ID</param>
        /// <returns>Command object</returns>
        public EndPointCommand Find(long id)
        {
            EndPointCommand        cmd  = new EndPointCommand();
            List <EndPointCommand> cmds = db.EndPointCommands.Where(l => l.ID == id).ToList();

            if (cmds.Count == 1)
            {
                cmd = cmds[0];
            }
            else
            {
                throw new Exception("Not Found");
            }
            return(cmd);
        }
Ejemplo n.º 14
0
 public ResultInfo.Result Edit(long id, string title, string description, long EndPointID, string commandCode)
 {
     try
     {
         EndPointCommand cmd = db.EndPointCommands.Find(id);
         cmd.Title       = title;
         cmd.Description = description;
         cmd.CommandCode = commandCode;
         cmd.EndPointID  = EndPointID;
         db.SaveChanges();
         return(ResultInfo.GenerateOKResult("Saved", cmd.ID));
     }
     catch
     {
         return(ResultInfo.GetResultByID(1));
     }
 }
Ejemplo n.º 15
0
 public ResultInfo.Result Execute(long commandID, Guid endPointKeyPass, string ownerID)
 {
     try
     {
         EndPointCommand cmd = Find(commandID);
         if (cmd.Endpoint.KeyPass == endPointKeyPass)
         {
             return(UnitOfWork_Repositories.repoEndpointIOs.Add(cmd.Endpoint.ID, cmd.CommandCode, EndpointIOsRepository.EndPointIOType.Command));
         }
         else
         {
             return(ResultInfo.GetResultByID(1));
         }
     }
     catch
     {
         return(ResultInfo.GetResultByID(1));
     }
 }
Ejemplo n.º 16
0
 public ResultInfo.Result Add(string title, long EndPointID, string description, string commandCode, string ownerID)
 {
     try
     {
         EndPointCommand cmd = new EndPointCommand();
         cmd.Title       = title;
         cmd.EndPointID  = EndPointID;
         cmd.Description = description;
         cmd.CommandCode = commandCode;
         cmd.OwnerID     = ownerID;
         db.EndPointCommands.Add(cmd);
         db.SaveChanges();
         return(ResultInfo.GenerateOKResult("Saved", cmd.ID));
     }
     catch
     {
         return(ResultInfo.GetResultByID(1));
     }
 }
        public static APIEndPointCommand fromEndpointCommand(EndPointCommand sourceEndpointCommand, bool loadEndpoint)
        {
            APIEndPointCommand result = new APIEndPointCommand();

            result.ID          = sourceEndpointCommand.ID;
            result.Title       = sourceEndpointCommand.Title;
            result.Description = sourceEndpointCommand.Description;
            result.CommandCode = sourceEndpointCommand.CommandCode;

            #region Load Parents
            if (loadEndpoint)
            {
                #region EndPoint
                result.EndPoint = TypesMapper.APIEndPointAdapter.fromEndpoint(sourceEndpointCommand.Endpoint, false, false);

                #endregion
            }
            #endregion

            return(result);
        }
Ejemplo n.º 18
0
        public PartialViewResult DetailsPV(long id)
        {
            EndPointCommand command = uof_repos.repoEndPointCommands.Find(id);

            return(PartialView("_Details_Main", command));
        }
Ejemplo n.º 19
0
        public PartialViewResult ExecutePV(long id)
        {
            EndPointCommand Command = uof_repos.repoEndPointCommands.Find(id);

            return(PartialView("_Execute", Command));
        }
Ejemplo n.º 20
0
        public PartialViewResult DetailsPV(long id)
        {
            EndPointCommand command = UnitOfWork_Repositories.repoEndPointCommands.Find(id);

            return(PartialView("_Details_Main", command));
        }
Ejemplo n.º 21
0
        public PartialViewResult ExecutePV(long id)
        {
            EndPointCommand Command = UnitOfWork_Repositories.repoEndPointCommands.Find(id);

            return(PartialView("_Execute", Command));
        }