Ejemplo n.º 1
0
 /// <summary>
 /// Check budget category exists
 /// </summary>
 /// <returns>Boolean</returns>
 public bool CheckCategoryExists(string categoryName)
 {
     object[] objCategoryCheck = new object[2];
     objCategoryCheck[0] = categoryName;
     objCategoryCheck[1] = userSession.CompanyId;
     return(DataLibrary.ExecuteReaderSql(ref objCategoryCheck, "bspCheckCategoryExists").HasRows);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Check group already exists
 /// </summary>
 /// <param name="groupName">Group Name</param>
 /// <returns>True if exists else false</returns>
 public bool CheckGroupAlreadyExists(string groupName)
 {
     object[] objCheckGroup = new object[2];
     objCheckGroup[0] = groupName;
     objCheckGroup[1] = userSession.CompanyId;
     return(DataLibrary.ExecuteReaderSql(ref objCheckGroup, "bspCheckGroupAlreadyExists").HasRows);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Check is budget already exists
 /// </summary>
 /// <param name="BudgetName"></param>
 /// <returns>true if exists else false</returns>
 public bool CheckBudgetExists(string budgetName)
 {
     object[] objBudgetCheck = new object[2];
     objBudgetCheck[0] = budgetName;
     objBudgetCheck[1] = userSession.CompanyId;
     return(DataLibrary.ExecuteReaderSql(ref objBudgetCheck, "bspCheckBudgetAlreadyExists").HasRows);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Check Amount Beyond Level
 /// </summary>
 /// <param name="AmountReturned">Amount returned</param>
 /// <param name="expenseId">Expense id.</param>
 /// <param name="amountReturnedBy">Amount returned by</param>
 /// <returns>true if the amount received is greater than the amount to be given then return true else false.</returns>
 public bool CheckAmountBeyondLevel(decimal AmountReturned, long expenseId, string amountReturnedBy, string amountReceivedBy)
 {
     object[] objReturnAmountCheck = new object[5];
     objReturnAmountCheck[0] = expenseId;
     objReturnAmountCheck[1] = AmountReturned;
     objReturnAmountCheck[2] = userSession.CompanyId;
     objReturnAmountCheck[3] = amountReturnedBy;
     objReturnAmountCheck[4] = amountReceivedBy;
     return(DataLibrary.ExecuteReaderSql(ref objReturnAmountCheck, "bspCheckAmountBeyondLevel").HasRows);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Check is valid password
        /// </summary>
        /// <param name="currentPassword">The current password.</param>
        /// <returns><see cref="bool"/></returns>
        public bool IsValidPassword(string currentPassword)
        {
            object[] objUserInput = new object[3];
            objUserInput[0] = userSession.UserId;
            objUserInput[1] = userSession.CompanyId;
            objUserInput[2] = encDecryption.Encrypt(currentPassword);
            SqlDataReader sdr = DataLibrary.ExecuteReaderSql(ref objUserInput, "bspCheckIsValidPassword");

            return(sdr.HasRows);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Get the currently available roles for a logged in user
        /// </summary>
        /// <param name="userName">Name of the logged in user</param>
        /// <returns>Return currently logged in user role</returns>
        public string GetCurrentUserRole(string userName)
        {
            object[]      objUserRoles = new object[0];
            string        userRole     = string.Empty;
            SqlDataReader readData     = DataLibrary.ExecuteReaderSql(ref objUserRoles, "bspGetCurrentUserRole");

            while (readData.Read())
            {
                userRole = readData.GetValue(0).ToString();
            }
            readData.Dispose();
            return(userRole);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Get all available roles in the application
        /// </summary>
        /// <returns></returns>
        public string[] GetAllAvailableRoles()
        {
            object[]      objUserRoles = new object[0];
            ArrayList     userRoles    = new ArrayList();
            SqlDataReader readData     = DataLibrary.ExecuteReaderSql(ref objUserRoles, "bspGetAllAvailableRoles");

            while (readData.Read())
            {
                userRoles.Add(readData.GetValue(0).ToString());
            }
            readData.Dispose();
            return((string[])userRoles.ToArray());
        }
Ejemplo n.º 8
0
        // <summary>
        // Get the list of application users
        // </summary>
        // <returns>Dictionary object of user list</returns>
        public Dictionary <string, string> GetAllApplicationUsers()
        {
            object[] objUserParameter = new object[1];
            objUserParameter[0] = userSession.CompanyId;
            Dictionary <string, string> userList = new Dictionary <string, string>();
            SqlDataReader userListReader         = DataLibrary.ExecuteReaderSql(ref objUserParameter, "bspGetApplicationUsers");

            while (userListReader.Read())
            {
                userList.Add(TypeConversionHelper.GetDefaultValueIfNull <string>(userListReader["UserId"]), TypeConversionHelper.GetDefaultValueIfNull <string>(userListReader["DisplayName"]));
            }

            return(userList);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Gets all of the available screens
        /// </summary>
        /// <returns>List of screen route entity</returns>
        public List <SharedAssembly.ScreenRoute> GetAvailableScreens()
        {
            object[]      objUserRoles = new object[0];
            ArrayList     userRoles    = new ArrayList();
            SqlDataReader readData     = DataLibrary.ExecuteReaderSql(ref objUserRoles, "bspGetAllAvailableScreens");
            List <SharedAssembly.ScreenRoute> screenRouteData = new List <SharedAssembly.ScreenRoute>();

            while (readData.Read())
            {
                screenRouteData.Add(new SharedAssembly.ScreenRoute
                {
                    ActionName     = readData["screenActionName"].ToString(),
                    AreaName       = readData["screenControllerName"].ToString(),
                    ControllerName = readData["screenAreaName"].ToString(),
                });
            }

            readData.Dispose();
            return(screenRouteData);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// To verify the email id
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="emailId"></param>
        /// <returns></returns>
        public bool VerifyAccount(string userName, string emailId)
        {
            object[] objChkEmail = new object[2];
            objChkEmail[0] = userName;
            objChkEmail[1] = emailId;
            string        userRole      = string.Empty;
            bool?         isValidVerfId = false;
            SqlDataReader readData      = DataLibrary.ExecuteReaderSql(ref objChkEmail, "bspVerifyEmail");

            if (readData != null && !readData.IsClosed)
            {
                while (readData.Read())
                {
                    isValidVerfId = (Nullable <bool>)readData["verified"];
                }
            }

            readData.Dispose();
            return(isValidVerfId ?? false);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Check is user has access to screen
        /// </summary>
        /// <param name="userId">Currently logged in user's Id </param>
        /// <param name="screenParameters">Screen url parameters</param>
        /// <returns>True if user has access else false</returns>
        public bool CheckIsUserHasAccessOnScreen(string userId, SharedAssembly.ScreenRoute screenParameters)
        {
            object[] objAppScreens = new object[5];
            objAppScreens[0] = userId;
            objAppScreens[1] = screenParameters.ActionName;
            objAppScreens[2] = screenParameters.ControllerName;
            objAppScreens[3] = screenParameters.AreaName;
            objAppScreens[4] = userSession.CompanyId;
            bool          isReadable           = false;
            SqlDataReader userPermissionReader = DataLibrary.ExecuteReaderSql(ref objAppScreens, "bspIsUserHasAccess");

            while (userPermissionReader.Read())
            {
                isReadable = TypeConversionHelper.GetDefaultValueIfNull <bool>(userPermissionReader["isRead"]);
                permissionHelper.SetPermission(isReadable,
                                               TypeConversionHelper.GetDefaultValueIfNull <bool>(userPermissionReader["isWrite"]),
                                               TypeConversionHelper.GetDefaultValueIfNull <bool>(userPermissionReader["isDelete"]));
            }

            return(isReadable);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Get the forgot password
        /// </summary>
        /// <param name="emailID"></param>
        /// <param name="newPassword">New password.</param>
        /// <returns>list of email id</returns>
        public string[] ResetPassword(string emailID, string newPassword)
        {
            try
            {
                object[]      objForgotPassword       = new object[] { emailID, newPassword };
                string[]      forgottenPasswordResult = null;
                SqlDataReader readData = DataLibrary.ExecuteReaderSql(ref objForgotPassword, "bspResetPassword");
                if (readData != null && !readData.IsClosed)
                {
                    while (readData.Read())
                    {
                        forgottenPasswordResult = new string[] { readData["DisplayName"].ToString(), readData["PassKey"].ToString() };
                    }
                }

                readData.Dispose();
                return(forgottenPasswordResult);
            }
            catch
            {
                return(null);
            }
        }