Example #1
0
        //保存区块关联
        public bool SaveRegionRelationInfo(SWfsBrandFlagShipStoreRegion obj)
        {
            if (obj.RegionID <= 0 || obj.BrandNO == null || obj.RelationType <= 0 || string.IsNullOrEmpty(obj.TemplateNo))
            {
                return(false);
            }
            if (obj.ImgNO == null)
            {
                obj.ImgNO = "";
            }
            if (obj.RelationContent == null)
            {
                obj.RelationContent = "";
            }
            obj.CreateDate = DateTime.Now;
            //查询关联数据描述
            switch (obj.RelationType)
            {
            case 1:    //查询名称活动
                if (!string.IsNullOrEmpty(obj.RelationContent))
                {
                    SWfsNewSubject subobj = GetNewSubjectByNO(obj.RelationContent);
                    obj.Direction = subobj == null ? "" : subobj.SubjectName;
                }
                break;

            case 2:
                obj.Direction = "";
                break;

            case 3:
                if (!string.IsNullOrEmpty(obj.RelationContent))
                {
                    SWfsBrandNavigation navobj = GetBrandNavigationNO(obj.RelationContent);
                    obj.Direction = navobj == null ? "" : navobj.NavigationName;
                }
                break;

            case 4:
                obj.Direction = "";
                break;
            }
            if (obj.FlagReigionID == 0)
            {
                //判断是否已近存在该区块的数据
                if (GetRegionRelationInfoByCondition(obj.BrandNO, obj.TemplateNo, obj.RegionID).Count() > 0)
                {
                    return(false);
                }
                return(DapperUtil.Insert <SWfsBrandFlagShipStoreRegion>(obj, true) > 0 ? true : false);
            }
            else
            {
                return(DapperUtil.Update <SWfsBrandFlagShipStoreRegion>(obj));
            }
        }
Example #2
0
        public JsonResult GetSWfsNewSubjectById(string id)
        {
            SWfsNewSubject swf = appIndexService.GetSWfsNewSubjectById(id);

            return(Json(new
            {
                id = swf.SubjectNo,
                name = swf.SubjectName,
                status = swf.Status == 1 ? "开启" : "关闭",
                startTime = swf.DateBegin.ToString("yyyy-MM-dd hh:mm:ss"),
                endTime = swf.DateEnd.ToString("yyyy-MM-dd hh:mm:ss"),
                imgID = swf.SubjectTemplateTopPicNo
            }, JsonRequestBehavior.AllowGet));
        }