Пример #1
0
 public override long List_Count(QueryCondition Condition = null)
 {
     if (Condition == null)
     { Condition = new QueryCondition(); }
     Condition.Add("IsDeleted", "=", typeof(bool).ToString(), "0");
     return base.List_Count(Condition);
 }
Пример #2
0
        public override DataTable List(QueryCondition Condition, string Sort, long Top, int Page)
        {
            if (Condition == null)
            { Condition = new QueryCondition(); }

            Condition.Add("IsDeleted", "=", typeof(bool).ToString(), "0");

            return base.List(Condition, Sort, Top, Page);
        }
Пример #3
0
        public override DataTable List(DataObjects_Framework.Objects.QueryCondition Condition, string Sort = "", int Top = 0, int Page = 0)
        {
            Interface_DataAccess Da = this.CreateDataAccess();

            try
            { return(base.List(Da, Condition, Sort, Top, Page)); }
            catch (Exception Ex) { throw Ex; }
            finally { Da.Close(); }
        }
Пример #4
0
        public override DataTable List(QueryCondition Condition, string Sort, long Top, int Page)
        {
            if (Condition == null)
            { Condition = this.mDa.CreateQueryCondition(); }

            Condition.Add("IsDeleted", "= 0", typeof(bool).ToString(), "0");

            if (!this.mCurrentUser.CheckAccess(Layer02_Constants.eSystem_Modules.Question, Layer02_Constants.eAccessLib.eAccessLib_View))
            { Condition.Add("RecruitmentTestUserID_CreatedBy", "= " + this.mCurrentUser.pUserID, typeof(Int64).ToString(), "0"); }

            return base.mDa.List("uvw_RecruitmentTestQuestions_Ex", Condition, Sort, Top, Page);
        }
        public static DataTable GetQuery(string ViewObject, string Fields, QueryCondition Condition, string Sort = "", Int64 Top = 0, Int32 Page = 0)
        {
            Interface_DataAccess Da = Do_Methods.CreateDataAccess();
            DataTable Dt = null;
            try
            {
                Da.Connect();
                Dt = GetQuery(Da, ViewObject, Fields, Condition, Sort, Top, Page);
            }
            catch (Exception Ex) { throw Ex; }
            finally { Da.Close(); }

            return Dt;
        }
        public ClsCustomer_ShippingAddress(ClsSysCurrentUser CurrentUser)
        {
            QueryCondition Qc = new QueryCondition();
            Qc.Add("IsDeleted", "0", "0");
            base.Setup("Customer_ShippingAddress", "uvw_Customer_ShippingAddress", Qc);

            //[-]

            List<Do_Constants.Str_ForeignKeyRelation> FetchKeys = new List<Do_Constants.Str_ForeignKeyRelation>();
            FetchKeys.Add(new Do_Constants.Str_ForeignKeyRelation("CustomerID", "CustomerID"));

            List<Do_Constants.Str_ForeignKeyRelation> ForeignKeys = new List<Do_Constants.Str_ForeignKeyRelation>();
            ForeignKeys.Add( new Do_Constants.Str_ForeignKeyRelation("AddressID", "AddressID"));

            base.Setup_AddListObject(
                "Address"
                , new ClsAddress(null)
                , new List<object>() { CurrentUser }
                , "uvw_Address_Customer_ShippingAddress"
                , FetchKeys
                , ForeignKeys);
        }
        public override DataTable List(QueryCondition Condition, string Sort, long Top, int Page)
        {
            if (Condition == null)
            { Condition = this.mDa.CreateQueryCondition(); }
            Condition.Add("IsApproved", "0", typeof(bool).ToString(), "0");

            this.mDt_List = base.List(Condition, Sort, Top, Page);
            this.mDt_List.Columns.Add("IsSelected", typeof(bool));
            this.AddRequired(this.mDt_List);
            return this.mDt_List;
        }
Пример #8
0
 public void ApplyFilter(QueryCondition Qc)
 {
     this.RebindGrid(Qc);
 }
