Beispiel #1
0
 public bool DeleteUserRole(UsesRoleDelete userRole)
 {
     Logging.LogDebugMessage("Method: UserRoleDelete, MethodType: Get, Layer: UserController, Parameters: userRole = " + JsonConvert.SerializeObject(userRole));
     using (UserBL deleteUserRole = new UserBL())
     {
         return(deleteUserRole.DeleteUserRole(userRole));
     }
 }
Beispiel #2
0
        /// <summary>Delete the user and roles.</summary>
        /// <param name="userRoleDelete"> UsesRoleDelete Object.</param>
        /// <returns>List of Users and roles List.</returns>
        public bool DeleteUserRole(UsesRoleDelete userRole)
        {
            Logging.LogDebugMessage("Method: DeleteUserRole, MethodType: Get, Layer: UserDAL, Parameters: userRole = " + JsonConvert.SerializeObject(userRole));
            var dataset = new DataSet();
            // var retList = new List<Users>();
            Boolean checkdeleteValue = false;

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.ConnectionString);
                    command.CommandText = "USP_UserRoleDelete";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RoleID", Value = userRole.RoleID
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserID", Value = userRole.UserID
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataset);
                        if (dataset != null && dataset.Tables.Count > 0)
                        {
                            checkdeleteValue = true;
                            //retList = EntityCollectionHelper.ConvertTo<Users>(ds.Tables[0]).ToList();
                        }
                        else
                        {
                            checkdeleteValue = false;
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: DeleteUserRole, Layer: UserDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: DeleteUserRole, Layer: UserDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(checkdeleteValue);
        }
Beispiel #3
0
 /// <summary>Delete the user and roles.</summary>
 /// <param name="userRoleDelete"> UsesRoleDelete Object.</param>
 /// <returns>List of Users and roles List.</returns>
 public bool DeleteUserRole(UsesRoleDelete userRole)
 {
     Logging.LogDebugMessage("Method: DeleteUserRole, MethodType: Get, Layer: UserBL, Parameters: userRole = " + JsonConvert.SerializeObject(userRole));
     using (UserDAL deleteUserrole = new UserDAL())
     {
         try
         {
             return(deleteUserrole.DeleteUserRole(userRole));
         }
         catch (SqlException sqlEx)
         {
             Logging.LogErrorMessage("Method: DeleteUserRole, Layer: UserBL, Stack Trace: " + sqlEx.ToString());
             throw;
         }
         catch (Exception ex)
         {
             Logging.LogErrorMessage("Method: DeleteUserRole, Layer: UserBL, Stack Trace: " + ex.ToString());
             throw;
         }
     }
 }