using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using HySoft.Common;
using System.Web.UI;


public class BasePage : System.Web.UI.Page
{
    public string PageTitle = "";//页面标题文本信息
    protected override void OnLoad(EventArgs e)
    {
        try
        {
            LoginUser p_LoginUser = new LoginUser(this.Context);
            if (p_LoginUser.UserID == 0)
            {
                string url = Request.Url.AbsoluteUri.Replace(Request.Path, "");
                ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>top.location='" + url + "/login.aspx';</script>");
            }
            else
            { 
                base.OnLoad(e); 
            }
        }
        catch (Exception ex)
        {
            SysLog.WriteLog(ex);
        }
        //设置基类  每个页面继承该类,该类判断是否存在该用户,如果不存在则返回重新登录

    }
    /// <summary>
    /// 操作日志
    /// </summary>
    /// <param name="F_FunctionId">页面ID</param>
    /// <param name="F_FunctionItemId">按钮ID</param>
    /// <param name="F_Descript">内容</param>
    /// <param name="F_State">操作类型,0正常，1失败,2异常</param>
    /// <returns></returns>
    public bool InsertOptLogs(int F_FunctionId, int F_FunctionItemId, string F_Descript, int F_State)
    {
        try
        {
            LoginUser p_LoginUser = new LoginUser(this.Context);
            bool bl = false;
            DataTable dt = new DataTable();
            HySoft.BaseCallCenter.Model.T_Sys_OperateLogs model = new HySoft.BaseCallCenter.Model.T_Sys_OperateLogs();
            model.F_Descript = F_Descript;
            model.F_DeletionStateCode = 0;
            model.F_FunctionId = F_FunctionId;
            model.F_FunctionItemId = F_FunctionItemId;
            model.F_OptBy = p_LoginUser.UserID;
            model.F_OptName = p_LoginUser.UserName;
            model.F_OptOn = DateTime.Now;
            model.F_State = F_State;
            HySoft.BaseCallCenter.BLL.T_Sys_OperateLogs bll = new HySoft.BaseCallCenter.BLL.T_Sys_OperateLogs();
            if (bll.Add(model) > 0)
            {
                bl = true;
            }
            return bl;
        }
        catch
        {
            return false;
        }
    }
}