Пример #9
0
 protected virtual void Setup(ClsCurrentUser CurrentUser, string TableName, string ViewName = "", QueryCondition Qc_LoadCondition = null, List<string> CustomKeys = null)
 {
     base.Setup(TableName, ViewName, Qc_LoadCondition, CustomKeys);
     this.mCurrentUser = CurrentUser;
 }
        protected string Details_PrepareOpen(Int64 ID)
        {
            DataTable Dt = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID.ToString());
            string Url = "";

            if (Dt.Rows.Count > 0)
            { Url = "~/" + (string)Do_Methods.IsNull(Dt.Rows[0]["PageUrl_Details"], ""); }

            this.Session[Layer01_Constants_Web.CnsSession_Keys] = null;

            QueryCondition Qc = new QueryCondition();
            Qc.Add(this.mObj_Base.pHeader_TableKey, "=", ID, typeof(Int64).ToString());
            Dt = this.List(Qc);
            if (Dt.Rows.Count > 0)
            { this.Session[Layer01_Constants_Web.CnsSession_Keys] = this.mObj_Base.GetKeys(Dt.Rows[0]); }

            return Url;
        }
        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;
        }
        //[-]
        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;
        }
Пример #13
0
        void UcFilter_EvFilter(QueryCondition Qc)
        {
            if (this.mFilterTarget == null)
            { return; }

            this.mFilterTarget.ApplyFilter(Qc);
        }
 void Filter_Details_EvFiltered(QueryCondition Qc)
 {
     this.Grid_Details.RebindGrid(Qc);
 }
 public long List_Count(Interface_Connection Cn, string ObjectName, QueryCondition Condition = null)
 {
     DataTable Dt = this.GetQuery(Cn, ObjectName, "Count(1) As [Ct]", Condition);
     Int64 ReturnValue = 0;
     try { ReturnValue = Do_Methods.Convert_Int64(Dt.Rows[0]["Ct"], 0); }
     catch { }
     return ReturnValue;
 }
        public override void RebindGrid()
        {
            Int64 Top = 0;
            try { Top = Do_Methods.Convert_Int64(this.Txt_Top.Text); }
            catch { }

            Int32 Page = 0;
            try { Page = Do_Methods.Convert_Int32(this.Cbo_Page.SelectedValue); }
            catch { }

            string ViewState_DisplayFilterString = (string)this.ViewState[CnsDisplayFilterString];
            string ViewState_DisplayOrderString = (string)this.ViewState[CnsDisplayOrderString];

            string ViewState_OrderString = (string)this.ViewState[CnsOrderString];

            QueryCondition Qc = null;
            try { Qc = (QueryCondition)this.ViewState[CnsObj_QueryCondition]; }
            catch { }

            if (Qc == null)
            { Qc = new QueryCondition(); }

            this.Details_SetPaginator(Top, this.List_Count(Qc));

            try
            { this.Cbo_Page.SelectedValue = Page.ToString(); }
            catch
            {
                try
                { Page = Convert.ToInt32(this.Cbo_Page.SelectedValue); }
                catch { }
            }

            DataTable Dt;
            try
            { Dt = this.List(Qc, ViewState_OrderString, Top, Page); }
            catch
            {
                Dt = this.List(Qc, "", Top, Page);
                ViewState_OrderString = "";
                ViewState_DisplayOrderString = "";
                this.ViewState[CnsOrderString] = ViewState_OrderString;
                this.ViewState[CnsDisplayOrderString] = ViewState_DisplayOrderString;
            }

            this.BindGrid(Dt);

            try
            { this.EOCbp_Grid.Update(); }
            catch { }
        }
        //[-]
        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;
        }
 void ListFilter_EvFiltered(QueryCondition Qc)
 {
     this.ReportGrid.RebindGrid(Qc);
 }
        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;
        }
