示例#1
0
        private ActionResult query(string title1, string address)
        {
            string pager;
            string appid  = Request.QueryString["appid"];
            string tabid  = Request.QueryString["tabid"];
            string typeid = Request.QueryString["typeid"];

            MyCreek.Platform.Dictionary bdict = new MyCreek.Platform.Dictionary();
            MyCreek.Platform.AppLibrary bapp  = new MyCreek.Platform.AppLibrary();
            string typeidstring = typeid.IsGuid() ? bapp.GetAllChildsIDString(typeid.ToGuid()) : "";
            string query        = string.Format("&appid={0}&tabid={1}&title1={2}&typeid={3}&address={4}",
                                                Request.QueryString["appid"],
                                                Request.QueryString["tabid"],
                                                title1.UrlEncode(), typeid, address.UrlEncode()
                                                );
            string query1 = string.Format("{0}&pagesize={1}&pagenumber={2}", query, Request.QueryString["pagesize"], Request.QueryString["pagenumber"]);
            List <MyCreek.Data.Model.AppLibrary> appList = bapp.GetPagerData(out pager, query, title1, typeidstring, address);

            ViewBag.Pager   = pager;
            ViewBag.AppID   = appid;
            ViewBag.TabID   = tabid;
            ViewBag.TypeID  = typeid;
            ViewBag.Title1  = title1;
            ViewBag.Address = address;
            ViewBag.Query1  = query1;
            return(View(appList));
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string pager;
            string appid   = Request.QueryString["appid"];
            string tabid   = Request.QueryString["tabid"];
            string typeid  = Request.QueryString["typeid"];
            string title1  = Request.QueryString["title1"];
            string address = Request.QueryString["address"];

            MyCreek.Platform.AppLibrary bapp = new MyCreek.Platform.AppLibrary();
            if (IsPostBack)
            {
                title1  = Request.Form["Title1"];
                address = Request.Form["Address"];
                //删除
                if (!Request.Form["Button1"].IsNullOrEmpty())
                {
                    string deleteID = Request.Form["checkbox_app"];
                    System.Text.StringBuilder delxml = new System.Text.StringBuilder();
                    foreach (string id in deleteID.Split(','))
                    {
                        Guid gid;
                        if (id.IsGuid(out gid))
                        {
                            var app = bapp.Get(gid);
                            if (app != null)
                            {
                                delxml.Append(app.Serialize());
                                bapp.Delete(gid);
                            }
                        }
                    }
                    MyCreek.Platform.Log.Add("删除了一批应用程序库", delxml.ToString(), MyCreek.Platform.Log.Types.角色应用);
                }
            }

            MyCreek.Platform.Dictionary bdict = new MyCreek.Platform.Dictionary();

            string typeidstring = typeid.IsGuid() ? bapp.GetAllChildsIDString(typeid.ToGuid()) : "";

            Query = string.Format("&appid={0}&tabid={1}&title1={2}&typeid={3}&address={4}",
                                  Request.QueryString["appid"],
                                  Request.QueryString["tabid"],
                                  title1.UrlEncode(), typeid, address.UrlEncode()
                                  );
            Query1 = string.Format("{0}&pagesize={1}&pagenumber={2}", Query, Request.QueryString["pagesize"], Request.QueryString["pagenumber"]);

            AppList         = bapp.GetPagerData(out pager, Query, title1, typeidstring, address);
            this.Pager.Text = pager;
        }
示例#3
0
        public ActionResult Body(FormCollection collection)
        {
            MyCreek.Platform.Dictionary   bdict = new MyCreek.Platform.Dictionary();
            MyCreek.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();
                    MyCreek.Platform.Log.Add("删除了数据字典及其下级共" + i.ToString() + "项", dict.Serialize(), MyCreek.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();
                MyCreek.Platform.Log.Add("修改了数据字典项", "", MyCreek.Platform.Log.Types.数据字典, oldXML, dict.Serialize());
                ViewBag.Script = "alert('保存成功!');parent.frames[0].reLoad('" + refreshID + "');";
            }

            return(View(dict));
        }
