private int SaveMorale(string morale, string clientIPAddress)
        {
            int result = 0;
            bool _moraleRecDeleted = false;
            string strUserIP = string.Empty;
            SapeMoraleDB DBCon = new SapeMoraleDB();

            _moraleRecDeleted = false;
            string IPAddress = clientIPAddress;

            strUserIP = string.Concat(IPAddress);

            try
            {
                sape_morale moraleRec = DBCon.sape_morale.Where(m => DbFunctions.TruncateTime(m.LASTUPDATEDDATE) == DateTime.Today.Date && m.IPADDRESS == strUserIP).FirstOrDefault();

                if (moraleRec == null)
                {
                    // new record
                    moraleRec = new sape_morale();
                    moraleRec.IPADDRESS = strUserIP;
                    moraleRec.MORALE = morale;
                    moraleRec.LASTUPDATEDDATE = DateTime.Now;
                    DBCon.sape_morale.Add(moraleRec);
                }
                else if (moraleRec.MORALE == morale)
                {
                    // delete
                    DBCon.sape_morale.Remove(moraleRec);
                    _moraleRecDeleted = true;
                }
                else
                {
                    // update
                    moraleRec.MORALE = morale;
                    moraleRec.LASTUPDATEDDATE = DateTime.Now;
                }

                result = DBCon.SaveChanges();

            }
            catch
            {
                return 0;
            }

            return result;
        }
        private async Task<bool> SubmitMorale(string Morale, string fingerprint = "")
        {
            string strUserIP = string.Empty;
            SapeMoraleDB DBCon = new SapeMoraleDB();
            
            _moraleRecDeleted = false;
            string IPAddress = Request.UserHostAddress;
            //string compName = DetermineCompName(IPAddress);

            strUserIP = string.Concat(Request.UserHostAddress, " | ", fingerprint);
            
            try
            {
                sape_morale moraleRec = DBCon.sape_morale.Where(m => DbFunctions.TruncateTime(m.LASTUPDATEDDATE) == DateTime.Today.Date && m.IPADDRESS == strUserIP).FirstOrDefault();

                if (moraleRec == null)
                {
                    // new record
                    moraleRec = new sape_morale();
                    moraleRec.IPADDRESS = strUserIP;
                    moraleRec.MORALE = Morale;
                    moraleRec.LASTUPDATEDDATE = DateTime.Now;
                    DBCon.sape_morale.Add(moraleRec);
                }
                else if (moraleRec.MORALE == Morale)
                {
                    // delete
                    DBCon.sape_morale.Remove(moraleRec);
                    _moraleRecDeleted = true;
                }
                else
                { 
                    // update
                    moraleRec.MORALE = Morale;
                    moraleRec.LASTUPDATEDDATE = DateTime.Now;                
                }
                
                int result = await DBCon.SaveChangesAsync();

                if (result == 1)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch
            {
                return false;
            }
        }
        private string GetUserMorale(string fingerprint = "")
        {
            string strUserIP = string.Empty;
            SapeMoraleDB DBCon = new SapeMoraleDB();
            string UserMorale = string.Empty;

            string IPAddress = Request.UserHostAddress;
            string compName = DetermineCompName(IPAddress);

            strUserIP = string.Concat(Request.UserHostAddress, " | ", compName);
            
            try
            {
                sape_morale moraleRec = DBCon.sape_morale.Where(m => DbFunctions.TruncateTime(m.LASTUPDATEDDATE) == DateTime.Today.Date && m.IPADDRESS == strUserIP).FirstOrDefault();
                if (moraleRec != null)
                {
                    UserMorale = moraleRec.MORALE;
                }
                return UserMorale;
            }
            catch
            {
                return UserMorale;
            }
        }