Пример #20
0
 void FilterList_EvFiltered(QueryCondition Qc)
 {
     this.GridList.RebindGrid(Qc);
 }
        public DataTable GetQuery(Interface_Connection Connection, Do_Constants.Str_QuerySource SourceObject, string Fields, QueryCondition Condition, string Sort = "", long Top = 0, int Page = 0)
        {
            Do_Constants.Str_Request_GetQuery Rgq = new Do_Constants.Str_Request_GetQuery();
            Rgq.ObjectQuerySource = SourceObject;
            Rgq.Fields = Fields;
            Rgq.Condition = Condition;
            Rgq.Sort = Sort;
            Rgq.Top = Do_Methods.Convert_Int32(Top);
            Rgq.Page = Page;

            Rgq.ConnectionString = (Connection as Connection_Wcf).pConnectionString;

            Do_Constants.Str_Request_Session Rs = new Do_Constants.Str_Request_Session();
            Rs.SessionID = ClsDataAccess_Wcf_Session.Instance.pSessionID;

            Client_WcfService Client = Client_WcfService.CreateObject();
            string ResponseData = Client.GetQuery(Rs, Rgq);
            SimpleDataTable Sdt = SimpleDataTable.Deserialize(ResponseData);

            return Sdt.ToDataTable();
        }
 public DataTable GetQuery(Do_Constants.Str_QuerySource SourceObject, string Fields, QueryCondition Condition, string Sort = "", long Top = 0, int Page = 0)
 {
     Connection_Wcf Cn = this.GetConnection();
     return this.GetQuery(Cn, SourceObject, Fields, Condition, Sort);
 }
        public DataTable List(string ObjectName, QueryCondition Condition, string Sort = "", Int64 Top = 0, Int32 Page = 0)
        {
            //if (this.mConnection == null)
            //{
            //    Connection_Wcf Cn = new Connection_Wcf();
            //    try
            //    {
            //        Cn.Connect();
            //        return this.List(Cn, ObjectName, Condition, Sort, Top, Page);
            //    }
            //    catch (Exception Ex)
            //    { throw Ex; }
            //}
            //else
            //{ return this.List(this.mConnection, ObjectName, Condition, Sort, Top, Page); }

            //[-]

            Connection_Wcf Cn = this.GetConnection();
            return this.List(Cn, ObjectName, Condition, Sort, Top, Page);
        }
 public static DataTable GetQuery(Interface_DataAccess Da, string ViewObject, string Fields, QueryCondition Condition, string Sort = "", Int64 Top = 0, Int32 Page = 0)
 {
     return Da.GetQuery(ViewObject, Fields, Condition, Sort, Top, Page);
 }
        public DataTable List(Interface_Connection Cn, string ObjectName, QueryCondition Condition, string Sort = "", long Top = 0, int Page = 0)
        {
            Do_Constants.Str_Request_List Rl = new Do_Constants.Str_Request_List();
            Rl.ObjectName = ObjectName;
            Rl.Condition = Condition;
            Rl.Sort = Sort;
            Rl.Top = Top;
            Rl.Page = Page;
            Rl.ConnectionString = (Cn as Connection_Wcf).pConnectionString;

            Do_Constants.Str_Request_Session Rs = new Do_Constants.Str_Request_Session();
            Rs.SessionID = ClsDataAccess_Wcf_Session.Instance.pSessionID;

            Client_WcfService Client = Client_WcfService.CreateObject();
            string ResponseData = Client.List(Rs, Rl);

            SimpleDataTable Sdt = SimpleDataTable.Deserialize(ResponseData);
            return Sdt.ToDataTable();
        }
        public void RebindGrid(QueryCondition Qc = null)
        {
            this.mState.Qc = Qc;

            DataTable Dt = null;

            /*
            if (this.mProperties.IsRequery)
            {
                StringBuilder Sb_Sort = new StringBuilder();
                foreach (GridSortExpression Se in this.Grid.MasterTableView.SortExpressions)
                { Sb_Sort.Append(Se.FieldName + " " + Se.SortOrderAsString()); }

                Dt = this.mBase.List(this.mState.Qc, Sb_Sort.ToString(), this.Grid.PageSize, this.Grid.CurrentPageIndex + 1);
                this.Grid.VirtualItemCount = Convert.ToInt32(this.mBase.List_Count(this.mState.Qc));
                this.Grid.PagerStyle.Mode = (GridPagerMode)PagerMode.NextPrev;
            }
            else
            {
                Dt = this.mDataSource;
                if (this.mState.Qc != null)
                {
                    try { Dt.DefaultView.RowFilter = this.mState.Qc.GetQueryCondition_String(); }
                    catch { }
                }
                else
                { Dt.DefaultView.RowFilter = ""; }
            }
            */

            switch (this.mProperties.SourceType)
            {
                case eSourceType.Base:
                case eSourceType.Table:
                    {
                        StringBuilder Sb_Sort = new StringBuilder();
                        foreach (GridSortExpression Se in this.Grid.MasterTableView.SortExpressions)
                        { Sb_Sort.Append(Se.FieldName + " " + Se.SortOrderAsString()); }

                        switch (this.mProperties.SourceType)
                        {
                            case eSourceType.Base:
                                {
                                    this.Grid.VirtualItemCount = Convert.ToInt32(this.mBase.List_Count(this.mState.Qc));

                                    try
                                    {
                                        if (this.Grid.VirtualItemCount / this.Grid.PageSize < (this.Grid.CurrentPageIndex + 1))
                                        { this.Grid.CurrentPageIndex = 0; }
                                    }
                                    catch { this.Grid.CurrentPageIndex = 0; }

                                    Dt = this.mBase.List(this.mState.Qc, Sb_Sort.ToString(), this.Grid.PageSize, this.Grid.CurrentPageIndex + 1);

                                    break;
                                }
                            case eSourceType.Table:
                                {
                                    this.Grid.VirtualItemCount = Convert.ToInt32(new Base().pDa.List_Count(this.mTableName, this.mState.Qc));

                                    try
                                    {
                                        if (this.Grid.VirtualItemCount / this.Grid.PageSize < (this.Grid.CurrentPageIndex + 1))
                                        { this.Grid.CurrentPageIndex = 0; }
                                    }
                                    catch { this.Grid.CurrentPageIndex = 0; }

                                    Dt = new Base().pDa.List(this.mTableName, this.mState.Qc, Sb_Sort.ToString(), this.Grid.CurrentPageIndex + 1);

                                    break;
                                }
                        }

                        break;
                    }
                case eSourceType.DataTable:
                    {
                        Dt = this.mDataSource;
                        if (this.mState.Qc != null)
                        {
                            try { Dt.DefaultView.RowFilter = this.mState.Qc.GetQueryCondition_String(); }
                            catch { }
                        }
                        else
                        { Dt.DefaultView.RowFilter = ""; }
                        break;
                    }
            }

            Methods_Web.ClearHTMLTags(Dt);

            this.Grid.DataSource = Dt;
            this.Grid.Rebind();
        }
        public long List_Count(Interface_Connection Cn, string ObjectName, QueryCondition Condition = null)
        {
            Do_Constants.Str_Request_List Rl = new Do_Constants.Str_Request_List();
            Rl.ObjectName = ObjectName;
            Rl.Condition = Condition;
            Rl.ConnectionString = (Cn as Connection_Wcf).pConnectionString;

            Do_Constants.Str_Request_Session Rs = new Do_Constants.Str_Request_Session();
            Rs.SessionID = ClsDataAccess_Wcf_Session.Instance.pSessionID;

            Client_WcfService Client = Client_WcfService.CreateObject();
            Int64 ResponseData = Client.List_Count(Rs, Rl);
            return ResponseData;
        }