示例#4
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     string id = context.Request.QueryString["id"];
     Guid gid;
     string note = "";
     if (id.IsGuid(out gid))
     {
         var dict = new MyCreek.Platform.Dictionary().Get(gid, true);
         if (dict != null)
         {
             note = dict.Note;
         }
     }
     context.Response.Write(note);
 }
示例#5
0
        public string GetNote()
        {
            string id = Request.QueryString["id"];
            Guid   gid;
            string note = "";

            if (id.IsGuid(out gid))
            {
                var dict = new MyCreek.Platform.Dictionary().Get(gid, true);
                if (dict != null)
                {
                    note = dict.Note;
                }
            }
            return(note);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string values = Request.QueryString["values"];

            MyCreek.Platform.Dictionary Dict = new MyCreek.Platform.Dictionary();
            System.Text.StringBuilder   sb   = new System.Text.StringBuilder();
            foreach (string value in values.Split(','))
            {
                var dict = Dict.Get(value.ToGuid(), true);
                if (dict != null)
                {
                    sb.Append(dict.Title);
                    sb.Append(',');
                }
            }
            Response.Write(sb.ToString().TrimEnd(','));
        }
示例#7
0
        public string GetNames()
        {
            string values = Request.QueryString["values"] ?? "";

            MyCreek.Platform.Dictionary Dict = new MyCreek.Platform.Dictionary();
            System.Text.StringBuilder   sb   = new System.Text.StringBuilder();
            foreach (string value in values.Split(','))
            {
                var dict = Dict.Get(value.ToGuid(), true);
                if (dict != null)
                {
                    sb.Append(dict.Title);
                    sb.Append(',');
                }
            }
            return(sb.ToString().TrimEnd(','));
        }
示例#8
0
        public ActionResult Sort(FormCollection collection)
        {
            MyCreek.Platform.Dictionary BDict = new MyCreek.Platform.Dictionary();
            string id        = Request.QueryString["id"];
            string refreshID = "";
            Guid   dictid;
            List <MyCreek.Data.Model.Dictionary> dicts = new List <MyCreek.Data.Model.Dictionary>();

            if (id.IsGuid(out dictid))
            {
                var dict = BDict.Get(dictid);
                if (dict != null)
                {
                    dicts     = BDict.GetChilds(dict.ParentID);
                    refreshID = dict.ParentID.ToString();
                }
            }

            if (collection != null)
            {
                string sortdict = Request.Form["sort"];
                if (sortdict.IsNullOrEmpty())
                {
                    return(View(dicts));
                }
                string[] sortArray = sortdict.Split(',');

                int i = 1;
                foreach (string id1 in sortArray)
                {
                    Guid gid;
                    if (id1.IsGuid(out gid))
                    {
                        BDict.UpdateSort(gid, i++);
                    }
                }
                BDict.RefreshCache();

                MyCreek.Platform.Log.Add("保存了数据字典排序", "保存了ID为:" + id + "的同级排序", MyCreek.Platform.Log.Types.数据字典);
                ViewBag.Script = "parent.frames[0].reLoad('" + refreshID + "');";
                dicts          = BDict.GetChilds(refreshID.ToGuid());
            }

            return(View(dicts));
        }
示例#9
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string values = context.Request.QueryString["values"] ?? "";

            MyCreek.Platform.Dictionary Dict = new MyCreek.Platform.Dictionary();
            System.Text.StringBuilder   sb   = new System.Text.StringBuilder();
            foreach (string value in values.Split(','))
            {
                var dict = Dict.Get(value.ToGuid(), true);
                if (dict != null)
                {
                    sb.Append(dict.Title);
                    sb.Append(',');
                }
            }
            context.Response.Write(sb.ToString().TrimEnd(','));
        }
