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 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 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 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 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 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 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 })); }