Пример #28
0
        public void RebindGrid(QueryCondition Qc = null, Boolean IsPageChange = false)
        {
            if (this.Ev_PageChanging != null)
            { this.Ev_PageChanging(this); }

            if (Qc != null)
            { this.mQc = Qc; }

            this.BindGrid(false, IsPageChange);

            if (this.Ev_PageChanged != null)
            { this.Ev_PageChanged(this); }
        }
        void Selection_AddFilter()
        {
            DataTable Dt_FilterFields = (DataTable)this.ViewState[CnsDt_FilterFields];
            string FilterSt = "";
            QueryCondition Qc = (QueryCondition)this.ViewState[CnsObj_QueryCondition];
            if (Qc == null)
            { Qc = new QueryCondition(); }

            DataRow[] ArrDr = Dt_FilterFields.Select("Field = '" + this.Cbo_SearchFilter.SelectedValue + "'");
            if (ArrDr.Length > 0)
            {
                Qc.Add(
                    (string)Do_Methods.IsNull(ArrDr[0]["Field"], "")
                    , this.Txt_Search.Text
                    , (string)Do_Methods.IsNull(ArrDr[0]["DataType"], ""));
                FilterSt = this.Cbo_SearchFilter.SelectedItem.Text + " by " + this.Txt_Search.Text;
            }

            this.ViewState[CnsObj_QueryCondition] = Qc;

            string ViewState_DisplayFilterString = (string)this.ViewState[CnsDisplayFilterString];
            ViewState_DisplayFilterString += @"<br />" + FilterSt;
            this.ViewState[CnsDisplayFilterString] = ViewState_DisplayFilterString;
        }
        public override long List_Count(QueryCondition Condition = null)
        {
            if (Condition == null)
            { Condition = this.mDa.CreateQueryCondition(); }
            Condition.Add("IsApproved", "0", typeof(bool).ToString(), "0");

            return base.List_Count(Condition);
        }
 /// <summary>
 /// Returns the Result Set Count with out actually fetching the result set, mainly used for pagination
 /// </summary>
 /// <param name="ObjectName">
 /// The source data object name
 /// </param>
 /// <param name="Condition">
 /// ClsQueryCondition Object to be used in fetching the data
 /// </param>
 /// <returns></returns>
 public long List_Count(string ObjectName, QueryCondition Condition = null)
 {
     if (this.mConnection == null)
     {
         Connection_SqlServer Cn = new Connection_SqlServer();
         try
         {
             Cn.Connect();
             return this.List_Count(Cn, ObjectName, Condition);
         }
         catch (Exception Ex)
         { throw Ex; }
         finally
         { Cn.Close(); }
     }
     else
     { return this.List_Count(this.mConnection, ObjectName, Condition); }
 }