using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for Class_LogRegister
/// </summary>
public class Class_LogRegister
{
    private String Str_LogDescription = String.Empty;
    private String Str_UserName = String.Empty;
    private String Str_LinkPath = String.Empty;

    public Class_LogRegister(String Str_LogDescription, String Str_LinkPath)
	{
        this.Str_LogDescription = Str_LogDescription;
        this.Str_LinkPath = Str_LinkPath;

        if (HttpContext.Current.Session["UserName"] != null)
        {
            this.Str_UserName = HttpContext.Current.Session["UserName"].ToString();
        }
        else
        {
            this.Str_UserName = "guest";
        }
	}

    public void UDF_SaveLogs()
    {
        LSC_WareHouseDataContext SvaeLog = new LSC_WareHouseDataContext();
        tblLog t_Logs = new tblLog();

        Class_TimeTypes Cls_Time = new Class_TimeTypes();
        Cls_Time.UDF_MakeSimpleTime();

        
        t_Logs.LogDate = DateTime.Now;
        t_Logs.LogTime = Cls_Time.Str_SimpleTimes;
        t_Logs.LogDescription = this.Str_LogDescription;
        t_Logs.LogedUserName = this.Str_UserName;
        t_Logs.LinkPath = this.Str_LinkPath;

        SvaeLog.tblLogs.InsertOnSubmit(t_Logs);
        SvaeLog.SubmitChanges();
    }
}
