public JsonResult OperationPicture(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            SWfsFlagShipOperationPicture entity = new SWfsFlagShipOperationPicture();

            TryUpdateModel <SWfsFlagShipOperationPicture>(entity, form);
            HttpPostedFileBase file = Request.Files["picFile"];

            rsPic.Clear();
            if (file != null && file.ContentLength > 0)
            {
                rsPic = _SwfsFlagShipModuleLinkService.SaveImg(Request.Files["picFile"], "width:310 ,Height:200,Length:150");
                //rsPic = _com.PostImg(file, "width:0 ,Height:0,Length:100");
                if (rsPic.Keys.Contains("error"))
                {
                    result.status = 0;
                    result.msg    = rsPic["error"];
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    entity.PictureFileNo = rsPic["success"];
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(Request.Form["LogoNo"]))
                {
                    entity.PictureFileNo = Request.Form["PictureFileNo"];
                }
            }
            if (entity.PictureManageId == 0)
            {
                result.status = _pic.Insert(entity);
            }
            else
            {
                result.status = _pic.Update(entity) ? 1 : 0;
            }
            result.msg     = result.status == 0 ? "操作失败" : "操作成功";
            result.content = entity;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public ActionResult OperationPicture(string brandNo, int index)
        {
            if (string.IsNullOrEmpty(brandNo))
            {
                Response.Redirect("/Shangpin/Brand/AIIBrandsSelect");
            }
            SWfsFlagShipOperationPicture entity = _pic.GetEntityByBrandNoAndIndex(brandNo, index);

            if (entity == null)
            {
                string strChnNames = "一二三四五六七八九";
                entity                = new SWfsFlagShipOperationPicture();
                entity.PageNo         = "index";
                entity.PictureIndex   = Convert.ToInt16(index);
                entity.PagePositionNo = "bottom";
                entity.DateBegin      = entity.DateEnd = entity.DateCreate = DateTime.Now;
                entity.DataState      = 1;
                entity.PictureName    = entity.PagePositionName = "底部广告位(" + strChnNames[index] + ")";
                entity.SortId         = 0;
                entity.LinkAddress    = "http://";
            }
            return(View(entity));
        }
Example #3
0
 public bool Update(SWfsFlagShipOperationPicture entity)
 {
     return(DapperUtil.Update <SWfsFlagShipOperationPicture>(entity));
 }
Example #4
0
 public int Insert(SWfsFlagShipOperationPicture entity)
 {
     return(DapperUtil.Insert <SWfsFlagShipOperationPicture>(entity, true));
 }