public ActionResult ProductDataEdit(int?ID, bool error = false) { if (!ID.HasValue) { return(RedirectToAction("ProductList")); } ListModuleService module = ListFactoryService.Create(ListMethodType.PRODUCT); ProductDetailsDataModel model = (module.DoGetDetailsByID((int)ID) as ProductDetailsDataModel); if (model == null) { return(RedirectToAction("Login", "SignIn")); } //取圖檔 ImgModule imgModule = new ImgModule(); model.ImagesData = imgModule.GetImages(model.ID, "Product", "S").FirstOrDefault(); model.OtherImagesData = imgModule.GetImages(model.ID, "Product", "M"); //產品分類下拉選單 ProductKindModule typeModule = new ProductKindModule(); SelectList typeList = typeModule.CreateProductKindDropList(model.TypeID, false, model.DisplayForFrontEnd); ViewBag.TypeList = typeList; if (error) { TempData["ERROR"] = "此分類已被停用,若要顯示前台請先將分類啟用"; } return(View(model)); }
public ActionResult Content(int?ID) { if (!ID.HasValue) { return(RedirectToAction("Index")); } ProductDetailsDataModel model; using (var module = ListFactoryService.Create(Enums.ListMethodType.PRODUCT)) { model = (module.DoGetDetailsByID((int)ID) as ProductDetailsDataModel); } if (model.Data == null) { return(RedirectToAction("Index")); } //取檔案 using (FileModule fileModule = new FileModule()) { model.FilesData = fileModule.GetFiles((int)model.Data.ID, "Products"); } return(View(model)); }
public ActionResult Agents() { ListModuleService module = ListFactoryService.Create(ListMethodType.AGENT); AgentDataModel model = (module.DoGetList <object>(null, Language.NotSet) as AgentDataModel); return(View(model)); }
public ActionResult Index() { var mdu = new ProductsModule <ListFilterBase, PRODUCT>(); Dictionary <bool, string> productInfo = mdu.GetProductInfo(); TempData["productInfo"] = productInfo; ListViewBase model = new ListViewBase(); Dictionary <int, List <FileViewModel> > files = new Dictionary <int, List <FileViewModel> >(); using (var module = ListFactoryService.Create(ListMethodType.PRODUCT)) { model.Result = (module.DoGetList(model.Filter) as ListResultBase); foreach (var data in (model.Result.Data as List <PRODUCT>)) { //取檔案 using (FileModule fileModule = new FileModule()) { var file = fileModule.GetFiles((int)data.ID, "Products"); if (!files.ContainsKey(data.ID)) { files.Add(data.ID, new List <FileViewModel>()); } files[data.ID] = file; } } } TempData["Files"] = files; return(View(model)); }
public JsonResult ProductKindDelete(int?ID) { bool success = true; JsonResult resultJson = new JsonResult(); string messages = string.Empty; try { ListModuleService module = ListFactoryService.Create(Enums.ListMethodType.PRODUCTKIND); module.DoDeleteByID((int)ID); messages = "刪除成功"; resultJson = Json(new { success = success, messages = messages }); } catch (ProductKindRelationExcption exRe) { success = false; resultJson = Json(new { success = success, messages = exRe.Message }); } catch (Exception ex) { success = false; messages = ex.Message; } return(resultJson); }
public ActionResult List() { ListViewBase model = new ListViewBase(); Dictionary <int, List <FileViewModel> > files = new Dictionary <int, List <FileViewModel> >(); using (var module = ListFactoryService.Create(ListMethodType.NEWS)) { model.Result = (module.DoGetList(model.Filter) as ListResultBase); List <NEWS> dataBind = (model.Result.Data as List <NEWS>).ToList(); foreach (var data in dataBind) { data.CONTENT = data.CONTENT = PublicMethodRepository.StripHTML(data.CONTENT).SplitLengthString(60); //取檔案 using (FileModule fileModule = new FileModule()) { var file = fileModule.GetFiles((int)data.ID, "News"); if (!files.ContainsKey(data.ID)) { files.Add(data.ID, new List <FileViewModel>()); } files[data.ID] = file; } } model.Result.Data = dataBind; } TempData["Files"] = files; return(View(model)); }
public ActionResult ProductKindAdd(FormCollection form) { string langCode = form["lang"] ?? PublicMethodRepository.CurrentLanguageCode; Language language = PublicMethodRepository.GetLanguageEnumByCode(langCode); ListModuleService module = ListFactoryService.Create(Enums.ListMethodType.PRODUCTKIND); int identityId = module.DoSaveData(form, language); return(RedirectToAction("ProductKindEdit", "_SysAdm", new { ID = identityId })); }
public ActionResult WorksDataAdd(FormCollection form, List <HttpPostedFileBase> image, List <HttpPostedFileBase> images) { string langCode = form["lang"] ?? PublicMethodRepository.CurrentLanguageCode; Language language = PublicMethodRepository.GetLanguageEnumByCode(langCode); ListModuleService module = ListFactoryService.Create(ListMethodType.WORKS); int identityId = module.DoSaveData(form, language, null, image, images); var redirectUrl = new UrlHelper(Request.RequestContext).Action("WorksDataEdit", "_SysAdm", new { ID = identityId }); return(Json(new { Url = redirectUrl })); }
public ActionResult ProductKindEdit(FormCollection form) { string langCode = form["lang"] ?? PublicMethodRepository.CurrentLanguageCode; Language language = PublicMethodRepository.GetLanguageEnumByCode(langCode); int? ID = Convert.ToInt32(form["ProductKindID"]); ListModuleService module = ListFactoryService.Create(Enums.ListMethodType.PRODUCTKIND); int identityId = module.DoSaveData(form, language, ID); ProductKindDetailsDataModel model = (module.DoGetDetailsByID((int)ID) as ProductKindDetailsDataModel); return(View(model)); }
public ActionResult NewsAdd(FormCollection form, List <HttpPostedFileBase> files) { int identityId = 0; using (var module = ListFactoryService.Create(Enums.ListMethodType.NEWS)) { identityId = module.DoSaveData(form, null, files); } var redirectUrl = new UrlHelper(Request.RequestContext).Action("NewsEdit", "_SysAdm", new { ID = identityId }); return(Json(new { Url = redirectUrl })); }
public ActionResult ProductsEdit(FormCollection form, List <HttpPostedFileBase> files) { int?ID = Convert.ToInt32(form["ID"]); int identityId = 0; using (var module = ListFactoryService.Create(Enums.ListMethodType.PRODUCT)) { identityId = module.DoSaveData(form, ID, files); } var redirectUrl = new UrlHelper(Request.RequestContext).Action("ProductsEdit", "_SysAdm", new { ID = identityId }); return(Json(new { Url = redirectUrl })); }
public ActionResult ProductKindEdit(int?ID) { if (!ID.HasValue) { return(RedirectToAction("ProductKindList")); } ListModuleService module = ListFactoryService.Create(Enums.ListMethodType.PRODUCTKIND); ProductKindDetailsDataModel model = (module.DoGetDetailsByID((int)ID) as ProductKindDetailsDataModel); if (model == null) { return(RedirectToAction("Login", "SignIn")); } return(View(model)); }
public ActionResult WorksList(int?page, string qry, string sort, string pDate, string fSt, string lang) { Language language = PublicMethodRepository.CurrentLanguageEnum; WorksListViewModel model = new WorksListViewModel(); model.Filter.CurrentPage = page ?? 1; model.Filter.QueryString = qry ?? string.Empty; model.Filter.SortColumn = sort ?? string.Empty; model.Filter.DisplayForFrontEnd = fSt ?? string.Empty; model.Filter.PublishDate = pDate; ListModuleService module = ListFactoryService.Create(Enums.ListMethodType.WORKS); model.Result = (module.DoGetList(model.Filter, language) as WorksListResultModel); return(View(model)); }
public ActionResult ProductKindList(int?page, string qry, string sort, string status) { Language language = PublicMethodRepository.CurrentLanguageEnum; ProductKindListViewModel model = new ProductKindListViewModel(); model.Filter.CurrentPage = page ?? 1; model.Filter.QueryString = qry ?? string.Empty; model.Filter.SortColumn = sort ?? string.Empty; model.Filter.Status = status ?? string.Empty; ListModuleService module = ListFactoryService.Create(Enums.ListMethodType.PRODUCTKIND); model.Result = (module.DoGetList(model.Filter, language) as ProductKindListResultModel); return(View(model)); }
public ActionResult NewsEdit(FormCollection form, List <HttpPostedFileBase> image, List <HttpPostedFileBase> images) { string langCode = form["lang"] ?? PublicMethodRepository.CurrentLanguageCode; Language language = PublicMethodRepository.GetLanguageEnumByCode(langCode); int? ID = Convert.ToInt32(form["newsID"]); ListModuleService module = ListFactoryService.Create(Enums.ListMethodType.NEWS); int identityId = module.DoSaveData(form, language, ID, image, images); NewsDetailsDataModel model = (module.DoGetDetailsByID((int)identityId) as NewsDetailsDataModel); //取圖檔 ImgModule imgModule = new ImgModule(); model.ImagesData = imgModule.GetImages(model.ID, "News", "S").FirstOrDefault(); var redirectUrl = new UrlHelper(Request.RequestContext).Action("NewsEdit", "_SysAdm", new { ID = identityId }); return(Json(new { Url = redirectUrl })); }
public ActionResult Content(int?ID) { if (!ID.HasValue) { return(RedirectToAction("Index")); } NewsDetailsDataModel model; using (var module = ListFactoryService.Create(Enums.ListMethodType.NEWS)) { model = (module.DoGetDetailsByID((int)ID) as NewsDetailsDataModel); } if (model.Data == null) { return(RedirectToAction("Index")); } //取檔案 using (FileModule fileModule = new FileModule()) { model.FilesData = fileModule.GetFiles((int)model.Data.ID, "News"); } string lastPageId = string.Empty; string nextPageId = string.Empty; using (var module = ListFactoryService.Create(ListMethodType.NEWS)) { ListViewBase temp = new ListViewBase(); var lstData = (module.DoGetList(temp.Filter) as ListResultBase); List <int> pageIDs = (lstData.Data as List <NEWS>).Select(s => s.ID).ToList(); int idIndex = pageIDs.IndexOf(ID.Value); lastPageId = idIndex == 0 ? "" : pageIDs[idIndex - 1].ToString(); nextPageId = idIndex == pageIDs.Count - 1 ? "" : pageIDs[idIndex + 1].ToString(); } List <string> pageInfo = new List <string>() { lastPageId, nextPageId }; TempData["PageInfo"] = pageInfo; return(View(model)); }
public ActionResult NewsList(int?page, string qry, string sort, string fSt, string pSdate, string pEdate) { ListViewBase model = new ListViewBase(); model.Filter.CurrentPage = page ?? 1; model.Filter.QueryString = qry ?? string.Empty; model.Filter.SortColumn = sort ?? string.Empty; model.Filter.DisplayForFrontEnd = fSt ?? string.Empty; model.Filter.PublishStartDate = pSdate; model.Filter.PublishEndate = pEdate; using (var module = ListFactoryService.Create(ListMethodType.NEWS)) { model.Result = (module.DoGetList(model.Filter) as ListResultBase); model.Result.Data = (model.Result.Data as List <NEWS>); } return(View(model)); }
/// 代理語言產品資料 public ActionResult ProductList(int?page, string qry, string sort, int?type, string status, string lang) { Language language = PublicMethodRepository.CurrentLanguageEnum; ProductListViewModel model = new ProductListViewModel(); model.Filter.CurrentPage = page ?? 1; model.Filter.QueryString = qry ?? string.Empty; model.Filter.SortColumn = sort ?? string.Empty; model.Filter.TypeID = type; model.Filter.Status = status ?? string.Empty; ListModuleService module = ListFactoryService.Create(Enums.ListMethodType.PRODUCT); model.Result = (module.DoGetList(model.Filter, language) as ProductListResultModel); ProductKindModule typeModule = new ProductKindModule(); //產品分類下拉選單 ViewBag.TypeList = typeModule.CreateProductKindDropList(model.Filter.TypeID); return(View(model)); }
public ActionResult NewsEdit(int?ID) { if (!ID.HasValue) { return(RedirectToAction("News")); } ListModuleService module = ListFactoryService.Create(Enums.ListMethodType.NEWS); NewsDetailsDataModel model = (module.DoGetDetailsByID((int)ID) as NewsDetailsDataModel); if (model == null) { return(RedirectToAction("Login", "SignIn")); } //取圖檔 ImgModule imgModule = new ImgModule(); model.ImagesData = imgModule.GetImages(model.ID, "News", "S").FirstOrDefault(); return(View(model)); }
public JsonResult WorksDataDelete(int?ID) { bool success = true; string messages = string.Empty; try { ListModuleService module = ListFactoryService.Create(ListMethodType.WORKS); module.DoDeleteByID((int)ID); messages = "刪除成功"; } catch (Exception ex) { success = false; messages = ex.Message; } var resultJson = Json(new { success = success, messages = messages }); return(resultJson); }
public ActionResult WorksDataEdit(int?ID) { if (!ID.HasValue) { return(RedirectToAction("WorksList")); } ListModuleService module = ListFactoryService.Create(ListMethodType.WORKS); WorksDetailsDataModel model = (module.DoGetDetailsByID((int)ID) as WorksDetailsDataModel); if (model == null) { return(RedirectToAction("Login", "SignIn")); } //取圖檔 ImgModule imgModule = new ImgModule(); model.ImagesData = imgModule.GetImages(model.ID, "Works", "S").FirstOrDefault(); model.OtherImagesData = imgModule.GetImages(model.ID, "Works", "M"); return(View(model)); }
public JsonResult ProductsDelete(int?ID) { bool success = true; string messages = string.Empty; try { using (var module = ListFactoryService.Create(Enums.ListMethodType.PRODUCT)) { module.DoDeleteByID((int)ID); } messages = "刪除成功"; } catch (Exception ex) { success = false; messages = ex.Message; } var resultJson = Json(new { success = success, messages = messages }); return(resultJson); }
public ActionResult ProductDataEdit(FormCollection form, List <HttpPostedFileBase> image, List <HttpPostedFileBase> images) { string langCode = form["lang"] ?? PublicMethodRepository.CurrentLanguageCode; Language language = PublicMethodRepository.GetLanguageEnumByCode(langCode); int? ID = Convert.ToInt32(form["ProductID"]); ProductKindModule typeModule = new ProductKindModule(); #region 判斷狀態是否已被停用 被停用 不得啟用前台顯示 if (ID.HasValue) { int chkTypeID = Convert.ToInt16(form["type"]); ProductKindDetailsDataModel tModel = (typeModule.DoGetDetailsByID(chkTypeID) as ProductKindDetailsDataModel); bool tpStatus = tModel.Status == "Y" ? true : false; bool setStatus = form["fSt"] == null ? false : true; if ((!tpStatus) && (setStatus)) { var redirectErrorUrl = new UrlHelper(Request.RequestContext).Action("ProductDataEdit", "_SysAdm", new { ID = ID, error = true }); return(Json(new { Url = redirectErrorUrl })); } } #endregion ListModuleService module = ListFactoryService.Create(ListMethodType.PRODUCT); int identityId = module.DoSaveData(form, language, ID, image, images); ProductDetailsDataModel model = (module.DoGetDetailsByID((int)identityId) as ProductDetailsDataModel); //取圖檔 ImgModule imgModule = new ImgModule(); model.ImagesData = imgModule.GetImages(model.ID, "Product", "S").FirstOrDefault(); model.OtherImagesData = imgModule.GetImages(model.ID, "Product", "M"); //產品分類下拉選單 SelectList typeList = typeModule.CreateProductKindDropList(model.TypeID, false, model.DisplayForFrontEnd); ViewBag.TypeList = typeList; var redirectUrl = new UrlHelper(Request.RequestContext).Action("ProductDataEdit", "_SysAdm", new { ID = identityId }); return(Json(new { Url = redirectUrl })); }
public ActionResult NewsEdit(int?ID) { if (!ID.HasValue) { return(RedirectToAction("NewsList")); } NewsDetailsDataModel model; using (var module = ListFactoryService.Create(Enums.ListMethodType.NEWS)) { model = (module.DoGetDetailsByID((int)ID) as NewsDetailsDataModel); } if (model.Data == null) { return(RedirectToAction("Login", "SignIn")); } //取檔案 using (FileModule fileModule = new FileModule()) { model.FilesData = fileModule.GetFiles((int)model.Data.ID, "News"); } return(View(model)); }
public ActionResult Index() { ViewBag.IsFirstPage = true; var mdu = new ProductsModule <ListFilterBase, PRODUCT>(); Dictionary <bool, string> productInfo = mdu.GetProductInfo(); TempData["productInfo"] = productInfo; HomeDataModel model = new HomeDataModel(); Dictionary <int, List <FileViewModel> > productFiles = new Dictionary <int, List <FileViewModel> >(); Dictionary <int, List <FileViewModel> > newstFiles = new Dictionary <int, List <FileViewModel> >(); using (var module = ListFactoryService.Create(ListMethodType.PRODUCT)) { ListViewBase temp = new ListViewBase(); List <PRODUCT> bindProductData = new List <PRODUCT>(); var productResult = (module.DoGetList(temp.Filter) as ListResultBase); foreach (var data in (productResult.Data as List <PRODUCT>).Take(2)) { //取檔案 using (FileModule fileModule = new FileModule()) { var file = fileModule.GetFiles((int)data.ID, "Products"); if (!productFiles.ContainsKey(data.ID)) { productFiles.Add(data.ID, new List <FileViewModel>()); } productFiles[data.ID] = file; } bindProductData.Add(data); } temp.Result.Data = bindProductData; model.Result.Add("Products", temp); } TempData["ProductFiles"] = productFiles; using (var module = ListFactoryService.Create(ListMethodType.NEWS)) { ListViewBase temp = new ListViewBase(); List <NEWS> bindNewsData = new List <NEWS>(); var newResult = (module.DoGetList(temp.Filter) as ListResultBase); foreach (var data in (newResult.Data as List <NEWS>).Take(3)) { data.CONTENT = data.CONTENT = PublicMethodRepository.StripHTML(data.CONTENT).SplitLengthString(60); //取檔案 using (FileModule fileModule = new FileModule()) { var file = fileModule.GetFiles((int)data.ID, "News"); if (!newstFiles.ContainsKey(data.ID)) { newstFiles.Add(data.ID, new List <FileViewModel>()); } newstFiles[data.ID] = file; bindNewsData.Add(data); } } temp.Result.Data = bindNewsData; model.Result.Add("News", temp); } TempData["NewstFiles"] = newstFiles; return(View(model)); }