Esempio n. 1
0
        public clsObject()
        {
            // 일단은 기본값 초기화..
            for (int i = 0; i < COLUMN_NAME.Length; i++)
            {
                COLUMNS.Add(COLUMN_NAME[i], "");
            }

            for (int i = 0; i < FIXED_COLUMN_NAME.Length; i++)
            {
                FIXED_COLUMNS.Add(FIXED_COLUMN_NAME[i]);
            }
        }
Esempio n. 2
0
        private Label buildRow(Object data, COLUMNS column, int row, Color color, FontWeight weight)
        {
            Label label = new Label();

            label.Content           = data;
            label.FontSize          = 8;
            label.FontWeight        = weight;
            label.Foreground        = new SolidColorBrush(Colors.Black);
            label.VerticalAlignment = VerticalAlignment.Top;
            Grid.SetRow(label, (int)row);
            Grid.SetColumn(label, (int)column);
            return(label);
        }
Esempio n. 3
0
        private Label BuildPlayerInfoRow(String data, COLUMNS column, int row, Color color)
        {
            Label label = new Label();

            label.Content           = data;
            label.FontSize          = 8;
            label.FontWeight        = FontWeights.Normal;
            label.Foreground        = new SolidColorBrush(color);
            label.VerticalAlignment = VerticalAlignment.Top;
            Grid.SetRow(label, (int)row);
            Grid.SetColumn(label, (int)column);
            return(label);
        }
Esempio n. 4
0
        private static Column ParseColumn(Table table, COLUMNS dbColumns)
        {
            var column = new Column();

            column.Table      = table;
            column.DbName     = dbColumns.COLUMN_NAME;
            column.DbType     = dbColumns.DATA_TYPE;
            column.Nullable   = dbColumns.IS_NULLABLE == "YES";
            column.Length     = dbColumns.CHARACTER_MAXIMUM_LENGTH;
            column.PrimaryKey = dbColumns.COLUMN_KEY == "PRI";

            var property = new Property();

            property.CsTypeName  = ParseCsType(column.DbType);
            property.CsNullable  = column.Nullable && IsCsTypeNullable(property.CsTypeName);
            column.ValueProperty = property;

            return(column);
        }
Esempio n. 5
0
        private static Column ParseColumn(TableMetadata table, COLUMNS dbColumns)
        {
            var column = new Column();

            column.Table         = table;
            column.DbName        = dbColumns.COLUMN_NAME;
            column.DbType        = dbColumns.DATA_TYPE;
            column.Nullable      = dbColumns.IS_NULLABLE == "YES";
            column.Length        = dbColumns.CHARACTER_MAXIMUM_LENGTH;
            column.PrimaryKey    = dbColumns.COLUMN_KEY == "PRI";
            column.AutoIncrement = dbColumns.EXTRA.Contains("auto_increment");
            column.Signed        = dbColumns.COLUMN_TYPE.Contains("unsigned") ? false : null;

            var property = new Property();

            property.CsTypeName  = ParseCsType(column.DbType);
            property.CsNullable  = column.Nullable && IsCsTypeNullable(property.CsTypeName);
            column.ValueProperty = property;

            return(column);
        }
