MeetingDetail.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:6k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Text;
- public partial class General_MeetingDetail : System.Web.UI.Page
- {
- /// <summary>
- /// 会议室名称
- /// </summary>
- public string StrHtmlMC = "";
- /// <summary>
- /// 预定情况
- /// </summary>
- public string StrHtmlYDQK = "";
- /// <summary>
- /// 当前状态
- /// </summary>
- public string StrHtmlDQZT = "";
- //模板
- Model.MeetingRun MM = new Model.MeetingRun();
- //业务
- BLL.MeetingRun BM = new BLL.MeetingRun();
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "General_MeetingDetail");
- if (!IsPostBack)
- {
- object objid = Request.QueryString["id"];
- if (objid != null)
- {
- int ri = int.Parse(objid.ToString());
- MM = BM.GetModel(ri);
- DropLoadSet();
- KeyValue_MC.Text = MM.MC;
- KeyValue_ZT.Text = MM.ZT;
- KeyValue_MS.Text = MM.MS;
- KeyValue_SQR.Text = MM.SQR;
- KeyValue_SQSJ.Text = MM.SQSJ.ToString();
- KeyValue_CXRYNB.Text = MM.CXRYNB;
- KeyValue_CXRYWB.Text = MM.CXRYWB;
- KeyValue_KSSJ.Text = MM.KSSJ.ToString();
- KeyValue_JSSJ.Text = MM.JSSJ.ToString();
- KeyValue_HYS.SelectedValue = MM.HYS.ToString();
- KeyValue_HYGLY.SelectedValue = MM.HYGLY;
- }
- Forbidden();
- }
- }
- /// <summary>
- /// 禁用控件
- /// </summary>
- public void Forbidden()
- {
- KeyValue_HYS.Enabled = false;
- KeyValue_MC.Enabled = false;
- KeyValue_ZT.Enabled = false;
- KeyValue_MS.Enabled = false;
- KeyValue_SQR.Enabled = false;
- KeyValue_CXRYNB.Enabled = false;
- KeyValue_CXRYWB.Enabled = false;
- KeyValue_KSSJ.Enabled = false;
- KeyValue_JSSJ.Enabled = false;
- KeyValue_HYGLY.Enabled = false;
- KeyValue_SQSJ.Enabled = false;
- }
- /// <summary>
- /// 数据绑定
- /// </summary>
- public void DropLoadSet()
- {
- #region 会议室
- KeyValue_HYS.DataTextField = "MC";
- KeyValue_HYS.DataValueField = "ID";
- KeyValue_HYS.DataSource = EnumGet.MeetingRoomsGetEnum();
- KeyValue_HYS.DataBind();
- ListItem linone = new ListItem();
- linone.Text = "--请选择--";
- linone.Value = "0";
- KeyValue_HYS.Items.Add(linone);
- KeyValue_HYS.SelectedIndex = KeyValue_HYS.Items.Count - 1;
- #endregion
- #region 会议室管理员
- KeyValue_HYGLY.DataTextField = "GLY";
- KeyValue_HYGLY.DataValueField = "ID";
- KeyValue_HYGLY.DataSource = EnumGet.MeetingManagersGetEnum();
- KeyValue_HYGLY.DataBind();
- ListItem linone2 = new ListItem();
- linone2.Text = "--请选择--";
- linone2.Value = "0";
- KeyValue_HYGLY.Items.Add(linone2);
- KeyValue_HYGLY.SelectedIndex = KeyValue_HYGLY.Items.Count - 1;
- #endregion
- }
- public void DropLoadSet(int Id)
- {
- if (Id > 0)
- {
- MM = BM.GetModel(Id);
- #region 会议室名称
- StrHtmlMC = EnumGet.GetMeetingRoomsName(Id);
- #endregion
- #region 预定情况
- StrHtmlYDQK = YDXX(Id);
- #endregion
- #region 当前状态
- //string condition = "HYS = 'lvs' and PZZT = '已准' and convert(varchar(10),KSSJ,120) = '今天' and (KSSJ < '现在时间' and JSSJ > '现在时间')";
- string condition = "HYS = '" + Id.ToString() + "' and PZZT = '" + States.SupplyState_Agree + "' and convert(varchar(10),KSSJ,120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (KSSJ < '" + DateTime.Now.ToString() + "' and JSSJ > '" + DateTime.Now.ToString() + "')";
- if (BM.GetCount(condition) > 0)
- {
- StrHtmlDQZT = States.UseState_Busy;
- }
- else
- {
- StrHtmlDQZT = States.UseState_Free;
- }
- #endregion
- }
- }
- /// <summary>
- /// 预定情况
- /// </summary>
- /// <param name="Id">会议室ID</param>
- /// <returns></returns>
- public string YDXX(int Id)
- {
- StringBuilder sb = new StringBuilder();
- if (Id > 0)
- {
- //string condtion = "MC = 'lvs' and PZZT = '待批' and convert(varchar(10),KSSJ,120) = '今天'";
- string condition = "HYS = '" + Id.ToString() + "' and PZZT = '" + States.SupplyState_Wait + "' and convert(varchar(10),KSSJ,120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'";
- string Rtstr = "当前共 " + BM.GetCount(condition).ToString() + " 条预定信息";
- //sb.Append("<a href='VehicleWait.aspx?TiaoJian=" + condition + "' title='点击查看详情'><span style='color: #0000ff; text-decoration: underline'>" + Rtstr + "</span></a>");
- if (BM.GetCount(condition) > 0)
- {
- sb.Append("<a href='" + "MeetingWait.aspx?id=" + Id.ToString() + "' title='点击查看详情'><span style='color: #0000ff; text-decoration: underline'>" + Rtstr + "</span></a>");
- }
- else
- {
- sb.Append("<a href='#' title='点击查看详情'><span style='color: #0000ff; text-decoration: underline'>" + Rtstr + "</span></a>");
- }
- }
- else
- {
- sb.Append("");
- }
- return sb.ToString();
- }
- protected void KeyValue_HYS_SelectedIndexChanged(object sender, EventArgs e)
- {
- DropLoadSet(int.Parse(KeyValue_HYS.SelectedValue));
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- DropLoadSet(int.Parse(KeyValue_HYS.SelectedValue));
- }
- }