Пример #1
0
        List <ClsBindGridColumn_EO> BindGrid(DataTable Dt_List)
        {
            bool IsReadOnly = false;

            if (
                !(this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_Edit) ||
                  this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_View))
                )
            {
                IsReadOnly = true;
            }

            bool IsNoSelect = false;

            try { IsNoSelect = (bool)this.ViewState[CnsIsNoSelect]; }
            catch { }

            if (IsNoSelect)
            {
                IsReadOnly = true;
            }

            DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSystem_BinDefinition_Name);
            List <ClsBindGridColumn_EO> List_Gc = Layer01_Methods_Web_EO.GetBindGridColumn_EO(this.mSystem_BinDefinition_Name);

            if (!IsReadOnly)
            {
                ClsBindGridColumn_EO Gc = new ClsBindGridColumn_EO("", "", 50, "", Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Button);
                Gc.mCommandName = "Select";
                Gc.mFieldText   = ">>";
                Gc.mButtonType  = ButtonColumnType.LinkButton;
                List_Gc.Insert(0, Gc);
            }

            string TableKey = "";

            if (this.mObj_Base != null)
            {
                TableKey = this.mObj_Base.pHeader_TableKey;
            }
            else
            {
                TableKey = (string)this.ViewState[CnsSourceKey];
                if (TableKey == "")
                {
                    TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], "");
                }
            }

            this.EOGrid_List.ClientSideOnItemCommand = "EOGrid_ItemCommand";
            this.EOGrid_List.FullRowMode             = true;
            Layer01_Methods_Web_EO.BindEOGrid(ref this.EOGrid_List, Dt_List, List_Gc, TableKey, false, false);
            return(List_Gc);
        }
        //[-]

        List <ClsBindGridColumn_EO> BindGrid(
            DataTable Dt_List
            , eCheck Check = eCheck.None)
        {
            DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSelectionName);
            List <ClsBindGridColumn_EO> List_Gc = Layer01_Methods_Web_EO.GetBindGridColumn_EO(this.mSelectionName);

            string Bind_TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], "");

            string TableKey = (string)this.ViewState[CnsQuery_Selection_Key];

            if (TableKey != "")
            {
                Bind_TableKey = TableKey;
            }

            Dt_List.Columns.Add("IsSelect", typeof(bool));
            ClsBindGridColumn_EO Gc =
                new ClsBindGridColumn_EO(
                    "IsSelect"
                    , "Select?"
                    , 80
                    , ""
                    , Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Checkbox
                    , this.mIsMultipleSelect);

            List_Gc.Insert(0, Gc);

            if (Check == eCheck.None)
            {
                foreach (DataRow Dr in this.mDt_Selected.Rows)
                {
                    DataRow[] Inner_ArrDr = Dt_List.Select(Bind_TableKey + " = " + Convert.ToInt64(Dr["ID"]).ToString());
                    if (Inner_ArrDr.Length > 0)
                    {
                        Inner_ArrDr[0]["IsSelect"] = Do_Methods.IsNull(Dr["IsSelect"], false);
                    }
                }
            }
            else
            {
                bool Inner_IsSelect = Check == eCheck.CheckAll;
                foreach (DataRow Dr in Dt_List.Rows)
                {
                    Dr["IsSelect"] = Inner_IsSelect;
                }
            }

            this.EOGrid_Selection.FullRowMode = true;
            Layer01_Methods_Web_EO.BindEOGrid(ref this.EOGrid_Selection, Dt_List, List_Gc, Bind_TableKey, false, false);
            return(List_Gc);
        }
        public void Setup(
            string Name
            , DataTable Dt
            , string Key      = ""
            , bool AllowSort  = false
            , bool HasDelete  = false
            , bool IsReadOnly = false)
        {
            ClsSysCurrentUser Obj_CurrentUser = (ClsSysCurrentUser)this.Session[Layer01_Constants_Web.CnsSession_CurrentUser];

            this.mObjID     = Obj_CurrentUser.GetNewPageObjectID();
            this.mDt_Source = Dt;

            this.ViewState[CnsObjID] = this.mObjID;
            this.Session[this.mObjID + CnsDt_Source] = this.mDt_Source;

            //[-]

            DataRow Dr_Bind       = Do_Methods_Query.GetSystemBindDefinition(Name);
            string  Bind_TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], "");
            List <ClsBindGridColumn_EO> List_Gc = Layer01_Methods_Web_EO.GetBindGridColumn_EO(Name);

            foreach (ClsBindGridColumn_EO Gc in List_Gc)
            {
                if (Gc.mEnabled)
                {
                    Gc.mEnabled = !IsReadOnly;
                }
            }

            if (!IsReadOnly)
            {
                if (HasDelete)
                {
                    ClsBindGridColumn_EO Gc =
                        new ClsBindGridColumn_EO(
                            ""
                            , ""
                            , 80
                            , ""
                            , Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Delete);
                    Gc.mFieldText           = "Delete";
                    Gc.mClientSideBeginEdit = "EOGrid_RowEdit";
                    List_Gc.Add(Gc);
                }
            }

            if (Key.Trim() == "")
            {
                Key = Bind_TableKey;
            }

            this.EOGrid_List.EnableKeyboardNavigation = true;
            this.EOGrid_List.StyleSetIDField          = "Item_Style";
            Layer01_Methods_Web_EO.BindEOGrid(ref this.EOGrid_List, Dt, List_Gc, Key, AllowSort);

            this.ViewState[CnsKey]       = Key;
            this.ViewState[CnsHasDelete] = HasDelete;

            //[-]

            this.Page_Load(null, null);
        }