Exemplo n.º 1
0
        public void ExportLotteryCSV(string filePath, List <LotteryWinnerInfo> winnerInfoList)
        {
            var head = new List <string>();

            head.Add("序号");
            head.Add("奖项");
            head.Add("姓名");
            head.Add("手机");
            head.Add("邮箱");
            head.Add("地址");
            head.Add("状态");
            head.Add("中奖时间");
            head.Add("兑奖码");
            head.Add("兑奖时间");

            var rows = new List <List <string> >();

            var index = 1;

            foreach (var winnerInfo in winnerInfoList)
            {
                LotteryAwardInfo awardInfo = null;
                if (awardInfoMap.ContainsKey(winnerInfo.AwardID))
                {
                    awardInfo = awardInfoMap[winnerInfo.AwardID];
                }
                else
                {
                    awardInfo = DataProviderWX.LotteryAwardDAO.GetAwardInfo(winnerInfo.AwardID);
                    awardInfoMap.Add(winnerInfo.AwardID, awardInfo);
                }

                var award = string.Empty;
                if (awardInfo != null)
                {
                    award = awardInfo.AwardName + ":" + awardInfo.Title;
                }

                var row = new List <string>();

                row.Add((index++).ToString());
                row.Add(award);
                row.Add(winnerInfo.RealName);
                row.Add(winnerInfo.Mobile);
                row.Add(winnerInfo.Email);
                row.Add(winnerInfo.Address);
                row.Add(EWinStatusUtils.GetText(EWinStatusUtils.GetEnumType(winnerInfo.Status)));
                row.Add(DateUtils.GetDateAndTimeString(winnerInfo.AddDate));
                row.Add(winnerInfo.CashSN);
                row.Add(DateUtils.GetDateAndTimeString(winnerInfo.CashDate));

                rows.Add(row);
            }

            CSVUtils.Export(filePath, head, rows);
        }
Exemplo n.º 2
0
        public void ExportCardSNCSV(string filePath, List <CardSNInfo> cardSNInfoList)
        {
            var head = new List <string>();

            head.Add("序号");
            head.Add("卡号");
            head.Add("姓名");
            head.Add("手机");
            head.Add("邮箱");
            head.Add("地址");
            head.Add("金额");
            head.Add("积分");
            head.Add("领卡时间");

            var rows = new List <List <string> >();

            var index = 1;

            foreach (var cardSNInfo in cardSNInfoList)
            {
                var userInfo        = BaiRongDataProvider.UserDao.GetUserInfoByUserName(cardSNInfo.UserName);
                var userContactInfo = BaiRongDataProvider.UserContactDao.GetContactInfo(cardSNInfo.UserName);

                var row = new List <string>();

                row.Add((index++).ToString());
                row.Add(cardSNInfo.SN);
                row.Add(userInfo != null ? userInfo.DisplayName : string.Empty);
                row.Add(userInfo != null ? userInfo.Mobile : string.Empty);
                row.Add(userInfo != null ? userInfo.Email : string.Empty);
                row.Add(userContactInfo != null ? userContactInfo.Address : string.Empty);
                row.Add(cardSNInfo.Amount.ToString());
                row.Add(userInfo != null ? userInfo.Credits.ToString() : "0");
                row.Add(DateUtils.GetDateAndTimeString(cardSNInfo.AddDate));
                rows.Add(row);
            }

            CSVUtils.Export(filePath, head, rows);
        }
        public void ExportAppointmentContentCSV(string filePath, List <AppointmentContentInfo> appointmentContentInfolList, string appointmentTitle, int appointmentID)
        {
            var appointmentInfo = DataProviderWX.AppointmentDAO.GetAppointmentInfo(appointmentID);

            var head = new List <string>();

            head.Add("序号");
            head.Add("预约名称");
            if (appointmentInfo.IsFormRealName == "True")
            {
                head.Add(appointmentInfo.FormRealNameTitle);
            }
            if (appointmentInfo.IsFormMobile == "True")
            {
                head.Add(appointmentInfo.FormMobileTitle);
            }
            if (appointmentInfo.IsFormEmail == "True")
            {
                head.Add(appointmentInfo.FormEmailTitle);
            }
            head.Add("预约时间");
            head.Add("预约状态");
            head.Add("留言");
            var configExtendInfoList = DataProviderWX.ConfigExtendDAO.GetConfigExtendInfoList(PublishmentSystemId, appointmentID, EKeywordTypeUtils.GetValue(EKeywordType.Appointment));

            foreach (var cList in configExtendInfoList)
            {
                head.Add(cList.AttributeName);
            }

            var rows = new List <List <string> >();

            var index = 1;

            foreach (var applist in appointmentContentInfolList)
            {
                var row = new List <string>();

                row.Add((index++).ToString());
                row.Add(appointmentTitle);
                if (appointmentInfo.IsFormRealName == "True")
                {
                    row.Add(applist.RealName);
                }
                if (appointmentInfo.IsFormMobile == "True")
                {
                    row.Add(applist.Mobile);
                }
                if (appointmentInfo.IsFormEmail == "True")
                {
                    row.Add(applist.Email);
                }
                row.Add(DateUtils.GetDateAndTimeString(applist.AddDate));
                row.Add(EAppointmentStatusUtils.GetText(EAppointmentStatusUtils.GetEnumType(applist.Status)));
                row.Add(applist.Message);

                var SettingsXML = applist.SettingsXML.Replace("{", "").Replace("}", "");
                var arr         = SettingsXML.Split(',');
                if (arr[0] != "")
                {
                    for (var i = 0; i < arr.Length; i++)
                    {
                        var arr1 = arr[i].Replace("\"", "").Split(':');
                        row.Add(arr1[1]);
                    }
                }
                rows.Add(row);
            }

            CSVUtils.Export(filePath, head, rows);
        }