public override long List_Count(ClsQueryCondition Condition = null)
 {
     if (Condition == null)
     { Condition = new ClsQueryCondition(); }
     Condition.Add("IsDeleted", "=", typeof(bool).ToString(), "0");
     return base.List_Count(Condition);
 }
        public override DataTable List(ClsQueryCondition Condition, string Sort = "", int Top = 0, int Page = 0)
        {
            if (Condition == null)
            { Condition = new Layer01_Common.Objects.ClsQueryCondition(); }

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

            return base.List(Condition, Sort, Top, Page);
        }
        // Gets the table data that meet certain conditions.
        //
        // @param Condition The condition object where filter parameters for the questions are set.
        // @param Sort The sort expression, or the column to which the table is sorted.
        // @param Top For paging, define the number of results returned for.
        // @param Page The selected index (page) if pagination is enforced.
        public override DataTable List(ClsQueryCondition Condition, string Sort = "", int Top = 0, int Page = 0)
        {
            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.List(Condition, Sort, Top, Page);
        }
 public DataTable GetQuery(string ViewObject, string Fields, ClsQueryCondition Condition, string Sort = "", long Top = 0, int Page = 0)
 {
     ClsConnection_SqlServer Da = new ClsConnection_SqlServer();
     try
     {
         Da.Connect();
         return GetQuery(Da, ViewObject, Fields, Condition, Sort, Top, Page);
     }
     catch (Exception ex)
     { throw ex; }
     finally
     { Da.Close(); }
 }
        public DataTable GetQuery(Interface_Connection Connection, string ViewObject, string Fields, ClsQueryCondition Condition, string Sort = "", long Top = 0, int Page = 0)
        {
            string Query_RowNumberSort = Sort;
            if (Query_RowNumberSort.Trim() == "") Query_RowNumberSort = "(Select 0)";

            string Query_Top = "";
            if (Top > 0) Query_Top = "Top " + Top.ToString();

            Int64 PageCondition = 0;
            if (Page > 0)
            { PageCondition = Top * (Page - 1); }

            if (ViewObject.Trim() != "") ViewObject = " From " + ViewObject + " ";
            if (Fields.Trim() == "") Fields = " * ";
            if (Sort.Trim() != "") Sort = " Order By " + Sort;

            ClsPreparedQuery Pq = new ClsPreparedQuery((ClsConnection_SqlServer)Connection);
            Pq.Add_Parameter("ViewObject", SqlDbType.VarChar, 8000, 0, 0, ViewObject);
            Pq.Add_Parameter("Fields", SqlDbType.VarChar, 8000, 0, 0, Fields);
            Pq.Add_Parameter("Sort", SqlDbType.VarChar, 8000, 0, 0, Sort);

            string Query_Condition = "";
            if (Condition != null)
            {
                Query_Condition = " Where 1 = 1 ";
                Query_Condition += " And " + Condition.GetQueryCondition();
                Pq.Add_Parameter(Condition.GetParameters());
            }

            Pq.pQuery = @"Select " + Query_Top + @" [Tb].* From ( Select Row_Number() Over (Order By " + Query_RowNumberSort + @") As [RowNumber], " + Fields + " " + ViewObject + " " + Query_Condition + @" ) As [Tb] Where [Tb].RowNumber > " + PageCondition + " " + Sort;
            Pq.Prepare();

            return Pq.ExecuteQuery().Tables[0];
        }
        public override DataTable List(ClsQueryCondition Condition, string Sort = "", int Top = 0, int Page = 0)
        {
            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;
        }
        public override long List_Count(ClsQueryCondition Condition = null)
        {
            if (Condition == null)
            { Condition = this.mDa.CreateQueryCondition(); }
            Condition.Add("IsApproved", "0", typeof(bool).ToString(), "0");

            return base.List_Count(Condition);
        }
Example #8
0
 public static DataTable GetQuery(string ViewObject, string Fields, ClsQueryCondition Condition, string Sort = "", Int64 Top = 0, Int32 Page = 0)
 {
     ClsDataAccess Da = new ClsDataAccess();
     try
     {
         Da.Connect();
         return GetQuery(Da, ViewObject, Fields, Condition, Sort, Top, Page);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Da.Close();
     }
 }
 /// <summary>
 /// Returns the Result Set Count with out actually fetching the result set,
 /// mainly used for pagination
 /// </summary>
 /// <param name="Condition">
 /// ClsQueryCondition Object to be used in fetching the data
 /// </param>
 /// <returns></returns>
 public virtual Int64 List_Count(ClsQueryCondition Condition = null)
 {
     return this.mDa.List_Count(this.mHeader_ViewName, Condition);
 }
