Ejemplo n.º 1
0
        //User Logs
        public string InsertUpdateEmployeeLogs(EmployeeLogs EmployeeLogsBO, out string error)
        {
            Exception exError;
            LoginBL   Bl  = new LoginBL();
            string    val = Bl.InsertUpdateEmployeeLogs(EmployeeLogsBO, out exError);

            error = exError == null ? "" : exError.Message;
            return(val);
        }
Ejemplo n.º 2
0
 public string InsertUpdateEmployeeLogs(EmployeeLogs EmployeeLogsBO, out Exception error)
 {
     try
     {
         LoginDAL dal = new LoginDAL();
         if (EmployeeLogsBO.EmployeeID == 0)
         {
             EmployeeLogsBO.EmployeeID = Convert.ToInt32(HttpContext.Current.Session["userid"]);
         }
         return(dal.InsertUpdateEmployeeLogs(EmployeeLogsBO, Constants.SpUserLogs, out error));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 3
0
        //User Logs when Logs Out
        public void InsertUpdateEmployeeLogs(int LoginUserID, int EmployeeLogID, int StatusID)
        {
            Exception    exError;
            LoginBL      Bl             = new LoginBL();
            EmployeeLogs EmployeeLogsBO = new EmployeeLogs();

            EmployeeLogsBO.StatusID         = StatusID;
            EmployeeLogsBO.LoggedOutTime    = DateTime.Now;
            EmployeeLogsBO.LastAccessedTime = DateTime.Now;
            EmployeeLogsBO.UserLogin        = "";
            EmployeeLogsBO.EmployeeID       = LoginUserID;
            EmployeeLogsBO.EmployeeLogID    = EmployeeLogID;

            string val = Bl.InsertUpdateEmployeeLogs(EmployeeLogsBO, out exError);

            val = exError == null ? val : exError.Message;
        }
Ejemplo n.º 4
0
        public string InsertUpdateEmployeeLogs(EmployeeLogs EmployeeLogsBO, string _commandText, out Exception error)
        {
            string Output = string.Empty;

            string hostName = Dns.GetHostName(); // Retrive the Name of HOST
            // Get the IP
            string myIP = Dns.GetHostByName(hostName).AddressList[0].ToString();

            try
            {
                error = null;
                try
                {
                    using (DbCommand command = _db.GetStoredProcCommand(_commandText))
                    {
                        using (DbConnection connection = _db.CreateConnection())
                        {
                            connection.Open();
                            command.Connection = connection;

                            EmployeeLogsBO.IPAddress = myIP;

                            var parameter = command.CreateParameter();
                            parameter.ParameterName = "@UserLoginID";
                            parameter.Value         = EmployeeLogsBO.EmployeeID;
                            command.Parameters.Add(parameter);

                            parameter = command.CreateParameter();
                            parameter.ParameterName = "@EmployeeLogID";
                            parameter.Value         = EmployeeLogsBO.EmployeeLogID;
                            command.Parameters.Add(parameter);

                            parameter = command.CreateParameter();
                            parameter.ParameterName = "@LoggedInTime";
                            parameter.Value         = EmployeeLogsBO.LoggedInTime;
                            command.Parameters.Add(parameter);

                            parameter = command.CreateParameter();
                            parameter.ParameterName = "@LoggedOutTime";
                            parameter.Value         = EmployeeLogsBO.LoggedOutTime;
                            command.Parameters.Add(parameter);

                            parameter = command.CreateParameter();
                            parameter.ParameterName = "@LastAccessedTime";
                            parameter.Value         = EmployeeLogsBO.LastAccessedTime;
                            command.Parameters.Add(parameter);

                            parameter = command.CreateParameter();
                            parameter.ParameterName = "@IPAddress";
                            parameter.Value         = EmployeeLogsBO.IPAddress;
                            command.Parameters.Add(parameter);

                            parameter = command.CreateParameter();
                            parameter.ParameterName = "@MessageLog";
                            parameter.Value         = EmployeeLogsBO.MessageLog;
                            command.Parameters.Add(parameter);

                            parameter = command.CreateParameter();
                            parameter.ParameterName = "@LoggedOutBy";
                            parameter.Value         = EmployeeLogsBO.LoggedOutBy;
                            command.Parameters.Add(parameter);

                            parameter = command.CreateParameter();
                            parameter.ParameterName = "@StatusID";
                            parameter.Value         = EmployeeLogsBO.StatusID;
                            command.Parameters.Add(parameter);

                            Output = command.ExecuteScalar().ToString();
                            connection.Close();
                        }
                    }
                }
                catch (InvalidOperationException invalid)
                {
                    error  = invalid;
                    Output = "failed";
                }
                catch (Exception ex)
                {
                    error  = ex;
                    Output = "failed";
                }
                return(Output);
            }
            catch (Exception)
            {
                throw;
            }
        }