public virtual ActionResult ChangePassword() { WorkContext.Breadcrumbs.Add(T("Account")); WorkContext.Breadcrumbs.Add(T("Change Password")); var model = new ChangePasswordModel { Email = WorkContext.CurrentUser.Email, UserName = WorkContext.CurrentUser.UserName }; var result = new ControlFormResult <ChangePasswordModel>(model) { Title = T("Change Password").Text, UpdateActionName = "ChangePassword", SubmitButtonText = T("Change Password"), CancelButtonUrl = Url.Action("Manage"), ShowBoxHeader = false, IconHeader = "fa fa-lg fa-fw fa-user", FormWrapperStartHtml = Constants.Form.FormWrapperStartHtml, FormWrapperEndHtml = Constants.Form.FormWrapperEndHtml, }; result.MakeReadOnlyProperty(x => x.Email); result.MakeReadOnlyProperty(x => x.UserName); return(result); }
public ActionResult Edit(int id) { WorkContext.Breadcrumbs.Add(new Breadcrumb { Text = T("Quản lý đơn hàng"), Url = "#" }); WorkContext.Breadcrumbs.Add(new Breadcrumb { Text = T("Xem thông tin đơn hàng"), Url = Url.Action("Index") }); var model = new OrdersModel(); if (id > 0) { model = this.service.GetById(id); } var result = new ControlFormResult <OrdersModel>(model) { Title = this.T("Xem thông tin đơn hàng"), FormMethod = FormMethod.Post, UpdateActionName = "Update", ShowCancelButton = false, ShowBoxHeader = false, FormWrapperStartHtml = Constants.Form.FormWrapperStartHtml, FormWrapperEndHtml = Constants.Form.FormWrapperEndHtml }; result.MakeReadOnlyProperty(x => x.OrderCode); result.MakeReadOnlyProperty(x => x.FullName); result.MakeReadOnlyProperty(x => x.PhoneNumber); result.MakeReadOnlyProperty(x => x.Email); result.MakeReadOnlyProperty(x => x.PaymentType); result.MakeReadOnlyProperty(x => x.PaymentCode); result.RegisterExternalDataSource(x => x.PaymentType, y => BindPaymentTypes()); var result2 = new ControlGridFormResult <OrderDetailsInfo> { Title = T("Danh sách sản phẩm"), CssClass = "table table-bordered table-striped", IsAjaxSupported = true, FetchAjaxSource = GetProducts, DefaultPageSize = WorkContext.DefaultPageSize, EnablePaginate = true, UpdateActionName = "Update", GridWrapperStartHtml = Constants.Grid.GridWrapperStartHtml, GridWrapperEndHtml = Constants.Grid.GridWrapperEndHtml, ClientId = TableName }; result2.AddCustomVar(Extensions.Constants.OrderId, id); result2.AddColumn(x => x.ProductName, T("Tên sản phẩm")); result2.AddColumn(x => x.Capacity, T("Thể tích")); result2.AddColumn(x => x.Quantity, T("Số lượng")); result2.AddColumn(x => x.Price, T("Giá")); result2.AddColumn(x => (x.Price * x.Quantity), T("Thành tiền")); result.AddAction().HasText(this.T("Back")).HasUrl(this.Url.Action("Index")).HasButtonStyle(ButtonStyle.Danger); return(new ControlFormsResult(result, result2)); }
public ActionResult Edit(int id) { WorkContext.Breadcrumbs.Add(new Breadcrumb { Text = T("Quản lý sản phẩm"), Url = "#" }); WorkContext.Breadcrumbs.Add(new Breadcrumb { Text = T("Thông tin sản phẩm"), Url = Url.Action("Index") }); var model = new ProductModel(); if (id > 0) { model = this.service.GetById(id); } var result = new ControlFormResult <ProductModel>(model); result.Title = this.T("Thông tin sản phẩm"); result.FormMethod = FormMethod.Post; result.UpdateActionName = "Update"; result.ShowCancelButton = false; result.ShowBoxHeader = false; result.FormWrapperStartHtml = Constants.Form.FormWrapperStartHtml; result.FormWrapperEndHtml = Constants.Form.FormWrapperEndHtml; result.RegisterFileUploadOptions("Image.FileName", new ControlFileUploadOptions { AllowedExtensions = "jpg,jpeg,png,gif" }); result.MakeReadOnlyProperty(x => x.CategoryId); result.AddAction().HasText(this.T("Clear")).HasUrl(this.Url.Action("Edit", RouteData.Values.Merge(new { id = 0 }))).HasButtonStyle(ButtonStyle.Success); result.AddAction().HasText(this.T("Back")).HasUrl(this.Url.Action("Index")).HasButtonStyle(ButtonStyle.Danger); result.RegisterExternalDataSource(x => x.CategoryId, y => BindCategories()); result.RegisterExternalDataSource(x => x.GroupId, y => BindProductGroup()); result.RegisterExternalDataSource(x => x.Type, y => BindProductTypes()); return(result); }
public ActionResult Edit(int id, int cateId, int articlesId) { WorkContext.Breadcrumbs.Add(new Breadcrumb { Text = T("Quản lý ảnh bài viết"), Url = "#" }); WorkContext.Breadcrumbs.Add(new Breadcrumb { Text = T("Thông tin ảnh bài viết"), Url = Url.Action("Index") }); var model = new ImagesModel { CategoryId = cateId, ArticlesId = articlesId }; var service = WorkContext.Resolve <IImagesService>(); if (id > 0) { var item = service.GetById(id); if (item != null) { model.CategoryId = item.CategoryId; model.ArticlesId = item.ArticlesId; model.ListCategory = Utilities.ParseListInt(item.ListCategory); if (item.ArticlesId > 0) { var list = service.GetRecords(x => x.ArticlesId == item.ArticlesId && x.CategoryId == 0); var listModel = list.Select(image => new UploadImageModel { ImageUrl = image.FilePath, Caption = image.Caption, SortOrder = image.SortOrder }).ToList(); model.UploadPhotos = listModel; } else { var list = service.GetRecords(x => x.CategoryId == item.CategoryId && x.ArticlesId == 0); var listModel = list.Select(image => new UploadImageModel { ImageUrl = image.FilePath, Caption = image.Caption, SortOrder = image.SortOrder }).ToList(); model.UploadPhotos = listModel; } } } if (cateId > 0) { var list = service.GetRecords(x => x.CategoryId == cateId); foreach (var imageInfo in list) { if (!string.IsNullOrEmpty(imageInfo.ListCategory)) { model.ListCategory = Utilities.ParseListInt(imageInfo.ListCategory); } } var listModel = list.Select(image => new UploadImageModel { ImageUrl = image.FilePath, Caption = image.Caption, SortOrder = image.SortOrder }).ToList(); model.UploadPhotos = listModel; } if (articlesId > 0) { var list = service.GetRecords(x => x.ArticlesId == articlesId); var listModel = list.Select(image => new UploadImageModel { ImageUrl = image.FilePath, Caption = image.Caption, SortOrder = image.SortOrder }).ToList(); model.UploadPhotos = listModel; } var result = new ControlFormResult <ImagesModel>(model); result.Title = this.T("Thông tin ảnh chuyên mục"); result.FormMethod = FormMethod.Post; result.UpdateActionName = "Update"; result.ShowCancelButton = false; result.ShowBoxHeader = false; result.FormWrapperStartHtml = Constants.Form.FormWrapperStartHtml; result.FormWrapperEndHtml = Constants.Form.FormWrapperEndHtml; if (articlesId > 0) { result.MakeReadOnlyProperty(x => x.CategoryId); result.MakeReadOnlyProperty(x => x.ListCategory); } result.RegisterExternalDataSource(x => x.CategoryId, BindCategories()); result.RegisterExternalDataSource(x => x.ListCategory, BindCategories()); result.AddAction().HasText(this.T("Back to Articles")).HasUrl(this.Url.Action("Index", "AdminArticles")).HasButtonStyle(ButtonStyle.Danger); result.AddAction().HasText(this.T("Back to Categories")).HasUrl(this.Url.Action("Index", "AdminCategories")).HasButtonStyle(ButtonStyle.Danger); //if (CheckPermission(ImagesPermissions.ManagerImages, T("Can't access the dashboard panel."))) //{ // result.AddAction().HasText(this.T("Back")).HasUrl(this.Url.Action("Index")).HasButtonStyle(ButtonStyle.Danger); //} return(result); }