public ScriptView OnEdit(ScriptView view) { var sender = view.GetSender(); var id = sender.Data.Id; var data = ServiceContext.InvokeDynamic("getAccount", (arg) => { arg.id = id; }); data.Transform("roles.id=>value"); data.Transform("roles.name=>text"); data.Transform("rpassword=password"); data.Transform("isEnabled=status.isEnabled"); var form = view.GetElement <FormSE>("formEdit"); form.Set(data); var modal = view.GetElement <ModalSE>("editDialog"); modal.SetTitle(string.Format(Strings.ModifyAccountInformationTip, data.Dynamic.name)); modal.Open(); return(view); }
public ScriptView OnSubmitEdit(ScriptView view) { var form = view.GetElement <FormSE>("formEdit"); var data = form.Data; data.Transform("isEnabled=isEnabled", (t) => { return(DataUtil.ToValue <bool>(t)); }); data.Transform("roles=>roleIds"); ServiceContext.Invoke("updateAccount", data); MenuHelper.RemoveMenuCode(data.Dynamic.Id.ToString()); var modal = view.GetElement <ModalSE>("editDialog"); modal.Close(); var grid = view.GetElement <DataTableSE>("list"); grid.Reload(); return(view); }
public ScriptView OnAdd(ScriptView view) { var form = view.GetElement <FormSE>("formAdd"); form.Reset(); var modal = view.GetElement <ModalSE>("addDialog"); modal.Open(); return(view); }
public ScriptView OnEdit(ScriptView view) { var sender = view.GetSender(); var data = sender.Data; var form = view.GetElement <FormSE>("formEdit"); form.Set(data); var modal = view.GetElement <ModalSE>("editDialog"); modal.SetTitle(string.Format(Strings.EditFunction, data.name)); modal.Open(); return(view); }
public ScriptView OnSubmitAdd(ScriptView view) { var form = view.GetElement <FormSE>("formAdd"); var data = form.Data; ServiceContext.Invoke("addPermission", data); form.Reset(); form.AlertSuccess(Strings.SavedSuccessfully); var grid = view.GetElement <DataTableSE>("list"); grid.Reload(); return(view); }
private IScriptView OnScriptCallback(ScriptView view) { var grid = view.GetElement <DataTableSE>("list"); grid.Load(); return(view); }
public ScriptView OnPaperMetadataSearch(ScriptView view) { var grid = view.GetElement <DataTableSE>("paperMetadatas"); grid.Load(); return(view); }
public ScriptView OnSearch(ScriptView view) { var grid = view.GetElement <DataTableSE>("list"); grid.Load(); return(view); }
private void Init(ScriptView view) { var data = ServiceContext.InvokeDynamic("getUser", (arg) => { arg.Id = Principal.Id; }); data.Transform("email=account.email;mobileNumber=account.mobileNumber"); var form = view.GetElement <FormSE>("baseForm"); form.Set(data); var file = this.Template.GetFile("/Pages/MyProfile/images/photo.png"); data.Dynamic.PhotoUrl = data.Dynamic.Photo != null?ImageUtil.GetDynamicUrl(data.Dynamic.Photo.StoreKey, 192, 192, 2) : file.VirtualPath; var card = view.GetElement <HtmlEelementSE>("card"); card.Bind(data); }
public ScriptView OnSubmitEdit(ScriptView view) { var form = view.GetElement <FormSE>("formEdit"); var data = form.Data; ServiceContext.Invoke("updatePermission", data); MenuHelper.RemoveAllMenuCode(); var modal = view.GetElement <ModalSE>("editDialog"); modal.Close(); var grid = view.GetElement <DataTableSE>("list"); grid.Reload(); return(view); }
public ScriptView OnDeletes(ScriptView view) { var grid = view.GetElement <DataTableSE>("list"); var items = grid.SelectedValues; ServiceContext.Invoke("deleteRoles", items.ToReusableObject("ids")); MenuHelper.RemoveAllMenuCode(); grid.Reload(items); return(view); }
public ScriptView OnSubmitAdd(ScriptView view) { var form = view.GetElement <FormSE>("formAdd"); var data = form.Data; data.Transform("isEnabled=isEnabled", (t) => { return(DataUtil.ToValue <bool>(t)); }); data.Transform("roles=>roleIds"); ServiceContext.Invoke("addUser", data); form.Reset(); form.AlertSuccess(Strings.SavedSuccessfully); var grid = view.GetElement <DataTableSE>("list"); grid.Reload(); return(view); }
protected virtual IScriptView Login(ScriptView view) { var form = view.GetElement <FormSE>("loginForm"); var data = form.Data; data["ip"] = HttpContext.Current.Request.UserHostAddress; var handler = ModuleController.GetHandler("login"); DTObject dto = handler.Process(data); var success = dto.GetValue <bool>("success"); if (success) { form.Reset(); view.Redirect(this.SuccessUrl); } else { view.GetElement("alertText").SetText(Strings.WrongUserNamePassword); view.GetElement("alert").Visible(); } return(view); }
public ScriptView OnBaseSubmit(ScriptView view) { var form = view.GetElement <FormSE>("baseForm"); var data = form.Data; data["id"] = Principal.Id; ServiceContext.Invoke("updateUser", data); Init(view); form.AlertSuccess(Strings.SuccessfulOperation); return(view); }
public ScriptView OnEdit(ScriptView view) { var sender = view.GetSender(); var id = sender.Data.Id; var data = ServiceContext.InvokeDynamic("getRole", (arg) => { arg.id = id; }); data.Transform("permissions.id=>value"); data.Transform("permissions.name=>text"); var form = view.GetElement <FormSE>("formEdit"); form.Set(data); var modal = view.GetElement <ModalSE>("editDialog"); modal.SetTitle(string.Format(Strings.EditRole, data.Dynamic.name)); modal.Open(); return(view); }
private IScriptView UpdateUser(ScriptView view) { var e = view.GetElement(this.Id); var data = e.Data; var getUser = ModuleController.GetHandler("user.detail"); var info = getUser.Process(para => { para["id"] = data.GetValue("userId"); }); var handler = ModuleController.GetHandler("user.update"); info.SetValue("imageId", data.GetValue("photoId")); handler.Process(info); return(view); }
private IScriptView Register(ScriptView view) { var form = view.GetElement <FormSE>("registerForm"); var data = form.Data; var result = SignUp(data); if (result.Success) { view.WriteCode("SnippetLogin.displaySignInForm();"); view.WriteCode(string.Format("$$('#loginForm').show('{0}');", Strings.OperationSucceededPleaseLogin)); } else { view.WriteCode(string.Format("registerForm.proxy().showError('{0}');", result.Message)); } return(view); }
protected virtual IScriptView Login(ScriptView view) { var form = view.GetElement <FormSE>("loginForm"); var data = form.Data; data["ip"] = HttpContext.Current.Request.UserHostAddress; var success = SignIn(data); if (success) { view.Redirect(this.SuccessUrl); } else { view.WriteCode(string.Format("loginForm.proxy().showError('{0}');", Strings.WrongUserNamePassword)); } return(view); }
public ScriptView OnAccountSubmit(ScriptView view) { var form = view.GetElement <FormSE>("accountForm"); var data = form.Data; if (data.Dynamic.newPassword != data.Dynamic.rPassword) { throw new UserUIException(Strings.PasswordTip2); } data["id"] = Principal.Id; ServiceContext.Invoke("updatePassword", data); Init(view); form.AlertSuccess(Strings.SuccessfulOperation); return(view); }