Beispiel #1
0
        public async Task <FileResult> ExportExcel(string Level    = "", string Name  = "",
                                                   string Business = "", string Store = "", string RegTimeFrom = "", string RegTimeTo = "")
        {
            string where = string.Empty;
            where       += _comAppService.GetWhere();
            if (!string.IsNullOrEmpty(Level))
            {
                where += $" and levelId={Level}";
            }
            if (!string.IsNullOrEmpty(Name))
            {
                where += $" and (FullName like'%{Name}%' or WeChatName like '%{Name}%')";
            }
            if (!string.IsNullOrEmpty(Business))
            {
                where += $" and m.BusinessId={Business}";
            }
            if (!string.IsNullOrEmpty(Store))
            {
                where += $" and m.ChainStoreId={Store}";
            }
            if (!string.IsNullOrEmpty(RegTimeFrom))
            {
                where += $" and RegTime>='{RegTimeFrom} 00:00:00'";
            }
            if (!string.IsNullOrEmpty(RegTimeTo))
            {
                where += $" and RegTime<='{RegTimeTo} 23:59:59'";
            }

            MemoryStream ms = await _AppService.ExportToExcel(where);

            return(File(ms.ToArray(), "application/vnd.ms-excel", "" + L("MemberList") + ".xlsx"));
        }