protected Int64 List_Count(QueryCondition Condition = null) { DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSystem_BinDefinition_Name); string Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], ""); string Bind_Sort = (string)Do_Methods.IsNull(Dr_Bind["Sort"], ""); string Query_Condition = ""; if (Bind_Condition.Trim() != "") { Query_Condition = " Where " + Bind_Condition; } string Source = (string)this.ViewState[CnsSource]; if (Source == "") { Source = this.mObj_Base.pHeader_ViewName; } string Query = @"(Select * From " + Source + " " + Query_Condition + " ) As [Tb]"; Interface_DataAccess Da = this.mObj_Base.CreateDataAccess(); //DataTable Dt = Do_Methods_Query.GetQuery(Query, "Count(1) As [Ct]", Condition); DataTable Dt = Da.GetQuery(Query, "Count(1) As [Ct]", Condition); Int64 Rv = 0; try { Rv = Convert.ToInt64(Do_Methods.IsNull(Dt.Rows[0]["Ct"], 0)); } catch { } return(Rv); }
public void Show_UseQuery( string SelectionName , string SelectionQuery , string SelectionQuery_Key , string Title = "" , bool IsMultipleSelect = false , string Data = "") { this.ViewState[CnsData] = Data; this.ViewState[CnsQuery_Selection] = @"( " + SelectionQuery + @") As [Tb]"; this.ViewState[CnsQuery_Selection_Key] = SelectionQuery_Key; this.ViewState[CnsObj_QueryCondition] = null; this.mSelectionName = SelectionName; this.mIsMultipleSelect = IsMultipleSelect; this.mQuery_Selection = (string)this.ViewState[CnsQuery_Selection]; this.mQuery_Selection_Key = (string)this.ViewState[CnsQuery_Selection_Key]; this.ViewState[CnsSelectionName] = SelectionName; this.ViewState[CnsIsMultipleSelect] = IsMultipleSelect; this.Panel_Check.Visible = IsMultipleSelect; //[-] DataTable Dt = new DataTable(); Dt.Columns.Add("ID", typeof(Int64)); Dt.Columns.Add("IsSelect", typeof(bool)); this.mDt_Selected = Dt; this.ViewState[CnsDt_Selected] = Dt; //[-] this.BindGrid(); this.Lbl_AppliedFilters.Text = this.Details_ItemsCount(); //[-] DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(SelectionName); if (Title == "") { Title = (string)Do_Methods.IsNull(Dr_Bind["Desc"], ""); } if (Title == "") { Title = "Select"; } this.EODialog_Selection.HeaderHtml = Title; this.EODialog_Selection.ClientSideOnAccept = "Selection_Accept_" + this.ClientID; this.EODialog_Selection.Show(); try { this.EOCbp_EODialog_Selection.Update(); } catch { } }
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); }
//[-] DataTable List( QueryCondition Condition = null , string Sort = "" , Int64 Top = 0 , Int32 Page = 0) { DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSelectionName); string Bind_Desc = (string)Do_Methods.IsNull(Dr_Bind["Desc"], ""); string Bind_TableName = (string)Do_Methods.IsNull(Dr_Bind["TableName"], ""); string Bind_TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], ""); string Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], ""); string Bind_Sort = (string)Do_Methods.IsNull(Dr_Bind["Sort"], ""); string Query_Source = ""; string Query_Condition = ""; if (this.mQuery_Selection != "") { Query_Condition = this.mQuery_Selection; } else { Query_Source = Bind_TableName; if (Bind_Condition != "") { Query_Condition = "Where " + Bind_Condition; } } if (Query_Source == "") { throw new Exception("Selection Source not set."); } if (Sort == "") { Sort = Bind_Sort; } string Query = @"(Select * From " + Query_Source + " " + Query_Condition + @") As [Tb]"; DataTable Dt_List = Do_Methods_Query.GetQuery(Query, "", Condition, Sort, Top, Page); return(Dt_List); }
Int64 List_Count(QueryCondition Condition = null) { DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSelectionName); string Bind_Desc = (string)Do_Methods.IsNull(Dr_Bind["Desc"], ""); string Bind_TableName = (string)Do_Methods.IsNull(Dr_Bind["TableName"], ""); string Bind_TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], ""); string Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], ""); string Bind_Sort = (string)Do_Methods.IsNull(Dr_Bind["Sort"], ""); string Query_Source = ""; string Query_Condition = ""; if (this.mQuery_Selection != "") { Query_Condition = this.mQuery_Selection; } else { Query_Source = Bind_TableName; if (Bind_Condition != "") { Query_Condition = "Where " + Bind_Condition; } } if (Query_Source == "") { throw new Exception("Selection Source not set."); } string Query = @"(Select * From " + Query_Source + " " + Query_Condition + @") As [Tb]"; DataTable Dt_List = Do_Methods_Query.GetQuery(Query, "Count(1) As [Ct]", Condition); Int64 Rv = 0; try { Rv = Convert.ToInt64(Do_Methods.IsNull(Dt_List.Rows[0]["Ct"], 0)); } catch { } return(Rv); }
//[-] protected DataTable List( QueryCondition Condition = null , string Sort = "" , Int64 Top = 0 , Int32 Page = 0) { DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSystem_BinDefinition_Name); string Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], ""); string Bind_Sort = (string)Do_Methods.IsNull(Dr_Bind["Sort"], ""); string Query_Condition = ""; if (Bind_Condition.Trim() != "") { Query_Condition = " Where " + Bind_Condition; } string Source = (string)this.ViewState[CnsSource]; if (Source == "") { Source = this.mObj_Base.pHeader_ViewName; } if (Sort == "") { Sort = Bind_Sort; } string Query_Table = @"(Select * From " + Source + " " + Query_Condition + " ) As [Tb]"; Interface_DataAccess Da = this.mObj_Base.CreateDataAccess(); //DataTable Dt = Do_Methods_Query.GetQuery(Query_Table, "", Condition, Sort, Top, Page); DataTable Dt = Da.GetQuery(Query_Table, "", Condition, Sort, Top, Page); Da.Close(); return(Dt); }
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); }