AgreeSupplyMeeting.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:6k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Collections.Generic;
- 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;
- public partial class General_AgreeSupplyMeeting : System.Web.UI.Page
- {
- /// <summary>
- /// 模板
- /// </summary>
- Model.MeetingRun MC = new Model.MeetingRun();
- /// <summary>
- /// 业务
- /// </summary>
- BLL.MeetingRun BC = new BLL.MeetingRun();
- /// <summary>
- /// 查询条件
- /// </summary>
- public string TiaoJian
- {
- get
- {
- if (ViewState["UseThingsTiaoJian"] == null)
- {
- return "";
- }
- else
- {
- return ViewState["UseThingsTiaoJian"].ToString();
- }
- }
- set { ViewState["UseThingsTiaoJian"] = value; }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "General_AgreeSupplyMeeting");
- BLL.MeetingManagers BMM = new BLL.MeetingManagers();
- if (BMM.GetCount("GLY = '" + SessionInclude.SessionId + "'") <= 0)
- {
- MessageBox.ShowAndRedirect(this, "你没有权限浏览该页面!", "../index.aspx");
- }
- else
- {
- if (!IsPostBack)
- {
- //TiaoJian = "CPH = 'lvs' and SYZT = '待批' and convert(varchar(10),KSSJ,120) = '今天'";
- TiaoJian = "PZZT = '" + States.SupplyState_Wait + "' and convert(varchar(10),KSSJ,120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'";
- MyDataBind(1);
- }
- }
- }
- /// <summary>
- /// 获取信息
- /// </summary>
- /// <param name="pidx">页号</param>
- public void MyDataBind(int pidx)
- {
- AspNetPager1.RecordCount = BC.GetCount(TiaoJian);
- List<Model.MeetingRun> LRData = BC.GetPageList(20, pidx, "KSSJ", true, TiaoJian);
- if (LRData.Count == 0)
- {
- Model.MeetingRun MC = new Model.MeetingRun();
- LRData.Add(MC);
- }
- GridView1.DataSource = LRData;
- GridView1.DataBind();
- }
- /// <summary>
- /// 会议室
- /// </summary>
- /// <returns></returns>
- public string HYS()
- {
- int id = 0;
- if (BC.GetCount(TiaoJian) > 0)
- {
- id = int.Parse(Eval("HYS").ToString());
- }
- return EnumGet.GetMeetingRoomsName(id);
- }
- /// <summary>
- /// 操作
- /// </summary>
- /// <returns></returns>
- public string CaoZuo()
- {
- string Rtstr = "";
- if (BC.GetCount(TiaoJian) > 0)
- {
- string Id = Eval("Id").ToString();
- Rtstr = "<a href='" + "MeetingDetail.aspx?id=" + Id + "'>详细信息</a> ";
- }
- else
- {
- Rtstr = "今日还没有待批的会议室!";
- }
- return Rtstr;
- }
- protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
- {
- MyDataBind(e.NewPageIndex);
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- for (int i = 0; i < GridView1.Rows.Count; i++)
- {
- //首先判断是否是数据行
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- //当鼠标停留时更改背景色
- e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
- //当鼠标移开时还原背景色
- e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
- }
- }
- }
- protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
- {
- for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
- {
- CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
- if (CheckBox1.Checked)
- {
- cbox.Checked = true;
- }
- else
- {
- cbox.Checked = false;
- }
- }
- }
- protected void DelButton1_Click(object sender, EventArgs e)
- {
- try
- {
- for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
- {
- CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
- if (cbox.Checked)
- {
- int Id = int.Parse(GridView1.Rows[i].Cells[1].Text.ToString());
- if (Id == 0)
- {
- throw new Exception("该记录不能进行审批!");
- }
- MC = BC.GetModel(Id);
- MC.PZZT = States.SupplyState_Agree;
- BC.Update(MC);
- }
- else
- {
- }
- }
- MessageBox.Show("审批完成!");
- }
- catch (Exception exp)
- { MessageBox.Show(exp.Message); }
- MyDataBind(AspNetPager1.CurrentPageIndex);
- }
- protected void DelButton2_Click(object sender, EventArgs e)
- {
- try
- {
- for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
- {
- CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
- if (cbox.Checked)
- {
- int Id = int.Parse(GridView1.Rows[i].Cells[1].Text.ToString());
- if (Id == 0)
- {
- throw new Exception("该记录不能进行审批!");
- }
- if (String.IsNullOrEmpty(KeyValue_MS.Text.Trim()))
- {
- throw new Exception("原因不能为空!");
- }
- MC = BC.GetModel(Id);
- MC.PZZT = States.SupplyState_No;
- MC.MS = KeyValue_MS.Text;
- BC.Update(MC);
- }
- else
- {
- }
- }
- MessageBox.Show("审批完成!");
- KeyValue_MS.Text = "";
- }
- catch (Exception exp)
- { MessageBox.Show(exp.Message); }
- MyDataBind(AspNetPager1.CurrentPageIndex);
- }
- }