Exemple #1
0
        private string getOptionsValue(Dictionary.OptionValueField valueField, RoadFlow.Data.Model.Dictionary dict)
        {
            string str = string.Empty;

            switch (valueField)
            {
            case Dictionary.OptionValueField.ID:
                str = dict.ID.ToString();
                break;

            case Dictionary.OptionValueField.Title:
                str = dict.Title;
                break;

            case Dictionary.OptionValueField.Code:
                str = dict.Code;
                break;

            case Dictionary.OptionValueField.Value:
                str = dict.Value;
                break;

            case Dictionary.OptionValueField.Other:
                str = dict.Other;
                break;

            case Dictionary.OptionValueField.Note:
                str = dict.Note;
                break;
            }
            return(str);
        }
Exemple #2
0
        /// <summary>
        /// 将DataRedar转换为List
        /// </summary>
        private List <RoadFlow.Data.Model.Dictionary> DataReaderToList(OracleDataReader dataReader)
        {
            List <RoadFlow.Data.Model.Dictionary> List = new List <RoadFlow.Data.Model.Dictionary>();

            RoadFlow.Data.Model.Dictionary model = null;
            while (dataReader.Read())
            {
                model          = new RoadFlow.Data.Model.Dictionary();
                model.ID       = dataReader.GetString(0).ToGuid();
                model.ParentID = dataReader.GetString(1).ToGuid();
                model.Title    = dataReader.GetString(2);
                if (!dataReader.IsDBNull(3))
                {
                    model.Code = dataReader.GetString(3);
                }
                if (!dataReader.IsDBNull(4))
                {
                    model.Value = dataReader.GetString(4);
                }
                if (!dataReader.IsDBNull(5))
                {
                    model.Note = dataReader.GetString(5);
                }
                if (!dataReader.IsDBNull(6))
                {
                    model.Other = dataReader.GetString(6);
                }
                model.Sort = dataReader.GetInt32(7);
                List.Add(model);
            }
            return(List);
        }
Exemple #3
0
        private List <RoadFlow.Data.Model.Dictionary> DataReaderToList(MySqlDataReader dataReader)
        {
            List <RoadFlow.Data.Model.Dictionary> dictionaryList = new List <RoadFlow.Data.Model.Dictionary>();

            while (dataReader.Read())
            {
                RoadFlow.Data.Model.Dictionary dictionary = new RoadFlow.Data.Model.Dictionary();
                dictionary.ID       = dataReader.GetString(0).ToGuid();
                dictionary.ParentID = dataReader.GetString(1).ToGuid();
                dictionary.Title    = dataReader.GetString(2);
                if (!dataReader.IsDBNull(3))
                {
                    dictionary.Code = dataReader.GetString(3);
                }
                if (!dataReader.IsDBNull(4))
                {
                    dictionary.Value = dataReader.GetString(4);
                }
                if (!dataReader.IsDBNull(5))
                {
                    dictionary.Note = dataReader.GetString(5);
                }
                if (!dataReader.IsDBNull(6))
                {
                    dictionary.Other = dataReader.GetString(6);
                }
                dictionary.Sort = dataReader.GetInt32(7);
                dictionaryList.Add(dictionary);
            }
            return(dictionaryList);
        }
        public string Tree1()
        {
            string msg;

            if (!Tools.CheckLogin(out msg) && !RoadFlow.Platform.WeiXin.Organize.CheckLogin())
            {
                return("");
            }
            RoadFlow.Platform.Dictionary dictionary1 = new RoadFlow.Platform.Dictionary();
            string str  = this.Request.QueryString["root"];
            int    num1 = "1" == this.Request.QueryString["ischild"] ? 1 : 0;
            Guid   test = Guid.Empty;

            if (!str.IsNullOrEmpty() && !str.IsGuid(out test))
            {
                RoadFlow.Data.Model.Dictionary byCode = dictionary1.GetByCode(str, false);
                if (byCode != null)
                {
                    test = byCode.ID;
                }
            }
            RoadFlow.Data.Model.Dictionary dictionary2 = test != Guid.Empty ? dictionary1.Get(test, false) : dictionary1.GetRoot();
            bool          flag          = dictionary1.HasChilds(dictionary2.ID);
            StringBuilder stringBuilder = new StringBuilder("[", 1000);

            stringBuilder.Append("{");
            stringBuilder.AppendFormat("\"id\":\"{0}\",", (object)dictionary2.ID);
            stringBuilder.AppendFormat("\"parentID\":\"{0}\",", (object)dictionary2.ParentID);
            stringBuilder.AppendFormat("\"title\":\"{0}\",", (object)dictionary2.Title);
            stringBuilder.AppendFormat("\"type\":\"{0}\",", flag ? (object)"0" : (object)"2");
            stringBuilder.AppendFormat("\"ico\":\"{0}\",", (object)this.Url.Content("~/images/ico/role.gif"));
            stringBuilder.AppendFormat("\"hasChilds\":\"{0}\",", flag ? (object)"1" : (object)"0");
            stringBuilder.Append("\"childs\":[");
            List <RoadFlow.Data.Model.Dictionary> childs = dictionary1.GetChilds(dictionary2.ID, false);
            int num2  = 0;
            int count = childs.Count;

            foreach (RoadFlow.Data.Model.Dictionary dictionary3 in childs)
            {
                stringBuilder.Append("{");
                stringBuilder.AppendFormat("\"id\":\"{0}\",", (object)dictionary3.ID);
                stringBuilder.AppendFormat("\"parentID\":\"{0}\",", (object)dictionary3.ParentID);
                stringBuilder.AppendFormat("\"title\":\"{0}\",", (object)dictionary3.Title);
                stringBuilder.AppendFormat("\"ico\":\"{0}\",", (object)"");
                stringBuilder.AppendFormat("\"hasChilds\":\"{0}\",", dictionary1.HasChilds(dictionary3.ID) ? (object)"1" : (object)"0");
                stringBuilder.Append("\"childs\":[");
                stringBuilder.Append("]");
                stringBuilder.Append("}");
                if (num2++ < count - 1)
                {
                    stringBuilder.Append(",");
                }
            }
            stringBuilder.Append("]");
            stringBuilder.Append("}");
            stringBuilder.Append("]");
            return(stringBuilder.ToString());
        }
