using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Morakhassi.Class
{
    class Class_Register_Logs
    {
        public Class_Register_Logs()
        {
        }

        public Class_Register_Logs(String _Log)
        {
            String str_PersonneliCodeOfUser = "";
            DateTime dtm_CurrentDateTime = DateTime.Now;
            lscArzeshGozariDataContext db = new lscArzeshGozariDataContext();
            try
            {
                tblUser userPesonneliCode = db.tblUsers.Single(n => n.UserName == Class.Class_Global_Var.ThisLogedUserName);
                str_PersonneliCodeOfUser = userPesonneliCode.PersonnelliCode;
            }
            catch
            {
                str_PersonneliCodeOfUser = "GU100000001";
            }
            tblLog _reglog = new tblLog();
            _reglog.PersonnelliCode = str_PersonneliCodeOfUser;
            _reglog.LogDateTime = dtm_CurrentDateTime;
            _reglog.LogDescription = _Log;
            db.tblLogs.InsertOnSubmit(_reglog);
            db.SubmitChanges();
        }
    }
}
