public virtual void InsertHomePlanDesign(HomePlanDesign planDesign) { homePlanDesignDao.Insert(planDesign); }
public JsonResult CreateHomePlanDesign(int pageW, int pageH, int page, int x, int y, int w, int h, string planID, string appID, string imgID) { JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" }; try { if (page < 1) { throw new Exception("请填入正确的页数"); } if (x > (pageW - 1) || x < 0) { throw new Exception("请填入正确的X坐标"); } if (y > (pageH - 1) || y < 0) { throw new Exception("请填入正确的Y坐标"); } if (w > pageW || w < 0) { throw new Exception("请填入正确的宽"); } if (h > pageH || h < 0) { throw new Exception("请填入正确的高"); } if (x + w > pageW) { throw new Exception("宽超过边界,请重新输入"); } if (y + h > pageH) { throw new Exception("高超过边界,请重新输入"); } if (CheckPlan(planID, pageW, page, x, y, w, h)) { throw new Exception("坐标上已存在其他应用"); } x = pageW * (page - 1) + x; HomePlanDesign design = new HomePlanDesign(); design.UpdateTime = DateTime.Now; design.CreateTime = DateTime.Now; design.UpdateUid = CurrentUser.UserUId; design.CreateUid = CurrentUser.UserUId; design.AppID = Convert.ToInt32(appID); design.PlanID = Convert.ToInt32(planID); design.Location = string.Format("{0},{1}", x, y); design.Size = string.Format("{0},{1}", w, h); design.Type = "Image"; if (!string.IsNullOrEmpty(imgID)) { design.ValueUri = string.Format(@"Server://beyondbit.smartbox.server.image/{0}", imgID); } BoFactory.GetVersionTrackBo.InsertHomePlanDesign(design); } catch (Exception ex) { Log4NetHelper.Error(ex); data.Msg = ex.Message; data.IsSuccess = false; } return Json(data); }