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 LeaveApp :BasePage
    {
        BaseBLL bll = new BaseBLL();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            List<object> list = bll.SelectObject(typeof(Model.User), "Users", "UserName,UserPos,UserTel", "ID=" + Session["UserID"].ToString());
            Model.User user = (Model.User)list[0];
            Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add("UserID", Session["UserID"].ToString());
            dic.Add("LeaveRea", Tb_LeaveRea.Text);
            dic.Add("Applicationstate","申请离职");
            dic.Add("UserName",user.UserName);
            dic.Add("UserPos",user.UserPos);
            dic.Add("UserPart", user.Part);
            object obj = bll.CreateObject(typeof(Model.UserLeave), dic);
            if (bll.SaveObject(obj, "UserLeave") == 0)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('申请成功！')", true);
                Tb_LeaveRea.Text = "";
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('申请失败！')", true);
            }
        }
    }
}