示例#10
0
        public ActionResult add1(FormCollection collection)
        {
            MyCreek.Data.Model.Dictionary dict  = new MyCreek.Data.Model.Dictionary();
            MyCreek.Platform.Dictionary   bdict = new MyCreek.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();
                MyCreek.Platform.Log.Add("添加了数据字典项", dict.Serialize(), MyCreek.Platform.Log.Types.数据字典);
                ViewBag.Script = "alert('添加成功!');parent.frames[0].reLoad('" + id + "');";
            }

            return(View(dict));
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyCreek.Platform.Dictionary BDict = new MyCreek.Platform.Dictionary();
            string id        = Request.QueryString["id"];
            string refreshID = "";
            Guid   dictid;

            if (id.IsGuid(out dictid))
            {
                var dict = BDict.Get(dictid);
                if (dict != null)
                {
                    DictList  = BDict.GetChilds(dict.ParentID);
                    refreshID = dict.ParentID.ToString();
                }
            }

            if (IsPostBack)
            {
                string sortdict = Request.Form["sort"];
                if (sortdict.IsNullOrEmpty())
                {
                    return;
                }
                string[] sortArray = sortdict.Split(',');
                int      i         = 1;
                foreach (string id1 in sortArray)
                {
                    Guid gid;
                    if (id1.IsGuid(out gid))
                    {
                        BDict.UpdateSort(gid, i++);
                    }
                }
                BDict.RefreshCache();
                MyCreek.Platform.Log.Add("保存了数据字典排序", "保存了ID为:" + id + "的同级排序", MyCreek.Platform.Log.Types.数据字典);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + refreshID + "');", true);
                DictList = BDict.GetChilds(refreshID.ToGuid());
            }
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                MyCreek.Data.Model.Dictionary dict  = new MyCreek.Data.Model.Dictionary();
                MyCreek.Platform.Dictionary   bdict = new MyCreek.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();
                MyCreek.Platform.Log.Add("添加了数据字典项", dict.Serialize(), MyCreek.Platform.Log.Types.数据字典);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');parent.frames[0].reLoad('" + id + "');", true);
            }
        }
示例#13
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string id = context.Request.QueryString["refreshid"];
            Guid   gid;

            if (!id.IsGuid(out gid))
            {
                context.Response.Write("[]");
                return;
            }
            System.Text.StringBuilder   json  = new System.Text.StringBuilder("[", 1000);
            MyCreek.Platform.Dictionary BDict = new MyCreek.Platform.Dictionary();
            var childs = BDict.GetChilds(gid).OrderBy(p => p.Sort);
            int i      = 0;
            int count  = childs.Count();

            foreach (var child in childs)
            {
                var hasChilds = BDict.HasChilds(child.ID);
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", child.ID);
                json.AppendFormat("\"parentID\":\"{0}\",", child.ParentID);
                json.AppendFormat("\"title\":\"{0}\",", child.Title);
                json.AppendFormat("\"type\":\"{0}\",", hasChilds ? "1" : "2");
                json.AppendFormat("\"ico\":\"{0}\",", "");
                json.AppendFormat("\"hasChilds\":\"{0}\",", hasChilds ? "1" : "0");
                json.Append("\"childs\":[");
                json.Append("]");
                json.Append("}");
                if (i++ < count - 1)
                {
                    json.Append(",");
                }
            }
            json.Append("]");
            context.Response.Write(json.ToString());
        }
