Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions OpsFlow/Core/Config/AzureBlobStorageSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ public sealed class AzureBlobStorageSettings
public required string ContainerName { get; set; } = "avatars";
public string? BaseUrl { get; set; }
}
}

}
3 changes: 1 addition & 2 deletions OpsFlow/Core/Exceptions/ConfigurationException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ public ConfigurationException(string message, Exception inner)
{
}
}
}

}
3 changes: 1 addition & 2 deletions OpsFlow/Core/Exceptions/FileUploadException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ public FileUploadException(string message, Exception inner)
{
}
}
}

}
3 changes: 1 addition & 2 deletions OpsFlow/Core/Exceptions/ResourceException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ public ResourceException(string message, Exception inner)
{
}
}
}

}
3 changes: 1 addition & 2 deletions OpsFlow/Core/Models/Department.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ public class Department
public string DepartmentName { get; set; } = string.Empty;

public virtual ICollection<User> Users { get; set; } = new List<User>();
}

}
4 changes: 1 addition & 3 deletions OpsFlow/Core/Models/UserSession.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using OpsFlow.Core.Models;

namespace OpsFlow.Core.Models;
namespace OpsFlow.Core.Models;

public static class UserSession
{
Expand Down
15 changes: 8 additions & 7 deletions OpsFlow/Core/Services/AppBootstrapper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Azure.Storage.Blobs;

using OpsFlow.Core.Exceptions;
using OpsFlow.Services.Interfaces;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -286,7 +287,7 @@ private void ValidateResourceFiles()
{
value = value.Substring(1, value.Length - 2);
}

return value;
}
}
Expand All @@ -295,7 +296,7 @@ private void ValidateResourceFiles()
catch
{
}

return Environment.GetEnvironmentVariable("AZURE_STORAGE_CONNECTION_STRING");
}
}
Expand Down
3 changes: 1 addition & 2 deletions OpsFlow/Core/Services/DatabaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ public static void Reset()
}
}
}
}

}
2 changes: 1 addition & 1 deletion OpsFlow/Core/Services/WindowManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>() where T : Form, new()
{
Expand Down
3 changes: 1 addition & 2 deletions OpsFlow/Services/Helpers/ComboBoxHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ public static class ComboBoxHelper
return departments.FirstOrDefault(d => d.DepartmentName == departmentName);
}
}
}

}
3 changes: 1 addition & 2 deletions OpsFlow/Services/Helpers/CompanyValidationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ public static (bool IsValid, string? ErrorMessage) ValidateCompanyForm(
return (true, null);
}
}
}

}
9 changes: 4 additions & 5 deletions OpsFlow/Services/Helpers/FileUploadServiceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -19,5 +19,4 @@ public static IFileUploadService Create()
return new FileUploadService();
}
}
}

}
3 changes: 1 addition & 2 deletions OpsFlow/Services/Helpers/FileValidationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
}
}

}
3 changes: 1 addition & 2 deletions OpsFlow/Services/Helpers/FormValidationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,4 @@ public static (bool IsValid, string? ErrorMessage) ValidatePersonelForm(
return (true, null);
}
}
}

}
9 changes: 4 additions & 5 deletions OpsFlow/Services/Helpers/UrlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}

}
14 changes: 7 additions & 7 deletions OpsFlow/Services/Implementations/AzureBlobStorageService.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -52,7 +53,7 @@ public AzureBlobStorageService()

_blobServiceClient = new BlobServiceClient(_settings.ConnectionString);
_containerClient = _blobServiceClient.GetBlobContainerClient(_settings.ContainerName);

try
{
_containerClient.CreateIfNotExists(PublicAccessType.Blob);
Expand Down Expand Up @@ -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);
Expand All @@ -213,7 +214,7 @@ private string GenerateUniqueFileName(int? userId, string extension)
{
value = value.Substring(1, value.Length - 2);
}

return value;
}
}
Expand All @@ -222,9 +223,8 @@ private string GenerateUniqueFileName(int? userId, string extension)
catch
{
}

return null;
}
}
}

}
6 changes: 2 additions & 4 deletions OpsFlow/Services/Implementations/CompanyService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Npgsql;

using OpsFlow.Core.Exceptions;
using OpsFlow.Core.Models;
using OpsFlow.Data.Context;
Expand Down Expand Up @@ -128,6 +128,4 @@ public async Task RegisterCompanyAsync(Company company)
await Task.Run(() => RegisterCompany(company));
}
}
}


}
4 changes: 2 additions & 2 deletions OpsFlow/Services/Implementations/DepartmentService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;

using OpsFlow.Core.Exceptions;
using OpsFlow.Core.Models;
using OpsFlow.Data.Context;
Expand Down Expand Up @@ -59,5 +60,4 @@ public async Task<List<Department>> GetAllDepartmentsAsync()
}
}
}
}

}
1 change: 1 addition & 0 deletions OpsFlow/Services/Implementations/EmailService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Net;
using System.Net.Mail;

using OpsFlow.Core.Config;
using OpsFlow.Core.Exceptions;
using OpsFlow.Services.Helpers;
Expand Down
3 changes: 1 addition & 2 deletions OpsFlow/Services/Implementations/FileUploadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,4 @@ private string GenerateUniqueFileName(int? userId, string extension)
return $"{prefix}{timestamp}_{guid}{extension}";
}
}
}

}
5 changes: 2 additions & 3 deletions OpsFlow/Services/Implementations/RoleService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;

using OpsFlow.Core.Exceptions;
using OpsFlow.Core.Models;
using OpsFlow.Data.Context;
Expand Down Expand Up @@ -59,6 +60,4 @@ public async Task<List<Role>> GetAllRolesAsync()
}
}
}
}


}
4 changes: 1 addition & 3 deletions OpsFlow/Services/Interfaces/ICompanyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ public interface ICompanyService
void RegisterCompany(Company company);
Task RegisterCompanyAsync(Company company);
}
}


}
3 changes: 1 addition & 2 deletions OpsFlow/Services/Interfaces/IDepartmentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ public interface IDepartmentService
Task<List<Department>> GetAllDepartmentsAsync();
Department? GetDepartmentById(int id);
}
}

}
3 changes: 1 addition & 2 deletions OpsFlow/Services/Interfaces/IFileUploadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ public interface IFileUploadService
bool FileExists(string relativePath);
string GetFullPath(string relativePath);
}
}

}
4 changes: 1 addition & 3 deletions OpsFlow/Services/Interfaces/IRoleService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ public interface IRoleService
Task<List<Role>> GetAllRolesAsync();
Role? GetRoleById(int id);
}
}


}
2 changes: 1 addition & 1 deletion OpsFlow/UI/Forms/Auth/LoginForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 4 additions & 3 deletions OpsFlow/UI/Forms/Main/MainForm.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down
Loading