Example #1
0
        public static ClsBindGrid pGridCfg_Get(String GridName)
        {
            List<ClsBindGrid> List_Grid = Do_Methods.DeserializeObjectFromFile_Json<List<ClsBindGrid>>(Layer01_Constants.CnsPathGridCfg);
            if (List_Grid == null)
            { List_Grid = new List<ClsBindGrid>(); }

            ClsBindGrid Grid = List_Grid.FirstOrDefault(O => O.pName == GridName);

            if (Grid == null)
            { Grid = new ClsBindGrid() { pName = GridName }; }

            return Grid;
        }
Example #2
0
        void Test_Form2_Load(object sender, EventArgs e)
        {
            Do_Globals.gSettings.pConnectionString = @"User ID=sa; Password=Administrator1; Initial Catalog=Damit; Data Source=.\SQL_2K8R2;";

            ClsBindGrid GridDef = new ClsBindGrid();
            GridDef.pColumns.Add(new ClsBindGridColumn("Name"));
            GridDef.pColumns.Add(new ClsBindGridColumn("Code"));

            ClsMayari Obj = new ClsMayari(null);

            this.ucFilter1.Setup(this.ucGrid1, GridDef, Obj.List_Empty());
            this.ucGrid1.Setup_FromBase("Test", Obj, GridDef, new List<string>() { "MayariID" }, false, true, true);
        }
Example #3
0
        public static void pGridCfg_Set(String GridName, ClsBindGrid Value)
        {
            List<ClsBindGrid> List_Grid = (List<ClsBindGrid>)Do_Methods.DeserializeObjectFromFile_Json(typeof(List<ClsBindGrid>), Layer01_Constants.CnsPathGridCfg);
            if (List_Grid == null)
            { List_Grid = new List<ClsBindGrid>(); }

            ClsBindGrid Grid = List_Grid.FirstOrDefault(O => O.pName == GridName);

            if (Grid == null)
            { List_Grid.Add(Value); }
            else
            { Grid.pColumns = Value.pColumns; }

            Do_Methods.SerializeObjectToFile_Json(List_Grid, Layer01_Constants.CnsPathGridCfg);
        }
        public static void BindGrid(
            C1TrueDBGrid Grid
            , String GridName
            , DataTable Dt_Source
            , ClsBindGrid GridDef
            , Boolean IsDefault = false
            , Boolean IsSelect = false)
        {
            ClsBindGrid GridDef_Cfg = Layer01_Config.pGridCfg_Get(GridName);

            if (((GridDef.pColumns.Count != GridDef_Cfg.pColumns.Count) || IsDefault))
            {
                GridDef_Cfg.pColumns = GridDef.pColumns;
                Layer01_Config.pGridCfg_Set(GridName, GridDef_Cfg);
            }

            if (IsSelect)
            {
                if (!Dt_Source.Columns.Contains("IsSelect"))
                { Dt_Source.Columns.Add("IsSelect", typeof(Boolean)); }

                foreach (DataRow Dr in Dt_Source.Rows)
                { Dr["IsSelect"] = false; }

                foreach (var Item in GridDef_Cfg.pColumns)
                { Item.pOrderIndex++; }

                ClsBindGridColumn Gc_New = new ClsBindGridColumn();
                GridDef_Cfg.pColumns.Add(Gc_New);

                Gc_New.pFieldName = "IsSelect";
                Gc_New.pFieldDesc = "Is Select?";
                Gc_New.pWidth = 80;
                Gc_New.pHorizontalAlign = Layer01_Constants.eSystem_Lookup_HorizontalAlign.Grid_HorizontalAlign_Center;
                Gc_New.pOrderIndex = 0;
            }

            InitializeGrid(Grid);

            Grid.DataSource = Dt_Source;
            Grid.Splits[0].CaptionHeight = 45;

            BindGrid_SetColumns(Grid, GridDef_Cfg);
        }