示例#14
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            MyCreek.Platform.Dictionary BDict = new MyCreek.Platform.Dictionary();

            string rootid  = context.Request.QueryString["root"];
            bool   ischild = "1" == context.Request.QueryString["ischild"];//是否要加载下级节点

            Guid rootID = Guid.Empty;

            if (!rootid.IsGuid(out rootID))
            {
                if (!rootid.IsGuid(out rootID))
                {
                    var dict = BDict.GetByCode(rootid);
                    if (dict != null)
                    {
                        rootID = dict.ID;
                    }
                }
            }

            var root         = rootID != Guid.Empty ? BDict.Get(rootID) : BDict.GetRoot();
            var rootHasChild = BDict.HasChilds(root.ID);

            System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000);
            json.Append("{");
            json.AppendFormat("\"id\":\"{0}\",", root.ID);
            json.AppendFormat("\"parentID\":\"{0}\",", root.ParentID);
            json.AppendFormat("\"title\":\"{0}\",", root.Title);
            json.AppendFormat("\"type\":\"{0}\",", rootHasChild ? "0" : "2"); //类型:0根 1父 2子
            json.AppendFormat("\"ico\":\"{0}\",", Common.Tools.BaseUrl + "/images/ico/role.gif");
            json.AppendFormat("\"hasChilds\":\"{0}\",", rootHasChild ? "1" : "0");
            json.Append("\"childs\":[");

            var childs = BDict.GetChilds(root.ID);
            int i      = 0;
            int count  = childs.Count;

            foreach (var child in childs)
            {
                var hasChild = ischild && BDict.HasChilds(child.ID);
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", child.ID);
                json.AppendFormat("\"parentID\":\"{0}\",", child.ParentID);
                json.AppendFormat("\"title\":\"{0}\",", child.Title);
                json.AppendFormat("\"type\":\"{0}\",", hasChild ? "1" : "2");
                json.AppendFormat("\"ico\":\"{0}\",", "");
                json.AppendFormat("\"hasChilds\":\"{0}\",", hasChild ? "1" : "0");
                json.Append("\"childs\":[");
                json.Append("]");
                json.Append("}");
                if (i++ < count - 1)
                {
                    json.Append(",");
                }
            }

            json.Append("]");
            json.Append("}");
            json.Append("]");
            context.Response.Write(json.ToString());
        }
示例#15
0
        public string Tree1()
        {
            MyCreek.Platform.Dictionary BDict = new MyCreek.Platform.Dictionary();

            string rootid  = Request.QueryString["root"];
            bool   ischild = "1" == Request.QueryString["ischild"];//是否要加载下级节点
            Guid   rootID  = Guid.Empty;

            if (!rootid.IsNullOrEmpty())
            {
                if (!rootid.IsGuid(out rootID))
                {
                    var dict = BDict.GetByCode(rootid);
                    if (dict != null)
                    {
                        rootID = dict.ID;
                    }
                }
            }

            var root         = rootID != Guid.Empty ? BDict.Get(rootID) : BDict.GetRoot();
            var rootHasChild = BDict.HasChilds(root.ID);

            System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000);
            json.Append("{");
            json.AppendFormat("\"id\":\"{0}\",", root.ID);
            json.AppendFormat("\"parentID\":\"{0}\",", root.ParentID);
            json.AppendFormat("\"title\":\"{0}\",", root.Title);
            json.AppendFormat("\"type\":\"{0}\",", rootHasChild ? "0" : "2"); //类型:0根 1父 2子
            json.AppendFormat("\"ico\":\"{0}\",", Url.Content("~/images/ico/role.gif"));
            json.AppendFormat("\"hasChilds\":\"{0}\",", rootHasChild ? "1" : "0");
            json.Append("\"childs\":[");

            var childs = BDict.GetChilds(root.ID);
            int i      = 0;
            int count  = childs.Count;

            foreach (var child in childs)
            {
                var hasChild = ischild && BDict.HasChilds(child.ID);
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", child.ID);
                json.AppendFormat("\"parentID\":\"{0}\",", child.ParentID);
                json.AppendFormat("\"title\":\"{0}\",", child.Title);
                json.AppendFormat("\"type\":\"{0}\",", hasChild ? "1" : "2");
                json.AppendFormat("\"ico\":\"{0}\",", "");
                json.AppendFormat("\"hasChilds\":\"{0}\",", hasChild ? "1" : "0");
                json.Append("\"childs\":[");
                json.Append("]");
                json.Append("}");
                if (i++ < count - 1)
                {
                    json.Append(",");
                }
            }

            json.Append("]");
            json.Append("}");
            json.Append("]");
            return(json.ToString());
        }
