using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;
namespace ComResProSystem
{
    public partial class LeaveDetail:BasePage
    {
        BaseBLL bll = new BaseBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindUserLeave();
                string UserID = Request.QueryString["UserID"];
            }
        }
        public void BindUserLeave()
        {
            string ID = Request.QueryString["ID"];
            List<object> list=bll.SelectObject(typeof(Model.UserLeave), "UserLeave", "*", "ID=" + ID);
            Model.UserLeave user = (Model.UserLeave)list[0];
            Lb_UserName.Text = user.UserName;
            Lb_UserPart.Text = user.UserPart;
            Lb_UserPos.Text = user.UserPos;
            Lb_ApplicationTime.Text = user.ApplicationTime;
            Tb_LeaveRea.Text = user.LeaveRea;
        }

        protected void Ibt_submit_Click(object sender, ImageClickEventArgs e)
        {
            if (Dd_Type.Text == "同意离职")
            {
                int ID =Convert.ToInt32(Request.QueryString["ID"]);
                int UserID =Convert.ToInt32(Request.QueryString["UserID"]);
                if (bll.AduitUserLeave(ID, UserID) == 0)
                {
                    Response.Write("<script>alert('操作成功！');window.parent.returnValue='1';window.close();</script>");

                }
            }
        }
    }
}