예제 #1
0
        private void 生成json对象ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var data = (this.gridControl1.DataSource as IEnumerable <E_Object>).ToList();

            var colinputs = data.OrderBy(p => p.sortnum).Select(p =>
            {
                return(string.Format("{0}: '{1}'", p.Column_name, p.Comments));
            }).ToList();

            string strTest = string.Format("{{{0}}}", string.Join(",", colinputs));

            var tmp = new tmpform(strTest);

            tmp.ShowDialog();
        }
예제 #2
0
        private void 生成avalonhtml选中ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var data      = (this.gridControl1.DataSource as IEnumerable <E_Object>).ToList();
            var colinputs = data.Where(p => p.ck).OrderBy(p => p.sortnum).Select(p =>
            {
                var typecol = "string";
                if (p.Data_type == "NUMBER")
                {
                    typecol = "number";
                }
                return(string.Format(TPL.avaloninput, "6", p.Column_name, typecol));
            }).ToList();
            var html = string.Format(TPL.avalonhtml, string.Join("", colinputs));
            var tmp  = new tmpform(html);

            tmp.ShowDialog();
        }
예제 #3
0
        private void 生成btcolumnsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var data = (this.gridControl1.DataSource as IEnumerable <E_Object>).ToList();

            if (sender != this.生成btcolumnsToolStripMenuItem)
            {
                data = data.Where(p => p.ck).ToList();
            }
            var colinputs = data.OrderBy(p => p.sortnum).Select(p =>
            {
                return(string.Format(@"{{field:'{0}',title:this.vmtag.{0},sortable: true}}", p.Column_name));
            }).ToList();

            var tmp = new tmpform(@"[{
                                checkbox: true
                            }," + string.Join(",", colinputs) + "]");

            tmp.ShowDialog();
        }
예제 #4
0
        private void 生成avalonhtmlToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var data      = (this.gridControl1.DataSource as IEnumerable <E_Object>).ToList();
            var colinputs = data.OrderBy(p => p.sortnum).Select(p =>
            {
                var typecol = "string";
                if (p.Data_type == "NUMBER")
                {
                    typecol = "number";
                }
                return(string.Format(TPL.avaloninput, "6", p.Column_name, typecol));
            }).ToList();
            var html = string.Format(TPL.avalonhtml, string.Join("", colinputs));
            var tmp  = new tmpform(html);

            tmp.ShowDialog();

            //if (this.gridControl1.DataSource == null || (this.gridControl1.DataSource as IEnumerable<E_Object>).Count() <= 0)
            //    return;
            //FolderBrowserDialog dialog = new FolderBrowserDialog();
            //dialog.Description = "请选择文件路径";

            //if (dialog.ShowDialog() != DialogResult.OK)
            //    return;

            //string foldPath = dialog.SelectedPath;

            //var data = (this.gridControl1.DataSource as IEnumerable<E_Object>).ToList();
            //var colinputs = data.OrderBy(p => p.sortnum).Select(p =>
            //{
            //    var typecol = "string";
            //    if (p.Data_type == "NUMBER")
            //    {
            //        typecol = "number";
            //    }
            //    return string.Format(TPL.avaloninput, "6", p.Column_name, typecol);
            //}).ToList();
            //var html = string.Format(TPL.avalonhtml, string.Join("", colinputs));

            //string strTest = html;
            //System.IO.File.WriteAllText(string.Format("{0}/{1}.html", foldPath, table.TABLE_NAME), strTest, Encoding.UTF8);
            //MessageBox.Show("保存成功!");
        }