Example #5
0
        public void Setup(ClsBindGrid GridDef, DataTable Dt_Source)
        {
            List<ClsBindGridColumn> GridDef_Columns = GridDef.pColumns;

            this.mFilterFields = new List<UcFilter_Field>();

            foreach (
                ClsBindGridColumn Item_Gc
                in (from O in GridDef_Columns where O.pIsFilter == true select O))
            {
                UcFilter_Field Field = new UcFilter_Field();
                Field.FieldName = Item_Gc.pFieldName;
                Field.FieldDesc = Item_Gc.pFieldDesc;

                if (Dt_Source.Columns.Contains(Item_Gc.pFieldName))
                { Field.DataType = Dt_Source.Columns[Item_Gc.pFieldName].DataType; }

                this.mFilterFields.Add(Field);
            }

            Layer01_Methods.BindCombo(this.Cbo_Field, this.mFilterFields, "FieldDesc", "FieldName");

            //[-]

            this.mDt_FilterItems = new DataTable();
            this.mDt_FilterItems.Columns.Add("Key", typeof(Int64));
            this.mDt_FilterItems.Columns.Add("Field", typeof(String));
            this.mDt_FilterItems.Columns.Add("Field_Condition", typeof(String));
            this.mDt_FilterItems.Columns.Add("Btn_Delete", typeof(String));

            Layer01_Methods_C1.InitializeGrid(this.Grid_Filters);
            this.Grid_Filters.FilterBar = false;
            this.Grid_Filters.AllowFilter = false;
            this.Grid_Filters.DataSource = this.mDt_FilterItems;

            ClsBindGrid GridDef_FilterItems = new ClsBindGrid();
            GridDef_FilterItems.pColumns.Add(new ClsBindGridColumn("Field", "Field", 100));
            GridDef_FilterItems.pColumns.Add(new ClsBindGridColumn("Field_Condition", "Condition", 200));
            GridDef_FilterItems.pColumns.Add(new ClsBindGridColumn("Btn_Delete", "", 100, "", Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Button, Layer01_Constants.eSystem_Lookup_HorizontalAlign.Grid_HorizontalAlign_Center));

            Layer01_Methods_C1.BindGrid_SetColumns(this.Grid_Filters, GridDef_FilterItems);

            this.Setup_EventHandlers();
        }
        public static void BindGrid_SetColumns(
            C1TrueDBGrid Grid
            , ClsBindGrid GridDef)
        {
            List<ClsBindGridColumn> GridDef_Columns = GridDef.pColumns;
            List<String> List_Columns = (from O in GridDef_Columns orderby O.pOrderIndex select O.pFieldName).ToList();
            SetGridColumnArrangement(Grid, List_Columns);

            foreach (Split Sp in Grid.Splits)
            {
                foreach (C1DisplayColumn Dc in Sp.DisplayColumns)
                {
                    var Inner_ItemColumn = GridDef_Columns.FirstOrDefault(O => O.pFieldName == Dc.DataColumn.DataField);
                    if (Inner_ItemColumn != null)
                    {
                        Dc.Width = Inner_ItemColumn.pWidth;
                        Dc.DataColumn.Caption = Inner_ItemColumn.pFieldDesc;
                        Dc.Locked = !Inner_ItemColumn.pIsEnabled;
                        Dc.FetchStyle = true;

                        switch (Inner_ItemColumn.pHorizontalAlign)
                        {
                            case Layer01_Constants.eSystem_Lookup_HorizontalAlign.Grid_HorizontalAlign_Center:
                                Dc.Style.HorizontalAlignment = AlignHorzEnum.Center;
                                break;
                            case Layer01_Constants.eSystem_Lookup_HorizontalAlign.Grid_HorizontalAlign_Far:
                                Dc.Style.HorizontalAlignment = AlignHorzEnum.Far;
                                break;
                            case Layer01_Constants.eSystem_Lookup_HorizontalAlign.Grid_HorizontalAlign_General:
                                Dc.Style.HorizontalAlignment = AlignHorzEnum.General;
                                break;
                            case Layer01_Constants.eSystem_Lookup_HorizontalAlign.Grid_HorizontalAlign_Justify:
                                Dc.Style.HorizontalAlignment = AlignHorzEnum.Justify;
                                break;
                            case Layer01_Constants.eSystem_Lookup_HorizontalAlign.Grid_HorizontalAlign_Near:
                                Dc.Style.HorizontalAlignment = AlignHorzEnum.Near;
                                break;
                            default:
                                Dc.Style.HorizontalAlignment = AlignHorzEnum.Justify;
                                break;
                        }

                        switch (Inner_ItemColumn.pFieldType)
                        {
                            case Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Button:
                                Dc.ButtonAlways = true;
                                Dc.ButtonText = true;
                                Dc.Locked = true;
                                Dc.Frozen = true;

                                break;
                        }
                    }
                    else
                    {
                        Dc.Visible = false;
                        Dc.AllowSizing = false;
                    }

                    Dc.HeadingStyle.HorizontalAlignment = AlignHorzEnum.Justify;
                }
            }
        }
