From 266a7f531b7391c40f6358163f81b4322b5dd2ec Mon Sep 17 00:00:00 2001 From: alisec Date: Tue, 6 Jan 2026 03:01:09 +0300 Subject: [PATCH] chore: remove unused using directives Remove unused using statements across the codebase using dotnet format analyzers. --- .../Core/Config/AzureBlobStorageSettings.cs | 3 +- .../Core/Exceptions/ConfigurationException.cs | 3 +- .../Core/Exceptions/FileUploadException.cs | 3 +- OpsFlow/Core/Exceptions/ResourceException.cs | 3 +- OpsFlow/Core/Models/Department.cs | 3 +- OpsFlow/Core/Models/UserSession.cs | 4 +- OpsFlow/Core/Services/AppBootstrapper.cs | 15 +++---- OpsFlow/Core/Services/DatabaseManager.cs | 3 +- OpsFlow/Core/Services/WindowManager.cs | 2 +- OpsFlow/Services/Helpers/ComboBoxHelper.cs | 3 +- .../Helpers/CompanyValidationHelper.cs | 3 +- .../Helpers/FileUploadServiceFactory.cs | 9 ++-- .../Services/Helpers/FileValidationHelper.cs | 3 +- .../Services/Helpers/FormValidationHelper.cs | 3 +- OpsFlow/Services/Helpers/UrlHelper.cs | 9 ++-- .../AzureBlobStorageService.cs | 14 +++---- .../Implementations/CompanyService.cs | 6 +-- .../Implementations/DepartmentService.cs | 4 +- .../Services/Implementations/EmailService.cs | 1 + .../Implementations/FileUploadService.cs | 3 +- .../Services/Implementations/RoleService.cs | 5 +-- .../Services/Interfaces/ICompanyService.cs | 4 +- .../Services/Interfaces/IDepartmentService.cs | 3 +- .../Services/Interfaces/IFileUploadService.cs | 3 +- OpsFlow/Services/Interfaces/IRoleService.cs | 4 +- OpsFlow/UI/Forms/Auth/LoginForm.cs | 2 +- OpsFlow/UI/Forms/Main/MainForm.cs | 7 ++-- OpsFlow/UI/Forms/Management/AddTaskForm.cs | 10 +---- OpsFlow/UI/Forms/Management/LogoutForm.cs | 12 +----- OpsFlow/UI/Forms/Management/PersonelCard.cs | 12 +++--- .../UI/Forms/Management/PersonelListForm.cs | 42 +++++++++---------- OpsFlow/UI/Forms/Management/ProfileControl.cs | 12 +----- .../UI/Forms/Management/ProfileEditForm.cs | 19 ++++----- OpsFlow/UI/Forms/Management/SettingsForm.cs | 10 +---- OpsFlow/UI/Forms/Management/TaskListForm.cs | 10 +---- OpsFlow/UI/Forms/Management/TaskRow.cs | 12 +----- .../UI/Forms/Onboarding/SplashScreenForm.cs | 5 ++- 37 files changed, 99 insertions(+), 170 deletions(-) diff --git a/OpsFlow/Core/Config/AzureBlobStorageSettings.cs b/OpsFlow/Core/Config/AzureBlobStorageSettings.cs index ef267c6..1325010 100644 --- a/OpsFlow/Core/Config/AzureBlobStorageSettings.cs +++ b/OpsFlow/Core/Config/AzureBlobStorageSettings.cs @@ -6,5 +6,4 @@ public sealed class AzureBlobStorageSettings public required string ContainerName { get; set; } = "avatars"; public string? BaseUrl { get; set; } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Core/Exceptions/ConfigurationException.cs b/OpsFlow/Core/Exceptions/ConfigurationException.cs index 6372b03..35ee6c4 100644 --- a/OpsFlow/Core/Exceptions/ConfigurationException.cs +++ b/OpsFlow/Core/Exceptions/ConfigurationException.cs @@ -12,5 +12,4 @@ public ConfigurationException(string message, Exception inner) { } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Core/Exceptions/FileUploadException.cs b/OpsFlow/Core/Exceptions/FileUploadException.cs index d6f329d..071f174 100644 --- a/OpsFlow/Core/Exceptions/FileUploadException.cs +++ b/OpsFlow/Core/Exceptions/FileUploadException.cs @@ -12,5 +12,4 @@ public FileUploadException(string message, Exception inner) { } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Core/Exceptions/ResourceException.cs b/OpsFlow/Core/Exceptions/ResourceException.cs index 49cb8ee..b298e85 100644 --- a/OpsFlow/Core/Exceptions/ResourceException.cs +++ b/OpsFlow/Core/Exceptions/ResourceException.cs @@ -12,5 +12,4 @@ public ResourceException(string message, Exception inner) { } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Core/Models/Department.cs b/OpsFlow/Core/Models/Department.cs index 7c47bb3..984f178 100644 --- a/OpsFlow/Core/Models/Department.cs +++ b/OpsFlow/Core/Models/Department.cs @@ -16,5 +16,4 @@ public class Department public string DepartmentName { get; set; } = string.Empty; public virtual ICollection Users { get; set; } = new List(); -} - +} \ No newline at end of file diff --git a/OpsFlow/Core/Models/UserSession.cs b/OpsFlow/Core/Models/UserSession.cs index efe0f24..cdc793f 100644 --- a/OpsFlow/Core/Models/UserSession.cs +++ b/OpsFlow/Core/Models/UserSession.cs @@ -1,6 +1,4 @@ -using OpsFlow.Core.Models; - -namespace OpsFlow.Core.Models; +namespace OpsFlow.Core.Models; public static class UserSession { diff --git a/OpsFlow/Core/Services/AppBootstrapper.cs b/OpsFlow/Core/Services/AppBootstrapper.cs index a5ae733..be97c23 100644 --- a/OpsFlow/Core/Services/AppBootstrapper.cs +++ b/OpsFlow/Core/Services/AppBootstrapper.cs @@ -1,4 +1,5 @@ using Azure.Storage.Blobs; + using OpsFlow.Core.Exceptions; using OpsFlow.Services.Interfaces; @@ -104,14 +105,14 @@ private async Task ValidateStorageServicesAsync() { string envPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ".env"); var connectionString = ReadConnectionStringFromEnvFile(envPath); - + if (string.IsNullOrWhiteSpace(connectionString)) { throw new ConfigurationException("USE_AZURE_STORAGE=true olarak ayarlandı ancak AZURE_STORAGE_CONNECTION_STRING tanımlı değil."); } connectionString = connectionString.Trim(); - + if (connectionString.StartsWith("\"") && connectionString.EndsWith("\"")) { connectionString = connectionString.Substring(1, connectionString.Length - 2).Trim(); @@ -147,10 +148,10 @@ await Task.Run(async () => { var blobServiceClient = new BlobServiceClient(connectionString); var properties = await blobServiceClient.GetPropertiesAsync(); - + var containerName = Environment.GetEnvironmentVariable("AZURE_STORAGE_CONTAINER_NAME") ?? "avatars"; var containerClient = blobServiceClient.GetBlobContainerClient(containerName); - + try { await containerClient.CreateIfNotExistsAsync(Azure.Storage.Blobs.Models.PublicAccessType.Blob); @@ -277,7 +278,7 @@ private void ValidateResourceFiles() if (equalsIndex >= 0 && equalsIndex < line.Length - 1) { string value = line.Substring(equalsIndex + 1).Trim(); - + if (value.StartsWith("\"") && value.EndsWith("\"")) { value = value.Substring(1, value.Length - 2); @@ -286,7 +287,7 @@ private void ValidateResourceFiles() { value = value.Substring(1, value.Length - 2); } - + return value; } } @@ -295,7 +296,7 @@ private void ValidateResourceFiles() catch { } - + return Environment.GetEnvironmentVariable("AZURE_STORAGE_CONNECTION_STRING"); } } diff --git a/OpsFlow/Core/Services/DatabaseManager.cs b/OpsFlow/Core/Services/DatabaseManager.cs index 66869ce..016f4f4 100644 --- a/OpsFlow/Core/Services/DatabaseManager.cs +++ b/OpsFlow/Core/Services/DatabaseManager.cs @@ -40,5 +40,4 @@ public static void Reset() } } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Core/Services/WindowManager.cs b/OpsFlow/Core/Services/WindowManager.cs index 935ddb3..4a51e14 100644 --- a/OpsFlow/Core/Services/WindowManager.cs +++ b/OpsFlow/Core/Services/WindowManager.cs @@ -4,7 +4,7 @@ namespace OpsFlow.Core.Services { public static class WindowManager { - private static ApplicationContext _context = new ApplicationContext(); + private static readonly ApplicationContext _context = new ApplicationContext(); public static void Run() where T : Form, new() { diff --git a/OpsFlow/Services/Helpers/ComboBoxHelper.cs b/OpsFlow/Services/Helpers/ComboBoxHelper.cs index ff0f53f..f132644 100644 --- a/OpsFlow/Services/Helpers/ComboBoxHelper.cs +++ b/OpsFlow/Services/Helpers/ComboBoxHelper.cs @@ -28,5 +28,4 @@ public static class ComboBoxHelper return departments.FirstOrDefault(d => d.DepartmentName == departmentName); } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Helpers/CompanyValidationHelper.cs b/OpsFlow/Services/Helpers/CompanyValidationHelper.cs index d6646e9..861725d 100644 --- a/OpsFlow/Services/Helpers/CompanyValidationHelper.cs +++ b/OpsFlow/Services/Helpers/CompanyValidationHelper.cs @@ -30,5 +30,4 @@ public static (bool IsValid, string? ErrorMessage) ValidateCompanyForm( return (true, null); } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Helpers/FileUploadServiceFactory.cs b/OpsFlow/Services/Helpers/FileUploadServiceFactory.cs index a360e8a..bacab97 100644 --- a/OpsFlow/Services/Helpers/FileUploadServiceFactory.cs +++ b/OpsFlow/Services/Helpers/FileUploadServiceFactory.cs @@ -8,9 +8,9 @@ public static class FileUploadServiceFactory public static IFileUploadService Create() { var useAzure = Environment.GetEnvironmentVariable("USE_AZURE_STORAGE"); - - if (!string.IsNullOrWhiteSpace(useAzure) && - bool.TryParse(useAzure, out bool useAzureStorage) && + + if (!string.IsNullOrWhiteSpace(useAzure) && + bool.TryParse(useAzure, out bool useAzureStorage) && useAzureStorage) { return new AzureBlobStorageService(); @@ -19,5 +19,4 @@ public static IFileUploadService Create() return new FileUploadService(); } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Helpers/FileValidationHelper.cs b/OpsFlow/Services/Helpers/FileValidationHelper.cs index a0b16d4..29b3acd 100644 --- a/OpsFlow/Services/Helpers/FileValidationHelper.cs +++ b/OpsFlow/Services/Helpers/FileValidationHelper.cs @@ -79,5 +79,4 @@ public static void ValidateFileForUpload(string filePath) throw new ArgumentException($"Dosya boyutu çok büyük. Maksimum dosya boyutu: {MaxFileSizeBytes / (1024 * 1024)} MB."); } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Helpers/FormValidationHelper.cs b/OpsFlow/Services/Helpers/FormValidationHelper.cs index dd9c169..d4cf0b2 100644 --- a/OpsFlow/Services/Helpers/FormValidationHelper.cs +++ b/OpsFlow/Services/Helpers/FormValidationHelper.cs @@ -70,5 +70,4 @@ public static (bool IsValid, string? ErrorMessage) ValidatePersonelForm( return (true, null); } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Helpers/UrlHelper.cs b/OpsFlow/Services/Helpers/UrlHelper.cs index 9d7b1b0..4164a59 100644 --- a/OpsFlow/Services/Helpers/UrlHelper.cs +++ b/OpsFlow/Services/Helpers/UrlHelper.cs @@ -7,7 +7,7 @@ public static string ConvertPathToFileUrl(string filePath) if (string.IsNullOrWhiteSpace(filePath)) return string.Empty; - if (Uri.TryCreate(filePath, UriKind.Absolute, out Uri? uri) && + if (Uri.TryCreate(filePath, UriKind.Absolute, out Uri? uri) && (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)) { return filePath; @@ -45,10 +45,9 @@ public static bool IsValidUrl(string url) return false; return Uri.TryCreate(url, UriKind.Absolute, out Uri? uri) && - (uri.Scheme == Uri.UriSchemeHttp || - uri.Scheme == Uri.UriSchemeHttps || + (uri.Scheme == Uri.UriSchemeHttp || + uri.Scheme == Uri.UriSchemeHttps || uri.Scheme == Uri.UriSchemeFile); } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Implementations/AzureBlobStorageService.cs b/OpsFlow/Services/Implementations/AzureBlobStorageService.cs index 246ac5a..fa014cd 100644 --- a/OpsFlow/Services/Implementations/AzureBlobStorageService.cs +++ b/OpsFlow/Services/Implementations/AzureBlobStorageService.cs @@ -1,5 +1,6 @@ using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; + using OpsFlow.Core.Config; using OpsFlow.Core.Exceptions; using OpsFlow.Services.Helpers; @@ -24,7 +25,7 @@ public AzureBlobStorageService() throw new ConfigurationException("AZURE_STORAGE_CONNECTION_STRING env değeri boş veya tanımsız."); connectionString = connectionString.Trim(); - + if (connectionString.StartsWith("\"") && connectionString.EndsWith("\"")) { connectionString = connectionString.Substring(1, connectionString.Length - 2).Trim(); @@ -52,7 +53,7 @@ public AzureBlobStorageService() _blobServiceClient = new BlobServiceClient(_settings.ConnectionString); _containerClient = _blobServiceClient.GetBlobContainerClient(_settings.ContainerName); - + try { _containerClient.CreateIfNotExists(PublicAccessType.Blob); @@ -204,7 +205,7 @@ private string GenerateUniqueFileName(int? userId, string extension) if (equalsIndex >= 0 && equalsIndex < line.Length - 1) { string value = line.Substring(equalsIndex + 1).Trim(); - + if (value.StartsWith("\"") && value.EndsWith("\"")) { value = value.Substring(1, value.Length - 2); @@ -213,7 +214,7 @@ private string GenerateUniqueFileName(int? userId, string extension) { value = value.Substring(1, value.Length - 2); } - + return value; } } @@ -222,9 +223,8 @@ private string GenerateUniqueFileName(int? userId, string extension) catch { } - + return null; } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Implementations/CompanyService.cs b/OpsFlow/Services/Implementations/CompanyService.cs index 04c3615..1eb4977 100644 --- a/OpsFlow/Services/Implementations/CompanyService.cs +++ b/OpsFlow/Services/Implementations/CompanyService.cs @@ -1,5 +1,5 @@ using Microsoft.EntityFrameworkCore; -using Npgsql; + using OpsFlow.Core.Exceptions; using OpsFlow.Core.Models; using OpsFlow.Data.Context; @@ -128,6 +128,4 @@ public async Task RegisterCompanyAsync(Company company) await Task.Run(() => RegisterCompany(company)); } } -} - - +} \ No newline at end of file diff --git a/OpsFlow/Services/Implementations/DepartmentService.cs b/OpsFlow/Services/Implementations/DepartmentService.cs index 3c95450..5e3f3a4 100644 --- a/OpsFlow/Services/Implementations/DepartmentService.cs +++ b/OpsFlow/Services/Implementations/DepartmentService.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; + using OpsFlow.Core.Exceptions; using OpsFlow.Core.Models; using OpsFlow.Data.Context; @@ -59,5 +60,4 @@ public async Task> GetAllDepartmentsAsync() } } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Implementations/EmailService.cs b/OpsFlow/Services/Implementations/EmailService.cs index 9756579..b37da81 100644 --- a/OpsFlow/Services/Implementations/EmailService.cs +++ b/OpsFlow/Services/Implementations/EmailService.cs @@ -1,5 +1,6 @@ using System.Net; using System.Net.Mail; + using OpsFlow.Core.Config; using OpsFlow.Core.Exceptions; using OpsFlow.Services.Helpers; diff --git a/OpsFlow/Services/Implementations/FileUploadService.cs b/OpsFlow/Services/Implementations/FileUploadService.cs index fd39595..abe45cf 100644 --- a/OpsFlow/Services/Implementations/FileUploadService.cs +++ b/OpsFlow/Services/Implementations/FileUploadService.cs @@ -105,5 +105,4 @@ private string GenerateUniqueFileName(int? userId, string extension) return $"{prefix}{timestamp}_{guid}{extension}"; } } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Implementations/RoleService.cs b/OpsFlow/Services/Implementations/RoleService.cs index f71dd28..69ff8f1 100644 --- a/OpsFlow/Services/Implementations/RoleService.cs +++ b/OpsFlow/Services/Implementations/RoleService.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; + using OpsFlow.Core.Exceptions; using OpsFlow.Core.Models; using OpsFlow.Data.Context; @@ -59,6 +60,4 @@ public async Task> GetAllRolesAsync() } } } -} - - +} \ No newline at end of file diff --git a/OpsFlow/Services/Interfaces/ICompanyService.cs b/OpsFlow/Services/Interfaces/ICompanyService.cs index ccc6f67..a8a8d50 100644 --- a/OpsFlow/Services/Interfaces/ICompanyService.cs +++ b/OpsFlow/Services/Interfaces/ICompanyService.cs @@ -10,6 +10,4 @@ public interface ICompanyService void RegisterCompany(Company company); Task RegisterCompanyAsync(Company company); } -} - - +} \ No newline at end of file diff --git a/OpsFlow/Services/Interfaces/IDepartmentService.cs b/OpsFlow/Services/Interfaces/IDepartmentService.cs index 6eadf08..145c592 100644 --- a/OpsFlow/Services/Interfaces/IDepartmentService.cs +++ b/OpsFlow/Services/Interfaces/IDepartmentService.cs @@ -8,5 +8,4 @@ public interface IDepartmentService Task> GetAllDepartmentsAsync(); Department? GetDepartmentById(int id); } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Interfaces/IFileUploadService.cs b/OpsFlow/Services/Interfaces/IFileUploadService.cs index a0e0854..0774d3d 100644 --- a/OpsFlow/Services/Interfaces/IFileUploadService.cs +++ b/OpsFlow/Services/Interfaces/IFileUploadService.cs @@ -7,5 +7,4 @@ public interface IFileUploadService bool FileExists(string relativePath); string GetFullPath(string relativePath); } -} - +} \ No newline at end of file diff --git a/OpsFlow/Services/Interfaces/IRoleService.cs b/OpsFlow/Services/Interfaces/IRoleService.cs index 806e466..f931895 100644 --- a/OpsFlow/Services/Interfaces/IRoleService.cs +++ b/OpsFlow/Services/Interfaces/IRoleService.cs @@ -8,6 +8,4 @@ public interface IRoleService Task> GetAllRolesAsync(); Role? GetRoleById(int id); } -} - - +} \ No newline at end of file diff --git a/OpsFlow/UI/Forms/Auth/LoginForm.cs b/OpsFlow/UI/Forms/Auth/LoginForm.cs index 9cccda4..64e96d6 100644 --- a/OpsFlow/UI/Forms/Auth/LoginForm.cs +++ b/OpsFlow/UI/Forms/Auth/LoginForm.cs @@ -4,8 +4,8 @@ using OpsFlow.Core.Services; using OpsFlow.Services.Implementations; using OpsFlow.UI.Forms.Core; -using OpsFlow.UI.Forms.Main; using OpsFlow.UI.Forms.Dialogs.Notifications; +using OpsFlow.UI.Forms.Main; namespace OpsFlow.UI.Forms.Auth; diff --git a/OpsFlow/UI/Forms/Main/MainForm.cs b/OpsFlow/UI/Forms/Main/MainForm.cs index 251d07d..784c791 100644 --- a/OpsFlow/UI/Forms/Main/MainForm.cs +++ b/OpsFlow/UI/Forms/Main/MainForm.cs @@ -1,7 +1,8 @@ using Guna.UI2.WinForms; + +using OpsFlow.Core.Models; using OpsFlow.UI.Controls; using OpsFlow.UI.Forms.Core; -using OpsFlow.Core.Models; using OpsFlow.UI.Forms.Management; namespace OpsFlow.UI.Forms.Main; @@ -101,10 +102,10 @@ private void LoadForm(Form childForm) childForm.TopLevel = false; childForm.FormBorderStyle = FormBorderStyle.None; childForm.Dock = DockStyle.Fill; - + _contentPanel.Controls.Add(childForm); _contentPanel.Tag = childForm; - + childForm.BringToFront(); childForm.Show(); } diff --git a/OpsFlow/UI/Forms/Management/AddTaskForm.cs b/OpsFlow/UI/Forms/Management/AddTaskForm.cs index 9dddb6d..f4b2f67 100644 --- a/OpsFlow/UI/Forms/Management/AddTaskForm.cs +++ b/OpsFlow/UI/Forms/Management/AddTaskForm.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace OpsFlow.UI.Forms.Management; +namespace OpsFlow.UI.Forms.Management; public partial class AddTaskForm : Form { diff --git a/OpsFlow/UI/Forms/Management/LogoutForm.cs b/OpsFlow/UI/Forms/Management/LogoutForm.cs index 027ff05..bc1e471 100644 --- a/OpsFlow/UI/Forms/Management/LogoutForm.cs +++ b/OpsFlow/UI/Forms/Management/LogoutForm.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace OpsFlow.UI.Forms.Management; +namespace OpsFlow.UI.Forms.Management; public partial class LogoutForm : Form { @@ -26,4 +18,4 @@ private void btnCancel_Click(object sender, EventArgs e) this.DialogResult = DialogResult.No; this.Close(); } -} +} \ No newline at end of file diff --git a/OpsFlow/UI/Forms/Management/PersonelCard.cs b/OpsFlow/UI/Forms/Management/PersonelCard.cs index d30cb3f..5b94f5c 100644 --- a/OpsFlow/UI/Forms/Management/PersonelCard.cs +++ b/OpsFlow/UI/Forms/Management/PersonelCard.cs @@ -1,6 +1,4 @@ using OpsFlow.Core.Models; -using OpsFlow.Core.Services; -using OpsFlow.Services.Implementations; namespace OpsFlow.UI.Forms.Management; @@ -19,7 +17,7 @@ public void SetUserData(User user) _user = user; lblName.Text = $"{user.Name} {user.Surname}"; - + string departmentName = user.Department?.DepartmentName ?? "Departman Yok"; btnRoleBadge.Text = departmentName; @@ -41,7 +39,7 @@ private async void LoadAvatarAsync(string? avatarUrl) try { - if (Uri.TryCreate(avatarUrl, UriKind.Absolute, out Uri? uri) && + if (Uri.TryCreate(avatarUrl, UriKind.Absolute, out Uri? uri) && (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)) { using (HttpClient client = new HttpClient()) @@ -101,7 +99,7 @@ private async void btnViewProfile_Click(object sender, EventArgs e) dimmer.Show(anaForm); DialogResult result = popup.ShowDialog(dimmer); dimmer.Close(); - + // Eğer kullanıcı bilgileri güncellendiyse, kartı yeniden yükle if (result == DialogResult.OK) { @@ -119,7 +117,7 @@ private async Task RefreshUserDataAsync() { using var context = OpsFlow.Core.Services.DatabaseManager.CreateContext(); var userService = new OpsFlow.Services.Implementations.UserService(context); - + // Güncel kullanıcı bilgilerini veritabanından çek var updatedUser = userService.GetUserById(_user.Id); if (updatedUser != null) @@ -133,4 +131,4 @@ private async Task RefreshUserDataAsync() // Hata durumunda sessizce devam et } } -} +} \ No newline at end of file diff --git a/OpsFlow/UI/Forms/Management/PersonelListForm.cs b/OpsFlow/UI/Forms/Management/PersonelListForm.cs index 6488837..c089790 100644 --- a/OpsFlow/UI/Forms/Management/PersonelListForm.cs +++ b/OpsFlow/UI/Forms/Management/PersonelListForm.cs @@ -15,14 +15,14 @@ public partial class PersonelListForm : BaseForm private int _currentPage = 0; private const int PageSize = 6; private bool _isLoading = false; - private System.Windows.Forms.Timer? _scrollTimer; - private System.Windows.Forms.Timer? _searchTimer; + private readonly System.Windows.Forms.Timer? _scrollTimer; + private readonly System.Windows.Forms.Timer? _searchTimer; public PersonelListForm() { InitializeComponent(); if (this.HeaderPanel != null) this.HeaderPanel.SendToBack(); - + cmbFilterDept.DropDownStyle = ComboBoxStyle.DropDown; cmbFilterRole.DropDownStyle = ComboBoxStyle.DropDown; cmbFilterStatus.DropDownStyle = ComboBoxStyle.DropDown; @@ -35,9 +35,9 @@ public PersonelListForm() flpPersonelContainer.WrapContents = true; flpPersonelContainer.FlowDirection = FlowDirection.LeftToRight; flpPersonelContainer.BackColor = Color.FromArgb(17, 19, 25); - + SetModernScrollbarStyle(); - + _scrollTimer = new System.Windows.Forms.Timer(); _scrollTimer.Interval = 200; _scrollTimer.Tick += ScrollTimer_Tick; @@ -291,10 +291,10 @@ private async Task UpdateStatistics(int totalPersonel, int activePersonel, int t txtPersonel.Text = totalPersonel.ToString(); await Task.Delay(100); - + txtActivePersonel.Text = activePersonel.ToString(); await Task.Delay(100); - + txtDep.Text = totalDepartments.ToString(); } @@ -344,7 +344,7 @@ private async Task LoadNextPage() int currentLoadedCount = flpPersonelContainer.Controls.Count; int expectedCount = startIndex + PageSize; - + if (currentLoadedCount >= expectedCount) return; @@ -387,7 +387,7 @@ private async Task LoadNextPage() _currentPage++; await Task.Delay(50); - + if (this.InvokeRequired) { this.Invoke(new Action(() => @@ -453,7 +453,7 @@ private async Task ApplyFiltersAsync() if (!string.IsNullOrWhiteSpace(searchText)) { - filtered = filtered.Where(u => + filtered = filtered.Where(u => (u.Name + " " + u.Surname).Contains(searchText, StringComparison.OrdinalIgnoreCase) || u.Name.Contains(searchText, StringComparison.OrdinalIgnoreCase) || u.Surname.Contains(searchText, StringComparison.OrdinalIgnoreCase)); @@ -501,7 +501,7 @@ private async Task ApplyFiltersAsync() } } await LoadNextPage(); - + // Scrollbar'ın görünür olmasını sağlamak için içeriğin yüksekliğini kontrol et if (flpPersonelContainer != null) { @@ -535,10 +535,10 @@ private void EnsureScrollbarVisible() flpPersonelContainer.AutoScroll = true; flpPersonelContainer.HorizontalScroll.Enabled = false; flpPersonelContainer.HorizontalScroll.Visible = false; - + // Daha fazla içerik olup olmadığını kontrol et bool hasMoreContent = _currentPage * PageSize < _filteredUsers.Count; - + // FlowLayoutPanel'in gerçek içerik yüksekliğini al int contentHeight = 0; if (flpPersonelContainer.Controls.Count > 0) @@ -553,10 +553,10 @@ private void EnsureScrollbarVisible() } contentHeight = maxBottom + flpPersonelContainer.Padding.Bottom; } - + int containerHeight = flpPersonelContainer.ClientSize.Height; bool contentExceedsContainer = contentHeight > containerHeight; - + // Eğer içerik varsa ve (container'dan büyükse veya daha fazla sayfa varsa) scrollbar'ı görünür yap if (flpPersonelContainer.Controls.Count > 0 && (contentExceedsContainer || hasMoreContent)) { @@ -567,13 +567,13 @@ private void EnsureScrollbarVisible() // Daha fazla içerik varsa, scrollbar'ın görünür olması için minimum boyutu container'dan büyük yap // Tahmini toplam yüksekliği hesapla (mevcut sayfa sayısına göre) int estimatedTotalItems = _filteredUsers.Count; - int itemsPerRow = Math.Max(1, flpPersonelContainer.ClientSize.Width / (flpPersonelContainer.Controls.Count > 0 ? + int itemsPerRow = Math.Max(1, flpPersonelContainer.ClientSize.Width / (flpPersonelContainer.Controls.Count > 0 ? (flpPersonelContainer.Controls[0].Width + flpPersonelContainer.Controls[0].Margin.Left + flpPersonelContainer.Controls[0].Margin.Right) : 1)); int estimatedRows = (int)Math.Ceiling((double)estimatedTotalItems / itemsPerRow); - int estimatedHeight = estimatedRows * (flpPersonelContainer.Controls.Count > 0 ? - (flpPersonelContainer.Controls[0].Height + flpPersonelContainer.Controls[0].Margin.Top + flpPersonelContainer.Controls[0].Margin.Bottom) : 100) + int estimatedHeight = estimatedRows * (flpPersonelContainer.Controls.Count > 0 ? + (flpPersonelContainer.Controls[0].Height + flpPersonelContainer.Controls[0].Margin.Top + flpPersonelContainer.Controls[0].Margin.Bottom) : 100) + flpPersonelContainer.Padding.Top + flpPersonelContainer.Padding.Bottom; - + requiredHeight = Math.Max(requiredHeight, Math.Max(containerHeight + 1, estimatedHeight)); } else @@ -581,7 +581,7 @@ private void EnsureScrollbarVisible() // Sadece mevcut içerik varsa, container'dan biraz büyük yap requiredHeight = Math.Max(requiredHeight, containerHeight + 1); } - + flpPersonelContainer.AutoScrollMinSize = new Size(0, requiredHeight); } else if (flpPersonelContainer.Controls.Count == 0) @@ -589,7 +589,7 @@ private void EnsureScrollbarVisible() // İçerik yoksa, minimum boyutu sıfırla flpPersonelContainer.AutoScrollMinSize = new Size(0, 0); } - + flpPersonelContainer.PerformLayout(); flpPersonelContainer.Refresh(); flpPersonelContainer.Invalidate(); diff --git a/OpsFlow/UI/Forms/Management/ProfileControl.cs b/OpsFlow/UI/Forms/Management/ProfileControl.cs index e94e5da..0f88b8d 100644 --- a/OpsFlow/UI/Forms/Management/ProfileControl.cs +++ b/OpsFlow/UI/Forms/Management/ProfileControl.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace OpsFlow.UI.Forms.Management; +namespace OpsFlow.UI.Forms.Management; public partial class ProfileControl : UserControl { @@ -19,4 +11,4 @@ private void txtName_TextChanged(object sender, EventArgs e) { } -} +} \ No newline at end of file diff --git a/OpsFlow/UI/Forms/Management/ProfileEditForm.cs b/OpsFlow/UI/Forms/Management/ProfileEditForm.cs index fb6bb46..b35ae70 100644 --- a/OpsFlow/UI/Forms/Management/ProfileEditForm.cs +++ b/OpsFlow/UI/Forms/Management/ProfileEditForm.cs @@ -6,14 +6,13 @@ using OpsFlow.Services.Implementations; using OpsFlow.Services.Interfaces; using OpsFlow.UI.Forms.Dialogs.Notifications; -using OpsFlow.UI.Forms.Core; namespace OpsFlow.UI.Forms.Management; public partial class ProfileEditForm : Form { - private User? _user; - private User? _originalUser; + private readonly User? _user; + private readonly User? _originalUser; private string? _uploadedFilePath; private readonly IFileUploadService _fileUploadService; private List _roles = new List(); @@ -121,12 +120,12 @@ private void LoadUserData() txtSurname.Text = _user.Surname; txtEmail.Text = _user.Email; txtPhone.Text = _user.Phone ?? string.Empty; - + if (_user.Role != null) { txtTitle.Text = _user.Role.RoleName; } - + if (_user.Department != null) { txtDepartmant.Text = _user.Department.DepartmentName; @@ -145,7 +144,7 @@ private async void LoadAvatarAsync(string? avatarUrl) try { - if (Uri.TryCreate(avatarUrl, UriKind.Absolute, out Uri? uri) && + if (Uri.TryCreate(avatarUrl, UriKind.Absolute, out Uri? uri) && (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)) { using (HttpClient client = new HttpClient()) @@ -307,7 +306,7 @@ await Task.Run(async () => { Notifier.Show("Başarılı", "Kullanıcı bilgileri başarıyla güncellendi.", NotificationType.Success); this.DialogResult = DialogResult.OK; - + // Mesajın görünmesi için kısa bir gecikme sonrası formu kapat var timer = new System.Windows.Forms.Timer(); timer.Interval = 1500; @@ -324,7 +323,7 @@ await Task.Run(async () => { Notifier.Show("Başarılı", "Kullanıcı bilgileri başarıyla güncellendi.", NotificationType.Success); this.DialogResult = DialogResult.OK; - + // Mesajın görünmesi için kısa bir gecikme sonrası formu kapat var timer = new System.Windows.Forms.Timer(); timer.Interval = 1500; @@ -377,7 +376,7 @@ private bool HasChanges() bool emailChanged = txtEmail.Text.Trim() != _originalUser.Email; bool phoneChanged = (txtPhone.Text.Trim() ?? string.Empty) != (_originalUser.Phone ?? string.Empty); bool avatarChanged = !string.IsNullOrWhiteSpace(_uploadedFilePath); - + bool roleChanged = txtTitle.Text.Trim() != (_user.Role?.RoleName ?? string.Empty); bool departmentChanged = txtDepartmant.Text.Trim() != (_user.Department?.DepartmentName ?? string.Empty); @@ -393,4 +392,4 @@ private void BtnCancel_Click(object? sender, EventArgs e) private void label2_Click(object sender, EventArgs e) { } -} +} \ No newline at end of file diff --git a/OpsFlow/UI/Forms/Management/SettingsForm.cs b/OpsFlow/UI/Forms/Management/SettingsForm.cs index eb532db..aaf2760 100644 --- a/OpsFlow/UI/Forms/Management/SettingsForm.cs +++ b/OpsFlow/UI/Forms/Management/SettingsForm.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -using Guna.UI2.WinForms; +using Guna.UI2.WinForms; namespace OpsFlow.UI.Forms.Management; diff --git a/OpsFlow/UI/Forms/Management/TaskListForm.cs b/OpsFlow/UI/Forms/Management/TaskListForm.cs index d7cc8e5..ba99029 100644 --- a/OpsFlow/UI/Forms/Management/TaskListForm.cs +++ b/OpsFlow/UI/Forms/Management/TaskListForm.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace OpsFlow.UI.Forms.Management; +namespace OpsFlow.UI.Forms.Management; public partial class TaskListForm : Form { diff --git a/OpsFlow/UI/Forms/Management/TaskRow.cs b/OpsFlow/UI/Forms/Management/TaskRow.cs index 8fa65e3..dbac74b 100644 --- a/OpsFlow/UI/Forms/Management/TaskRow.cs +++ b/OpsFlow/UI/Forms/Management/TaskRow.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace OpsFlow.UI.Forms.Management; +namespace OpsFlow.UI.Forms.Management; public partial class TaskRow : UserControl { @@ -14,4 +6,4 @@ public TaskRow() { InitializeComponent(); } -} +} \ No newline at end of file diff --git a/OpsFlow/UI/Forms/Onboarding/SplashScreenForm.cs b/OpsFlow/UI/Forms/Onboarding/SplashScreenForm.cs index eb16d61..7226a8f 100644 --- a/OpsFlow/UI/Forms/Onboarding/SplashScreenForm.cs +++ b/OpsFlow/UI/Forms/Onboarding/SplashScreenForm.cs @@ -1,7 +1,8 @@ using Guna.UI2.WinForms; + using OpsFlow.Core.Services; -using OpsFlow.UI.Forms.Core; using OpsFlow.UI.Forms.Auth; +using OpsFlow.UI.Forms.Core; namespace OpsFlow.UI.Forms.Onboarding { @@ -122,7 +123,7 @@ await bootstrapper.InitializeAsync((message, progress) => { errorMessage += $"\n{ex.InnerException.Message}"; } - + _lblStatus.Text = $"
{errorMessage}
"; _progressBar.ProgressColor = Color.FromArgb(239, 68, 68); _progressBar.ProgressColor2 = Color.FromArgb(239, 68, 68);