예제 #1
0
        /// <summary>
        /// 根据TTCode获取实体
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public Entities.TPage GetTPageByTTCode(string ttcode)
        {
            Entities.TPage      tpageModel = new Entities.TPage();
            Entities.QueryTPage query      = new QueryTPage();
            query.TTCode = ttcode;
            int       totalCount = 0;
            DataTable dt         = BLL.TPage.Instance.GetTPage(query, "", 1, 999, out totalCount);

            if (dt != null && dt.Rows.Count > 0)
            {
                tpageModel = Dal.TPage.Instance.GetTPage(int.Parse(dt.Rows[0]["RecID"].ToString()));
            }
            return(tpageModel);
        }
예제 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Entities.TPage GetTPage(int RecID)
        {
            QueryTPage query = new QueryTPage();

            query.RecID = RecID;
            DataTable dt    = new DataTable();
            int       count = 0;

            dt = GetTPage(query, string.Empty, 1, 1, out count);
            if (count > 0)
            {
                return(LoadSingleTPage(dt.Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool IsExistsByRecID(int RecID)
        {
            QueryTPage query = new QueryTPage();

            query.RecID = RecID;
            DataTable dt    = new DataTable();
            int       count = 0;

            dt = GetTPage(query, string.Empty, 1, 1, out count);
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        /// <summary>
        /// 按照查询条件查询
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <param name="order">排序</param>
        /// <param name="currentPage">页号,-1不分页</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="totalCount">总行数</param>
        /// <returns>集合</returns>
        public DataTable GetTPage(QueryTPage query, string order, int currentPage, int pageSize, out int totalCount)
        {
            string where = string.Empty;


            //分组权限判断
            //if ((query.OwnGroup != Constant.STRING_INVALID_VALUE && query.OwnGroup != string.Empty) || (query.OneSelf != Constant.STRING_INVALID_VALUE && query.OneSelf != string.Empty))
            //{
            //    if (query.LoginID != Constant.INT_INVALID_VALUE)
            //    {
            //        where += " AND (";

            //        if (query.OwnGroup != Constant.STRING_INVALID_VALUE && query.OwnGroup != string.Empty)
            //        {
            //            //筛选登陆人管理的所属业务组权限是 本组 的信息
            //            where += " TPage.BGID IN ( " + query.OwnGroup + ") ";
            //        }

            //        if (query.OwnGroup != Constant.STRING_INVALID_VALUE && query.OwnGroup != string.Empty && query.OneSelf != Constant.STRING_INVALID_VALUE && query.OneSelf != string.Empty)
            //        {
            //            where += " OR ";
            //        }

            //        if (query.OneSelf != Constant.STRING_INVALID_VALUE && query.OneSelf != string.Empty)
            //        {
            //            //筛选登陆人管理的所属业务组权限是 本人 的信息
            //            where += " (TPage.BGID IN (" + query.OneSelf + ") AND TPage.CreateUserID=" + query.LoginID + ")";
            //        }

            //        where += ")";
            //    }
            //}
            #region 数据权限判断
            if (query.LoginID != Constant.INT_INVALID_VALUE)
            {
                string whereDataRight = "";
                whereDataRight = Dal.UserGroupDataRigth.Instance.GetSqlRightstr("TPage", "BGID", "CreateUserID", query.LoginID);

                where += whereDataRight;
            }
            #endregion
            if (query.RecID != Constant.INT_INVALID_VALUE)
            {
                where += " AND RecID = " + query.RecID + "";
            }

            if (query.TPName != Constant.STRING_INVALID_VALUE)
            {
                where += " AND TPName like '%" + StringHelper.SqlFilter(query.TPName) + "%'";
            }

            if (query.TTName != Constant.STRING_INVALID_VALUE)
            {
                where += " AND TTName ='" + StringHelper.SqlFilter(query.TTName) + "'";
            }

            if (query.TTCode != Constant.STRING_INVALID_VALUE)
            {
                where += " AND TTCode ='" + StringHelper.SqlFilter(query.TTCode) + "'";
            }

            if (query.BGID != Constant.INT_INVALID_VALUE)
            {
                where += " AND BGID=" + query.BGID;
            }

            if (query.IsUsed != Constant.INT_INVALID_VALUE)
            {
                where += " AND IsUsed=" + query.IsUsed;
            }
            if (query.SCID != Constant.INT_INVALID_VALUE)
            {
                where += " AND SCID=" + query.SCID;
            }
            if (query.CreateUserID != Constant.INT_INVALID_VALUE)
            {
                where += " AND CreateUserID=" + query.CreateUserID;
            }
            if (query.BeginTime != Constant.STRING_INVALID_VALUE && query.EndTime != Constant.STRING_INVALID_VALUE)
            {
                where += " AND Createtime>='" + StringHelper.SqlFilter(query.BeginTime) + " 0:00:000' AND Createtime<='" + StringHelper.SqlFilter(query.EndTime) + " 23:59:29'";
            }

            //0- 未完成  ;1-已完成;2-已使用(TPage表中除了 二手车客户导入模版 和 新车客户导入模板 的status=2,其他的已使用需要去TTable根据TTCode查询字段TTIsData是否为1,如果为1则表示已使用;为其他的则表示未使用)

            if (query.Statuss != Constant.STRING_INVALID_VALUE)
            {
                string statusWhere = query.Statuss;

                if (statusWhere.Contains("0") && statusWhere.Contains("1") && statusWhere.Contains("2"))
                {
                }
                else if (statusWhere.Contains("0") && statusWhere.Contains("1"))
                {
                    where += " and (status =0 or (status=1 and TTCode in (select TTCode from TTable where TTable.TTCode=Tpage.TTCode and TTIsData<>1)))";
                }
                else if (statusWhere.Contains("0") && statusWhere.Contains("2"))
                {
                    where += " and (status=1 and TTCode in (select TTCode from TTable where TTable.TTCode=Tpage.TTCode and TTIsData=1) or status in (0,2))";
                }
                else if (statusWhere.Contains("1") && statusWhere.Contains("2"))
                {
                    where += " and  status in (1,2)";
                }
                else if (statusWhere.Contains("0"))
                {
                    where += " and  status=0";
                }
                else if (statusWhere.Contains("1"))
                {
                    where += " and  status=1 and TTCode in (select TTCode from TTable where TTable.TTCode=Tpage.TTCode and TTIsData<>1)";
                }
                else if (statusWhere.Contains("2"))
                {
                    where += " and(  (status=1 and TTCode in (select TTCode from TTable where TTable.TTCode=Tpage.TTCode and TTIsData=1) ) or status=2)";
                }
            }

            DataSet ds;

            SqlParameter[] parameters =
            {
                new SqlParameter("@where",         SqlDbType.NVarChar, 40000),
                new SqlParameter("@order",         SqlDbType.NVarChar,   200),
                new SqlParameter("@pagesize",      SqlDbType.Int,          4),
                new SqlParameter("@indexpage",     SqlDbType.Int,          4),
                new SqlParameter("@totalRecorder", SqlDbType.Int, 4)
            };

            parameters[0].Value     = where;
            parameters[1].Value     = order;
            parameters[2].Value     = pageSize;
            parameters[3].Value     = currentPage;
            parameters[4].Direction = ParameterDirection.Output;

            ds         = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_TPAGE_SELECT, parameters);
            totalCount = (int)(parameters[4].Value);
            return(ds.Tables[0]);
        }
예제 #5
0
 /// <summary>
 /// 按照查询条件查询
 /// </summary>
 /// <param name="query">查询条件</param>
 /// <param name="order">排序</param>
 /// <param name="currentPage">页号,-1不分页</param>
 /// <param name="pageSize">每页记录数</param>
 /// <param name="totalCount">总行数</param>
 /// <returns>集合</returns>
 public DataTable GetTPage(QueryTPage query, string order, int currentPage, int pageSize, out int totalCount)
 {
     return(Dal.TPage.Instance.GetTPage(query, order, currentPage, pageSize, out totalCount));
 }