// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of System.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (Repair.Expression != null) { targetCommand.AddParameter("Repair", Repair.Get(context)); } if (Server.Expression != null) { targetCommand.AddParameter("Server", Server.Get(context)); } if (Credential.Expression != null) { targetCommand.AddParameter("Credential", Credential.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
public ActionResult FinishDate(Repair record) { var result = false; var message = "Lưu thông tin không thành công"; RepairModel model = null; if (AccountInfo.Type != LoginType.Sale && AccountInfo.Username != "admin") { message = "Bạn chưa có quyền sử dụng chức năng này"; } else if (result = record.SaveFinishDate(UserID, Employee.ID)) { message = "Lưu thông tin thành công"; model = Repair.Get(UserID, Employee.ID, record.ID); var login = Login.Get(UserID); model.ViewInternalNote = login.Type == LoginType.Mechanic || login.Type == LoginType.Office || login.Username == "admin"; } if (Request.IsAjaxRequest()) { return(Json(new { result = result, message = message, html = result ? RenderPartialViewToString(Views.Detail, model) : null }, JsonRequestBehavior.DenyGet)); } var list = new RepairList(); list.Current = model; return(View(Views.History, list)); }
public ActionResult Detail(int id) { var model = Repair.Get(UserID, Employee.ID, id); var login = Login.Get(UserID); model.ViewInternalNote = login.Type == LoginType.Mechanic || login.Type == LoginType.Office || login.Username == "admin"; if (Request.IsAjaxRequest()) { return(Json(new { html = RenderPartialViewToString(Views.Detail, model) }, JsonRequestBehavior.AllowGet)); } var list = new RepairList(); list.Current = model; return(View(Views.History, list)); }
public ActionResult Update(int id) { var model = Repair.Get(UserID, Employee.ID, id); model.Edit = true; var login = Login.Get(UserID); model.Editable = login.Type == LoginType.Office || login.Username == "admin"; if (Request.IsAjaxRequest()) { return(Json(new { html = RenderPartialViewToString("Edit", model) }, JsonRequestBehavior.AllowGet)); } var list = new RepairList(); list.Current = model; return(View(Views.History, list)); }