public string Query()
        {
            string str   = base.Request.Form["Title"];
            string str2  = base.Request.Form["Address"];
            string str3  = base.Request.Form["typeid"];
            string text  = base.Request.Form["sidx"];
            string text2 = base.Request.Form["sord"];

            RoadFlow.Platform.Dictionary dictionary = new RoadFlow.Platform.Dictionary();
            RoadFlow.Platform.AppLibrary appLibrary = new RoadFlow.Platform.AppLibrary();
            string type       = str3.IsGuid() ? appLibrary.GetAllChildsIDString(str3.ToGuid()) : "";
            int    pageSize   = Tools.GetPageSize();
            int    pageNumber = Tools.GetPageNumber();
            string order      = (text.IsNullOrEmpty() ? "Title" : text) + " " + (text2.IsNullOrEmpty() ? "asc" : text2);
            long   count;
            List <RoadFlow.Data.Model.AppLibrary> pagerData = appLibrary.GetPagerData(out count, pageSize, pageNumber, str.Trim1(), type, str2.Trim1(), order);
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.AppLibrary item in pagerData)
            {
                string empty = string.Empty;
                empty = ((!item.Ico.IsFontIco()) ? ("<img src=\"" + item.Ico.Trim1() + "\" style=\"vertical-align:middle;\" />") : ("<i class=\"fa " + item.Ico.Trim1() + "\" style=\"font-size:14px;vertical-align:middle;" + (item.Color.IsNullOrEmpty() ? "" : ("color:" + item.Color + ";")) + "\"></i>"));
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]        = item.ID.ToString();
                jsonData2["Title"]     = empty + "<span style=\"vertical-align:middle;margin-left:4px;\">" + item.Title + "</span>";
                jsonData2["Address"]   = item.Address;
                jsonData2["TypeTitle"] = dictionary.GetTitle(item.Type);
                jsonData2["Opation"]   = "<a class=\"editlink\" href=\"javascript:void(0);\" onclick=\"edit('" + item.ID.ToString() + "');return false;\" style=\"margin-right:6px;\">编辑</a><a class=\"editlink\" href=\"javascript:void(0);\" onclick=\"editsubpage('" + item.ID.ToString() + "');return false;\">子页面</a>";
                jsonData.Add(jsonData2);
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}");
        }
Example #2
0
        public DataTable GetExportDataTable(Guid programID, out string template, out string headerText, out string fileName)
        {
            template   = "";
            headerText = "";
            fileName   = "";
            ProgramBuilderCache set = this.GetSet(programID);

            if (set == null)
            {
                return(new DataTable());
            }
            template   = Files.FilePath + set.Program.ExportTemplate.DesDecrypt();
            headerText = set.Program.ExportHeaderText;
            fileName   = set.Program.ExportFileName;
            string querySql;
            List <IDbDataParameter> parList;
            DataTable dataTable1 = new DBConnection().GetDataTable(this.GetExportCache(programID, out querySql, out parList), querySql, (IDataParameter[])parList.ToArray());
            List <RoadFlow.Data.Model.ProgramBuilderExport> export = set.Export;
            DataTable dataTable2 = new DataTable();

            foreach (RoadFlow.Data.Model.ProgramBuilderExport programBuilderExport in export)
            {
                string showTitle = programBuilderExport.ShowTitle;
                int?   nullable  = programBuilderExport.DataType;
                int    type;
                if (!nullable.HasValue)
                {
                    type = 0;
                }
                else
                {
                    nullable = programBuilderExport.DataType;
                    type     = nullable.Value;
                }
                Type       exportColumnsType = this.GetExportColumnsType(type);
                DataColumn column            = new DataColumn(showTitle, exportColumnsType);
                DataColumn dataColumn        = column;
                nullable = programBuilderExport.Width;
                string str = nullable.ToString();
                dataColumn.Caption = str;
                dataTable2.Columns.Add(column);
            }
            int        num        = 1;
            Dictionary dictionary = new Dictionary();
            Organize   organize   = new Organize();

            foreach (DataRow row1 in (InternalDataCollectionBase)dataTable1.Rows)
            {
                DataRow row2 = dataTable2.NewRow();
                foreach (RoadFlow.Data.Model.ProgramBuilderExport programBuilderExport in export)
                {
                    object empty    = (object)string.Empty;
                    object obj1     = programBuilderExport.Field.IsNullOrEmpty() ? (object)"" : row1[programBuilderExport.Field];
                    int?   showType = programBuilderExport.ShowType;
                    object obj2;
                    if (showType.HasValue)
                    {
                        switch (showType.GetValueOrDefault())
                        {
                        case 0:
                            obj2 = obj1;
                            goto label_24;

                        case 1:
                            obj2 = (object)num.ToString();
                            goto label_24;

                        case 2:
                            obj2 = (object)obj1.ToString().ToDateTime().ToString(programBuilderExport.ShowFormat);
                            goto label_24;

                        case 3:
                            obj2 = (object)obj1.ToString().ToDecimal().ToString(programBuilderExport.ShowFormat);
                            goto label_24;

                        case 4:
                            obj2 = (object)dictionary.GetTitle(obj1.ToString().ToGuid());
                            goto label_24;

                        case 5:
                            obj2 = (object)organize.GetNames(obj1.ToString(), ",");
                            goto label_24;

                        case 6:
                            obj2 = (object)programBuilderExport.CustomString;
                            goto label_24;
                        }
                    }
                    obj2 = obj1;
label_24:
                    row2[programBuilderExport.ShowTitle] = obj2;
                }
                ++num;
                dataTable2.Rows.Add(row2);
            }
            return(dataTable2);
        }