示例#16
0
        //
        // GET: /Controls/SelectDict/

        public ActionResult Index()
        {
            MyCreek.Platform.Dictionary Dict = new MyCreek.Platform.Dictionary();

            string values     = Request.QueryString["values"] ?? "";
            string rootid     = Request.QueryString["rootid"];
            string datasource = Request.QueryString["datasource"];
            string sql        = Request.QueryString["sql"];

            DataTable SqlDataTable = new DataTable();

            if ("1" == datasource)
            {
                string dbconn = Request.QueryString["dbconn"];
                MyCreek.Platform.DBConnection conn = new MyCreek.Platform.DBConnection();
                var conn1 = conn.Get(dbconn.ToGuid());
                SqlDataTable = conn.GetDataTable(conn1, sql.UrlDecode().ReplaceSelectSql());
            }

            System.Text.StringBuilder defautlSB = new System.Text.StringBuilder();
            foreach (string value in values.Split(','))
            {
                switch (datasource)
                {
                case "0":
                default:
                    Guid id;
                    if (!value.IsGuid(out id))
                    {
                        continue;
                    }
                    defautlSB.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", value);
                    defautlSB.Append(Dict.GetTitle(id));
                    defautlSB.Append("</div>");
                    break;

                case "1":    //SQL
                    string title1 = string.Empty;
                    foreach (DataRow dr in SqlDataTable.Rows)
                    {
                        if (value == dr[0].ToString())
                        {
                            title1 = SqlDataTable.Columns.Count > 1 ? dr[1].ToString() : value;
                            break;
                        }
                    }
                    defautlSB.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", value);
                    defautlSB.Append(title1);
                    defautlSB.Append("</div>");
                    break;

                case "2":    //url
                    string url2 = Request.QueryString["url2"];
                    if (!url2.IsNullOrEmpty())
                    {
                        url2 = url2.IndexOf('?') >= 0 ? url2 + "&values=" + value : url2 + "?values=" + value;
                        System.Text.StringBuilder sb = new System.Text.StringBuilder();

                        try
                        {
                            System.IO.TextWriter tw = new System.IO.StringWriter(sb);
                            Server.Execute(url2, tw);
                        }
                        catch { }
                        defautlSB.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", value);
                        defautlSB.Append(sb.ToString());
                        defautlSB.Append("</div>");
                    }
                    break;

                case "3":    //table
                    string dbconn      = Request.QueryString["dbconn"];
                    string dbtable     = Request.QueryString["dbtable"];
                    string valuefield  = Request.QueryString["valuefield"];
                    string titlefield  = Request.QueryString["titlefield"];
                    string parentfield = Request.QueryString["parentfield"];
                    string where = Request.QueryString["where1"];
                    MyCreek.Platform.DBConnection bdbconn = new MyCreek.Platform.DBConnection();
                    var       conn   = bdbconn.Get(dbconn.ToGuid());
                    string    sql2   = "select " + titlefield + " from " + dbtable + " where " + valuefield + "='" + value + "'";
                    DataTable dt     = bdbconn.GetDataTable(conn, sql2.ReplaceSelectSql());
                    string    title3 = string.Empty;
                    if (dt.Rows.Count > 0)
                    {
                        title3 = dt.Rows[0][0].ToString();
                    }
                    defautlSB.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", value);
                    defautlSB.Append(title3);
                    defautlSB.Append("</div>");
                    ViewBag.where = where.UrlEncode();
                    break;
                }
            }
            ViewBag.defaultValuesString = defautlSB.ToString();
            return(View());
        }