示例#1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int              count       = 0;
            StringBuilder    SqlWhere    = new StringBuilder();
            IList <SqlParam> IList_param = new List <SqlParam>();

            SqlWhere.Append("SELECT *  ");
            SqlWhere.Append("FROM View_UserList U");
            SqlWhere.Append(" WHERE 1=1 ");
            if (!string.IsNullOrEmpty(this.AreaName.Value))
            {
                SqlWhere.AppendFormat(" AND AreaName='{0}' ", this.AreaName.Value);
            }
            if (!string.IsNullOrEmpty(this.EduBackName.Value))
            {
                SqlWhere.AppendFormat(" AND EduBackName='{0}' ", this.EduBackName.Value);
            }
            if (!string.IsNullOrEmpty(this.EduTypeName.Value))
            {
                SqlWhere.AppendFormat(" AND EduTypeName='{0}' ", this.EduTypeName.Value);
            }
            if (!string.IsNullOrEmpty(this.CompanyID.Value))
            {
                SqlWhere.AppendFormat(" AND CompanyID='{0}' ", this.CompanyID.Value);
            }
            if (!string.IsNullOrEmpty(this.specName.Value))
            {
                SqlWhere.AppendFormat(" AND specName='{0}' ", this.specName.Value);
            }
            if (!string.IsNullOrEmpty(this.status.Value))
            {
                SqlWhere.AppendFormat(" AND status='{0}' ", this.status.Value);
            }
            if (!string.IsNullOrEmpty(this.sexText.Value))
            {
                SqlWhere.AppendFormat(" AND sexText='{0}' ", this.sexText.Value);
            }
            if (!string.IsNullOrEmpty(this.Is985.Value))
            {
                SqlWhere.AppendFormat(" AND Is985={0} ", this.Is985.Value);
            }
            if (!string.IsNullOrEmpty(this.Is211.Value))
            {
                SqlWhere.AppendFormat(" AND Is211={0} ", this.Is211.Value);
            }
            if (!string.IsNullOrEmpty(this.IsFullDay.Value))
            {
                SqlWhere.AppendFormat(" AND IsFullDay={0} ", this.IsFullDay.Value);
            }
            SqlWhere.Append(" AND Checks='是'");
            SqlWhere.Append(" AND specName IS NOT NULL");
            if (!string.IsNullOrEmpty(this.txt_Search.Value))
            {
                SqlWhere.Append(" AND U." + this.Searchwhere.Value + " like @obj ");
                IList_param.Add(new SqlParam("@obj", '%' + this.txt_Search.Value.Trim() + '%'));
            }

            string webpath = peridal.ExportExcelFilebySQL(SqlWhere);

            if (webpath != "0")
            {
                ShowMsgHelper.showFaceMsg("导出成功!" + webpath);
                // ShowMsgHelper.
            }
            else
            {
                ShowMsgHelper.Alert("导出失败!请联系技术人员。电话:18638956262");
            }
        }