using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNWD.Pregrant.Model;
using HNWD.Pregrant.Common;
using System.Text;
using HNWD.Pregrant.DataAccess;
using HNWD.Pregrant.WebService;
namespace HNWD.Pregrant.WebService.WDHS_I
{
///
/// 广播数据
///
public partial class callingMainNurse_BroadcastInfo : PageBase
{
///
/// PartitionNo
/// ID=37 ,
/// IsOpen=1
/// PartitionNo=""
/// ID=37&IsOpen=1
///
protected void Page_Load(object sender, EventArgs e)
{
string PartitionNo = this.GetValueByKey("PartitionNo");
string ID = this.GetValueByKey("ID");
string IsOpen = this.GetValueByKey("IsOpen");
int Pages = Convert.ToInt32(string.IsNullOrEmpty(this.GetValueByKey("Page"))?"-1": this.GetValueByKey("Page"));
int PageSize = Convert.ToInt32(string.IsNullOrEmpty(this.GetValueByKey("PageSize"))?"8" : this.GetValueByKey("PageSize"));
WD_ZoneInfoDataAccess wd = new WD_ZoneInfoDataAccess(new WD_ZoneInfo() { ZONE_STATUS = IsOpen, ID = ID });
if( !string.IsNullOrEmpty(ID))
{
if(string.IsNullOrEmpty(IsOpen))
{
this.ResponseDefaultError();
return;
}
else
{
wd.UpdateZoneStatus();
if(!wd.bSuccess)
{
this.ResponseDefaultError();
return ;
}
}
}
wd.Query(PartitionNo);
if(!wd.ext.bSuccess || wd.ext.Rows == 0)
{
this.ResponseDefaultError();
return;
}
MusicFileExt musicFileext = new MusicFileExt();
musicFileext.bSuccess = wd.ext.bSuccess;
musicFileext.Message = wd.ext.Message;
musicFileext.Code = wd.ext.Code;
foreach(WD_ZoneInfo zoneInfo in wd.ext.messageDataList)
{
MusicFile musicInfo = new MusicFile();
if (Pages == -1)
{
musicInfo.FileName = zoneInfo.ZONE_FILELIST;
}
else
{
foreach (string str in zoneInfo.ZONE_FILELIST.Split(new char[] { ',' }).ToList().Skip(Pages * PageSize).Take(PageSize).ToList())
{
musicInfo.FileName = musicInfo.FileName + "," + str ;
}
if(musicInfo.FileName.Length > 0)
{
musicInfo.FileName = musicInfo.FileName.Substring(1);
}
}
musicInfo.PartitionNo = zoneInfo.ZONE_ZONEID;
musicInfo.IsChecked = "false";
musicInfo.Status = zoneInfo.ZONE_STATUS;
musicInfo.Remarks = zoneInfo.ZONE_CONTENT;
musicInfo.Weeks = zoneInfo.ZONE_WEEK;
musicInfo.StartTime = zoneInfo.ZONE_STARTTIME;
musicInfo.EndTime = zoneInfo.ZONE_ENDTIME;
musicInfo.ID = zoneInfo.ID;
musicFileext.FileList.Add(musicInfo);
}
Response.Write(JsonHelper.SerializeWithSuffix(musicFileext));
}
}
}