コード例 #1
0
        protected void SetDropDownColumn(JQGrid grid, string dataField, List <SelectListItem> listItems)
        {
            JQGridColumn column = grid.Columns.Find(c => c.DataField == dataField);

            if (column != null)
            {
                if (column.Searchable)
                {
                    column.SearchType = SearchType.DropDown;
                    if (grid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
                    {
                        column.SearchList = listItems;
                    }
                }
                if (column.Editable)
                {
                    column.EditType = EditType.DropDown;
                    if (grid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
                    {
                        column.EditList = listItems;
                    }
                }
                if (column.Visible)
                {
                    column.Formatter = new DropDownFormatter();
                }
            }
        }
コード例 #2
0
        private void SetUpFreightSearchDropDown(JQGrid ordersGrid)
        {
            // setup the grid search criteria for the columns
            JQGridColumn freightColumn = ordersGrid.Columns.Find(c => c.DataField == "Freight");

            freightColumn.Searchable = true;

            // DataType must be set in order to use searching
            freightColumn.DataType = typeof(decimal);
            freightColumn.SearchToolBarOperation = SearchOperation.IsGreaterOrEqualTo;
            freightColumn.SearchType             = SearchType.DropDown;

            // Populate the search dropdown only on initial request, in order to optimize performance
            if (ordersGrid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
            {
                List <SelectListItem> searchList = new List <SelectListItem>();
                searchList.Add(new SelectListItem {
                    Text = "> 10", Value = "10"
                });
                searchList.Add(new SelectListItem {
                    Text = "> 30", Value = "30"
                });
                searchList.Add(new SelectListItem {
                    Text = "> 50", Value = "50"
                });
                searchList.Add(new SelectListItem {
                    Text = "> 100", Value = "100"
                });

                freightColumn.SearchList = searchList.ToList <SelectListItem>();
                freightColumn.SearchList.Insert(0, new SelectListItem {
                    Text = "All", Value = ""
                });
            }
        }
コード例 #3
0
        protected virtual List <JQGridColumn> CreateGridColumnDefs()
        {
            //object model = TypeAccessor.CreateInstance();
            List <JQGridColumn> columns = new List <JQGridColumn>();

            foreach (ModelMetadata property in Metadata.Properties)
            {
                JQGridColumn column = CreateGridColumn(property);
                columns.Add(column);
            }

            if (Metadata.Model is ITrackableEntity)
            {
                JQGridColumn col = null;
                col = columns.Find((c) => {
                    return(c.DataField == "ChangedBy");
                });
                col.Visible  = false;
                col.Editable = false;

                col = columns.Find((c) => {
                    return(c.DataField == "ChangedDate");
                });
                col.Visible  = false;
                col.Editable = false;
            }

            return(columns);
        }
コード例 #4
0
        private void SetupInventoryGridModel(JQGrid grid)
        {
            grid.DataUrl = Url.Action("Inventory_RequestData");
            grid.EditUrl = Url.Action("Inventory_EditData");

            JQGridColumn unitsColumn = grid.Columns.Find(c => c.DataField == "UnitOfMeasure");

            unitsColumn.Formatter = new CustomFormatter()
            {
                FormatFunction   = "ShowName",
                UnFormatFunction = "UnShowName"
            };
            unitsColumn.EditType   = EditType.DropDown;
            unitsColumn.SearchType = SearchType.DropDown;
            if (grid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
            {
                var editList = (from u in db.UnitOfMeasures
                                select new
                {
                    u.Id,
                    u.Name
                }).ToList();
                var list = editList.Select(s => new SelectListItem {
                    Text = s.Name, Value = s.Id.ToString()
                });
                unitsColumn.EditList   = list.ToList <SelectListItem>();
                unitsColumn.SearchList = list.ToList <SelectListItem>();
                unitsColumn.SearchList.Insert(0, new SelectListItem {
                    Text = "所有", Value = ""
                });
            }
        }
コード例 #5
0
        private void CreateColumns()
        {
            var modelType = typeof(T);
            var columns   = new List <JQGridColumn>();

            var properties = modelType.GetProperties();

            if (properties != null)
            {
                foreach (var property in properties)
                {
                    var column = new JQGridColumn();
                    column.Name = property.Name;

                    var attrs = Attribute.GetCustomAttributes(property);
                    foreach (var attr in attrs)
                    {
                        var a = attr as JQGridColumnAttribute;
                        if (a != null)
                        {
                            column.Width      = a.Width;
                            column.IsHidden   = a.IsHidden;
                            column.IsSortable = a.IsSortable;
                            column.Align      = a.Align;
                            column.Formatter  = a.Formatter;
                            column.Entity     = a.Entity;
                            column.TypeName   = property.PropertyType.Name;
                        }
                    }
                    columns.Add(column);

                    //if (property.Name.Equals("Customer"))
                    //{
                    //    var customerProperties = property.PropertyType.GetProperties();
                    //    foreach (var customerProperty in customerProperties)
                    //    {
                    //        var customerColumn = new JQGridColumn();
                    //        customerColumn.Name = customerProperty.Name;

                    //        var customerAttrs = Attribute.GetCustomAttributes(customerProperty);
                    //        foreach (var attr in customerAttrs)
                    //        {
                    //            var a = attr as JQGridColumnAttribute;
                    //            if (a != null)
                    //            {
                    //                customerColumn.Width = a.Width;
                    //                customerColumn.IsHidden = a.IsHidden;
                    //                customerColumn.IsSortable = a.IsSortable;
                    //                customerColumn.Align = a.Align;
                    //                customerColumn.Formatter = a.Formatter;
                    //                customerColumn.Entity = a.Entity;
                    //            }
                    //        }
                    //        columns.Add(customerColumn);
                    //    }
                    //}
                }
            }
            Columns = columns;
        }
コード例 #6
0
        private void SetupkeyMangeGrid(JQGrid grid)
        {
            grid.DataUrl = Url.Action("KeyManage_RequestData");
            grid.EditUrl = Url.Action("KeyManage_EditData");

            JQGridColumn userColumn = grid.Columns.Find(c => c.DataField == "UserId");

            if (grid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
            {
                var us  = db.aspnet_CustomProfile.ToList();
                var lus = us.Select(u => new SelectListItem {
                    Text = u.FullName, Value = u.UserId.ToString()
                }
                                    ).ToList();

                userColumn.EditList = lus;
            }
            userColumn.EditType = EditType.DropDown;

            userColumn.Formatter = new CustomFormatter()
            {
                FormatFunction   = "ShowName",
                UnFormatFunction = "UnShowName"
            };
        }
コード例 #7
0
        private void SetupParaGridModel(JQGrid grid)
        {
            grid.DataUrl = Url.Action("Para_RequestData");
            grid.EditUrl = Url.Action("Para_EditData");
            grid.SearchDialogSettings.MultipleSearch = true;
            JQGridColumn typeColumn = grid.Columns.Find(c => c.DataField == "Type");

            //typeColumn.Formatter = new CheckBoxFormatter();
            typeColumn.SearchType = SearchType.DropDown;
            if (grid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
            {
                List <SelectListItem> litem = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "所有", Value = ""
                    },
                    new SelectListItem {
                        Text = "部门编码长度", Value = "DeptCodeLength"
                    },                                                               //DeptCodeLength
                    new SelectListItem {
                        Text = "结算方式", Value = "BalanceType"
                    }                                                          //BalanceType
                };
                typeColumn.EditList = litem;
                //litem.Insert(0, new SelectListItem { Text = "所有", Value = "" });
                typeColumn.SearchList = litem;
            }
            typeColumn.EditType = EditType.DropDown;
        }
コード例 #8
0
        private void SetUpCustomerIDSearchDropDown(JQGrid ordersGrid)
        {
            // setup the grid search criteria for the columns
            JQGridColumn customersColumn = ordersGrid.Columns.Find(c => c.DataField == "CustomerID");

            customersColumn.Searchable = true;

            // DataType must be set in order to use searching
            customersColumn.DataType = typeof(string);
            customersColumn.SearchToolBarOperation = SearchOperation.IsEqualTo;
            customersColumn.SearchType             = SearchType.DropDown;

            // Populate the search dropdown only on initial request, in order to optimize performance
            //if (ordersGrid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
            //{
            //    var northWindModel = new NorthwindDataContext();
            //    var searchList = from customers in northWindModel.Customers
            //                     select new SelectListItem
            //                     {
            //                         Text = customers.CustomerID,
            //                         Value = customers.CustomerID
            //                     };

            //customersColumn.SearchList = searchList.ToList<SelectListItem>();
            //customersColumn.SearchList.Insert(0, new SelectListItem { Text = "All", Value = "" });
            //}
        }
コード例 #9
0
ファイル: BaseController.cs プロジェクト: zhenghua75/DXInfo
        protected void SetGridColumn(JQGrid grid, string dataField, bool enabled)
        {
            JQGridColumn column = grid.Columns.Find(c => c.DataField == dataField);

            if (column != null)
            {
                if (column.Exportable)
                {
                    column.Exportable = enabled;
                }
                else
                {
                    if (column.Visible)
                    {
                        column.Visible = enabled;
                    }
                    if (column.Editable)
                    {
                        column.Editable = enabled;
                    }
                    if (column.Searchable)
                    {
                        column.Searchable = enabled;
                    }
                }
                if (!column.Hidedlg)
                {
                    column.Hidedlg = !enabled;
                }
            }
        }
コード例 #10
0
        private void SetUpColumns()
        {
            var builder = new JQGridColumnBuilder();

            var columnId = builder.GetStandard("Id", "Id");

            columnId.Editable   = false;
            columnId.Searchable = false;
            columnId.PrimaryKey = true;
            columnId.Visible    = false;

            Grid.Columns.Add(columnId);

            var columnDescription = builder.GetStandard("Descripción", "Descripcion");

            columnDescription.Width = 300;

            Grid.Columns.Add(columnDescription);

            var columnProvincia = builder.GetStandard("Provincia", "ProvinciaDescripcion");

            columnDescription.Width = 300;

            Grid.Columns.Add(columnProvincia);

            var maskColumn = new JQGridColumn();

            maskColumn.HeaderText = "MaskTest";
            maskColumn.DataField  = "MaskTest";
            maskColumn.Width      = 150;

            Grid.Columns.Add(maskColumn);
        }
コード例 #11
0
        protected virtual JQGridColumn CreateGridColumn(ModelMetadata metadata)
        {
            Guard.IsNotNull(metadata, "column");
            Type         type      = metadata.ModelType.GetObjectTypeIfNullable();
            string       modelType = type.Name;
            JQGridColumn column    = new JQGridColumn();

            //column.HeaderText = metadata.DisplayName;
            column.HeaderText = String.IsNullOrEmpty(metadata.ShortDisplayName) ? metadata.GetDisplayName() : metadata.ShortDisplayName;
            //column.HeaderText += ":" + modelType;
            column.DataField  = metadata.PropertyName;
            column.DataType   = metadata.ModelType;
            column.Searchable = column.Visible = metadata.ShowForDisplay || metadata.ShowForEdit;
            //column.Searchable = true;
            column.Editable = !metadata.IsReadOnly;
            //column.Editable = !metadata.IsReadOnly && metadata.ShowForEdit;
            if (modelType == "Int32" ||
                modelType == "Byte" ||
                modelType == "Float" ||
                modelType == "Decimal" ||
                modelType == "Double")
            {
                column.TextAlign = TextAlign.Right;
                column.SearchSupportedOperations = SearchOperations.ForNumerics;
                column.SearchToolBarOperation    = SearchOperation.IsEqualTo;
                column.Width = 70;
            }
            if (modelType == "Int32" || modelType == "Byte")
            {
                column.Formatter = new IntegerFormatter();
            }
            if (modelType == "Float" || modelType == "Decimal")
            {
                column.Formatter = new NumberFormatter {
                    DecimalPlaces = 2
                };
            }
            if (modelType == "Double")
            {
                column.Formatter = new NumberFormatter {
                    DecimalPlaces = 4
                };
            }
            if (modelType == "String")
            {
                //column.TextAlign = TextAlign.Center;
                //column.Formatter = new CheckBoxFormatter();
                column.SearchSupportedOperations = SearchOperations.ForStrings;
            }
            if (modelType == "Boolean")
            {
                column.TextAlign = TextAlign.Center;
                column.Formatter = new CheckBoxFormatter();
                column.SearchSupportedOperations = SearchOperations.IsEqualTo;
                column.EditType = EditType.CheckBox;
            }
            return(column);
        }
コード例 #12
0
        private void SetShipNameSearchDropDown(JQGrid ordersGrid)
        {
            JQGridColumn freightColumn = ordersGrid.Columns.Find(c => c.DataField == "ShipName");

            freightColumn.Searchable             = true;
            freightColumn.DataType               = typeof(string);
            freightColumn.SearchToolBarOperation = SearchOperation.Contains;
            freightColumn.SearchType             = SearchType.TextBox;
        }
コード例 #13
0
        private void SetUpUsersGrid(JQGrid grid)
        {
            grid.DataUrl = Url.Action("Users_RequestData");
            grid.EditUrl = Url.Action("Users_EditData");
            SetUpGrid(grid);

            SetDropDownColumn(grid, "DeptId", this.GetDept());
            SetBoolColumn(grid, "IsApproved");
            SetBoolColumn(grid, "IsLockedOut");
            SetDateTimeColumn(grid, "LastActivityDate");
            SetDateTimeColumn(grid, "LastLoginDate");
            SetDateTimeColumn(grid, "CreateDate");
            grid.ToolBarSettings.ShowAddButton = false;
            grid.ToolBarSettings.CustomButtons.Add(new JQGridToolBarButton()
            {
                Position   = ToolBarButtonPosition.Last,
                ToolTip    = "重置密码",
                Text       = "<span class='ui-pg-button-text'>重置密码</span>",
                OnClick    = "customButtonClicked",
                ButtonIcon = "ui-icon-extlink",
            });
            grid.ToolBarSettings.CustomButtons.Add(new JQGridToolBarButton()
            {
                Position   = ToolBarButtonPosition.Last,
                ToolTip    = "解锁",
                Text       = "<span class='ui-pg-button-text'>解锁</span>",
                OnClick    = "customButton2Clicked",
                ButtonIcon = "ui-icon-extlink",
            });
            grid.ToolBarSettings.CustomButtons.Add(new JQGridToolBarButton()
            {
                Position   = ToolBarButtonPosition.First,
                ToolTip    = "创建用户",
                Text       = "<span class='ui-pg-button-text'>创建用户</span>",
                OnClick    = "Register",
                ButtonIcon = "ui-icon-plus",
            });
            MembershipUser user = Membership.GetUser();

            if (user != null && user.UserName == "admin")
            {
                grid.ToolBarSettings.ShowDeleteButton = true;
                JQGridColumn col = grid.Columns.Find(f => f.EditActionIconsColumn);
                if (col != null)
                {
                    col.EditActionIconsSettings = new EditActionIconsSettings()
                    {
                        ShowEditIcon = true, ShowDeleteIcon = true
                    };
                }
            }
            else
            {
                grid.ToolBarSettings.ShowDeleteButton = false;
            }
            this.SetDropDownColumn(grid, "AuthorityType", centerCommon.GetAuthorityType());
        }
コード例 #14
0
        private void SearchArtists(JQGrid artistsGrid)
        {
            JQGridColumn nameColumn = artistsGrid.Columns.Find(c => c.DataField == "Name");

            nameColumn.Searchable             = true;
            nameColumn.DataType               = typeof(string);
            nameColumn.SearchToolBarOperation = SearchOperation.Contains;
            nameColumn.SearchType             = SearchType.TextBox;
        }
コード例 #15
0
ファイル: BaseController.cs プロジェクト: zhenghua75/DXInfo
        //protected void SetGridColumnVisible(JQGrid grid, string dataField, bool visible)
        //{
        //    JQGridColumn column = grid.Columns.Find(c => c.DataField == dataField);
        //    if (column != null)
        //    {
        //        column.Visible = visible;
        //        column.Searchable = visible;
        //    }
        //}
        //protected void SetGridColumnEditable(JQGrid grid, string dataField, bool editable)
        //{
        //    JQGridColumn column = grid.Columns.Find(c => c.DataField == dataField);
        //    if (column != null)
        //    {
        //        column.Editable = editable;
        //        column.Searchable = editable;
        //    }
        //}
        protected void SetGridColumnHeadText(JQGrid grid, string dataField, string headText)
        {
            JQGridColumn col = grid.Columns.Find(f => f.DataField == dataField);

            if (col != null)
            {
                col.HeaderText = headText;
            }
        }
コード例 #16
0
        private void SetColumn(string VouchType)
        {
            string[] strs  = null;
            string[] strs1 = { "Id",          "VouchType",         "Code",        "RdDate",      "WhName", "ARVCode", "ArvDate", "VenName",
                               "BusTypeName", "SalesmanName",      "IsVerify",    "VerifyDate",  "Memo",
                               "SubId",       "InvName",           "Specs",       "STUnitName",  "Num",    "Price",   "Amount",  "Batch",  "MadeDate",
                               "ShelfLife",   "ShelfLifeTypeName", "InvalidDate", "LocatorName", "SubMemo" };
            string[] strTransVouch = { "Id",        "Code",              "TVDate",      "OutWhName",   "InWhName", "SalesmanName", "IsVerify", "VerifyDate", "Memo",
                                       "SubId",     "InvName",           "Specs",       "STUnitName",  "Num",      "Price",        "Amount",   "Batch",      "MadeDate",
                                       "ShelfLife", "ShelfLifeTypeName", "InvalidDate", "LocatorName", "SubMemo" };
            string[] strScrapVouch = { "Id",        "Code",              "SVDate",      "WhName",      "SalesmanName", "IsVerify", "VerifyDate", "Memo",
                                       "SubId",     "InvName",           "Specs",       "STUnitName",  "Num",          "Price",    "Amount",     "Batch","MadeDate",
                                       "ShelfLife", "ShelfLifeTypeName", "InvalidDate", "LocatorName", "SubMemo" };
            string[] strCheckVouch = { "Id",        "Code",              "CVDate",      "WhName",      "SalesmanName", "IsVerify", "VerifyDate", "Memo",
                                       "SubId",     "InvName",           "Specs",       "STUnitName",  "Num",          "CNum",     "AddInNum",   "AddOutNum","Batch","MadeDate",
                                       "ShelfLife", "ShelfLifeTypeName", "InvalidDate", "LocatorName", "SubMemo" };
            string[] strAdjustLocatorVouch = { "Id",        "Code",              "ALVDate",     "WhName",         "SalesmanName",  "IsVerify", "VerifyDate", "Memo",
                                               "SubId",     "InvName",           "Specs",       "STUnitName",     "Num",           "Batch",    "MadeDate",
                                               "ShelfLife", "ShelfLifeTypeName", "InvalidDate", "OutLocatorName", "InLocatorName", "SubMemo" };
            string[] strMixVouch = { "Id",    "Code",    "MVDate", "InWhName",   "OutWhName", "SalesmanName", "IsVerify", "VerifyDate", "Memo",
                                     "SubId", "InvName", "Specs",  "STUnitName", "Num",       "SubMemo" };
            switch (VouchType)
            {
            case DXInfo.Models.VouchTypeCode.ScrapVouch:
                strs = strScrapVouch;
                break;

            case DXInfo.Models.VouchTypeCode.TransVouch:
                strs = strTransVouch;
                break;

            case DXInfo.Models.VouchTypeCode.CheckVouch:
                strs = strCheckVouch;
                break;

            case DXInfo.Models.VouchTypeCode.AdjustLocatorVouch:
                strs = strAdjustLocatorVouch;
                break;

            case DXInfo.Models.VouchTypeCode.MixVouch:
                strs = strMixVouch;
                break;

            default:
                strs = strs1;
                break;
            }
            foreach (string str in strs)
            {
                JQGridColumn col = allColumn.Find(f => f.DataField == str);
                if (col != null)
                {
                    this.Columns.Add(col);
                }
            }
        }
コード例 #17
0
        private void SetUpContractorEditDropDown(JQGrid itemGrid)
        {
            // setup the grid search criteria for the columns
            JQGridColumn responsibleIdColumn = itemGrid.Columns.Find(c => c.DataField == "ResponsibleId");
            //JQGridColumn responsibleNameColumn = itemGrid.Columns.Find(c => c.DataField == "ResponsibleName");

            //JQGridColumn regionIdColumn = itemGrid.Columns.Find(c => c.DataField == "RegionId");
            JQGridColumn contractorTypeIdColumn = itemGrid.Columns.Find(c => c.DataField == "ContractorTypeId");

            // Populate the search dropdown only on initial request, in order to optimize performance
            if (itemGrid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
            {
                var skladModel = new SkladDataContext();

                // Выбрать только Сотрудников и менеджеров
                var usersList = (from m in skladModel.UserProfiles where m.ContactTypeId < 3 select m).AsEnumerable()
                                .Select(x => new SelectListItem
                {
                    Text  = x.DisplayName,
                    Value = x.UserId.ToString()
                });

                //var regionsList = (from m in skladModel.Regions select m).AsEnumerable()
                //              .Select(x => new SelectListItem
                //              {
                //                  Text = x.Name,
                //                  Value = x.RegionId.ToString()
                //              });

                var contractorTypesList = (from m in skladModel.ContractorTypes select m).AsEnumerable()
                                          .Select(x => new SelectListItem
                {
                    Text  = x.Name,
                    Value = x.ContractorTypeId.ToString()
                });

                responsibleIdColumn.EditList.AddRange(usersList.ToList <SelectListItem>());
                responsibleIdColumn.SearchList = usersList.ToList <SelectListItem>();
                responsibleIdColumn.SearchList.Insert(0, new SelectListItem {
                    Text = "Все", Value = ""
                });

                //regionIdColumn.SearchList = regionsList.ToList<SelectListItem>();
                //regionIdColumn.SearchList.Insert(0, new SelectListItem { Text = "Все", Value = "" });
                //regionIdColumn.EditList.AddRange(regionsList.ToList<SelectListItem>());

                contractorTypeIdColumn.SearchList = contractorTypesList.ToList <SelectListItem>();
                contractorTypeIdColumn.SearchList.Insert(0, new SelectListItem {
                    Text = "Все", Value = ""
                });
                contractorTypeIdColumn.EditList.AddRange(contractorTypesList.ToList <SelectListItem>());
            }
        }
コード例 #18
0
 protected virtual void CreateEditActionIconsColumn()
 {
     Grid.Columns.Insert(0, EditActionIconsColumn = new JQGridColumn {
         Fixed = true,
         EditActionIconsColumn   = true,
         EditActionIconsSettings = new EditActionIconsSettings {
             ShowEditIcon   = true,
             ShowDeleteIcon = true
         },
         HeaderText = Kesco.Web.Mvc.UI.Controls.Localization.Resources.KescoGridActionColumn_Title,
         Width      = 60,
         Sortable   = false,
         Searchable = false
     });
 }
コード例 #19
0
        protected override void SetUpGrid()
        {
            base.SetUpGrid();
            JQGridColumn column = Grid.Columns.First((c) => {
                return(c.DataField == "ID");
            });

            if (column != null)
            {
                column.Fixed      = true;
                column.PrimaryKey = true;
                column.Formatter  = null;
                column.TextAlign  = TextAlign.Right;
            }

            Grid.Columns.All(c => {
                if (c.DataField == "Nickname" || c.DataField == "INN")
                {
                    c.Visible = true;
                }
                else
                {
                    c.Visible = false;
                }
                return(true);
            });

            column = Grid.Columns.FirstOrDefault((c) => {
                return(c.DataField == "Nickname");
            });

            if (column != null)
            {
                column.Formatter = new Kesco.Web.Mvc.UI.Grid.CustomFormatter {
                    FormatFunction = "formatSearchResultGridNicknameColumn"
                };
            }

            column = Grid.Columns.FirstOrDefault((c) => {
                return(c.DataField == "INN");
            });

            if (column != null)
            {
                column.Fixed = true;
                column.Width = 100;
            }
        }
コード例 #20
0
        private void SetUpRefundsProductLineColumns(JQGrid itemGrid)
        {
            JQGridColumn salePriceColumn = itemGrid.Columns.Find(c => c.DataField == "SalePrice");

            salePriceColumn.Visible  = true;
            salePriceColumn.Editable = false;

            JQGridColumn saleSumColumn = itemGrid.Columns.Find(c => c.DataField == "SaleSum");

            saleSumColumn.Visible = true;

            JQGridColumn marginabsColumn = itemGrid.Columns.Find(c => c.DataField == "MarginAbs");

            marginabsColumn.Visible  = true;
            marginabsColumn.Editable = true;
        }
コード例 #21
0
ファイル: BaseController.cs プロジェクト: zhenghua75/DXInfo
        protected void SetImgColumn(JQGrid grid, string dataField)
        {
            JQGridColumn column = grid.Columns.Find(c => c.DataField == dataField);

            if (column != null)
            {
                if (column.Visible)
                {
                    column.Formatter = new CustomFormatter()
                    {
                        FormatFunction   = "formatImage",
                        UnFormatFunction = "unformatImage"
                    };
                }
                column.Width = 100;
            }
        }
コード例 #22
0
        private void SetUpAuthGridModel(AuthorizationGridModel authorizationGridModel)
        {
            var authorizationGrid = authorizationGridModel.AuthorizationGrid;
            var roleGrid          = authorizationGridModel.RolesGrid;

            authorizationGrid.DataUrl = Url.Action("AuthorizationRuleOfAuth_RequestData");
            authorizationGrid.EditUrl = Url.Action("AuthorizationRuleOfAuth_EditData");
            authorizationGrid.SearchDialogSettings.MultipleSearch = true;
            //authorizationGrid.Columns.Insert(0, new JQGridColumn
            //{
            //    Sortable=false,
            //    Fixed = true,
            //    EditActionIconsColumn = true
            //});
            authorizationGrid.ToolBarSettings.ShowEditButton = true;
            JQGridColumn isInRoleColumn = authorizationGrid.Columns.Find(c => c.DataField == "IsInRole");

            isInRoleColumn.Formatter  = new CheckBoxFormatter();
            isInRoleColumn.SearchType = SearchType.DropDown;
            if (authorizationGrid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
            {
                isInRoleColumn.SearchList = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "所有", Value = ""
                    },
                    new SelectListItem {
                        Text = "选择", Value = "true"
                    },
                    new SelectListItem {
                        Text = "未选择", Value = "false"
                    }
                };
            }
            isInRoleColumn.EditType = EditType.CheckBox;

            roleGrid.DataUrl = Url.Action("AuthorizationRuleOfRole_RequestData");
            roleGrid.ID      = "RolesGrid";
            roleGrid.HierarchySettings.HierarchyMode          = HierarchyMode.Parent;
            roleGrid.AppearanceSettings.Caption               = "权限";
            roleGrid.ClientSideEvents.SubGridRowExpanded      = "showAuthsSubGrid";
            roleGrid.SearchDialogSettings.MultipleSearch      = true;
            authorizationGrid.HierarchySettings.HierarchyMode = HierarchyMode.Child;

            authorizationGrid.ID = "AuthorizationGrid";
        }
コード例 #23
0
        private void SetUpContractorEmployeeEditDropDown(JQGrid itemGrid)
        {
            JQGridColumn employeeNameColumn = itemGrid.Columns.Find(c => c.DataField == "EmployeeName");

            employeeNameColumn.Visible = true;

            JQGridColumn contractorNameColumn = itemGrid.Columns.Find(c => c.DataField == "ContractorName");

            contractorNameColumn.Visible = true;
            JQGridColumn contractorIdColumn = itemGrid.Columns.Find(c => c.DataField == "ContractorId");

            contractorIdColumn.Visible = true;

            JQGridColumn saleSumColumn = itemGrid.Columns.Find(c => c.DataField == "SaleSum");

            saleSumColumn.Visible = true;

            // setup the grid search criteria for the columns
            JQGridColumn employeeIdColumn = itemGrid.Columns.Find(c => c.DataField == "EmployeeId");

            employeeIdColumn.Visible = true;

            // Populate the search dropdown only on initial request, in order to optimize performance
            if (itemGrid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
            {
                var skladModel = new SkladDataContext();

                // Выбрать только Сотрудников и менеджеров
                var usersList = (from m in skladModel.UserProfiles
                                 where m.ContactTypeId == (int)EntityEnum.ContactTypeEnum.Employee select m).AsEnumerable()
                                .Select(x => new SelectListItem
                {
                    Text  = x.DisplayName,
                    Value = x.UserId.ToString()
                });

                employeeIdColumn.EditList.AddRange(usersList.ToList <SelectListItem>());
                employeeIdColumn.SearchList = usersList.ToList <SelectListItem>();
                employeeIdColumn.SearchList.Insert(0, new SelectListItem {
                    Text = "Все", Value = ""
                });
            }
        }
コード例 #24
0
        private void SetUpColumns()
        {
            var columnId = new JQGridColumn();

            columnId.DataField  = "Id";
            columnId.Editable   = false;
            columnId.Searchable = false;
            columnId.PrimaryKey = true;
            columnId.Visible    = false;

            Grid.Columns.Add(columnId);

            var columnDescription = new JQGridColumn();

            columnDescription.HeaderText = "Descripción";
            columnDescription.DataField  = "Descripcion";
            columnDescription.Width      = 300;

            Grid.Columns.Add(columnDescription);
        }
コード例 #25
0
ファイル: BaseController.cs プロジェクト: zhenghua75/DXInfo
        protected void SetStarColumn(JQGrid grid, string dataField)
        {
            JQGridColumn column = grid.Columns.Find(c => c.DataField == dataField);

            if (column != null)
            {
                if (column.Visible)
                {
                    column.Formatter = new RankingFormatter();
                }
                if (column.Editable)
                {
                    column.EditType = EditType.Custom;
                    column.EditTypeCustomCreateElement = "createStarsEditElement";
                    column.EditTypeCustomGetValue      = "getStarsElementValue";
                }
                column.Width = 100;
                grid.ClientSideEvents.AfterAjaxRequest = "ConvertGridRowToRateIt";
            }
        }
コード例 #26
0
        private void AddKeysAndBoundFields(IDataSourceViewSchema schema)
        {
            JQGridColumnCollection columns = ((JQGrid)base.Component).Columns;

            try
            {
                columns.Clear();
            }
            catch (Exception)
            {
            }
            if (schema != null)
            {
                IDataSourceFieldSchema[] fields = schema.GetFields();
                if (fields != null && fields.Length > 0)
                {
                    new ArrayList();
                    IDataSourceFieldSchema[] array = fields;
                    for (int i = 0; i < array.Length; i++)
                    {
                        IDataSourceFieldSchema dataSourceFieldSchema = array[i];
                        if (((JQGrid)base.Component).IsBindableType(dataSourceFieldSchema.DataType))
                        {
                            JQGridColumn jQGridColumn;
                            if (dataSourceFieldSchema.DataType == typeof(bool) || dataSourceFieldSchema.DataType == typeof(bool?))
                            {
                                jQGridColumn = new JQGridColumn();
                            }
                            else
                            {
                                jQGridColumn = new JQGridColumn();
                            }
                            string name = dataSourceFieldSchema.Name;
                            jQGridColumn.DataField  = name;
                            jQGridColumn.PrimaryKey = dataSourceFieldSchema.PrimaryKey;
                            columns.Add(jQGridColumn);
                        }
                    }
                }
            }
        }
コード例 #27
0
ファイル: BaseController.cs プロジェクト: zhenghua75/DXInfo
        protected void SetRequiredColumn(JQGrid grid, string dataField, string suffix = "(*)")
        {
            JQGridColumn column = grid.Columns.Find(c => c.DataField == dataField);

            if (column != null)
            {
                if (column.Editable)
                {
                    column.EditDialogFieldSuffix = suffix;
                    column.EditClientSideValidators.Add(new RequiredValidator());
                    if (column.DataType == typeof(decimal))
                    {
                        column.EditClientSideValidators.Add(new NumberValidator());
                    }
                    if (column.DataType == typeof(int))
                    {
                        column.EditClientSideValidators.Add(new IntegerValidator());
                    }
                }
            }
        }
コード例 #28
0
 private void AddKeysAndBoundFields(IDataSourceViewSchema schema)
 {
     JQGridColumnCollection columns = ((JQGrid)base.Component).Columns;
     try
     {
         columns.Clear();
     }
     catch (Exception)
     {
     }
     if (schema != null)
     {
         IDataSourceFieldSchema[] fields = schema.GetFields();
         if (fields != null && fields.Length > 0)
         {
             new ArrayList();
             IDataSourceFieldSchema[] array = fields;
             for (int i = 0; i < array.Length; i++)
             {
                 IDataSourceFieldSchema dataSourceFieldSchema = array[i];
                 if (((JQGrid)base.Component).IsBindableType(dataSourceFieldSchema.DataType))
                 {
                     JQGridColumn jQGridColumn;
                     if (dataSourceFieldSchema.DataType == typeof(bool) || dataSourceFieldSchema.DataType == typeof(bool?))
                     {
                         jQGridColumn = new JQGridColumn();
                     }
                     else
                     {
                         jQGridColumn = new JQGridColumn();
                     }
                     string name = dataSourceFieldSchema.Name;
                     jQGridColumn.DataField = name;
                     jQGridColumn.PrimaryKey = dataSourceFieldSchema.PrimaryKey;
                     columns.Add(jQGridColumn);
                 }
             }
         }
     }
 }
コード例 #29
0
        private void SetUpStatesColumn(JQGrid grid)
        {
            // setup the grid search criteria for the columns
            JQGridColumn column = grid.Columns.Find(c => c.DataField == "Region");

            column.Editable = true;
            column.EditType = EditType.DropDown;

            // Populate the search dropdown only on initial request, in order to optimize performance
            if (grid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
            {
                string[] states            = new string[] { "Alabama", "California", "New Hampshire" };
                List <SelectListItem> list = new List <SelectListItem>(states.Length);
                foreach (string state in states)
                {
                    list.Add(new SelectListItem {
                        Text = state, Value = state
                    });
                }
                column.EditList = list;
            }
        }
コード例 #30
0
        private void SetUpCustomerIDEditDropDown(JQGrid ordersGrid)
        {
            // setup the grid search criteria for the columns
            JQGridColumn customersColumn = ordersGrid.Columns.Find(c => c.DataField == "CustomerID");

            customersColumn.Editable = true;
            customersColumn.EditType = EditType.DropDown;

            // Populate the search dropdown only on initial request, in order to optimize performance
            if (ordersGrid.AjaxCallBackMode == AjaxCallBackMode.RequestData)
            {
                //var northWindModel = null; // new NorthwindDataContext();
                //var editList = from customers in northWindModel.Customers
                //               select new SelectListItem
                //               {
                //                   Text = customers.CustomerID,
                //                   Value = customers.CustomerID
                //               };

                //customersColumn.EditList = editList.ToList<SelectListItem>();
            }
        }
コード例 #31
0
        protected void SetTimeColumn(JQGrid grid, string dataField)
        {
            JQGridColumn column = grid.Columns.Find(c => c.DataField == dataField);

            if (column != null)
            {
                if (column.Visible)
                {
                    column.DataFormatString = @"{0:hh\:mm}";
                }
                if (column.Searchable)
                {
                    column.SearchType      = SearchType.TimePicker;
                    column.SearchControlID = "TimePicker";
                }
                if (column.Editable)
                {
                    column.EditType        = EditType.TimePicker;
                    column.EditorControlID = "TimePicker";
                }
            }
        }