예제 #1
0
            /// <summary>
            /// 将数据库实体转换成界面上的实体
            /// </summary>
            /// <param name="entity"></param>
            public void LoadFromStep(WF_M_STEP entity)
            {
                this.id      = entity.StepId;
                this.name    = entity.StepName;
                this.ModelId = entity.ModelId;

                this.alt  = true;
                this.left = 0;
                this.top  = 0;

                if (entity.StepType == "Start")
                {
                    this.type   = "start";
                    this.width  = 24;
                    this.height = 24;
                }
                else if (entity.StepType == "Stop")
                {
                    this.type   = "end";
                    this.width  = 24;
                    this.height = 24;
                }
                else
                {
                    this.type   = "task";
                    this.width  = 135;
                    this.height = 50;
                }
                this.strategy   = Pub.GetOriginalSql(entity.Script);
                this.scripttype = entity.ScriptType.GetValueOrDefault().ToString();

                // 默认值
                var dict = JsonSerializeHelper.DeserializeObject <Dictionary <string, string> >(entity.Extend01);

                if (dict != null)
                {
                    if (dict.ContainsKey("left"))
                    {
                        this.left = ParseHelper.ParseInt(dict["left"]);
                    }
                    if (dict.ContainsKey("top"))
                    {
                        this.top = ParseHelper.ParseInt(dict["top"]);
                    }
                    if (dict.ContainsKey("width"))
                    {
                        this.width = ParseHelper.ParseInt(dict["width"]);
                    }
                    if (dict.ContainsKey("height"))
                    {
                        this.height = ParseHelper.ParseInt(dict["height"]);
                    }
                    if (dict.ContainsKey("alt"))
                    {
                        this.alt = ParseHelper.ParseBool(dict["alt"]);
                    }
                }
            }
예제 #2
0
            internal WF_M_STEP ToStep()
            {
                var entity = new WF_M_STEP();

                if (string.IsNullOrWhiteSpace(this.id))
                {
                    entity.StepId = Guid.NewGuid().ToString();
                }
                else
                {
                    entity.StepId = this.id;
                }

                entity.StepName   = this.name;
                entity.Script     = Pub.GetHtmlSql(this.strategy);
                entity.ScriptType = ParseHelper.ParseInt(this.scripttype).GetValueOrDefault();
                entity.ModelId    = ModelId;
                if (this.type == "start")
                {
                    entity.StepType = "Start";
                }
                else if (this.type == "end")
                {
                    entity.StepType = "Stop";
                }
                else
                {
                    entity.StepType = "One Actor";
                }

                // 其他属性
                var dict = new Dictionary <string, string>();

                dict.Add("top", string.Format("{0}", this.top));
                dict.Add("left", string.Format("{0}", this.left));
                dict.Add("width", string.Format("{0}", this.width));
                dict.Add("height", string.Format("{0}", this.height));
                dict.Add("alt", string.Format("{0}", this.alt));
                entity.Extend01 = JsonSerializeHelper.SerializeObject(dict);

                return(entity);
            }