Example #7
0
        void Setup(
            String GridName
            , eSourceType SourceType
            , Object Datasource
            , ClsBindGrid GridDefinition
            , Boolean IsSelection = false
            , List<String> List_TableKey = null
            , Boolean AllowSort = false
            , Boolean AllowPaging = false
            , Boolean IsDefault = false)
        {
            this.mProperties = new UcGrid_Properties();
            this.mProperties.SourceType = SourceType;

            switch (SourceType)
            {
                case eSourceType.Base:
                    this.mProperties.Datasource_Base = (ClsBase)Datasource;
                    break;
                case eSourceType.DataTable:
                    this.mProperties.Datasource_Dt = (DataTable)Datasource;
                    break;
                case eSourceType.Table:
                    this.mProperties.Datasource_TableName = (String)Datasource;
                    break;
                case eSourceType.QuerySource:
                    this.mProperties.Datasource_QuerySource = (Do_Constants.Str_QuerySource)Datasource;
                    break;
            }

            this.mProperties.GridDefinition = GridDefinition;
            this.mProperties.IsSelection = IsSelection;
            //this.mProperties.TableKey = KeyName;
            this.mProperties.List_TableKey = List_TableKey;
            this.mProperties.AllowSort = AllowSort;
            this.mProperties.AllowPaging = AllowPaging;
            this.mProperties.GridName = GridName;

            this.BindGrid(IsDefault);

            this.Setup_EventHandlers();
        }
Example #8
0
 public void Setup_FromTable(
     String GridName
     , String Datasource_TableName
     , ClsBindGrid GridDefinition
     , List<String> List_TableKey = null
     , Boolean IsSelection = false
     , Boolean AllowSort = false
     , Boolean AllowPaging = false
     , Boolean IsDefault = false)
 {
     this.Setup(
         GridName
         , eSourceType.Table
         , Datasource_TableName
         , GridDefinition
         , IsSelection
         , List_TableKey
         , AllowSort
         , AllowPaging
         , IsDefault);
 }
Example #9
0
 public void Setup_FromQuerySource(
     String GridName
     , Do_Constants.Str_QuerySource DataSource_QuerySource
     , ClsBindGrid GridDefinition
     , List<String> List_TableKey = null
     , Boolean IsSelection = false
     , Boolean AllowSort = false
     , Boolean AllowPaging = false
     , Boolean IsDefault = false)
 {
     this.Setup(
         GridName
         , eSourceType.QuerySource
         , DataSource_QuerySource
         , GridDefinition
         , IsSelection
         , List_TableKey
         , AllowSort
         , AllowPaging
         , IsDefault);
 }
Example #10
0
        //[-]
        public static ClsBindGrid GetBindGrid(String Name)
        {
            ClsBindGrid GridDef = new ClsBindGrid() { pName = Name };

            DataTable Dt_Def = Do_Methods_Query.GetQuery(@"System_BindDefinition", "", "Name = '" + Name + "'");
            if (Dt_Def.Rows.Count == 0)
            { throw new Exception("Specified BindDefinition not found."); }

            DataRow Dr_Def = Dt_Def.Rows[0];

            //GridDef.pTableName = Do_Methods.Convert_String(Dr_Def["TableName"]);
            //GridDef.pTableKey = Do_Methods.Convert_String(Dr_Def["TableKey"]);
            //GridDef.pDesc = Do_Methods.Convert_String(Dr_Def["Desc"]);
            //GridDef.pCondition = Do_Methods.Convert_String(Dr_Def["Condition"]);
            //GridDef.pSort = Do_Methods.Convert_String(Dr_Def["Sort"]);

            DataTable Dt_DefColumns = Do_Methods_Query.GetQuery(@"udf_System_BindDefinition('" + Name + @"')", "", "", "OrderIndex");
            foreach (DataRow Dr in Dt_DefColumns.Rows)
            {
                GridDef.pColumns.Add(new ClsBindGridColumn(
                    Do_Methods.Convert_String(Dr["Name"])
                    , Do_Methods.Convert_String(Dr["Desc"])
                    , Do_Methods.Convert_Int32(Dr["Width"])
                    , Do_Methods.Convert_String(Dr["NumberFormat"])
                    , Do_Methods.ParseEnum<Layer01_Constants.eSystem_Lookup_FieldType>(Do_Methods.Convert_String(Dr["System_LookupID_FieldType"]))
                    , Do_Methods.ParseEnum<Layer01_Constants.eSystem_Lookup_HorizontalAlign>(Do_Methods.Convert_String(Dr["System_LookupID_HorizontalAlign"]))
                    , !Do_Methods.Convert_Boolean(Dr["IsHidden"])
                    , !Do_Methods.Convert_Boolean(Dr["IsReadOnly"])
                    , Do_Methods.Convert_Boolean(Dr["IsFilter"])));
            }

            return GridDef;
        }
Example #11
0
 public void Setup(Interface_FilterTarget FilterTarget, ClsBindGrid GridDef, DataTable Dt_Source)
 {
     this.mFilterTarget = FilterTarget;
     this.EvFilter += new DsFilter(UcFilter_EvFilter);
     this.Setup(GridDef, Dt_Source);
 }