Example #3
0
        public DataTable GetExportDataTable(Guid programID, out string template, out string headerText, out string fileName)
        {
            template   = "";
            headerText = "";
            fileName   = "";
            ProgramBuilderCache set = GetSet(programID);

            if (set == null)
            {
                return(new DataTable());
            }
            template   = Files.FilePath + set.Program.ExportTemplate.DesDecrypt();
            headerText = set.Program.ExportHeaderText;
            fileName   = set.Program.ExportFileName;
            string querySql;
            List <IDbDataParameter> parList;
            Guid         exportCache  = GetExportCache(programID, out querySql, out parList);
            DBConnection dBConnection = new DBConnection();
            Guid         connID       = exportCache;
            string       sql          = querySql;

            IDataParameter[] param     = parList.ToArray();
            DataTable        dataTable = dBConnection.GetDataTable(connID, sql, param);
            List <RoadFlow.Data.Model.ProgramBuilderExport> export = set.Export;
            DataTable dataTable2 = new DataTable();

            foreach (RoadFlow.Data.Model.ProgramBuilderExport item in export)
            {
                DataColumn dataColumn = new DataColumn(item.ShowTitle, GetExportColumnsType(item.DataType.HasValue ? item.DataType.Value : 0));
                dataColumn.Caption = item.Width.ToString();
                dataTable2.Columns.Add(dataColumn);
            }
            int        num        = 1;
            Dictionary dictionary = new Dictionary();
            Organize   organize   = new Organize();

            foreach (DataRow row in dataTable.Rows)
            {
                DataRow dataRow2 = dataTable2.NewRow();
                foreach (RoadFlow.Data.Model.ProgramBuilderExport item2 in export)
                {
                    object empty = string.Empty;
                    object obj   = item2.Field.IsNullOrEmpty() ? "" : row[item2.Field];
                    switch (item2.ShowType)
                    {
                    case 0:
                        empty = obj;
                        break;

                    case 1:
                        empty = num.ToString();
                        break;

                    case 2:
                        empty = obj.ToString().ToDateTime().ToString(item2.ShowFormat);
                        break;

                    case 3:
                        empty = obj.ToString().ToDecimal().ToString(item2.ShowFormat);
                        break;

                    case 4:
                        empty = dictionary.GetTitle(obj.ToString().ToGuid());
                        break;

                    case 5:
                        empty = organize.GetNames(obj.ToString());
                        break;

                    case 6:
                        empty = item2.CustomString;
                        break;

                    default:
                        empty = obj;
                        break;
                    }
                    dataRow2[item2.ShowTitle] = empty;
                }
                num++;
                dataTable2.Rows.Add(dataRow2);
            }
            return(dataTable2);
        }
        public ActionResult Index()
        {
            RoadFlow.Platform.Dictionary dictionary = new RoadFlow.Platform.Dictionary();
            string    obj       = base.Request.QueryString["values"] ?? "";
            string    text7     = base.Request.QueryString["rootid"];
            string    text      = base.Request.QueryString["datasource"];
            string    str       = base.Request.QueryString["sql"];
            DataTable dataTable = new DataTable();

            if ("1" == text)
            {
                string str2 = base.Request.QueryString["dbconn"];
                RoadFlow.Platform.DBConnection   dBConnection = new RoadFlow.Platform.DBConnection();
                RoadFlow.Data.Model.DBConnection dbconn       = dBConnection.Get(str2.ToGuid());
                dataTable = dBConnection.GetDataTable(dbconn, str.UrlDecode().FilterWildcard().ReplaceSelectSql());
            }
            StringBuilder stringBuilder = new StringBuilder();

            string[] array = obj.Split(',');
            foreach (string text2 in array)
            {
                if (!text2.IsNullOrEmpty())
                {
                    if (!(text == "0"))
                    {
                        if (text == "1")
                        {
                            string value = string.Empty;
                            foreach (DataRow row in dataTable.Rows)
                            {
                                if (text2 == row[0].ToString())
                                {
                                    value = ((dataTable.Columns.Count > 1) ? row[1].ToString() : text2);
                                    break;
                                }
                            }
                            stringBuilder.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", text2);
                            stringBuilder.Append(value);
                            stringBuilder.Append("</div>");
                            continue;
                        }
                        if (text == "2")
                        {
                            string text3 = base.Request.QueryString["url2"];
                            if (!text3.IsNullOrEmpty())
                            {
                                text3 = ((text3.IndexOf('?') >= 0) ? (text3 + "&values=" + text2) : (text3 + "?values=" + text2));
                                StringBuilder stringBuilder2 = new StringBuilder();
                                try
                                {
                                    TextWriter writer = new StringWriter(stringBuilder2);
                                    base.Server.Execute(text3, writer);
                                }
                                catch
                                {
                                }
                                stringBuilder.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", text2);
                                stringBuilder.Append(stringBuilder2.ToString());
                                stringBuilder.Append("</div>");
                            }
                            continue;
                        }
                        if (text == "3")
                        {
                            string str3  = base.Request.QueryString["dbconn"];
                            string text4 = base.Request.QueryString["dbtable"];
                            string text5 = base.Request.QueryString["valuefield"];
                            string text6 = base.Request.QueryString["titlefield"];
                            string text8 = base.Request.QueryString["parentfield"];
                            string str4  = base.Request.QueryString["where1"];
                            RoadFlow.Platform.DBConnection   dBConnection2 = new RoadFlow.Platform.DBConnection();
                            RoadFlow.Data.Model.DBConnection dbconn2       = dBConnection2.Get(str3.ToGuid());
                            string    str5       = "select " + text6 + " from " + text4 + " where " + text5 + "='" + text2 + "'";
                            DataTable dataTable2 = dBConnection2.GetDataTable(dbconn2, str5.ReplaceSelectSql());
                            string    value2     = string.Empty;
                            if (dataTable2.Rows.Count > 0)
                            {
                                value2 = dataTable2.Rows[0][0].ToString();
                            }
                            stringBuilder.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", text2);
                            stringBuilder.Append(value2);
                            stringBuilder.Append("</div>");
                            ViewBag.where = str4.UrlEncode();
                            continue;
                        }
                    }
                    Guid test;
                    if (text2.IsGuid(out test))
                    {
                        stringBuilder.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", text2);
                        stringBuilder.Append(dictionary.GetTitle(test));
                        stringBuilder.Append("</div>");
                    }
                }
            }
            base.ViewBag.defaultValuesString = stringBuilder.ToString().Trim1();
            return(View());
        }