public string EncryptUser(BallySecurityProperty objUserDetails)
        {
            string sEncodedValue = string.Empty;

            if (objUserDetails.UserName.ToUpper() != "BALLY")
            {
                objUserDetails.Password = Encode(objUserDetails.Password, "geoffrey" + objUserDetails.UserName);
            }
            return(sEncodedValue);
        }
        /// <summary>
        ///  Function checks whether the user is authenticated and authorized.
        /// </summary>
        ///  Revision History
        ///   Anuradha      Created         26/05/08
        /// <param name="objUserDet>MeterHistoryProperty</param>
        /// <returns>boolean</returns>

        public bool ValidateUser(BallySecurityProperty objUserDetails)
        {
            if (objUserDetails.UserName.ToUpper() != "BALLY")
            {
                Type t = objUserDetails.GetType();
                dtUserDt = new DataTable(t.Name);
                foreach (PropertyInfo pi in t.GetProperties())
                {
                    dtUserDt.Columns.Add(pi.Name);
                }
                DataRow dr = dtUserDt.NewRow();
                foreach (DataColumn dc in dtUserDt.Columns)
                {
                    dr[dc.ColumnName] = objUserDetails.GetType().GetProperty(dc.ColumnName).GetValue(objUserDetails, null);
                }
                dtUserDt.Rows.Add(dr);
                return(Authenticate(dtUserDt));
            }
            else if (objUserDetails.UserName.ToUpper() == "BALLY")
            {
                BallySuperUserPassword objSuperUser = new BallySuperUserPassword();
                string strPass = objSuperUser.CreateSuperUserPassword();
                if (objUserDetails.Password == strPass)
                {
                    strUserRole = "administrator";
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        private bool CheckBallyuser(string strUser, string strPass)
        {
            bool bResult;

            try
            {
                var oSecurityAuthenticate = new BallySecurityAuthentication();
                var objProperty = new BallySecurityProperty { UserName = strUser, Password = strPass };

                if (objProperty.UserName.ToUpper() != "BALLY")
                {
                    objProperty.Password = oSecurityAuthenticate.EncryptUser(objProperty);
                    bResult = oSecurityAuthenticate.ValidateUser(objProperty);
                }
                else
                    bResult = oSecurityAuthenticate.ValidateUser(objProperty);
            }
            catch (Exception ex)
            {
                bResult = false;
                ExceptionManager.Publish(ex);
            }
            return bResult;
        }
        /// <summary>
        ///  Function checks whether the user is authenticated and authorized.
        /// </summary> 
        ///  Revision History
        ///   Anuradha      Created         26/05/08
        /// <param name="objUserDet>MeterHistoryProperty</param>
        /// <returns>boolean</returns>

        public bool ValidateUser(BallySecurityProperty objUserDetails)
        {
            
            if (objUserDetails.UserName.ToUpper() != "BALLY")
            {               
                Type t = objUserDetails.GetType();
                dtUserDt = new DataTable(t.Name);
                foreach (PropertyInfo pi in t.GetProperties())
                {
                    dtUserDt.Columns.Add(pi.Name);
                }
                DataRow dr=dtUserDt.NewRow();
                foreach (DataColumn dc in dtUserDt.Columns) 
                {
                    dr[dc.ColumnName] = objUserDetails.GetType().GetProperty(dc.ColumnName).GetValue(objUserDetails, null);
                }
                dtUserDt.Rows.Add(dr);
                return Authenticate(dtUserDt);
            }
            else if (objUserDetails.UserName.ToUpper() == "BALLY")
            {
                BallySuperUserPassword objSuperUser = new BallySuperUserPassword();
                string strPass = objSuperUser.CreateSuperUserPassword();
                if (objUserDetails.Password == strPass)
                {
                    strUserRole = "administrator";
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
 public string EncryptUser(BallySecurityProperty objUserDetails)
 {
     string sEncodedValue = string.Empty;
     if (objUserDetails.UserName.ToUpper() != "BALLY")
     {
         objUserDetails.Password = Encode(objUserDetails.Password, "geoffrey" + objUserDetails.UserName);
     }
     return sEncodedValue;
 }