Esempio n. 6
0
    public string GetTable()
    {
        Content_Type = "text/html";

        string CurrentPage = Request["CurrentPage"];

        if (string.IsNullOrEmpty(CurrentPage))
        {
            CurrentPage = "0";
        }

        //当前页码
        int SAO_CURRENT_PAGE = Convert.ToInt32(CurrentPage);

        //每页条数
        int SAO_PAGE_SIZE = 20;

        //1通过code 查询配置表
        //构造sql语句
        //查询记录条数
        //按照分页查询语句查出打datatable
        //配置SogTable 生成html返回
        //配置Sogpages 生成html返回
        StringBuilder strsql     = new StringBuilder();
        StringBuilder str_count  = new StringBuilder();
        StringBuilder str_column = new StringBuilder();
        StringBuilder str_where  = new StringBuilder();
        StringBuilder str_order  = new StringBuilder();

        List <SqlParameter> list_para = new List <SqlParameter>();


        StringBuilder SogTextSQL = new StringBuilder();

        foreach (SYS_COLUMNS c in COLUMNS_SEARCH)
        {
            if (!string.IsNullOrEmpty(c.SC_CONTROL_DATA))
            {
                string value = Request[c.SC_COLUMN_NAME];
                if (!string.IsNullOrEmpty(value))
                {
                    str_where.Append(" and " + c.SC_COLUMN_NAME + "=@" + c.SC_COLUMN_NAME + " ");
                    list_para.Add(new SqlParameter("@" + c.SC_COLUMN_NAME, Request[c.SC_COLUMN_NAME]));
                }
            }
            else
            {
                string value = Request["SogText"];
                if (!string.IsNullOrEmpty(value))
                {
                    if (SogTextSQL.Length == 0)
                    {
                        SogTextSQL.Append(" " + c.SC_COLUMN_NAME + " like @" + c.SC_COLUMN_NAME + " ");
                    }
                    else
                    {
                        SogTextSQL.Append("or " + c.SC_COLUMN_NAME + " like @" + c.SC_COLUMN_NAME + " ");
                    }
                    list_para.Add(new SqlParameter("@" + c.SC_COLUMN_NAME, "%" + Request["SogText"] + "%"));
                }
            }
        }

        //and (a like @a or b like @b)
        if (SogTextSQL.Length != 0)
        {
            str_where.Append(" and (" + SogTextSQL + ")");
        }

        string session_other_sql = Session["OtherSQL" + SO_ID.ToString()].ToString();

        if (!string.IsNullOrEmpty(session_other_sql))
        {
            List <SqlParameter> session_other_para = (List <SqlParameter>)Session["list_para" + SO_ID.ToString()];
            str_where.Append(session_other_sql);
            list_para.AddRange(session_other_para);
        }


        Dictionary <string, string> ht_order_search = (Dictionary <string, string>)Session["OtherSearch" + SO_ID.ToString()];

        foreach (KeyValuePair <string, string> item in ht_order_search)
        {
            string value = Request[item.Key];
            if (!string.IsNullOrEmpty(value))
            {
                str_where.Append(" " + item.Value + " ");
                list_para.Add(new SqlParameter("@" + item.Key, value));
            }
        }



        string session_other_order = Session["OtherOrder" + SO_ID.ToString()].ToString();

        if (string.IsNullOrEmpty(session_other_order))
        {
            str_order.Append("order by " + OBJECT.SO_TABLE_KEY + " desc");
        }
        else
        {
            str_order.Append(session_other_order);
        }


        str_count.Append("select " + "count(1)" + "  from " + OBJECT.SO_TABLE_NAME_SEARCH + " where 1=1 " + str_where);

        SqlConnection cn_count = comm_fun.get_cn();
        string        count    = "0";

        try
        {
            count = comm_fun.ExecuteScalar(str_count.ToString(), cn_count, list_para);
        }
        catch (Exception ex)
        {
            comm_fun.WriteLog(ex.ToString());
            count = "0";
        }
        finally
        {
            comm_fun.CloseConnection(cn_count);
        }

        str_column.Append(OBJECT.SO_TABLE_KEY);
        foreach (SYS_COLUMNS c in COLUMNS_TABLE)
        {
            //str_column.Append("," + item.SC_COLUMN_NAME);

            if (c.SC_CONTROL_TYPE == "SogDate")
            {
                str_column.Append("," + "dbo.fn_convert_date(" + c.SC_COLUMN_NAME + ") as " + c.SC_COLUMN_NAME);
            }
            else if (c.SC_CONTROL_TYPE == "SogDateTime")
            {
                str_column.Append("," + "dbo.fn_convert_datetime(" + c.SC_COLUMN_NAME + ") as " + c.SC_COLUMN_NAME);
            }
            else
            {
                str_column.Append("," + c.SC_COLUMN_NAME);
            }
        }

        strsql.Append("select top " + SAO_PAGE_SIZE + "  " + str_column.ToString() + "  from " + OBJECT.SO_TABLE_NAME_SEARCH + " where 1=1");
        strsql.Append(" and " + OBJECT.SO_TABLE_KEY + "  not in (select top " + (SAO_CURRENT_PAGE * SAO_PAGE_SIZE).ToString() + " " + OBJECT.SO_TABLE_KEY + "   " + "  from " + OBJECT.SO_TABLE_NAME_SEARCH + " where 1=1 " + str_where.ToString() + "  " + str_order.ToString() + ")" + str_where.ToString() + "  " + str_order.ToString());


        SqlConnection cn = comm_fun.get_cn();
        DataTable     dt = new DataTable();

        try
        {
            dt = comm_fun.GetDatatable(strsql.ToString(), cn, list_para);
        }
        catch (Exception ex)
        {
            comm_fun.WriteLog(ex.ToString());
        }
        finally
        {
            comm_fun.CloseConnection(cn);
        }


        for (Int32 i = 0; i < dt.Rows.Count; i++)
        {
            List <SYS_COLUMNS> list = COLUMNS.Where(o => string.IsNullOrEmpty(o.SC_CONTROL_DATA) == false).ToList();

            foreach (SYS_COLUMNS item in list)
            {
                DataRow dr = dt.Rows[i];
                dr[item.SC_COLUMN_NAME.ToColumnName()] = GetDataDescription(GetControlData(item.SC_CONTROL_DATA), dr[item.SC_COLUMN_NAME.ToColumnName()].ToString());
            }
        }

        //文件解析
        List <SYS_COLUMNS> list_column_file = COLUMNS_TABLE.Where(o => o.SC_CONTROL_TYPE == "SogFileUpload").ToList();

        foreach (SYS_COLUMNS c in list_column_file)
        {
            for (Int32 i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                dr[c.SC_COLUMN_NAME.ToColumnName()] = GetFileDescription(dr[c.SC_COLUMN_NAME.ToColumnName()].ToString());
            }
        }



        //文件夹解析
        List <SYS_COLUMNS> list_column_folder = COLUMNS_TABLE.Where(o => o.SC_CONTROL_TYPE == "SogFolderUpload").ToList();

        foreach (SYS_COLUMNS c in list_column_folder)
        {
            for (Int32 i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                dr[c.SC_COLUMN_NAME.ToColumnName()] = GetFolderDescription(dr[c.SC_COLUMN_NAME.ToColumnName()].ToString());
            }
        }

        //日期控件解析
        //List<SYS_COLUMNS> list_column_date = COLUMNS_TABLE.Where(o => o.SC_CONTROL_TYPE == "SogDate").ToList();
        //foreach (SYS_COLUMNS c in list_column_date)
        //{
        //    dt.Columns.Add(c.SC_COLUMN_NAME.ToColumnName() + "_desc");

        //    for (Int32 i = 0; i < dt.Rows.Count; i++)
        //    {
        //        DataRow dr = dt.Rows[i];
        //        dr[c.SC_COLUMN_NAME.ToColumnName() + "_desc"] = GetDate(dr[c.SC_COLUMN_NAME.ToColumnName()].ToString());
        //    }
        //}



        SogTable tb = new SogTable();

        tb.Buttons    = GSYS.GetButton(SO_ID);
        tb.DataSource = dt;
        tb.KeyField   = OBJECT.SO_TABLE_KEY;
        tb.HasCheck   = true;


        foreach (SYS_COLUMNS item in COLUMNS_TABLE)
        {
            //if (item.SC_CONTROL_TYPE == "SogDate")
            //{
            //    tb.Add(item.SC_COLUMN_NAME.ToColumnName() + "_desc", item.SC_COLUMN_DESC, "", item.SC_TABLE_CLASS);
            //}
            //else
            //{
            //    tb.Add(item.SC_COLUMN_NAME.ToColumnName(), item.SC_COLUMN_DESC, "", item.SC_TABLE_CLASS);
            //}

            tb.Add(item.SC_COLUMN_NAME.ToColumnName(), item.SC_COLUMN_DESC, "", item.SC_TABLE_CLASS);
        }

        SogPages p = new SogPages();

        p.TotalPage   = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(count) / Convert.ToDouble(SAO_PAGE_SIZE)));
        p.CurrentPage = SAO_CURRENT_PAGE;

        return(tb.ToHtml() + p.ToHtml());
    }