Exemple #5
0
 public string GetTitle(Guid id)
 {
     RoadFlow.Data.Model.Dictionary dictionary = this.Get(id, true);
     if (dictionary != null)
     {
         return(dictionary.Title);
     }
     return("");
 }
Exemple #6
0
 public Guid GetIDByCode(string code)
 {
     RoadFlow.Data.Model.Dictionary byCode = this.GetByCode(code, true);
     if (byCode != null)
     {
         return(byCode.ID);
     }
     return(Guid.Empty);
 }
Exemple #7
0
 private void addParent(List <RoadFlow.Data.Model.Dictionary> list, Guid id)
 {
     RoadFlow.Data.Model.Dictionary parent = this.GetParent(id);
     if (parent == null)
     {
         return;
     }
     list.Add(parent);
     this.addParent(list, parent.ParentID);
 }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];

            this.Code.Attributes.Add("validate_url", "CheckCode.ashx?id=" + id);
            if (id.IsGuid())
            {
                dict = bdict.Get(id.ToGuid());
            }
            if (dict == null)
            {
                dict = bdict.GetRoot();
            }
            if (IsPostBack && dict != null)
            {
                string refreshID = dict.ParentID == Guid.Empty ? dict.ID.ToString() : dict.ParentID.ToString();
                //删除
                if (!Request.Form["Delete"].IsNullOrEmpty())
                {
                    int i = bdict.DeleteAndAllChilds(dict.ID);
                    bdict.RefreshCache();
                    RoadFlow.Platform.Log.Add("删除了数据字典及其下级共" + i.ToString() + "项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典);
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('删除成功!');parent.frames[0].reLoad('" + refreshID + "');window.location='Body.aspx?id=" + dict.ParentID.ToString() + "&appid=" + Request.QueryString["appid"] + "';", true);
                }
                //保存
                if (!Request.Form["Save"].IsNullOrEmpty())
                {
                    string title  = Request.Form["Title1"];
                    string code   = Request.Form["Code"];
                    string values = Request.Form["Values"];
                    string note   = Request.Form["Note"];
                    string other  = Request.Form["Other"];
                    string oldXML = dict.Serialize();

                    dict.Code  = code.IsNullOrEmpty() ? null : code.Trim();
                    dict.Note  = note.IsNullOrEmpty() ? null : note.Trim();
                    dict.Other = other.IsNullOrEmpty() ? null : other.Trim();
                    dict.Title = title.Trim();
                    dict.Value = values.IsNullOrEmpty() ? null : values.Trim();

                    bdict.Update(dict);
                    bdict.RefreshCache();
                    RoadFlow.Platform.Log.Add("修改了数据字典项", "", RoadFlow.Platform.Log.Types.数据字典, oldXML, dict.Serialize());
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');parent.frames[0].reLoad('" + refreshID + "');", true);
                }
            }
            if (dict != null)
            {
                this.Title1.Value = dict.Title;
                this.Code.Value   = dict.Code;
                this.Values.Value = dict.Value;
                this.Note.Value   = dict.Note;
                this.Other.Value  = dict.Other;
            }
        }
