Beispiel #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Entities.TemplateInfo GetTemplateInfo(int RecID)
        {
            QueryTemplateInfo query = new QueryTemplateInfo();

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

            dt = GetTemplateInfo(query, string.Empty, 1, 1, out count);
            if (count > 0)
            {
                return(LoadSingleTemplateInfo(dt.Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool IsExistsByRecID(int RecID)
        {
            QueryTemplateInfo query = new QueryTemplateInfo();

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

            dt = GetTemplateInfo(query, string.Empty, 1, 1, out count);
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
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 GetTemplateInfo(QueryTemplateInfo query, string order, int currentPage, int pageSize, out int totalCount)
        {
            string where = string.Empty;

            if (query.TCID != Constant.INT_INVALID_VALUE)
            {
                where += " And TCID in(" + query.TCID + ")";
            }
            if (query.RecID != Constant.INT_INVALID_VALUE)
            {
                where += " and TemplateInfo.RecID=" + query.RecID;
            }
            if (query.Content != Constant.STRING_INVALID_VALUE)
            {
                where += " And TCID in(" + Dal.Util.SqlFilterByInCondition(query.Content) + ")";
            }
            DataSet ds;

            SqlParameter[] parameters =
            {
                new SqlParameter("@where",         SqlDbType.NVarChar, 2000),
                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_TEMPLATEINFO_SELECT, parameters);
            totalCount = (int)(parameters[4].Value);
            return(ds.Tables[0]);
        }
Beispiel #4
0
        private void BindData()
        {
            int pageIndex;

            if (Request.QueryString["page"] != null)
            {
                pageIndex = Convert.ToInt32(Request.QueryString["page"].Trim());
            }
            else
            {
                pageIndex = 1;
            }

            int totalCount          = 0;
            QueryTemplateInfo query = new QueryTemplateInfo();
            string            TcID  = "";
            int CateTotal           = 0;

            Entities.QueryTemplateCategory CateQuery = new Entities.QueryTemplateCategory();
            if (Request.QueryString["type"] != null)
            {
                CateQuery.Type = int.Parse(Request.QueryString["type"]);
                DataTable dt2 = BLL.TemplateCategory.Instance.GetTemplateCategory(CateQuery, "", 1, 100, out CateTotal);
                foreach (DataRow row in dt2.Rows)
                {
                    TcID += row["RecID"].ToString() + ",";
                }
            }
            if (Request.QueryString["class1"] != null)
            {
                if (Request.QueryString["class1"].ToString() != "-1")
                {
                    TcID          = Request.QueryString["class1"].ToString() + ",";
                    CateQuery.Pid = int.Parse(Request.QueryString["class1"].ToString());
                    DataTable dt2 = BLL.TemplateCategory.Instance.GetTemplateCategory(CateQuery, "", 1, 100, out CateTotal);
                    foreach (DataRow row in dt2.Rows)
                    {
                        TcID += row["RecID"].ToString() + ",";
                    }
                }
            }
            if (Request.QueryString["class2"] != null)
            {
                if (Request.QueryString["class2"].ToString() != "-1")
                {
                    TcID = Request.QueryString["class2"].ToString() + ",";
                }
            }

            if (TcID.Length > 0)
            {
                TcID          = TcID.Substring(0, TcID.Length - 1);
                query.Content = TcID;
            }

            DataTable dt = BLL.TemplateInfo.Instance.GetTemplateInfo(query, "TemplateInfo.CreateTime desc", pageIndex, 20, out totalCount);

            dt.Columns.Add("CreateName");
            dt.Columns.Add("EmailServers");
            int intVal = 0;

            foreach (DataRow dr in dt.Rows)
            {
                if (int.TryParse(dr["CreateUserIDB"].ToString(), out intVal))
                {
                    dr["CreateName"] = BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(intVal);
                }

                #region 邮件接收人
                DataTable dtEmailServers = BLL.TemplateInfo.Instance.getEmailServers(Convert.ToInt32(dr["RecID"]));
                if (dtEmailServers != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow drEmailServers in dtEmailServers.Rows)
                    {
                        if (int.TryParse(drEmailServers["UserID"].ToString(), out intVal))
                        {
                            dr["EmailServers"] += BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(intVal) + ",";
                        }
                    }
                    if (dr["EmailServers"].ToString().Length > 0)
                    {
                        dr["EmailServers"] = dr["EmailServers"].ToString().Substring(0, dr["EmailServers"].ToString().Length - 1);
                    }
                }
                #endregion

                #region 分类两级添加
                DataTable             db        = new DataTable(); //Template.TCID;
                QueryTemplateCategory queryCate = new QueryTemplateCategory();
                queryCate.RecID = Convert.ToInt32(dr["TcID"]);
                int totle;
                db = BLL.TemplateCategory.Instance.GetTemplateCategory(queryCate, "RecID", 1, 1, out totle);
                if (db != null && db.Rows.Count > 0)
                {
                    if (db.Rows[0]["Level"].ToString() == "2")
                    {
                        DataTable             dbOri          = new DataTable(); //Template.TCID;
                        QueryTemplateCategory queryCatedbOri = new QueryTemplateCategory();
                        queryCatedbOri.RecID = Convert.ToInt32(db.Rows[0]["PID"]);
                        int totledbOri;
                        dbOri      = BLL.TemplateCategory.Instance.GetTemplateCategory(queryCatedbOri, "RecID", 1, 1, out totledbOri);
                        dr["Name"] = dbOri.Rows[0]["Name"].ToString() + "-" + dr["Name"].ToString();
                    }
                }
                #endregion
            }
            Rpt_TempList.DataSource = dt;
            Rpt_TempList.DataBind();                                  //返回总条数
            //litPage.Text = BLL.PageCommon.Instance.LinkString("", 10, totalCount,10); //(totalCount);
            //分组页容量      每页条数
            litPage.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), 8, totalCount, 20, BLL.PageCommon.Instance.PageIndex, 1);
        }
Beispiel #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 GetTemplateInfo(QueryTemplateInfo query, string order, int currentPage, int pageSize, out int totalCount)
 {
     return(Dal.TemplateInfo.Instance.GetTemplateInfo(query, order, currentPage, pageSize, out totalCount));
 }