Example #10
0
 /// <summary>
 /// Returns a List based on the supplied Table/View Name
 /// </summary>
 /// <param name="Condition">
 /// ClsQueryCondition Object to be used in fetching the data
 /// </param>
 /// <param name="Sort">
 /// Additional sorting to be used in fetching the data
 /// </param>
 /// <param name="Top">
 /// Limits the result set, mainly used for pagination
 /// </param>
 /// <param name="Page">
 /// Fetch a section of the result set based on the supplied Top, mainly used for pagination
 /// </param>
 /// <returns></returns>
 public virtual DataTable List(ClsQueryCondition Condition, string Sort = "", Int32 Top = 0, Int32 Page = 0)
 {
     return this.mDa.List(this.mHeader_ViewName, Condition, Sort, Top, Page);
 }
Example #11
0
 public Int64 List_Count(ClsQueryCondition Condition = null)
 {
     DataTable Dt = Methods_Query.GetQuery(this.mHeader_ViewName, "Count(1) As [Ct]", Condition);
     Int64 ReturnValue = 0;
     try
     { ReturnValue = (Int64)Methods.IsNull(Dt.Rows[0]["Ct"], 0); }
     catch { }
     return ReturnValue;
 }
 public DataTable List(
     string ObjectName
     , ClsQueryCondition Condition
     , string Sort = ""
     , int Top = 0
     , int Page = 0)
 {
     DataTable Dt = this.GetQuery(ObjectName, "*", Condition, Sort, Top, Page);
     return Dt;
 }
 void ListFilter_EvFiltered(ClsQueryCondition Qc)
 {
     this.QuestionGrid.RebindGrid(Qc);
 }
        public override long List_Count(ClsQueryCondition Condition = null)
        {
            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.List_Count(Condition);
        }
 /// <summary>
 /// Not Implemented, use Me.Load()
 /// </summary>
 /// <param name="Condition"></param>
 /// <param name="Sort"></param>
 /// <param name="Top"></param>
 /// <param name="Page"></param>
 /// <returns></returns>
 public override DataTable List(ClsQueryCondition Condition = null, string Sort = "", int Top = 0, int Page = 0)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Sets the data object definition, 
 /// must be set preferably in the constructor of the derived object
 /// </summary>
 /// <param name="pCurrentUser">
 /// The current logged user object
 /// </param>
 /// <param name="pTableName">
 /// Table Name of the data object will be using
 /// </param>
 /// <param name="pViewName">
 /// View Name of the data object 
 /// this will be used Me.Load() if supplied
 /// </param>
 /// <param name="pQc_LoadCondition"></param>
 public virtual void Setup(ClsSysCurrentUser pCurrentUser, string pTableName, string pViewName = "", ClsQueryCondition pQc_LoadCondition = null)
 {
     base.Setup(pCurrentUser, pTableName, pViewName);
     this.mQc_LoadCondition = pQc_LoadCondition;
 }
 /// <summary>
 /// Sets the data object definition, 
 /// must be set preferably in the constructor of the derived object
 /// </summary>
 /// <param name="pCurrentUser">
 /// The current logged user object
 /// </param>
 /// <param name="pTableName">
 /// Table Name of the data object will be using
 /// </param>
 /// <param name="pViewName">
 /// View Name of the data object 
 /// this will be used Me.Load() if supplied
 /// </param>
 /// <param name="pQc_LoadCondition"></param>
 public virtual void Setup(string pTableName, string pViewName = "", ClsQueryCondition pQc_LoadCondition = null)
 {
     base.Setup(pTableName, pViewName);
     this.mQc_LoadCondition = pQc_LoadCondition;
 }
 public long List_Count(string ObjectName, ClsQueryCondition Condition = null)
 {
     DataTable Dt = this.GetQuery(ObjectName, "Count(1) As [Ct]", Condition);
     Int64 ReturnValue = 0;
     try
     { ReturnValue =  Methods.Convert_Int64(Dt.Rows[0]["Ct"], 0); }
     catch { }
     return ReturnValue;
 }
Example #19
0
 public virtual DataTable List(ClsQueryCondition Condition = null, string Sort ="", Int32 Top = 0, Int32 Page = 0)
 {
     DataTable Dt = Methods_Query.GetQuery(this.mHeader_ViewName, "*", Condition, Sort, Top, Page);
     return Dt;
 }