Exemple #1
0
            /// <summary>
            /// 将数据库实体转换成界面上的实体
            /// </summary>
            /// <param name="entity"></param>
            public void LoadFromConnector(WF_M_CONNECTOR entity)
            {
                this.id         = entity.ConnectorId;
                this.name       = entity.ConnectorName;
                this.from       = entity.FromStepId;
                this.to         = entity.ToStepId;
                this.strategy   = Pub.GetOriginalSql(entity.Script);
                this.scripttype = entity.ScriptType.GetValueOrDefault().ToString();
                this.ModelId    = entity.ModelId;

                // 默认值
                this.marked = false;
                this.M      = 200;
                this.type   = "lr";
                var dict = JsonSerializeHelper.DeserializeObject <Dictionary <string, string> >(entity.Extend01);

                if (dict != null)
                {
                    if (dict.ContainsKey("M"))
                    {
                        this.M = ParseHelper.ParseDecimal(dict["M"]);
                    }
                    if (dict.ContainsKey("marked"))
                    {
                        this.marked = ParseHelper.ParseBool(dict["marked"]);
                    }
                    if (dict.ContainsKey("type"))
                    {
                        this.type = dict["type"];
                    }
                }
            }
Exemple #2
0
            public WF_M_CONNECTOR ToConnector()
            {
                var entity = new WF_M_CONNECTOR();

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

                entity.ConnectorName = this.name;
                entity.FromStepId    = this.from;
                entity.ToStepId      = this.to;
                entity.Script        = Pub.GetHtmlSql(this.strategy);
                entity.ScriptType    = 0;   // 0 表示 sql 语句
                entity.ModelId       = ModelId;

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

                dict.Add("M", string.Format("{0}", this.M));
                dict.Add("type", string.Format("{0}", this.type));
                dict.Add("marked", string.Format("{0}", this.marked));
                entity.Extend01 = JsonSerializeHelper.SerializeObject(dict);

                return(entity);
            }