Example #1
0
        /// <summary>
        /// 预告页 页内图片操作的页面展现
        /// </summary>
        /// <param name="id"></param>
        /// <param name="act"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public ActionResult PicManage(string id, string act, string picId)
        {
            SWfsAolaiAdvancePageService service = new SWfsAolaiAdvancePageService();
            SWfsAolaiAdvancePagePic     modle   = new SWfsAolaiAdvancePagePic();

            switch (act)
            {
            case "create":    //新建
                SWfsAolaiAdvancePage model = service.GetModel(id);
                modle.SWfsAolaiNoticePagPicId = "0";
                modle.SwfsAolaiNoticePageId   = id;
                ViewBag.PageName = model.PageName;
                return(View("/Areas/Outlet/Views/Notice/PicManage.cshtml", modle));

            case "edit":    //修改
                modle = service.GetPicModel(picId);
                return(View("/Areas/Outlet/Views/Notice/PicManage.cshtml", modle));

            case "del":
                service.DelPic(picId);
                return(Redirect("/outlet/notice/PicIndex?id=" + id + CommonService.GetTimeStamp("&")));
            }
            return(View());
        }
Example #2
0
        public ActionResult PicManage(FormCollection formCol)
        {
            string tmpPicId    = formCol.Get("SWfsAolaiNoticePagPicId");
            string tmpPageId   = formCol.Get("SwfsAolaiNoticePageId");
            string pictureName = formCol.Get("PictureName");
            string pictureLink = formCol.Get("PictureLink");
            string sort        = formCol.Get("Sort");

            SWfsAolaiAdvancePageService service = new SWfsAolaiAdvancePageService();
            SWfsAolaiAdvancePagePic     model   = new SWfsAolaiAdvancePagePic();

            if (!string.IsNullOrEmpty(tmpPicId) && !tmpPicId.Equals("0")) //修改
            {
                model = service.GetPicModel(tmpPicId);
            }
            else //新增
            {
                model.BackUpField             = string.Empty;
                model.DateCreate              = DateTime.Now;//暂时未用
                model.SWfsAolaiNoticePagPicId = new CommonService().GetNextCounterId("SWfsAolaiNoticePagPicId").ToString("00000");
            }
            model.PictureName           = pictureName;
            model.PictureLink           = pictureLink;
            model.Sort                  = int.Parse(sort);
            model.SwfsAolaiNoticePageId = tmpPageId;
            CommonService commonService       = new CommonService();
            Dictionary <string, string> rsPic = new Dictionary <string, string>();

            if (null != Request.Files["PictureFileNo"] && Request.Files["PictureFileNo"].ContentLength > 0)
            {
                rsPic = commonService.PostImg(Request.Files["PictureFileNo"], "width:0,Height:0,Length:300");
                if (rsPic.Keys.Contains("error"))
                {
                    return(Json(new { reslut = "error", msg = rsPic["error"] }));
                }
                if (rsPic.Keys.Contains("success"))
                {
                    model.PictureFileNo = rsPic["success"];
                }
            }


            if (!string.IsNullOrEmpty(tmpPicId) && !tmpPicId.Equals("0")) //修改
            {
                try
                {
                    service.UpdatePagePic(model);
                    return(Json(new { reslut = "success", msg = "修改成功" }));
                }
                catch (Exception e)
                {
                    return(Json(new { reslut = "error", msg = e.Message }));
                }
            }
            else
            {
                try
                {
                    service.AddPic(model);
                    return(Json(new { reslut = "success", msg = "添加成功" }));
                }
                catch (Exception e)
                {
                    return(Json(new { reslut = "error", msg = e.Message }));
                }
            }
        }
 public void AddPic(SWfsAolaiAdvancePagePic model)
 {
     DapperUtil.Insert <SWfsAolaiAdvancePagePic>(model);
 }
 public bool UpdatePagePic(SWfsAolaiAdvancePagePic model)
 {
     return(DapperUtil.Update <SWfsAolaiAdvancePagePic>(model));
 }