Exemple #9
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="model">RoadFlow.Data.Model.Dictionary实体类</param>
        /// <returns>操作所影响的行数</returns>
        public int Add(RoadFlow.Data.Model.Dictionary model)
        {
            string sql = @"INSERT INTO Dictionary
				(ID,ParentID,Title,Code,Value,Note,Other,Sort) 
				VALUES(@ID,@ParentID,@Title,@Code,@Value,@Note,@Other,@Sort)"                ;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ID
                },
                new SqlParameter("@ParentID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ParentID
                },
                new SqlParameter("@Title", SqlDbType.NVarChar, -1)
                {
                    Value = model.Title
                },
                model.Code == null ? new SqlParameter("@Code", SqlDbType.VarChar, 500)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Code", SqlDbType.VarChar, 500)
                {
                    Value = model.Code
                },
                model.Value == null ? new SqlParameter("@Value", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Value", SqlDbType.VarChar, -1)
                {
                    Value = model.Value
                },
                model.Note == null ? new SqlParameter("@Note", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Note", SqlDbType.VarChar, -1)
                {
                    Value = model.Note
                },
                model.Other == null ? new SqlParameter("@Other", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Other", SqlDbType.VarChar, -1)
                {
                    Value = model.Other
                },
                new SqlParameter("@Sort", SqlDbType.Int, -1)
                {
                    Value = model.Sort
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Exemple #10
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model">RoadFlow.Data.Model.Dictionary实体类</param>
        public int Update(RoadFlow.Data.Model.Dictionary model)
        {
            string sql = @"UPDATE Dictionary SET 
				ParentID=@ParentID,Title=@Title,Code=@Code,Value=@Value,Note=@Note,Other=@Other,Sort=@Sort
				WHERE ID=@ID"                ;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@ParentID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ParentID
                },
                new SqlParameter("@Title", SqlDbType.NVarChar, -1)
                {
                    Value = model.Title
                },
                model.Code == null ? new SqlParameter("@Code", SqlDbType.VarChar, 500)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Code", SqlDbType.VarChar, 500)
                {
                    Value = model.Code
                },
                model.Value == null ? new SqlParameter("@Value", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Value", SqlDbType.VarChar, -1)
                {
                    Value = model.Value
                },
                model.Note == null ? new SqlParameter("@Note", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Note", SqlDbType.VarChar, -1)
                {
                    Value = model.Note
                },
                model.Other == null ? new SqlParameter("@Other", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Other", SqlDbType.VarChar, -1)
                {
                    Value = model.Other
                },
                new SqlParameter("@Sort", SqlDbType.Int, -1)
                {
                    Value = model.Sort
                },
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ID
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Exemple #11
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model">RoadFlow.Data.Model.Dictionary实体类</param>
        public int Update(RoadFlow.Data.Model.Dictionary model)
        {
            string sql = @"UPDATE Dictionary SET 
				ParentID=:ParentID,Title=:Title,Code=:Code,Value=:Value,Note=:Note,Other=:Other,Sort=:Sort
				WHERE ID=:ID"                ;

            OracleParameter[] parameters = new OracleParameter[] {
                new OracleParameter(":ParentID", OracleDbType.Varchar2, 40)
                {
                    Value = model.ParentID
                },
                new OracleParameter(":Title", OracleDbType.NVarchar2)
                {
                    Value = model.Title
                },
                model.Code == null ? new OracleParameter(":Code", OracleDbType.Varchar2, 500)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":Code", OracleDbType.Varchar2, 500)
                {
                    Value = model.Code
                },
                model.Value == null ? new OracleParameter(":Value", OracleDbType.Clob)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":Value", OracleDbType.Clob)
                {
                    Value = model.Value
                },
                model.Note == null ? new OracleParameter(":Note", OracleDbType.Clob)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":Note", OracleDbType.Clob)
                {
                    Value = model.Note
                },
                model.Other == null ? new OracleParameter(":Other", OracleDbType.Clob)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":Other", OracleDbType.Clob)
                {
                    Value = model.Other
                },
                new OracleParameter(":Sort", OracleDbType.Int32)
                {
                    Value = model.Sort
                },
                new OracleParameter(":ID", OracleDbType.Varchar2, 40)
                {
                    Value = model.ID
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Exemple #12
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="model">RoadFlow.Data.Model.Dictionary实体类</param>
        /// <returns>操作所影响的行数</returns>
        public int Add(RoadFlow.Data.Model.Dictionary model)
        {
            string sql = @"INSERT INTO Dictionary
				(ID,ParentID,Title,Code,Value,Note,Other,Sort) 
				VALUES(:ID,:ParentID,:Title,:Code,:Value,:Note,:Other,:Sort)"                ;

            OracleParameter[] parameters = new OracleParameter[] {
                new OracleParameter(":ID", OracleDbType.Varchar2, 40)
                {
                    Value = model.ID
                },
                new OracleParameter(":ParentID", OracleDbType.Varchar2, 40)
                {
                    Value = model.ParentID
                },
                new OracleParameter(":Title", OracleDbType.NVarchar2)
                {
                    Value = model.Title
                },
                model.Code == null ? new OracleParameter(":Code", OracleDbType.Varchar2, 500)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":Code", OracleDbType.Varchar2, 500)
                {
                    Value = model.Code
                },
                model.Value == null ? new OracleParameter(":Value", OracleDbType.Clob)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":Value", OracleDbType.Clob)
                {
                    Value = model.Value
                },
                model.Note == null ? new OracleParameter(":Note", OracleDbType.Clob)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":Note", OracleDbType.Clob)
                {
                    Value = model.Note
                },
                model.Other == null ? new OracleParameter(":Other", OracleDbType.Clob)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":Other", OracleDbType.Clob)
                {
                    Value = model.Other
                },
                new OracleParameter(":Sort", OracleDbType.Int32)
                {
                    Value = model.Sort
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Exemple #13
0
        public bool HasCode(string code, string id = "")
        {
            if (code.IsNullOrEmpty())
            {
                return(false);
            }
            RoadFlow.Data.Model.Dictionary byCode = this.GetByCode(code.Trim(), false);
            Guid test;

            return(byCode != null && (!id.IsGuid(out test) || !(byCode.ID == test)));
        }
Exemple #14
0
        private List <RoadFlow.Data.Model.Dictionary> getChildsByCodeFromCache(string code)
        {
            List <RoadFlow.Data.Model.Dictionary> all = this.GetAll(true);

            RoadFlow.Data.Model.Dictionary dict = all.Find((Predicate <RoadFlow.Data.Model.Dictionary>)(p => string.Compare(p.Code, code, true) == 0));
            if (dict != null)
            {
                return(all.FindAll((Predicate <RoadFlow.Data.Model.Dictionary>)(p => p.ParentID == dict.ID)).OrderBy <RoadFlow.Data.Model.Dictionary, int>((Func <RoadFlow.Data.Model.Dictionary, int>)(p => p.Sort)).ToList <RoadFlow.Data.Model.Dictionary>());
            }
            return(new List <RoadFlow.Data.Model.Dictionary>());
        }
Exemple #15
0
        /// <summary>
        /// 得到一个字典项的上级节点数
        /// </summary>
        /// <param name="dictList"></param>
        /// <param name="dict"></param>
        /// <returns></returns>
        private int getParentCount(List <RoadFlow.Data.Model.Dictionary> dictList, RoadFlow.Data.Model.Dictionary dict)
        {
            int parent = 0;

            RoadFlow.Data.Model.Dictionary parentDict = dictList.Find(p => p.ID == dict.ParentID);
            while (parentDict != null)
            {
                parentDict = dictList.Find(p => p.ID == parentDict.ParentID);
                parent++;
            }
            return(parent);
        }
        public ActionResult Sort(FormCollection collection)
        {
            RoadFlow.Platform.Dictionary dictionary1 = new RoadFlow.Platform.Dictionary();
            string str1 = this.Request.QueryString["id"];
            string str2 = "";
            List <RoadFlow.Data.Model.Dictionary> dictionaryList = new List <RoadFlow.Data.Model.Dictionary>();
            Guid test1;

            if (str1.IsGuid(out test1))
            {
                RoadFlow.Data.Model.Dictionary dictionary2 = dictionary1.Get(test1, false);
                if (dictionary2 != null)
                {
                    dictionaryList = dictionary1.GetChilds(dictionary2.ParentID, false);
                    str2           = dictionary2.ParentID.ToString();
                }
            }
            if (collection != null)
            {
                string str3 = this.Request.Form["sort"];
                if (str3.IsNullOrEmpty())
                {
                    return((ActionResult)this.View((object)dictionaryList));
                }
                string[] strArray = str3.Split(',');
                int      num      = 1;
                foreach (string str4 in strArray)
                {
                    Guid test2;
                    if (str4.IsGuid(out test2))
                    {
                        dictionary1.UpdateSort(test2, num++);
                    }
                }
                dictionary1.RefreshCache();
                RoadFlow.Platform.Log.Add("保存了数据字典排序", "保存了ID为:" + str1 + "的同级排序", RoadFlow.Platform.Log.Types.数据字典, "", "", (RoadFlow.Data.Model.Users)null);
                // ISSUE: reference to a compiler-generated field
                if (DictController.\u003C\u003Eo__11.\u003C\u003Ep__0 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    DictController.\u003C\u003Eo__11.\u003C\u003Ep__0 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "Script", typeof(DictController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                    {
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                    }));
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                object obj = DictController.\u003C\u003Eo__11.\u003C\u003Ep__0.Target((CallSite)DictController.\u003C\u003Eo__11.\u003C\u003Ep__0, this.ViewBag, "parent.frames[0].reLoad('" + str2 + "');");
                dictionaryList = dictionary1.GetChilds(str2.ToGuid(), false);
            }
            return((ActionResult)this.View((object)dictionaryList));
        }
Exemple #17
0
        private int getParentCount(List <RoadFlow.Data.Model.Dictionary> dictList, RoadFlow.Data.Model.Dictionary dict)
        {
            int num = 0;

            RoadFlow.Data.Model.Dictionary parentDict = dictList.Find((Predicate <RoadFlow.Data.Model.Dictionary>)(p => p.ID == dict.ParentID));
            while (parentDict != null)
            {
                parentDict = dictList.Find((Predicate <RoadFlow.Data.Model.Dictionary>)(p => p.ID == parentDict.ParentID));
                ++num;
            }
            return(num);
        }
Exemple #18
0
 public string GetTitle(string code)
 {
     if (code.IsNullOrEmpty())
     {
         return("");
     }
     RoadFlow.Data.Model.Dictionary byCode = this.GetByCode(code.Trim(), true);
     if (byCode != null)
     {
         return(byCode.Title);
     }
     return("");
 }
Exemple #19
0
 public List <RoadFlow.Data.Model.Dictionary> GetAllChilds(string code, bool fromCache)
 {
     if (code.IsNullOrEmpty())
     {
         return(new List <RoadFlow.Data.Model.Dictionary>());
     }
     RoadFlow.Data.Model.Dictionary byCode = this.GetByCode(code, fromCache);
     if (byCode == null)
     {
         return(new List <RoadFlow.Data.Model.Dictionary>());
     }
     return(this.GetAllChilds(byCode.ID, fromCache));
 }
Exemple #20
0
 public string GetTitle(string code, string value)
 {
     if (code.IsNullOrEmpty())
     {
         return("");
     }
     RoadFlow.Data.Model.Dictionary dictionary = this.getChildsByCodeFromCache(code.Trim()).Find((Predicate <RoadFlow.Data.Model.Dictionary>)(p => p.Value == value));
     if (dictionary != null)
     {
         return(dictionary.Title);
     }
     return("");
 }
        public ActionResult Body(FormCollection collection)
        {
            RoadFlow.Platform.Dictionary   bdict = new RoadFlow.Platform.Dictionary();
            RoadFlow.Data.Model.Dictionary dict  = null;
            string id = Request.QueryString["id"];

            if (id.IsGuid())
            {
                dict = bdict.Get(id.ToGuid());
            }
            if (dict == null)
            {
                dict = bdict.GetRoot();
            }

            if (collection != null)
            {
                string refreshID = dict.ParentID == Guid.Empty ? dict.ID.ToString() : dict.ParentID.ToString();
                //删除
                if (!Request.Form["Delete"].IsNullOrEmpty())
                {
                    int i = bdict.DeleteAndAllChilds(dict.ID);
                    bdict.RefreshCache();
                    RoadFlow.Platform.Log.Add("删除了数据字典及其下级共" + i.ToString() + "项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典);
                    ViewBag.Script = "alert('删除成功!');parent.frames[0].reLoad('" + refreshID + "');window.location='Body?id=" + dict.ParentID.ToString() + "&appid=" + Request.QueryString["appid"] + "';";
                    return(View(dict));
                }

                string title  = Request.Form["Title"];
                string code   = Request.Form["Code"];
                string values = Request.Form["Values"];
                string note   = Request.Form["Note"];
                string other  = Request.Form["Other"];
                string oldXML = dict.Serialize();

                dict.Code  = code.IsNullOrEmpty() ? null : code.Trim();
                dict.Note  = note.IsNullOrEmpty() ? null : note.Trim();
                dict.Other = other.IsNullOrEmpty() ? null : other.Trim();
                dict.Title = title.Trim();
                dict.Value = values.IsNullOrEmpty() ? null : values.Trim();

                bdict.Update(dict);
                bdict.RefreshCache();
                RoadFlow.Platform.Log.Add("修改了数据字典项", "", RoadFlow.Platform.Log.Types.数据字典, oldXML, dict.Serialize());
                ViewBag.Script = "alert('保存成功!');parent.frames[0].reLoad('" + refreshID + "');";
            }

            return(View(dict));
        }
        public ActionResult add1(FormCollection collection)
        {
            RoadFlow.Data.Model.Dictionary model      = new RoadFlow.Data.Model.Dictionary();
            RoadFlow.Platform.Dictionary   dictionary = new RoadFlow.Platform.Dictionary();
            string str1 = this.Request.QueryString["id"];

            if (!str1.IsGuid())
            {
                RoadFlow.Data.Model.Dictionary root = dictionary.GetRoot();
                str1 = root != null?root.ID.ToString() : "";
            }
            if (!str1.IsGuid())
            {
                throw new Exception("未找到父级");
            }
            if (collection != null)
            {
                string str2 = this.Request.Form["Title"];
                string str3 = this.Request.Form["Code"];
                string str4 = this.Request.Form["Values"];
                string str5 = this.Request.Form["Note"];
                string str6 = this.Request.Form["Other"];
                model.ID       = Guid.NewGuid();
                model.Code     = str3.IsNullOrEmpty() ? (string)null : str3.Trim();
                model.Note     = str5.IsNullOrEmpty() ? (string)null : str5.Trim();
                model.Other    = str6.IsNullOrEmpty() ? (string)null : str6.Trim();
                model.ParentID = str1.ToGuid();
                model.Sort     = dictionary.GetMaxSort(str1.ToGuid());
                model.Title    = str2.Trim();
                model.Value    = str4.IsNullOrEmpty() ? (string)null : str4.Trim();
                dictionary.Add(model);
                dictionary.RefreshCache();
                RoadFlow.Platform.Log.Add("添加了数据字典项", model.Serialize(), RoadFlow.Platform.Log.Types.数据字典, "", "", (RoadFlow.Data.Model.Users)null);
                // ISSUE: reference to a compiler-generated field
                if (DictController.\u003C\u003Eo__9.\u003C\u003Ep__0 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    DictController.\u003C\u003Eo__9.\u003C\u003Ep__0 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "Script", typeof(DictController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                    {
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                    }));
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                object obj = DictController.\u003C\u003Eo__9.\u003C\u003Ep__0.Target((CallSite)DictController.\u003C\u003Eo__9.\u003C\u003Ep__0, this.ViewBag, "alert('添加成功!');parent.frames[0].reLoad('" + str1 + "');");
            }
            return((ActionResult)this.View((object)model));
        }
Exemple #23
0
        public List <RoadFlow.Data.Model.Dictionary> GetAllParents(Guid id, bool isMe = true)
        {
            List <RoadFlow.Data.Model.Dictionary> list = new List <RoadFlow.Data.Model.Dictionary>();

            RoadFlow.Data.Model.Dictionary dictionary = this.Get(id, false);
            if (dictionary == null)
            {
                return(list);
            }
            if (isMe)
            {
                list.Add(dictionary);
            }
            this.addParent(list, dictionary.ParentID);
            return(list);
        }
        public string GetNames()
        {
            string obj = base.Request.QueryString["values"] ?? "";

            RoadFlow.Platform.Dictionary dictionary = new RoadFlow.Platform.Dictionary();
            StringBuilder stringBuilder             = new StringBuilder();

            string[] array = obj.Split(',');
            foreach (string text in array)
            {
                RoadFlow.Data.Model.Dictionary dictionary2 = dictionary.Get(MyExtensions.ToGuid(text), fromCache: true);
                if (dictionary2 != null)
                {
                    stringBuilder.Append(dictionary2.Title);
                    stringBuilder.Append(',');
                }
            }
            return(stringBuilder.ToString().TrimEnd(','));
        }
        public ActionResult add1(FormCollection collection)
        {
            RoadFlow.Data.Model.Dictionary dict  = new RoadFlow.Data.Model.Dictionary();
            RoadFlow.Platform.Dictionary   bdict = new RoadFlow.Platform.Dictionary();
            string id = Request.QueryString["id"];

            if (!id.IsGuid())
            {
                var dictRoot = bdict.GetRoot();
                id = dictRoot != null?dictRoot.ID.ToString() : "";
            }
            if (!id.IsGuid())
            {
                throw new Exception("未找到父级");
            }

            if (collection != null)
            {
                string title  = Request.Form["Title"];
                string code   = Request.Form["Code"];
                string values = Request.Form["Values"];
                string note   = Request.Form["Note"];
                string other  = Request.Form["Other"];

                dict.ID       = Guid.NewGuid();
                dict.Code     = code.IsNullOrEmpty() ? null : code.Trim();
                dict.Note     = note.IsNullOrEmpty() ? null : note.Trim();
                dict.Other    = other.IsNullOrEmpty() ? null : other.Trim();
                dict.ParentID = id.ToGuid();
                dict.Sort     = bdict.GetMaxSort(id.ToGuid());
                dict.Title    = title.Trim();
                dict.Value    = values.IsNullOrEmpty() ? null : values.Trim();

                bdict.Add(dict);
                bdict.RefreshCache();
                RoadFlow.Platform.Log.Add("添加了数据字典项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典);
                ViewBag.Script = "alert('添加成功!');parent.frames[0].reLoad('" + id + "');";
            }

            return(View(dict));
        }
Exemple #26
0
        public string GetNames()
        {
            string str1 = this.Request.QueryString["values"] ?? "";

            RoadFlow.Platform.Dictionary dictionary1 = new RoadFlow.Platform.Dictionary();
            StringBuilder stringBuilder = new StringBuilder();

            char[] chArray = new char[1] {
                ','
            };
            foreach (string str2 in str1.Split(chArray))
            {
                RoadFlow.Data.Model.Dictionary dictionary2 = dictionary1.Get(str2.ToGuid(), true);
                if (dictionary2 != null)
                {
                    stringBuilder.Append(dictionary2.Title);
                    stringBuilder.Append(',');
                }
            }
            return(stringBuilder.ToString().TrimEnd(','));
        }
Exemple #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                RoadFlow.Data.Model.Dictionary dict  = new RoadFlow.Data.Model.Dictionary();
                RoadFlow.Platform.Dictionary   bdict = new RoadFlow.Platform.Dictionary();
                string id = Request.QueryString["id"];
                if (!id.IsGuid())
                {
                    var dictRoot = bdict.GetRoot();
                    id = dictRoot != null?dictRoot.ID.ToString() : "";
                }
                if (!id.IsGuid())
                {
                    throw new Exception("未找到父级");
                }


                string title  = Request.Form["Title1"];
                string code   = Request.Form["Code"];
                string values = Request.Form["Values"];
                string note   = Request.Form["Note"];
                string other  = Request.Form["Other"];

                dict.ID       = Guid.NewGuid();
                dict.Code     = code.IsNullOrEmpty() ? null : code.Trim();
                dict.Note     = note.IsNullOrEmpty() ? null : note.Trim();
                dict.Other    = other.IsNullOrEmpty() ? null : other.Trim();
                dict.ParentID = id.ToGuid();
                dict.Sort     = bdict.GetMaxSort(id.ToGuid());
                dict.Title    = title.Trim();
                dict.Value    = values.IsNullOrEmpty() ? null : values.Trim();

                bdict.Add(dict);
                bdict.RefreshCache();
                RoadFlow.Platform.Log.Add("添加了数据字典项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');parent.frames[0].reLoad('" + id + "');", true);
            }
        }
Exemple #28
0
        public int Add(RoadFlow.Data.Model.Dictionary model)
        {
            string sql = "INSERT INTO dictionary\r\n\t\t\t\t(ID,ParentID,Title,Code,Value,Note,Other,Sort) \r\n\t\t\t\tVALUES(@ID,@ParentID,@Title,@Code,@Value,@Note,@Other,@Sort)";

            MySqlParameter[] mySqlParameterArray = new MySqlParameter[8];
            int            index1          = 0;
            MySqlParameter mySqlParameter1 = new MySqlParameter("@ID", MySqlDbType.VarChar, 36);

            mySqlParameter1.Value       = (object)model.ID;
            mySqlParameterArray[index1] = mySqlParameter1;
            int            index2          = 1;
            MySqlParameter mySqlParameter2 = new MySqlParameter("@ParentID", MySqlDbType.VarChar, 36);

            mySqlParameter2.Value       = (object)model.ParentID;
            mySqlParameterArray[index2] = mySqlParameter2;
            int            index3          = 2;
            MySqlParameter mySqlParameter3 = new MySqlParameter("@Title", MySqlDbType.LongText, -1);

            mySqlParameter3.Value       = (object)model.Title;
            mySqlParameterArray[index3] = mySqlParameter3;
            int            index4 = 3;
            MySqlParameter mySqlParameter4;

            if (model.Code != null)
            {
                MySqlParameter mySqlParameter5 = new MySqlParameter("@Code", MySqlDbType.Text, -1);
                mySqlParameter5.Value = (object)model.Code;
                mySqlParameter4       = mySqlParameter5;
            }
            else
            {
                mySqlParameter4       = new MySqlParameter("@Code", MySqlDbType.Text, -1);
                mySqlParameter4.Value = (object)DBNull.Value;
            }
            mySqlParameterArray[index4] = mySqlParameter4;
            int            index5 = 4;
            MySqlParameter mySqlParameter6;

            if (model.Value != null)
            {
                MySqlParameter mySqlParameter5 = new MySqlParameter("@Value", MySqlDbType.LongText, -1);
                mySqlParameter5.Value = (object)model.Value;
                mySqlParameter6       = mySqlParameter5;
            }
            else
            {
                mySqlParameter6       = new MySqlParameter("@Value", MySqlDbType.LongText, -1);
                mySqlParameter6.Value = (object)DBNull.Value;
            }
            mySqlParameterArray[index5] = mySqlParameter6;
            int            index6 = 5;
            MySqlParameter mySqlParameter7;

            if (model.Note != null)
            {
                MySqlParameter mySqlParameter5 = new MySqlParameter("@Note", MySqlDbType.LongText, -1);
                mySqlParameter5.Value = (object)model.Note;
                mySqlParameter7       = mySqlParameter5;
            }
            else
            {
                mySqlParameter7       = new MySqlParameter("@Note", MySqlDbType.LongText, -1);
                mySqlParameter7.Value = (object)DBNull.Value;
            }
            mySqlParameterArray[index6] = mySqlParameter7;
            int            index7 = 6;
            MySqlParameter mySqlParameter8;

            if (model.Other != null)
            {
                MySqlParameter mySqlParameter5 = new MySqlParameter("@Other", MySqlDbType.LongText, -1);
                mySqlParameter5.Value = (object)model.Other;
                mySqlParameter8       = mySqlParameter5;
            }
            else
            {
                mySqlParameter8       = new MySqlParameter("@Other", MySqlDbType.LongText, -1);
                mySqlParameter8.Value = (object)DBNull.Value;
            }
            mySqlParameterArray[index7] = mySqlParameter8;
            int            index8          = 7;
            MySqlParameter mySqlParameter9 = new MySqlParameter("@Sort", MySqlDbType.Int32, 11);

            mySqlParameter9.Value       = (object)model.Sort;
            mySqlParameterArray[index8] = mySqlParameter9;
            MySqlParameter[] parameter = mySqlParameterArray;
            return(this.dbHelper.Execute(sql, parameter, false));
        }
Exemple #29
0
 public int Add(RoadFlow.Data.Model.Dictionary model)
 {
     return(this.dataDictionary.Add(model));
 }
Exemple #30
0
 public int Update(RoadFlow.Data.Model.Dictionary model)
 {
     return(this.dataDictionary.Update(model));
 }