예제 #1
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var contentInfo = new AppointmentContentInfo(e.Item.DataItem);

                var ltlItemIndex         = e.Item.FindControl("ltlItemIndex") as Literal;
                var ltlRealName          = e.Item.FindControl("ltlRealName") as Literal;
                var ltlAppointementTitle = e.Item.FindControl("ltlAppointementTitle") as Literal;
                var ltlMobile            = e.Item.FindControl("ltlMobile") as Literal;
                var ltlExtendVal         = e.Item.FindControl("ltlExtendVal") as Literal;
                var ltlEmail             = e.Item.FindControl("ltlEmail") as Literal;
                var ltlAddDate           = e.Item.FindControl("ltlAddDate") as Literal;
                var ltlStatus            = e.Item.FindControl("ltlStatus") as Literal;
                var ltlMessage           = e.Item.FindControl("ltlMessage") as Literal;
                var ltlEditUrl           = e.Item.FindControl("ltlEditUrl") as Literal;
                var ltlSelectUrl         = e.Item.FindControl("ltlSelectUrl") as Literal;



                AppointmentItemInfo itemInfo = null;
                if (_itemInfoDictionary.ContainsKey(contentInfo.AppointmentItemId))
                {
                    itemInfo = _itemInfoDictionary[contentInfo.AppointmentItemId];
                }
                else
                {
                    itemInfo = DataProviderWx.AppointmentItemDao.GetItemInfo(contentInfo.AppointmentItemId);
                    _itemInfoDictionary.Add(contentInfo.AppointmentItemId, itemInfo);
                }

                ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString();
                ltlRealName.Text  = contentInfo.RealName;
                if (itemInfo != null)
                {
                    ltlAppointementTitle.Text = itemInfo.Title;
                    AppointmentTitle          = itemInfo.Title;
                }
                ltlMobile.Text  = contentInfo.Mobile;
                ltlEmail.Text   = contentInfo.Email;
                ltlAddDate.Text = DateUtils.GetDateAndTimeString(contentInfo.AddDate);
                ltlStatus.Text  = EAppointmentStatusUtils.GetText(EAppointmentStatusUtils.GetEnumType(contentInfo.Status));
                ltlMessage.Text = contentInfo.Message;

                ltlEditUrl.Text =
                    $@"<a href=""javascrip:;"" onclick=""{ModalAppointmentHandle.GetOpenWindowStringToSingle(
                        PublishmentSystemId, contentInfo.Id)}"">预约处理</a>";

                ltlSelectUrl.Text =
                    $@"<a href=""javascrip:;"" onclick=""{ModalAppointmentContentDetail.GetOpenWindowStringToSingle(
                        PublishmentSystemId, contentInfo.Id)}"">预约详情</a>";
            }
        }
        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);
        }