/// <summary>
        /// Check if the user credentials are valid
        /// </summary>
        /// <param name="ConnectionString"></param>
        /// <returns>success or failure</returns>
        /// Method Revision History
        ///
        /// Author             Date              Description
        /// ---------------------------------------------------
        /// Anuradha         05-Jan-2009        Intial Version 
        /// 
        public static bool Checkuser(string strUser,string strPass)
        {
            bool bResult = false;
            SecurityAuthenticate objSecurity = null;

            try
            {   
                objSecurity = new SecurityAuthenticate();
                SecurityProperty objProperty = new SecurityProperty();
                objProperty.UserName = strUser;
                objProperty.Password = strPass;

                bResult = objSecurity.ValidateUser(objProperty);
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("Checkuser" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(ex);
            }
            return bResult;
        }
 /// <summary>
 ///  This function retrives the user details
 /// </summary>
 /// /// <param name="baseObject">MeterHistoryTransport</param>
 public static DataSet UserDetails(SecurityProperty baseObject)
 {
     //Check for Active Installation           
     DataSet objdsUser = null;
     string strspName = "rsp_GetUserDetails";
     try
     {
         objdsUser = SqlHelper.ExecuteDataset(GetConnection(), CommandType.StoredProcedure, strspName, GetUserSpParameters(baseObject));
     }
     catch (Exception ex)
     {
         objdsUser = null;
         //MessageBox.Show("Error while retrieving User Details", strCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
         LogManager.WriteLog("Error while retrieving User Details" + ex.Message, LogManager.enumLogLevel.Error);
         BMC.Common.ExceptionManagement.ExceptionManager.Publish(ex);
     }
     return objdsUser;
 }
 /// <summary>
 ///  This function gets the parameters collection for retrieving User Details
 /// </summary>
 /// <param name="meterObject">MeterHistoryTranport</param>
 public static SqlParameter[] GetUserSpParameters(SecurityProperty meterObject)
 {
     SqlParameter[] sp_parames = null;
     if (meterObject != null)
     {
         //Call the SP with MHIDs to convert
         sp_parames = new SqlParameter[2];
         sp_parames[0] = new SqlParameter(SecuirtyConstants.strStaffUName, meterObject.UserName);
         sp_parames[1] = new SqlParameter(SecuirtyConstants.strPwd, meterObject.Password);
     }
     return sp_parames;
 }
示例#4
0
        /// <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(SecurityProperty objUserDetails)
        {
            //  SecurityProperty objUserDetails = (SecurityProperty)objUserDet;
            if (objUserDetails.UserName.ToUpper() != "BALLY")
            {
                objUserDetails.Password = Encode(objUserDetails.Password, "geoffrey" + objUserDetails.UserName);
                objUserDt = SecurityDBBuilder.UserDetails(objUserDetails).Tables[0];
                return Authenticate(objUserDt);
            }
            else if (objUserDetails.UserName.ToUpper() == "BALLY")
            {
                clsSuperUserPassword objSuperUser = new clsSuperUserPassword();
                string strPass = objSuperUser.CreateSuperUserPassword();
                if (objUserDetails.Password == strPass)
                {
                    strUserRole = "administrator";
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }