예제 #1
0
        protected override void afterInsertUpdateAction()
        {
            BP.Sys.FrmImg imgAth = new BP.Sys.FrmImg();
            imgAth.MyPK = this.MyPK;
            imgAth.RetrieveFromDBSources();
            imgAth.Update();

            //同步更新MapAttr
            MapAttrString attr = new MapAttrString(this.MyPK);

            attr.SetValByKey(MapAttrAttr.ColSpan, this.GetValStrByKey(MapAttrAttr.ColSpan));
            attr.SetValByKey(MapAttrAttr.TextColSpan, this.GetValStrByKey(MapAttrAttr.TextColSpan));
            attr.SetValByKey(MapAttrAttr.RowSpan, this.GetValStrByKey(MapAttrAttr.RowSpan));

            attr.SetValByKey(MapAttrAttr.Name, this.GetValStrByKey(FrmImgAttr.Name)); //名称.

            attr.SetValByKey(MapAttrAttr.X, this.GetValStrByKey(FrmImgAttr.X));       //名称.
            attr.SetValByKey(MapAttrAttr.Y, this.GetValStrByKey(FrmImgAttr.Y));       //名称.
            attr.Update();

            base.afterInsertUpdateAction();
        }
예제 #2
0
        public static void SaveImage(string fk_mapdata, JsonData control, JsonData properties, string pks, string ctrlID)
        {
            FrmImg img = new FrmImg();

            img.MyPK          = ctrlID;
            img.FK_MapData    = fk_mapdata;
            img.IsEdit        = 1;
            img.HisImgAppType = ImgAppType.Img;

            //坐标
            JsonData vector = control["style"]["gradientBounds"];

            img.X = float.Parse(vector[0].ToJson());
            img.Y = float.Parse(vector[1].ToJson());
            //图片高、宽
            decimal minX      = decimal.Parse(vector[0].ToJson());
            decimal minY      = decimal.Parse(vector[1].ToJson());
            decimal maxX      = decimal.Parse(vector[2].ToJson());
            decimal maxY      = decimal.Parse(vector[3].ToJson());
            decimal imgWidth  = maxX - minX;
            decimal imgHeight = maxY - minY;

            img.W = float.Parse(imgWidth.ToString("0.00"));
            img.H = float.Parse(imgHeight.ToString("0.00"));

            StringBuilder fontStyle = new StringBuilder();

            for (int iProperty = 0; iProperty < properties.Count; iProperty++)
            {
                JsonData property = properties[iProperty];
                if (property == null || !property.Keys.Contains("property") || property["property"] == null)
                {
                    continue;
                }

                if (property["property"].ToString() == "LinkURL")
                {
                    //图片连接到
                    img.LinkURL = property["PropertyValue"] == null ? "" : property["PropertyValue"].ToString();
                }
                else if (property["property"].ToString() == "WinOpenModel")
                {
                    //打开窗口方式
                    img.LinkTarget = property["PropertyValue"] == null ? "_blank" : property["PropertyValue"].ToString();
                }
                else if (property["property"].ToString() == "ImgAppType")
                {
                    //应用类型:0本地图片,1指定路径.
                    img.ImgSrcType = property["PropertyValue"] == null ? 0 : int.Parse(property["PropertyValue"].ToString());
                }
                else if (property["property"].ToString() == "ImgPath")
                {
                    //指定图片路径
                    img.ImgURL = property["PropertyValue"] == null ? "" : property["PropertyValue"].ToString();
                }
            }

            //ImageFrame 本地图片路径
            JsonData primitives = control["primitives"];

            foreach (JsonData primitive in primitives)
            {
                if (primitive["oType"] == null)
                {
                    continue;
                }
                if (primitive["oType"].ToJson() == "ImageFrame")
                {
                    img.ImgPath = primitive == null ? "" : primitive["url"].ToString();
                }
            }

            //执行保存.
            if (pks.Contains(img.MyPK + "@") == true)
            {
                img.DirectUpdate();
            }
            else
            {
                img.DirectInsert();
            }
        }