Example #1
0
        private void ColumnGrid_DoubleClick(object sender, EventArgs e)
        {
            DataRow row = ColumnGridView.GetDataRow(ColumnGridView.FocusedRowHandle);

            txtMessage.Text = txtMessage.Text + "<" + row["ColumnName"].ToString() + ">  ";
            txtMessage.SelectAll();
            MakeQuery();
        }
Example #2
0
        private void TableGrid_DoubleClick(object sender, EventArgs e)
        {
            DataRow row = TableGridView.GetDataRow(TableGridView.FocusedRowHandle);

            SourceTable = row["TableName"].ToString();
            DataSet dsSource = ProjectFunctions.GetDataSet("SELECT COLUMN_NAME as ColumnName FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'" + row["TableName"].ToString() + "'", ProjectFunctions.GetConnection());

            if (dsSource.Tables[0].Rows.Count > 0)
            {
                ColumnGrid.DataSource = dsSource.Tables[0];
                ColumnGridView.BestFitColumns();
            }
            else
            {
                ColumnGrid.DataSource = null;
                ColumnGridView.BestFitColumns();
            }

            txtQuery.Text = "Select FROM " + SourceTable;

            DataSet dsColumns = ProjectFunctions.GetDataSet("SELECT COLUMN_NAME as ColumnName FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'" + row["TableName"].ToString() + "'", ProjectFunctions.GetConnection());

            if (dsColumns.Tables[0].Rows.Count > 0)
            {
                dsColumns.Tables[0].Columns.Add("Select", typeof(bool));
                foreach (DataRow dr in dsColumns.Tables[0].Rows)
                {
                    dr["Select"] = false;
                }
                ParameterGrid.DataSource = dsColumns.Tables[0];
            }
            else
            {
                ParameterGrid.DataSource = null;
            }
        }
Example #3
0
        public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            //=========================================================================
            List <ColumnGridView> columns         = new List <ColumnGridView>();
            GridViewSetting       gridViewSetting = new GridViewSetting();

            //=========================================================================

            gridViewSetting.HasRowNumber = this.HasRowNumber;

            //تعداد آیتمی که باید نمایش داده شود
            var result = Query.Skip(pagenumber).Take(pagesize).ToList();


            #region setting for columns

            //گرفتن آیتمها یا به عبارتی ستون ها
            foreach (PropertyInfo prop in ClassType.GetType().GetProperties())
            {
                ColumnGridView column = new ColumnGridView
                {
                    // نام فیلد مورد نظر
                    Name = prop.Name,
                    // نوع فیلد مورد نظر
                    ColumnType = GetFieldType(prop)
                };



                foreach (var attr in prop.GetCustomAttributesData())
                {
                    Dictionary <string, string> item = new Dictionary <string, string>();


                    //if (attr.AttributeType.Name == "DisplayAttribute")



                    if (attr.AttributeType.Name == "ColumnGridViewAttribute")
                    {
                        foreach (var ColumnGridViewAttributeAttr in attr.NamedArguments)
                        {
                            if (ColumnGridViewAttributeAttr.MemberName == "DisplayName")
                            {
                                // عنوان ستون که باید نمایش داده شود
                                column.Title = ColumnGridViewAttributeAttr.TypedValue.ToString();
                            }

                            // اندازه
                            if (ColumnGridViewAttributeAttr.MemberName == "Width")
                            {
                                column.Width = ColumnGridViewAttributeAttr.TypedValue.ToString();
                            }

                            // جستجو
                            if (ColumnGridViewAttributeAttr.MemberName == "Searchable")
                            {
                                column.Searchable = Convert.ToBoolean(ColumnGridViewAttributeAttr.TypedValue.Value);
                            }

                            // مرتب سازی
                            if (ColumnGridViewAttributeAttr.MemberName == "Sortable")
                            {
                                column.Sortable = Convert.ToBoolean(ColumnGridViewAttributeAttr.TypedValue.Value);
                            }

                            // مرتب سازی
                            if (ColumnGridViewAttributeAttr.MemberName == "AlignCenter")
                            {
                                column.AlignCenter = Convert.ToBoolean(ColumnGridViewAttributeAttr.TypedValue.Value);
                            }
                        }
                    }

                    item.Add(attr.AttributeType.Name, attr.NamedArguments[0].TypedValue.ToString());

                    column.Attrs.Add(item);
                }
                columns.Add(column);
            }

            #endregion


            ViewContext.ViewBag.ColumnsGridView     = columns;
            ViewContext.ViewBag.ColumnsGridViewJson = JArray.FromObject(columns).ToString();//JsonConvert.SerializeObject(columns, Formatting.Indented).Replace("\\", "");
            ViewContext.ViewBag.GridViewSetting     = gridViewSetting;
            ViewContext.ViewBag.Name = this.Name;

            (html as IViewContextAware).Contextualize(ViewContext);



            var content = html.Partial("~/Views/Shared/TagHelpersView/GridList.cshtml", result);
            output.Content.SetHtmlContent(content);

            return(base.ProcessAsync(context, output));
        }