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 override object DoGetDetailsByID(int ID) { ProductKindDetailsDataModel data = DB.WBPRODUCTTYPE.Select(s => new ProductKindDetailsDataModel { ID = s.ID, SortIndex = s.SR_SQ, TypeName = s.PRD_TP_NM, Status = s.PRD_TP_ST, }).Where(w => w.ID == ID).FirstOrDefault(); return(data); }
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 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 })); }