├── Asrfly ├── Asrfly.ico ├── Resources │ ├── Asrfly.ico │ ├── Asrfly.png │ ├── Loading_2.gif │ ├── Logo 2021.png │ ├── icons8_about_32px.png │ ├── icons8_add_32px.png │ ├── icons8_edit_32px.png │ ├── icons8_help_32px.png │ ├── icons8_input_32px.png │ ├── icons8_save_32px.png │ ├── icons8_smart_32px.png │ ├── icons8_smart_96px.png │ ├── icons8_users_32px.png │ ├── lockunlock_conv-2.gif │ ├── icons8_Delete_32px.png │ ├── icons8_Logout_32px.png │ ├── icons8_about_32px_1.png │ ├── icons8_home_32px_1.png │ ├── icons8_login_32px_1.png │ ├── icons8_output_32px.png │ ├── icons8_people_32px.png │ ├── icons8_save_32px_1.png │ ├── icons8_search_32px.png │ ├── icons8_update_32px.png │ ├── icons8_categorize_32px.png │ ├── icons8_conference_32px.png │ ├── icons8_moleskine_32px.png │ ├── icons8_settings_32px.png │ ├── icons8_xls_export_32px.png │ ├── icons8_data_backup_32px.png │ ├── icons8_notification_80px.png │ ├── icons8_Notification_128px.png │ ├── icons8_Database_Backup_32px_1.png │ ├── icons8_microsoft_project_32px.png │ ├── icons8_Database_Restore_32px_1.png │ ├── icons8_Microsoft_Azure_Storage_Explorer_32px.png │ └── pict-employee-male-business-people-vector-stencils-library.png-diagram-flowchart-example.png ├── Gui │ ├── GuiLoading │ │ ├── LoadingForm.cs │ │ ├── LoadingForm.Designer.cs │ │ └── LoadingForm.resx │ ├── GuiNotificaiton │ │ ├── NotificationForm.cs │ │ ├── NotificationForm.resx │ │ └── NotificationForm.Designer.cs │ ├── GuiProjects │ │ ├── ProjectManagmentForm.cs │ │ ├── AddProjectForm.resx │ │ ├── ProjectManagmentForm.resx │ │ └── ProjectsUserControl.resx │ ├── GuiAbout │ │ ├── About.resx │ │ └── About.cs │ ├── GuiUsers │ │ ├── AddUserForm.resx │ │ ├── UserLoginForm.resx │ │ ├── UsersControl.resx │ │ └── UserLoginForm.cs │ ├── GuiHome │ │ ├── HomeUserControl.resx │ │ └── HomeUserControl.cs │ ├── GuiIncome │ │ ├── AddIncomeForm.resx │ │ └── IncomeUserControl.resx │ ├── GuiOutcome │ │ ├── AddOutcomeForm.resx │ │ └── OutcomeUserControl.resx │ ├── GuiSettings │ │ └── SettingsForm.resx │ ├── GuiCategories │ │ ├── AddCategoryForm.resx │ │ ├── CategoryUserControl.resx │ │ └── AddCategoryForm.cs │ ├── GuiCustomers │ │ ├── AddCustomersForm.resx │ │ └── CustomersUserControl.resx │ ├── GuiSuppliers │ │ ├── AddSuppliersForm.resx │ │ ├── SuppliersUserControl.resx │ │ └── AddSuppliersForm.cs │ └── GuiSystemRecords │ │ └── RecordsUserControl.resx ├── Code │ ├── ConfigrationObjectManager.cs │ ├── UsersRolesManager.cs │ ├── PageManager.cs │ ├── DependnecyInjection.cs │ └── MessageCollections.cs ├── Program.cs ├── Properties │ ├── Settings.settings │ └── Settings.Designer.cs ├── StartForm.cs ├── StartForm.resx ├── Asrfly.csproj ├── Main.cs └── StartForm.Designer.cs ├── Asrfly.Core ├── Asrfly.Core.csproj ├── SystemRecords.cs ├── UsersRoles.cs ├── Categories.cs ├── Customers.cs ├── Users.cs ├── Suppliers.cs ├── Income.cs ├── Projects.cs └── Outcome.cs ├── Asrfly.Data ├── SqlServer │ ├── SqlCon.cs │ ├── DBContext.cs │ ├── BackUpRestoreHelper.cs │ └── UsersRolesEntity.cs ├── Asrfly.Data.csproj ├── Migrations │ ├── 20230304110037_SystemRecordsTable.cs │ ├── 20230210044616_AddCategoriesTable.cs │ ├── 20230311053841_AddCustomersTable.cs │ ├── 20230312155508_AddSupplierTable.cs │ ├── 20230210044616_AddCategoriesTable.Designer.cs │ ├── 20230313165737_AddProjectTable.cs │ ├── 20230304110037_SystemRecordsTable.Designer.cs │ ├── 20230321044932_AddUsesAndRoles.cs │ ├── 20230315082102_AddOut.cs │ ├── 20230316050300_AddIncomeTable.cs │ ├── 20230311053841_AddCustomersTable.Designer.cs │ ├── 20230312155508_AddSupplierTable.Designer.cs │ └── 20230313165737_AddProjectTable.Designer.cs └── IDataHelper.cs ├── Asrfly.Tests ├── Asrfly.Tests.csproj └── CategoriesEntityTests.cs ├── Asrfly.sln └── .gitattributes /Asrfly/Asrfly.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Asrfly.ico -------------------------------------------------------------------------------- /Asrfly/Resources/Asrfly.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/Asrfly.ico -------------------------------------------------------------------------------- /Asrfly/Resources/Asrfly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/Asrfly.png -------------------------------------------------------------------------------- /Asrfly/Resources/Loading_2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/Loading_2.gif -------------------------------------------------------------------------------- /Asrfly/Resources/Logo 2021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/Logo 2021.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_about_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_about_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_add_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_add_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_edit_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_edit_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_help_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_help_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_input_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_input_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_save_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_save_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_smart_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_smart_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_smart_96px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_smart_96px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_users_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_users_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/lockunlock_conv-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/lockunlock_conv-2.gif -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_Delete_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_Delete_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_Logout_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_Logout_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_about_32px_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_about_32px_1.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_home_32px_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_home_32px_1.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_login_32px_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_login_32px_1.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_output_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_output_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_people_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_people_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_save_32px_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_save_32px_1.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_search_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_search_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_update_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_update_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_categorize_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_categorize_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_conference_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_conference_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_moleskine_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_moleskine_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_settings_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_settings_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_xls_export_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_xls_export_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_data_backup_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_data_backup_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_notification_80px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_notification_80px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_Notification_128px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_Notification_128px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_Database_Backup_32px_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_Database_Backup_32px_1.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_microsoft_project_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_microsoft_project_32px.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_Database_Restore_32px_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_Database_Restore_32px_1.png -------------------------------------------------------------------------------- /Asrfly/Resources/icons8_Microsoft_Azure_Storage_Explorer_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/icons8_Microsoft_Azure_Storage_Explorer_32px.png -------------------------------------------------------------------------------- /Asrfly.Core/Asrfly.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Asrfly/Resources/pict-employee-male-business-people-vector-stencils-library.png-diagram-flowchart-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engsafaaj/Asrfly/HEAD/Asrfly/Resources/pict-employee-male-business-people-vector-stencils-library.png-diagram-flowchart-example.png -------------------------------------------------------------------------------- /Asrfly.Data/SqlServer/SqlCon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Data.SqlServer 6 | { 7 | public static class SqlCon 8 | { 9 | public static string SqlConnetion { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Asrfly.Core/SystemRecords.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Core 6 | { 7 | public class SystemRecords 8 | { 9 | public int Id { get; set; } 10 | public string UserName { get; set; } 11 | public string Title { get; set; } 12 | public string Details { get; set; } 13 | public DateTime AddedDate { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Asrfly.Core/UsersRoles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Core 6 | { 7 | public class UsersRoles 8 | { 9 | public int Id { get; set; } 10 | public string Key { get; set; } 11 | public bool Value { get; set; } 12 | 13 | // Navigations 14 | public int UserId { get; set; } 15 | public Users Users { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiLoading/LoadingForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Text; 7 | using System.Windows.Forms; 8 | 9 | namespace Asrfly.Gui.GuiLoading 10 | { 11 | public partial class LoadingForm : Form 12 | { 13 | public LoadingForm() 14 | { 15 | InitializeComponent(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Asrfly.Core/Categories.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Core 6 | { 7 | public class Categories 8 | { 9 | public int Id { get; set; } 10 | public string Name { get; set; } 11 | public string Type { get; set; } 12 | public string Details { get; set; } 13 | public double Balance { get; set; } 14 | public DateTime AddedDate { get; set; } 15 | 16 | // Navigations 17 | public virtual List Outcome { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Asrfly.Core/Customers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Core 6 | { 7 | public class Customers 8 | { 9 | public int Id { get; set; } 10 | public string Name { get; set; } 11 | public string PhoneNumber { get; set; } 12 | public string Address { get; set; } 13 | public string Email { get; set; } 14 | public string Details { get; set; } 15 | public double Balance { get; set; } 16 | public DateTime AddedDate { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Asrfly.Core/Users.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Core 6 | { 7 | public class Users 8 | { 9 | public int Id { get; set; } 10 | public string FullName { get; set; } 11 | public string UserName { get; set; } 12 | public string Password { get; set; } 13 | public string Email { get; set; } 14 | public string Phone { get; set; } 15 | public DateTime AddedDate { get; set; } 16 | 17 | // Navigations 18 | public virtual List UsersRoles { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Asrfly/Code/ConfigrationObjectManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Code 6 | { 7 | public static class ConfigrationObjectManager 8 | { 9 | private static Dictionary ObjectList = new Dictionary(); 10 | 11 | public static void Register(string ObjectName,object ObjectValue) 12 | { 13 | ObjectList.Add(ObjectName, ObjectValue); 14 | } 15 | 16 | public static object GetObject(string ObjectName) 17 | { 18 | return ObjectList[ObjectName]; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Asrfly.Core/Suppliers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Core 6 | { 7 | public class Suppliers 8 | { 9 | public int Id { get; set; } 10 | public string Name { get; set; } 11 | public string PhoneNumber { get; set; } 12 | public string Address { get; set; } 13 | public string Email { get; set; } 14 | public string Details { get; set; } 15 | public double Balance { get; set; } 16 | public DateTime AddedDate { get; set; } 17 | 18 | // Navigations 19 | public virtual List Outcome { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Asrfly/Code/UsersRolesManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Code 6 | { 7 | public static class UsersRolesManager 8 | { 9 | private static Dictionary RolesList = new Dictionary(); 10 | 11 | public static void Register(string RoleKey,bool RoleValue) 12 | { 13 | RolesList.Add(RoleKey, RoleValue); 14 | } 15 | 16 | public static bool GetRole(string RoleKey) 17 | { 18 | return RolesList[RoleKey]; 19 | } 20 | public static void ClearRoles() 21 | { 22 | RolesList.Clear(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Asrfly.Tests/Asrfly.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiNotificaiton/NotificationForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Text; 7 | using System.Windows.Forms; 8 | 9 | namespace Asrfly.Gui.GuiNotificaiton 10 | { 11 | public partial class NotificationForm : Form 12 | { 13 | public NotificationForm() 14 | { 15 | InitializeComponent(); 16 | timerNotification.Interval = Properties.Settings.Default.HideNotificaitonInterval*1000; 17 | } 18 | 19 | private void labelTitle_Click(object sender, EventArgs e) 20 | { 21 | Close(); 22 | } 23 | 24 | private void timerNotification_Tick(object sender, EventArgs e) 25 | { 26 | Close(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Asrfly.Core/Income.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Core 6 | { 7 | public class Income 8 | { 9 | public int Id { get; set; } 10 | public string CategoryName { get; set; } 11 | public string SupplierName { get; set; } 12 | public DateTime IncomeDate { get; set; } 13 | public string RecNo { get; set; } 14 | public double Amount { get; set; } 15 | public string Details { get; set; } 16 | 17 | // Navigations 18 | public int CategroyId { get; set; } 19 | public Categories Categories { get; set; } 20 | 21 | public int SupplierId { get; set; } 22 | public Suppliers Suppliers { get; set; } 23 | 24 | public int ProjectId { get; set; } 25 | public Projects Projects { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Asrfly.Core/Projects.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Core 6 | { 7 | public class Projects 8 | { 9 | public int Id { get; set; } 10 | public string Name { get; set; } 11 | public string Customer { get; set; } 12 | public string Address { get; set; } 13 | public string Company { get; set; } 14 | public DateTime StartDate { get; set; } 15 | public DateTime FinishDate { get; set; } 16 | public string Details { get; set; } 17 | public double Income { get; set; } 18 | public double Outcome { get; set; } 19 | public double Revenue { get; set; } 20 | public DateTime AddedDate { get; set; } 21 | 22 | 23 | // Navigations 24 | public virtual List outcome { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Asrfly.Core/Outcome.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Asrfly.Core 6 | { 7 | public class Outcome 8 | { 9 | public int Id { get; set; } 10 | public string CategoryName { get; set; } 11 | public string SupplierName { get; set; } 12 | public DateTime OutcomeDate { get; set; } 13 | public string RecNo { get; set; } 14 | public double Amount { get; set; } 15 | public string Details { get; set; } 16 | 17 | // Navigations 18 | public int CategroyId { get; set; } 19 | public Categories Categories { get; set; } 20 | 21 | public int SupplierId { get; set; } 22 | public Suppliers Suppliers { get; set; } 23 | 24 | public int ProjectId { get; set; } 25 | public Projects Projects { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Asrfly/Program.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Code; 2 | using Asrfly.Data.SqlServer; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | 9 | namespace Asrfly 10 | { 11 | static class Program 12 | { 13 | /// 14 | /// The main entry point for the application. 15 | /// 16 | [STAThread] 17 | static void Main() 18 | { 19 | Application.SetHighDpiMode(HighDpiMode.SystemAware); 20 | Application.EnableVisualStyles(); 21 | Application.SetCompatibleTextRenderingDefault(false); 22 | DependnecyInjection.AddDependencyValues(); 23 | SqlCon.SqlConnetion = Properties.Settings.Default.SqlServerConString; 24 | Application.Run(new StartForm()); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Asrfly/Code/PageManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Linq; 5 | using System.Windows.Forms; 6 | 7 | namespace Asrfly.Code 8 | { 9 | public class PageManager 10 | { 11 | private readonly Main main; 12 | 13 | public PageManager(Main main) 14 | { 15 | this.main = main; 16 | } 17 | 18 | public void LoadPage(UserControl PageUserControl) 19 | { 20 | // Load old page 21 | var oldPage = main.panelContainer.Controls.OfType().FirstOrDefault(); 22 | if (oldPage != null) 23 | { 24 | main.panelContainer.Controls.Remove(oldPage); // Remove Old Page 25 | oldPage.Dispose(); 26 | } 27 | 28 | // Load New Page 29 | PageUserControl.Dock = DockStyle.Fill; 30 | main.panelContainer.Controls.Add(PageUserControl); 31 | 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Asrfly/Code/DependnecyInjection.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Data.SqlServer; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Asrfly.Code 7 | { 8 | public static class DependnecyInjection 9 | { 10 | public static void AddDependencyValues() 11 | { 12 | ConfigrationObjectManager.Register("Categories", new CategoriesEntity()); 13 | ConfigrationObjectManager.Register("SystemRecords", new SystemRecordsEntity()); 14 | ConfigrationObjectManager.Register("Customers", new CustomersEntity ()); 15 | ConfigrationObjectManager.Register("Suppliers", new SuppliersEntity ()); 16 | ConfigrationObjectManager.Register("Projects", new ProjectsEntity ()); 17 | ConfigrationObjectManager.Register("Outcome", new OutcomeEntity ()); 18 | ConfigrationObjectManager.Register("Income", new IncomeEntity ()); 19 | ConfigrationObjectManager.Register("Users", new UsersEntity ()); 20 | ConfigrationObjectManager.Register("UsersRoles", new UsersRolesRolesEntity ()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Asrfly/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Server=.\SQLEXPRESS;Database=AsrflyDataBase;Trusted_Connection=True 7 | 8 | 9 | 2 10 | 11 | 12 | صفاء جاسم 13 | 14 | 15 | 3 16 | 17 | 18 | ادخل هنا اسم المؤسسة 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Asrfly.Data/Asrfly.Data.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | all 12 | runtime; build; native; contentfiles; analyzers; buildtransitive 13 | 14 | 15 | 16 | 17 | all 18 | runtime; build; native; contentfiles; analyzers; buildtransitive 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Asrfly.Data/SqlServer/DBContext.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Core; 2 | using Microsoft.EntityFrameworkCore; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Asrfly.Data.SqlServer 8 | { 9 | public class DBContext : DbContext 10 | { 11 | public DBContext() 12 | { 13 | 14 | } 15 | 16 | // Set ConString 17 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 18 | { 19 | // var sqlcon = @"Server=.\SQLEXPRESS;Database=AsrflyDataBase;Trusted_Connection=True;"; // For Test 20 | 21 | optionsBuilder.UseSqlServer(SqlCon.SqlConnetion); 22 | } 23 | 24 | // Tables 25 | public DbSet Categories { get; set; } 26 | public DbSet SystemRecords { get; set; } 27 | public DbSet Customers { get; set; } 28 | public DbSet Suppliers { get; set; } 29 | public DbSet Projects { get; set; } 30 | public DbSet Outcome { get; set; } 31 | public DbSet Income { get; set; } 32 | public DbSet Users { get; set; } 33 | public DbSet UsersRoles { get; set; } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230304110037_SystemRecordsTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace Asrfly.Data.Migrations 5 | { 6 | public partial class SystemRecordsTable : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.CreateTable( 11 | name: "SystemRecords", 12 | columns: table => new 13 | { 14 | Id = table.Column(type: "int", nullable: false) 15 | .Annotation("SqlServer:Identity", "1, 1"), 16 | UserName = table.Column(type: "nvarchar(max)", nullable: true), 17 | Title = table.Column(type: "nvarchar(max)", nullable: true), 18 | Details = table.Column(type: "nvarchar(max)", nullable: true), 19 | AddedDate = table.Column(type: "datetime2", nullable: false) 20 | }, 21 | constraints: table => 22 | { 23 | table.PrimaryKey("PK_SystemRecords", x => x.Id); 24 | }); 25 | } 26 | 27 | protected override void Down(MigrationBuilder migrationBuilder) 28 | { 29 | migrationBuilder.DropTable( 30 | name: "SystemRecords"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230210044616_AddCategoriesTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace Asrfly.Data.Migrations 5 | { 6 | public partial class AddCategoriesTable : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.CreateTable( 11 | name: "Categories", 12 | columns: table => new 13 | { 14 | Id = table.Column(type: "int", nullable: false) 15 | .Annotation("SqlServer:Identity", "1, 1"), 16 | Name = table.Column(type: "nvarchar(100)", nullable: true), 17 | Type = table.Column(type: "nvarchar(15)", nullable: true), 18 | Details = table.Column(type: "nvarchar(max)", nullable: true), 19 | Balance = table.Column(type: "float", nullable: false), 20 | AddedDate = table.Column(type: "datetime2", nullable: false) 21 | }, 22 | constraints: table => 23 | { 24 | table.PrimaryKey("PK_Categories", x => x.Id); 25 | }); 26 | } 27 | 28 | protected override void Down(MigrationBuilder migrationBuilder) 29 | { 30 | migrationBuilder.DropTable( 31 | name: "Categories"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230311053841_AddCustomersTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace Asrfly.Data.Migrations 5 | { 6 | public partial class AddCustomersTable : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.CreateTable( 11 | name: "Customers", 12 | columns: table => new 13 | { 14 | Id = table.Column(type: "int", nullable: false) 15 | .Annotation("SqlServer:Identity", "1, 1"), 16 | Name = table.Column(type: "nvarchar(max)", nullable: true), 17 | PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), 18 | Address = table.Column(type: "nvarchar(max)", nullable: true), 19 | Email = table.Column(type: "nvarchar(max)", nullable: true), 20 | Details = table.Column(type: "nvarchar(max)", nullable: true), 21 | Balance = table.Column(type: "float", nullable: false), 22 | AddedDate = table.Column(type: "datetime2", nullable: false) 23 | }, 24 | constraints: table => 25 | { 26 | table.PrimaryKey("PK_Customers", x => x.Id); 27 | }); 28 | } 29 | 30 | protected override void Down(MigrationBuilder migrationBuilder) 31 | { 32 | migrationBuilder.DropTable( 33 | name: "Customers"); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230312155508_AddSupplierTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace Asrfly.Data.Migrations 5 | { 6 | public partial class AddSupplierTable : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.CreateTable( 11 | name: "Suppliers", 12 | columns: table => new 13 | { 14 | Id = table.Column(type: "int", nullable: false) 15 | .Annotation("SqlServer:Identity", "1, 1"), 16 | Name = table.Column(type: "nvarchar(max)", nullable: true), 17 | PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), 18 | Address = table.Column(type: "nvarchar(max)", nullable: true), 19 | Email = table.Column(type: "nvarchar(max)", nullable: true), 20 | Details = table.Column(type: "nvarchar(max)", nullable: true), 21 | Balance = table.Column(type: "float", nullable: false), 22 | AddedDate = table.Column(type: "datetime2", nullable: false) 23 | }, 24 | constraints: table => 25 | { 26 | table.PrimaryKey("PK_Suppliers", x => x.Id); 27 | }); 28 | } 29 | 30 | protected override void Down(MigrationBuilder migrationBuilder) 31 | { 32 | migrationBuilder.DropTable( 33 | name: "Suppliers"); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230210044616_AddCategoriesTable.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Asrfly.Data.SqlServer; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | namespace Asrfly.Data.Migrations 11 | { 12 | [DbContext(typeof(DBContext))] 13 | [Migration("20230210044616_AddCategoriesTable")] 14 | partial class AddCategoriesTable 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .UseIdentityColumns() 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 22 | .HasAnnotation("ProductVersion", "5.0.0"); 23 | 24 | modelBuilder.Entity("Asrfly.Core.Categories", b => 25 | { 26 | b.Property("Id") 27 | .ValueGeneratedOnAdd() 28 | .HasColumnType("int") 29 | .UseIdentityColumn(); 30 | 31 | b.Property("AddedDate") 32 | .HasColumnType("datetime2"); 33 | 34 | b.Property("Balance") 35 | .HasColumnType("float"); 36 | 37 | b.Property("Details") 38 | .HasColumnType("nvarchar(max)"); 39 | 40 | b.Property("Name") 41 | .HasColumnType("nvarchar(max)"); 42 | 43 | b.Property("Type") 44 | .HasColumnType("nvarchar(max)"); 45 | 46 | b.HasKey("Id"); 47 | 48 | b.ToTable("Categories"); 49 | }); 50 | #pragma warning restore 612, 618 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230313165737_AddProjectTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace Asrfly.Data.Migrations 5 | { 6 | public partial class AddProjectTable : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.CreateTable( 11 | name: "Projects", 12 | columns: table => new 13 | { 14 | Id = table.Column(type: "int", nullable: false) 15 | .Annotation("SqlServer:Identity", "1, 1"), 16 | Name = table.Column(type: "nvarchar(max)", nullable: true), 17 | Customer = table.Column(type: "nvarchar(max)", nullable: true), 18 | Address = table.Column(type: "nvarchar(max)", nullable: true), 19 | Company = table.Column(type: "nvarchar(max)", nullable: true), 20 | StartDate = table.Column(type: "datetime2", nullable: false), 21 | FinishDate = table.Column(type: "datetime2", nullable: false), 22 | Details = table.Column(type: "nvarchar(max)", nullable: true), 23 | Income = table.Column(type: "float", nullable: false), 24 | Outcome = table.Column(type: "float", nullable: false), 25 | Revenue = table.Column(type: "float", nullable: false), 26 | AddedDate = table.Column(type: "datetime2", nullable: false) 27 | }, 28 | constraints: table => 29 | { 30 | table.PrimaryKey("PK_Projects", x => x.Id); 31 | }); 32 | } 33 | 34 | protected override void Down(MigrationBuilder migrationBuilder) 35 | { 36 | migrationBuilder.DropTable( 37 | name: "Projects"); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Asrfly.Data/SqlServer/BackUpRestoreHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Microsoft.EntityFrameworkCore; 5 | namespace Asrfly.Data.SqlServer 6 | { 7 | public class BackUpRestoreHelper 8 | { 9 | private DBContext db; 10 | public BackUpRestoreHelper() 11 | { 12 | db = new DBContext(); 13 | } 14 | 15 | public string BackUp(string Path) 16 | { 17 | try 18 | { 19 | db = new DBContext(); 20 | db.Database.SetCommandTimeout(0); 21 | string dbName = db.Database.GetDbConnection().Database; 22 | string FileName = Path + dbName + DateTime.Now.ToString("yyyyMMddHHmm") + ".bak"; 23 | string sqlquery = "BACKUP DATABASE ["+dbName+ "] TO DISK = N'" + FileName + "' WITH NOFORMAT, NOINIT, NAME = N'" + dbName + "', SKIP, NOREWIND, NOUNLOAD, STATS = 10"; 24 | db.Database.ExecuteSqlRaw(sqlquery); 25 | return "1"; 26 | } 27 | catch(Exception ex) 28 | { 29 | return ex.Message; 30 | } 31 | } 32 | public string Restore(string FileName) 33 | { 34 | try 35 | { 36 | db = new DBContext(); 37 | db.Database.SetCommandTimeout(0); 38 | string dbName = db.Database.GetDbConnection().Database; 39 | 40 | string AlterDbSetSingle = "ALTER DATABASE [" + dbName + "] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;"; 41 | string AlterDbSetDouble = ";ALTER DATABASE [" + dbName + "] SET MULTI_USER"; 42 | 43 | string sqlquery = AlterDbSetSingle+"USE [master];RESTORE DATABASE [" +dbName+ "] FROM DISK = N'" + FileName + "' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"+ AlterDbSetDouble; 44 | 45 | db.Database.ExecuteSqlRaw(sqlquery); 46 | return "1"; 47 | } 48 | catch (Exception ex) 49 | { 50 | return ex.Message; 51 | } 52 | } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Asrfly/StartForm.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Code; 2 | using Asrfly.Core; 3 | using Asrfly.Data; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel; 7 | using System.Data; 8 | using System.Drawing; 9 | using System.Text; 10 | using System.Windows.Forms; 11 | 12 | namespace Asrfly 13 | { 14 | public partial class StartForm : Form 15 | { 16 | private readonly IDataHelper dataHelper; 17 | 18 | public StartForm() 19 | { 20 | InitializeComponent(); 21 | dataHelper = (IDataHelper)ConfigrationObjectManager.GetObject("Users"); 22 | 23 | } 24 | 25 | private async void CheckCon() 26 | { 27 | labelState.Text = "جاري الاتصال بقاعدة البيانات"; 28 | Asrfly.Data.SqlServer.DBContext dB = new Data.SqlServer.DBContext(); 29 | if (await dB.Database.CanConnectAsync()) 30 | { 31 | var data = await dataHelper.GetAllDataAsync(); 32 | if (data.Count > 0) 33 | { 34 | // Login Form 35 | Gui.GuiUsers.UserLoginForm loginForm = new Gui.GuiUsers.UserLoginForm(); 36 | loginForm.Show(); 37 | Hide(); 38 | } 39 | else 40 | { 41 | // Add Form 42 | Gui.GuiUsers.AddUserForm addUserForm = new Gui.GuiUsers.AddUserForm(0, new Gui.GuiUsers.UsersControl(), true); 43 | addUserForm.Show(); 44 | Hide(); 45 | } 46 | } 47 | else 48 | { 49 | Hide(); 50 | var result = MessageBox.Show("هناك خطا في الاتصال في قاعدة البيانات, اضغط نعم لضبط الاتصال و لا للخروج من البرنامج", "خطا في الاتصال", 51 | MessageBoxButtons.YesNo, MessageBoxIcon.Question); 52 | if (result == DialogResult.Yes) 53 | { 54 | Gui.GuiSettings.SettingsForm settingsForm = new Gui.GuiSettings.SettingsForm(true); 55 | settingsForm.Show(); 56 | } 57 | else 58 | { 59 | Application.Exit(); 60 | } 61 | } 62 | 63 | } 64 | 65 | private void Form1_Load(object sender, EventArgs e) 66 | { 67 | CheckCon(); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Asrfly.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.32228.343 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asrfly", "Asrfly\Asrfly.csproj", "{BA8D8925-1AD8-4874-B4F6-D9132E7B7287}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asrfly.Core", "Asrfly.Core\Asrfly.Core.csproj", "{E960E3A0-B009-4A5A-B8B6-D202EDB4A242}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asrfly.Data", "Asrfly.Data\Asrfly.Data.csproj", "{FDAA796F-51D2-411A-A4FA-F332827675A9}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asrfly.Tests", "Asrfly.Tests\Asrfly.Tests.csproj", "{84CB11E6-04BA-41F1-9E2B-6E297707CDC3}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {BA8D8925-1AD8-4874-B4F6-D9132E7B7287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {BA8D8925-1AD8-4874-B4F6-D9132E7B7287}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {BA8D8925-1AD8-4874-B4F6-D9132E7B7287}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {BA8D8925-1AD8-4874-B4F6-D9132E7B7287}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {E960E3A0-B009-4A5A-B8B6-D202EDB4A242}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {E960E3A0-B009-4A5A-B8B6-D202EDB4A242}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {E960E3A0-B009-4A5A-B8B6-D202EDB4A242}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {E960E3A0-B009-4A5A-B8B6-D202EDB4A242}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {FDAA796F-51D2-411A-A4FA-F332827675A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {FDAA796F-51D2-411A-A4FA-F332827675A9}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {FDAA796F-51D2-411A-A4FA-F332827675A9}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {FDAA796F-51D2-411A-A4FA-F332827675A9}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {84CB11E6-04BA-41F1-9E2B-6E297707CDC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {84CB11E6-04BA-41F1-9E2B-6E297707CDC3}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {84CB11E6-04BA-41F1-9E2B-6E297707CDC3}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {84CB11E6-04BA-41F1-9E2B-6E297707CDC3}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {62634CD6-DC70-4168-AE0F-1DA657028CE4} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /Asrfly/Code/MessageCollections.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows.Forms; 5 | using Asrfly.Properties; 6 | namespace Asrfly.Code 7 | { 8 | public static class MessageCollections 9 | { 10 | // Message 11 | public static void ShowEmptyDataMessage() 12 | { 13 | MessageBox.Show(Resources.EmptyMessageText, Resources.EmptyMessageCaption, 14 | MessageBoxButtons.OK, MessageBoxIcon.Information); 15 | } 16 | public static void ShowErrorServer() 17 | { 18 | MessageBox.Show(Resources.ServerErrorText, Resources.ServerErrorCaption, 19 | MessageBoxButtons.OK, MessageBoxIcon.Error); 20 | } 21 | public static void ShowFiledsRequired() 22 | { 23 | MessageBox.Show(Resources.FiledsReqText, Resources.FiledReqCaption, 24 | MessageBoxButtons.OK, MessageBoxIcon.Information); 25 | } 26 | public static void ShowRequiredDeleteRow() 27 | { 28 | MessageBox.Show(Resources.ShowReDeleteFiledText, Resources.ShowReDeleteFiledCaption, 29 | MessageBoxButtons.OK, MessageBoxIcon.Information); 30 | } 31 | // Dialog 32 | public static bool ShowDeleteDialog() 33 | { 34 | var result= MessageBox.Show(Resources.DeleteDialogText, Resources.DeleteDialogCaption, 35 | MessageBoxButtons.YesNo, MessageBoxIcon.Question); 36 | if (result == DialogResult.Yes) 37 | { 38 | return true; 39 | } 40 | else 41 | { 42 | return false; 43 | } 44 | } 45 | // Notificaitons 46 | public static void ShowAddNotificaiton() 47 | { 48 | Gui.GuiNotificaiton.NotificationForm notificationForm = new Gui.GuiNotificaiton.NotificationForm(); 49 | notificationForm.labelTitle.Text = "تمت عملية الاضافة بنجاح"; 50 | notificationForm.Show(); 51 | } 52 | public static void ShowUpdateNotificaiton() 53 | { 54 | Gui.GuiNotificaiton.NotificationForm notificationForm = new Gui.GuiNotificaiton.NotificationForm(); 55 | notificationForm.labelTitle.Text = "تمت عملية التعديل بنجاح"; 56 | notificationForm.Show(); 57 | } 58 | public static void ShowDeleteNotificaiton() 59 | { 60 | Gui.GuiNotificaiton.NotificationForm notificationForm = new Gui.GuiNotificaiton.NotificationForm(); 61 | notificationForm.labelTitle.Text = "تمت عملية الحذف بنجاح"; 62 | notificationForm.Show(); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230304110037_SystemRecordsTable.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Asrfly.Data.SqlServer; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | namespace Asrfly.Data.Migrations 11 | { 12 | [DbContext(typeof(DBContext))] 13 | [Migration("20230304110037_SystemRecordsTable")] 14 | partial class SystemRecordsTable 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .UseIdentityColumns() 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 22 | .HasAnnotation("ProductVersion", "5.0.0"); 23 | 24 | modelBuilder.Entity("Asrfly.Core.Categories", b => 25 | { 26 | b.Property("Id") 27 | .ValueGeneratedOnAdd() 28 | .HasColumnType("int") 29 | .UseIdentityColumn(); 30 | 31 | b.Property("AddedDate") 32 | .HasColumnType("datetime2"); 33 | 34 | b.Property("Balance") 35 | .HasColumnType("float"); 36 | 37 | b.Property("Details") 38 | .HasColumnType("nvarchar(max)"); 39 | 40 | b.Property("Name") 41 | .HasColumnType("nvarchar(max)"); 42 | 43 | b.Property("Type") 44 | .HasColumnType("nvarchar(max)"); 45 | 46 | b.HasKey("Id"); 47 | 48 | b.ToTable("Categories"); 49 | }); 50 | 51 | modelBuilder.Entity("Asrfly.Core.SystemRecords", b => 52 | { 53 | b.Property("Id") 54 | .ValueGeneratedOnAdd() 55 | .HasColumnType("int") 56 | .UseIdentityColumn(); 57 | 58 | b.Property("AddedDate") 59 | .HasColumnType("datetime2"); 60 | 61 | b.Property("Details") 62 | .HasColumnType("nvarchar(max)"); 63 | 64 | b.Property("Title") 65 | .HasColumnType("nvarchar(max)"); 66 | 67 | b.Property("UserName") 68 | .HasColumnType("nvarchar(max)"); 69 | 70 | b.HasKey("Id"); 71 | 72 | b.ToTable("SystemRecords"); 73 | }); 74 | #pragma warning restore 612, 618 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiLoading/LoadingForm.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Asrfly.Gui.GuiLoading 3 | { 4 | partial class LoadingForm 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 33 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 34 | this.SuspendLayout(); 35 | // 36 | // pictureBox1 37 | // 38 | this.pictureBox1.BackColor = System.Drawing.Color.White; 39 | this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; 40 | this.pictureBox1.Image = global::Asrfly.Properties.Resources.Loading_2; 41 | this.pictureBox1.Location = new System.Drawing.Point(0, 0); 42 | this.pictureBox1.Name = "pictureBox1"; 43 | this.pictureBox1.Size = new System.Drawing.Size(163, 91); 44 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 45 | this.pictureBox1.TabIndex = 0; 46 | this.pictureBox1.TabStop = false; 47 | // 48 | // LoadingForm 49 | // 50 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); 51 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 52 | this.ClientSize = new System.Drawing.Size(163, 91); 53 | this.Controls.Add(this.pictureBox1); 54 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 55 | this.Name = "LoadingForm"; 56 | this.ShowInTaskbar = false; 57 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 58 | this.Text = "LoadingForm"; 59 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 60 | this.ResumeLayout(false); 61 | 62 | } 63 | 64 | #endregion 65 | 66 | private System.Windows.Forms.PictureBox pictureBox1; 67 | } 68 | } -------------------------------------------------------------------------------- /Asrfly/Gui/GuiProjects/ProjectManagmentForm.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Code; 2 | using Asrfly.Core; 3 | using Asrfly.Data; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel; 7 | using System.Data; 8 | using System.Drawing; 9 | using System.Linq; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | using System.Windows.Forms; 13 | 14 | namespace Asrfly.Gui.GuiProjects 15 | { 16 | public partial class ProjectManagmentForm : Form 17 | { 18 | private readonly int projectId; 19 | private readonly IDataHelper dataHelperIncome; 20 | private readonly IDataHelper dataHelperOutCome; 21 | private double TotalIncome; 22 | private double TotalOutcome; 23 | 24 | public ProjectManagmentForm(int ProjectId) 25 | { 26 | dataHelperIncome = (IDataHelper)ConfigrationObjectManager.GetObject("Income"); 27 | dataHelperOutCome = (IDataHelper)ConfigrationObjectManager.GetObject("Outcome"); 28 | InitializeComponent(); 29 | projectId = ProjectId; 30 | LoadOutComeUI(); 31 | LoadIncomeUI(); 32 | } 33 | 34 | private void LoadOutComeUI() 35 | { 36 | // Load OutCome UI 37 | GuiOutcome.OutcomeUserControl outcomeUserControl = new GuiOutcome.OutcomeUserControl(projectId); 38 | outcomeUserControl.Dock = DockStyle.Fill; 39 | panelOutcome.Controls.Add(outcomeUserControl); 40 | } 41 | private void LoadIncomeUI() 42 | { 43 | // Load OutCome UI 44 | GuiIncome.IncomeUserControl IncomeUserControl = new GuiIncome.IncomeUserControl(projectId); 45 | IncomeUserControl.Dock = DockStyle.Fill; 46 | panelIncome.Controls.Add(IncomeUserControl); 47 | } 48 | 49 | 50 | 51 | 52 | 53 | private void ProjectManagmentForm_Activated(object sender, EventArgs e) 54 | { 55 | GetTotalData(); 56 | } 57 | 58 | private void GetTotalData() 59 | { 60 | // Get Data 61 | try 62 | { 63 | TotalIncome = dataHelperIncome.GetAllData() 64 | .Where(x => x.ProjectId == projectId).Select(x => x.Amount).ToArray().Sum(); 65 | TotalOutcome = dataHelperOutCome.GetAllData() 66 | .Where(x => x.ProjectId == projectId).Select(x => x.Amount).ToArray().Sum(); 67 | } 68 | catch { } 69 | var Rev = TotalIncome - TotalOutcome; 70 | 71 | // Set Data to Ui 72 | labelIncome.Text = "المقبوضات: "+ TotalIncome.ToString("#0.00"); 73 | labelOutcome.Text = "المصروفات: "+ TotalOutcome.ToString("#0.00"); 74 | labelRev.Text = "الارباح: "+ Rev.ToString("#0.00"); 75 | 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Asrfly.Data/IDataHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | 6 | namespace Asrfly.Data 7 | { 8 | public interface IDataHelper 9 | { 10 | // Read 11 | /// Gets all data. 12 | /// 13 | ///
14 | ///
15 | List
GetAllData(); 16 | /// Searches the specified search item. 17 | /// The search item. 18 | /// Searched Data 19 | List
Search(string SearchItem); 20 | /// Finds the specified identifier. 21 | /// The identifier. 22 | /// Row Table When Id ==Id 23 | Table Find(int Id); 24 | 25 | // Write 26 | /// Adds the specified table. 27 | /// The table. 28 | /// 1 when the task success, 0 when task failed 29 | int Add(Table table); 30 | /// Edits the specified table. 31 | /// The table. 32 | /// 1 when the task success, 0 when task failed 33 | int Edit(Table table); 34 | /// Deletes the specified identifier. 35 | /// The identifier. 36 | /// 1 when the task success, 0 when task failed 37 | int Delete(int Id); 38 | 39 | // Read Async 40 | /// Gets all data asynchronous. 41 | /// All Data Of Table 42 | Task> GetAllDataAsync(); 43 | /// Searches the asynchronous. 44 | /// The search item. 45 | /// Row Data 46 | Task> SearchAsync(string SearchItem); 47 | /// Finds the asynchronous. 48 | /// The identifier. 49 | /// Row Data 50 | Task
FindAsync(int Id); 51 | 52 | // Write Async 53 | /// Adds the asynchronous. 54 | /// The table. 55 | /// 1 when the task success, 0 when task failed 56 | Task AddAsync(Table table); 57 | /// Edits the asynchronous. 58 | /// The table. 59 | /// 1 when the task success, 0 when task failed 60 | Task EditAsync(Table table); 61 | /// Deletes the asynchronous. 62 | /// The identifier. 63 | /// 1 when the task success, 0 when task failed 64 | Task DeleteAsync(int Id); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230321044932_AddUsesAndRoles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace Asrfly.Data.Migrations 5 | { 6 | public partial class AddUsesAndRoles : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.CreateTable( 11 | name: "Users", 12 | columns: table => new 13 | { 14 | Id = table.Column(type: "int", nullable: false) 15 | .Annotation("SqlServer:Identity", "1, 1"), 16 | FullName = table.Column(type: "nvarchar(max)", nullable: true), 17 | UserName = table.Column(type: "nvarchar(max)", nullable: true), 18 | Password = table.Column(type: "nvarchar(max)", nullable: true), 19 | Email = table.Column(type: "nvarchar(max)", nullable: true), 20 | Phone = table.Column(type: "nvarchar(max)", nullable: true), 21 | AddedDate = table.Column(type: "datetime2", nullable: false) 22 | }, 23 | constraints: table => 24 | { 25 | table.PrimaryKey("PK_Users", x => x.Id); 26 | }); 27 | 28 | migrationBuilder.CreateTable( 29 | name: "UsersRoles", 30 | columns: table => new 31 | { 32 | Id = table.Column(type: "int", nullable: false) 33 | .Annotation("SqlServer:Identity", "1, 1"), 34 | Key = table.Column(type: "nvarchar(max)", nullable: true), 35 | Value = table.Column(type: "bit", nullable: false), 36 | UserId = table.Column(type: "int", nullable: false), 37 | UsersId = table.Column(type: "int", nullable: true) 38 | }, 39 | constraints: table => 40 | { 41 | table.PrimaryKey("PK_UsersRoles", x => x.Id); 42 | table.ForeignKey( 43 | name: "FK_UsersRoles_Users_UsersId", 44 | column: x => x.UserId, 45 | principalTable: "Users", 46 | principalColumn: "Id", 47 | onDelete: ReferentialAction.Cascade); 48 | }); 49 | 50 | migrationBuilder.CreateIndex( 51 | name: "IX_UsersRoles_UsersId", 52 | table: "UsersRoles", 53 | column: "UsersId"); 54 | } 55 | 56 | protected override void Down(MigrationBuilder migrationBuilder) 57 | { 58 | migrationBuilder.DropTable( 59 | name: "UsersRoles"); 60 | 61 | migrationBuilder.DropTable( 62 | name: "Users"); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Asrfly/StartForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiAbout/About.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiLoading/LoadingForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiUsers/AddUserForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiUsers/UserLoginForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiUsers/UsersControl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiHome/HomeUserControl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiIncome/AddIncomeForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiIncome/IncomeUserControl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiOutcome/AddOutcomeForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiProjects/AddProjectForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiSettings/SettingsForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiCategories/AddCategoryForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiCustomers/AddCustomersForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiOutcome/OutcomeUserControl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiProjects/ProjectManagmentForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiProjects/ProjectsUserControl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiSuppliers/AddSuppliersForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiCategories/CategoryUserControl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiCustomers/CustomersUserControl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiSuppliers/SuppliersUserControl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiSystemRecords/RecordsUserControl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiNotificaiton/NotificationForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | 61 | 17, 17 62 | 63 | -------------------------------------------------------------------------------- /Asrfly.Tests/CategoriesEntityTests.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Core; 2 | using Asrfly.Data; 3 | using Asrfly.Data.SqlServer; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace Asrfly.Tests 10 | { 11 | [TestClass] 12 | public class CategoriesEntityTests 13 | { 14 | IDataHelper dataHelper; 15 | public CategoriesEntityTests() 16 | { 17 | dataHelper = new CategoriesEntity(); 18 | } 19 | 20 | [TestMethod] 21 | public void AddTest() 22 | { 23 | // Arrange ( Set ) 24 | Categories categories = new Categories 25 | { 26 | Name = "تحليل المشروع", 27 | Details = "الصنف الخاص في عملية تحليل المشروع", 28 | Type = "صرف", 29 | Balance = 1000, 30 | AddedDate = DateTime.Now, 31 | }; 32 | // Act and expt ( Get ) 33 | 34 | int act = dataHelper.Add(categories); 35 | int expt = 1; 36 | // Assert (Test) 37 | Assert.AreEqual(expt, act); 38 | } 39 | 40 | [TestMethod] 41 | public void EditTest() 42 | { 43 | // Arrange ( Set ) 44 | Categories categories = new Categories 45 | { 46 | Id = 1, 47 | Name = "تصميم المشروع", 48 | Details = "الصنف الخاص في عملية تصميم المشروع", 49 | Type = "صرف", 50 | Balance = 2000, 51 | AddedDate = DateTime.Now, 52 | }; 53 | // Act and expt ( Get ) 54 | 55 | int act = dataHelper.Edit(categories); 56 | int expt = 1; 57 | // Assert (Test) 58 | Assert.AreEqual(expt, act); 59 | } 60 | 61 | [TestMethod] 62 | public void GetAllDataTest() 63 | { 64 | // Arrange ( Set ) 65 | 66 | // Act and expt ( Get ) 67 | 68 | var act = dataHelper.GetAllData(); 69 | // Assert (Test) 70 | Assert.IsNotNull(act); 71 | } 72 | [TestMethod] 73 | public void SearchTest() 74 | { 75 | // Arrange ( Set ) 76 | var searchitem = "صرف"; 77 | // Act and expt ( Get ) 78 | 79 | var act = dataHelper.Search(searchitem); 80 | // Assert (Test) 81 | Assert.IsNotNull(act); 82 | } 83 | 84 | [TestMethod] 85 | 86 | public void FindTest() 87 | { 88 | // Arrange ( Set ) 89 | var Id = 1; 90 | // Act and expt ( Get ) 91 | 92 | var act = dataHelper.Find(1); 93 | // Assert (Test) 94 | Assert.IsNotNull(act); 95 | } 96 | [TestMethod] 97 | 98 | public void DeleteTest() 99 | { 100 | // Arrange ( Set ) 101 | var Id = 1; 102 | // Act and expt ( Get ) 103 | 104 | var act = dataHelper.Delete(1); 105 | // Assert (Test) 106 | Assert.AreEqual(1, act); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230315082102_AddOut.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace Asrfly.Data.Migrations 5 | { 6 | public partial class AddOut : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.CreateTable( 11 | name: "Outcome", 12 | columns: table => new 13 | { 14 | Id = table.Column(type: "int", nullable: false) 15 | .Annotation("SqlServer:Identity", "1, 1"), 16 | CategoryName = table.Column(type: "nvarchar(max)", nullable: true), 17 | SupplierName = table.Column(type: "nvarchar(max)", nullable: true), 18 | OutcomeDate = table.Column(type: "datetime2", nullable: false), 19 | RecNo = table.Column(type: "nvarchar(max)", nullable: true), 20 | Amount = table.Column(type: "float", nullable: false), 21 | Details = table.Column(type: "nvarchar(max)", nullable: true), 22 | CategroyId = table.Column(type: "int", nullable: false), 23 | CategoriesId = table.Column(type: "int", nullable: true), 24 | SupplierId = table.Column(type: "int", nullable: false), 25 | SuppliersId = table.Column(type: "int", nullable: true), 26 | ProjectId = table.Column(type: "int", nullable: false), 27 | ProjectsId = table.Column(type: "int", nullable: true) 28 | }, 29 | constraints: table => 30 | { 31 | table.PrimaryKey("PK_Outcome", x => x.Id); 32 | table.ForeignKey( 33 | name: "FK_Outcome_Categories_CategoriesId", 34 | column: x => x.CategroyId, 35 | principalTable: "Categories", 36 | principalColumn: "Id", 37 | onDelete: ReferentialAction.Restrict); 38 | table.ForeignKey( 39 | name: "FK_Outcome_Projects_ProjectsId", 40 | column: x => x.ProjectId, 41 | principalTable: "Projects", 42 | principalColumn: "Id", 43 | onDelete: ReferentialAction.Cascade); 44 | table.ForeignKey( 45 | name: "FK_Outcome_Suppliers_SuppliersId", 46 | column: x => x.SupplierId, 47 | principalTable: "Suppliers", 48 | principalColumn: "Id", 49 | onDelete: ReferentialAction.Restrict); 50 | }); 51 | 52 | migrationBuilder.CreateIndex( 53 | name: "IX_Outcome_CategoriesId", 54 | table: "Outcome", 55 | column: "CategoriesId"); 56 | 57 | migrationBuilder.CreateIndex( 58 | name: "IX_Outcome_ProjectsId", 59 | table: "Outcome", 60 | column: "ProjectsId"); 61 | 62 | migrationBuilder.CreateIndex( 63 | name: "IX_Outcome_SuppliersId", 64 | table: "Outcome", 65 | column: "SuppliersId"); 66 | } 67 | 68 | protected override void Down(MigrationBuilder migrationBuilder) 69 | { 70 | migrationBuilder.DropTable( 71 | name: "Outcome"); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230316050300_AddIncomeTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace Asrfly.Data.Migrations 5 | { 6 | public partial class AddIncomeTable : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.CreateTable( 11 | name: "Income", 12 | columns: table => new 13 | { 14 | Id = table.Column(type: "int", nullable: false) 15 | .Annotation("SqlServer:Identity", "1, 1"), 16 | CategoryName = table.Column(type: "nvarchar(max)", nullable: true), 17 | SupplierName = table.Column(type: "nvarchar(max)", nullable: true), 18 | IncomeDate = table.Column(type: "datetime2", nullable: false), 19 | RecNo = table.Column(type: "nvarchar(max)", nullable: true), 20 | Amount = table.Column(type: "float", nullable: false), 21 | Details = table.Column(type: "nvarchar(max)", nullable: true), 22 | CategroyId = table.Column(type: "int", nullable: false), 23 | CategoriesId = table.Column(type: "int", nullable: true), 24 | SupplierId = table.Column(type: "int", nullable: false), 25 | SuppliersId = table.Column(type: "int", nullable: true), 26 | ProjectId = table.Column(type: "int", nullable: false), 27 | ProjectsId = table.Column(type: "int", nullable: true) 28 | }, 29 | constraints: table => 30 | { 31 | table.PrimaryKey("PK_Income", x => x.Id); 32 | table.ForeignKey( 33 | name: "FK_Income_Categories_CategoriesId", 34 | column: x => x.CategroyId, 35 | principalTable: "Categories", 36 | principalColumn: "Id", 37 | onDelete: ReferentialAction.Restrict); 38 | table.ForeignKey( 39 | name: "FK_Income_Projects_ProjectsId", 40 | column: x => x.ProjectId, 41 | principalTable: "Projects", 42 | principalColumn: "Id", 43 | onDelete: ReferentialAction.Cascade); 44 | table.ForeignKey( 45 | name: "FK_Income_Suppliers_SuppliersId", 46 | column: x => x.SupplierId, 47 | principalTable: "Suppliers", 48 | principalColumn: "Id", 49 | onDelete: ReferentialAction.Restrict); 50 | }); 51 | 52 | migrationBuilder.CreateIndex( 53 | name: "IX_Income_CategoriesId", 54 | table: "Income", 55 | column: "CategoriesId"); 56 | 57 | migrationBuilder.CreateIndex( 58 | name: "IX_Income_ProjectsId", 59 | table: "Income", 60 | column: "ProjectsId"); 61 | 62 | migrationBuilder.CreateIndex( 63 | name: "IX_Income_SuppliersId", 64 | table: "Income", 65 | column: "SuppliersId"); 66 | } 67 | 68 | protected override void Down(MigrationBuilder migrationBuilder) 69 | { 70 | migrationBuilder.DropTable( 71 | name: "Income"); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiAbout/About.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Reflection; 6 | using System.Windows.Forms; 7 | 8 | namespace Asrfly.Gui.GuiAbout 9 | { 10 | partial class About : Form 11 | { 12 | public About() 13 | { 14 | InitializeComponent(); 15 | this.Text = String.Format("About {0}", AssemblyTitle); 16 | this.labelProductName.Text = AssemblyProduct; 17 | this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); 18 | this.labelCopyright.Text = AssemblyCopyright; 19 | this.labelCompanyName.Text = AssemblyCompany; 20 | this.textBoxDescription.Text = AssemblyDescription; 21 | } 22 | 23 | #region Assembly Attribute Accessors 24 | 25 | public string AssemblyTitle 26 | { 27 | get 28 | { 29 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); 30 | if (attributes.Length > 0) 31 | { 32 | AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; 33 | if (titleAttribute.Title != "") 34 | { 35 | return titleAttribute.Title; 36 | } 37 | } 38 | return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); 39 | } 40 | } 41 | 42 | public string AssemblyVersion 43 | { 44 | get 45 | { 46 | return Assembly.GetExecutingAssembly().GetName().Version.ToString(); 47 | } 48 | } 49 | 50 | public string AssemblyDescription 51 | { 52 | get 53 | { 54 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); 55 | if (attributes.Length == 0) 56 | { 57 | return ""; 58 | } 59 | return ((AssemblyDescriptionAttribute)attributes[0]).Description; 60 | } 61 | } 62 | 63 | public string AssemblyProduct 64 | { 65 | get 66 | { 67 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); 68 | if (attributes.Length == 0) 69 | { 70 | return ""; 71 | } 72 | return ((AssemblyProductAttribute)attributes[0]).Product; 73 | } 74 | } 75 | 76 | public string AssemblyCopyright 77 | { 78 | get 79 | { 80 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); 81 | if (attributes.Length == 0) 82 | { 83 | return ""; 84 | } 85 | return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; 86 | } 87 | } 88 | 89 | public string AssemblyCompany 90 | { 91 | get 92 | { 93 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); 94 | if (attributes.Length == 0) 95 | { 96 | return ""; 97 | } 98 | return ((AssemblyCompanyAttribute)attributes[0]).Company; 99 | } 100 | } 101 | #endregion 102 | 103 | private void okButton_Click(object sender, EventArgs e) 104 | { 105 | Close(); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /Asrfly/Asrfly.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | netcoreapp3.1 6 | true 7 | Tecno U 8 | هو اداة ذكية وبسيطة لمتابعة صرفيات المشاريع 9 | 10 | جميع الحقوق محفوظة لقناة تكنو U 2023 11 | Asrfly.ico 12 | 13 | 14 | 15 | 2 16 | 17 | 18 | 19 | 20 | 21 | 22 | all 23 | runtime; build; native; contentfiles; analyzers; buildtransitive 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | UserControl 35 | 36 | 37 | Form 38 | 39 | 40 | Form 41 | 42 | 43 | UserControl 44 | 45 | 46 | Form 47 | 48 | 49 | UserControl 50 | 51 | 52 | Form 53 | 54 | 55 | UserControl 56 | 57 | 58 | Form 59 | 60 | 61 | UserControl 62 | 63 | 64 | Form 65 | 66 | 67 | UserControl 68 | 69 | 70 | Form 71 | 72 | 73 | UserControl 74 | 75 | 76 | True 77 | True 78 | Resources.resx 79 | 80 | 81 | True 82 | True 83 | Settings.settings 84 | 85 | 86 | 87 | 88 | 89 | ResXFileCodeGenerator 90 | Resources.Designer.cs 91 | 92 | 93 | 94 | 95 | 96 | SettingsSingleFileGenerator 97 | Settings.Designer.cs 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /Asrfly/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Asrfly.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("Server=.\\SQLEXPRESS;Database=AsrflyDataBase;Trusted_Connection=True")] 29 | public string SqlServerConString { 30 | get { 31 | return ((string)(this["SqlServerConString"])); 32 | } 33 | set { 34 | this["SqlServerConString"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("2")] 41 | public int HideNotificaitonInterval { 42 | get { 43 | return ((int)(this["HideNotificaitonInterval"])); 44 | } 45 | set { 46 | this["HideNotificaitonInterval"] = value; 47 | } 48 | } 49 | 50 | [global::System.Configuration.UserScopedSettingAttribute()] 51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 52 | [global::System.Configuration.DefaultSettingValueAttribute("صفاء جاسم")] 53 | public string UserName { 54 | get { 55 | return ((string)(this["UserName"])); 56 | } 57 | set { 58 | this["UserName"] = value; 59 | } 60 | } 61 | 62 | [global::System.Configuration.UserScopedSettingAttribute()] 63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 64 | [global::System.Configuration.DefaultSettingValueAttribute("3")] 65 | public int DataGridViewRowNo { 66 | get { 67 | return ((int)(this["DataGridViewRowNo"])); 68 | } 69 | set { 70 | this["DataGridViewRowNo"] = value; 71 | } 72 | } 73 | 74 | [global::System.Configuration.UserScopedSettingAttribute()] 75 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 76 | [global::System.Configuration.DefaultSettingValueAttribute("ادخل هنا اسم المؤسسة")] 77 | public string CompanyName { 78 | get { 79 | return ((string)(this["CompanyName"])); 80 | } 81 | set { 82 | this["CompanyName"] = value; 83 | } 84 | } 85 | 86 | [global::System.Configuration.UserScopedSettingAttribute()] 87 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 88 | [global::System.Configuration.DefaultSettingValueAttribute("")] 89 | public string CompanyLogo { 90 | get { 91 | return ((string)(this["CompanyLogo"])); 92 | } 93 | set { 94 | this["CompanyLogo"] = value; 95 | } 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230311053841_AddCustomersTable.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Asrfly.Data.SqlServer; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | namespace Asrfly.Data.Migrations 11 | { 12 | [DbContext(typeof(DBContext))] 13 | [Migration("20230311053841_AddCustomersTable")] 14 | partial class AddCustomersTable 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .UseIdentityColumns() 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 22 | .HasAnnotation("ProductVersion", "5.0.0"); 23 | 24 | modelBuilder.Entity("Asrfly.Core.Categories", b => 25 | { 26 | b.Property("Id") 27 | .ValueGeneratedOnAdd() 28 | .HasColumnType("int") 29 | .UseIdentityColumn(); 30 | 31 | b.Property("AddedDate") 32 | .HasColumnType("datetime2"); 33 | 34 | b.Property("Balance") 35 | .HasColumnType("float"); 36 | 37 | b.Property("Details") 38 | .HasColumnType("nvarchar(max)"); 39 | 40 | b.Property("Name") 41 | .HasColumnType("nvarchar(max)"); 42 | 43 | b.Property("Type") 44 | .HasColumnType("nvarchar(max)"); 45 | 46 | b.HasKey("Id"); 47 | 48 | b.ToTable("Categories"); 49 | }); 50 | 51 | modelBuilder.Entity("Asrfly.Core.Customers", b => 52 | { 53 | b.Property("Id") 54 | .ValueGeneratedOnAdd() 55 | .HasColumnType("int") 56 | .UseIdentityColumn(); 57 | 58 | b.Property("AddedDate") 59 | .HasColumnType("datetime2"); 60 | 61 | b.Property("Address") 62 | .HasColumnType("nvarchar(max)"); 63 | 64 | b.Property("Balance") 65 | .HasColumnType("float"); 66 | 67 | b.Property("Details") 68 | .HasColumnType("nvarchar(max)"); 69 | 70 | b.Property("Email") 71 | .HasColumnType("nvarchar(max)"); 72 | 73 | b.Property("Name") 74 | .HasColumnType("nvarchar(max)"); 75 | 76 | b.Property("PhoneNumber") 77 | .HasColumnType("nvarchar(max)"); 78 | 79 | b.HasKey("Id"); 80 | 81 | b.ToTable("Customers"); 82 | }); 83 | 84 | modelBuilder.Entity("Asrfly.Core.SystemRecords", b => 85 | { 86 | b.Property("Id") 87 | .ValueGeneratedOnAdd() 88 | .HasColumnType("int") 89 | .UseIdentityColumn(); 90 | 91 | b.Property("AddedDate") 92 | .HasColumnType("datetime2"); 93 | 94 | b.Property("Details") 95 | .HasColumnType("nvarchar(max)"); 96 | 97 | b.Property("Title") 98 | .HasColumnType("nvarchar(max)"); 99 | 100 | b.Property("UserName") 101 | .HasColumnType("nvarchar(max)"); 102 | 103 | b.HasKey("Id"); 104 | 105 | b.ToTable("SystemRecords"); 106 | }); 107 | #pragma warning restore 612, 618 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiNotificaiton/NotificationForm.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Asrfly.Gui.GuiNotificaiton 3 | { 4 | partial class NotificationForm 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.components = new System.ComponentModel.Container(); 33 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 34 | this.labelTitle = new System.Windows.Forms.Label(); 35 | this.timerNotification = new System.Windows.Forms.Timer(this.components); 36 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 37 | this.SuspendLayout(); 38 | // 39 | // pictureBox1 40 | // 41 | this.pictureBox1.BackColor = System.Drawing.Color.Transparent; 42 | this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Left; 43 | this.pictureBox1.Image = global::Asrfly.Properties.Resources.icons8_Notification_128px; 44 | this.pictureBox1.Location = new System.Drawing.Point(0, 0); 45 | this.pictureBox1.Name = "pictureBox1"; 46 | this.pictureBox1.Size = new System.Drawing.Size(75, 79); 47 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 48 | this.pictureBox1.TabIndex = 0; 49 | this.pictureBox1.TabStop = false; 50 | // 51 | // labelTitle 52 | // 53 | this.labelTitle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); 54 | this.labelTitle.Dock = System.Windows.Forms.DockStyle.Fill; 55 | this.labelTitle.ForeColor = System.Drawing.Color.White; 56 | this.labelTitle.Location = new System.Drawing.Point(75, 0); 57 | this.labelTitle.Name = "labelTitle"; 58 | this.labelTitle.Size = new System.Drawing.Size(311, 79); 59 | this.labelTitle.TabIndex = 1; 60 | this.labelTitle.Text = "هنا وصف الاشعار "; 61 | this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 62 | this.labelTitle.Click += new System.EventHandler(this.labelTitle_Click); 63 | // 64 | // timerNotification 65 | // 66 | this.timerNotification.Enabled = true; 67 | this.timerNotification.Interval = 2000; 68 | this.timerNotification.Tick += new System.EventHandler(this.timerNotification_Tick); 69 | // 70 | // NotificationForm 71 | // 72 | this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 37F); 73 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 74 | this.ClientSize = new System.Drawing.Size(386, 79); 75 | this.Controls.Add(this.labelTitle); 76 | this.Controls.Add(this.pictureBox1); 77 | this.Font = new System.Drawing.Font("Cairo", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); 78 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 79 | this.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); 80 | this.Name = "NotificationForm"; 81 | this.ShowIcon = false; 82 | this.ShowInTaskbar = false; 83 | this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; 84 | this.Text = "NotificationForm"; 85 | this.TopMost = true; 86 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 87 | this.ResumeLayout(false); 88 | 89 | } 90 | 91 | #endregion 92 | 93 | private System.Windows.Forms.PictureBox pictureBox1; 94 | public System.Windows.Forms.Label labelTitle; 95 | private System.Windows.Forms.Timer timerNotification; 96 | } 97 | } -------------------------------------------------------------------------------- /Asrfly/Main.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Code; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Diagnostics; 7 | using System.Drawing; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | namespace Asrfly 13 | { 14 | public partial class Main : Form 15 | { 16 | private readonly PageManager pageManager; 17 | public Main() 18 | { 19 | InitializeComponent(); 20 | pageManager = new PageManager(this); 21 | // Load Home Page 22 | pageManager.LoadPage(Gui.GuiHome.HomeUserControl.Instance()); 23 | SetRoles(); 24 | 25 | } 26 | 27 | #region Events 28 | private void buttonHome_Click(object sender, EventArgs e) 29 | { 30 | // Load Home Page 31 | pageManager.LoadPage(Gui.GuiHome.HomeUserControl.Instance()); 32 | } 33 | private void buttonCategory_Click(object sender, EventArgs e) 34 | { 35 | // Load Categories Page 36 | pageManager.LoadPage(Gui.GuiCategories.CategoryUserControl.Instance()); 37 | } 38 | #endregion 39 | 40 | private void buttonCustomers_Click(object sender, EventArgs e) 41 | { 42 | // Load Customers Page 43 | pageManager.LoadPage(Gui.GuiCustomers.CustomersUserControl.Instance()); 44 | } 45 | 46 | private void buttonSuppliers_Click(object sender, EventArgs e) 47 | { 48 | // Load Suppliers Page 49 | pageManager.LoadPage(Gui.GuiSuppliers.SuppliersUserControl.Instance()); 50 | } 51 | 52 | private void buttonProjects_Click(object sender, EventArgs e) 53 | { 54 | // Load Projects Page 55 | pageManager.LoadPage(Gui.GuiProjects.ProjectsUserControl.Instance()); 56 | } 57 | 58 | private void buttonUsers_Click(object sender, EventArgs e) 59 | { 60 | // Load Users Page 61 | pageManager.LoadPage(Gui.GuiUsers.UsersControl.Instance()); 62 | } 63 | 64 | private void SetRoles() 65 | { 66 | if (!UsersRolesManager.GetRole("checkBoxHome")) 67 | { 68 | buttonHome.Visible = false; 69 | } 70 | if (!UsersRolesManager.GetRole("checkBoxCategory")) 71 | { 72 | buttonCategory.Visible = false; 73 | } 74 | if (!UsersRolesManager.GetRole("checkBoxSupplier")) 75 | { 76 | buttonSuppliers.Visible = false; 77 | } 78 | if (!UsersRolesManager.GetRole("checkBoxCustoemr")) 79 | { 80 | buttonCustomers.Visible = false; 81 | } 82 | if (!UsersRolesManager.GetRole("checkBoxProjects")) 83 | { 84 | buttonProjects.Visible = false; 85 | } 86 | if (!UsersRolesManager.GetRole("checkBoxUsers")) 87 | { 88 | buttonUsers.Visible = false; 89 | } 90 | if (!UsersRolesManager.GetRole("checkBoxSettings")) 91 | { 92 | buttonSettings.Visible = false; 93 | } 94 | if (!UsersRolesManager.GetRole("checkBoxSystemRecords")) 95 | { 96 | buttonSystemRecords.Visible = false; 97 | } 98 | 99 | } 100 | 101 | private void buttonSettings_Click(object sender, EventArgs e) 102 | { 103 | Gui.GuiSettings.SettingsForm settingsForm = new Gui.GuiSettings.SettingsForm(false); 104 | settingsForm.Show(); 105 | } 106 | 107 | private void Main_FormClosed(object sender, FormClosedEventArgs e) 108 | { 109 | Application.Exit(); 110 | } 111 | 112 | private void buttonLogout_Click(object sender, EventArgs e) 113 | { 114 | Gui.GuiUsers.UserLoginForm loginForm = new Gui.GuiUsers.UserLoginForm(); 115 | loginForm.Show(); 116 | Hide(); 117 | } 118 | 119 | private void buttonSystemRecords_Click(object sender, EventArgs e) 120 | { 121 | // Load Users Page 122 | pageManager.LoadPage(Gui.GuiSystemRecords.RecordsUserControl.Instance()); 123 | } 124 | 125 | private void buttonAbout_Click(object sender, EventArgs e) 126 | { 127 | Gui.GuiAbout.About about = new Gui.GuiAbout.About(); 128 | about.Show(); 129 | } 130 | 131 | private void buttonHelp_Click(object sender, EventArgs e) 132 | { 133 | var url = "https://www.youtube.com/channel/UCUUg8uOn44gIan33tNoFJZA"; 134 | Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true }); 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiUsers/UserLoginForm.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Code; 2 | using Asrfly.Core; 3 | using Asrfly.Data; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel; 7 | using System.Data; 8 | using System.Drawing; 9 | using System.Linq; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | using System.Windows.Forms; 13 | 14 | namespace Asrfly.Gui.GuiUsers 15 | { 16 | public partial class UserLoginForm : Form 17 | { 18 | // Variables 19 | private readonly int ID; 20 | private readonly UsersControl categoryUserControl; 21 | private Users users; 22 | private readonly IDataHelper dataHelper; 23 | private readonly IDataHelper dataHelperUsersRoles; 24 | private readonly GuiLoading.LoadingForm loadingForm; 25 | private readonly IDataHelper dataHelperSystemRecords; 26 | private Dictionary ListOfRoles = new Dictionary(); 27 | 28 | public UserLoginForm() 29 | { 30 | InitializeComponent(); 31 | dataHelper = (IDataHelper)ConfigrationObjectManager.GetObject("Users"); 32 | dataHelperUsersRoles = (IDataHelper)ConfigrationObjectManager.GetObject("UsersRoles"); 33 | dataHelperSystemRecords = (IDataHelper)ConfigrationObjectManager.GetObject("SystemRecords"); 34 | 35 | loadingForm = new GuiLoading.LoadingForm(); 36 | 37 | } 38 | 39 | #region Events 40 | 41 | 42 | private async void buttonSave_Click(object sender, EventArgs e) 43 | { 44 | if (IsFiledsEmpty()) 45 | { 46 | MessageCollections.ShowFiledsRequired(); 47 | } 48 | else 49 | { 50 | var userName = textBoxUserName.Text; 51 | var password = textBoxPassword.Text; 52 | loadingForm.Show(); 53 | var UserLoginResult = await Task.Run(() => Login(userName, password)); 54 | if (UserLoginResult==1) 55 | { 56 | Main main = new Main(); 57 | main.Show(); 58 | Hide(); 59 | } 60 | else if(UserLoginResult==2) 61 | { 62 | 63 | MessageCollections.ShowErrorServer(); 64 | } 65 | else 66 | { 67 | MessageBox.Show("هناك خطا في معلومات تسجل الدخول"); 68 | } 69 | loadingForm.Hide(); 70 | } 71 | } 72 | private void AddCategoryForm_Load(object sender, EventArgs e) 73 | { 74 | 75 | 76 | } 77 | #endregion 78 | 79 | #region Methods 80 | 81 | 82 | 83 | private bool IsFiledsEmpty() 84 | { 85 | if ( 86 | textBoxUserName.Text == string.Empty 87 | || textBoxPassword.Text == string.Empty 88 | ) 89 | { 90 | return true; 91 | } 92 | else 93 | { 94 | return false; 95 | } 96 | } 97 | 98 | private int Login(string UserName, string Password) 99 | { 100 | 101 | try 102 | { 103 | // Check 104 | Users user = dataHelper.GetAllData().Where(x => x.UserName == UserName && x.Password == Password).FirstOrDefault(); 105 | if (user != null) 106 | { 107 | Properties.Settings.Default.UserName = user.FullName; 108 | Properties.Settings.Default.Save(); 109 | // Get Roles 110 | var ListRoles = dataHelperUsersRoles.GetAllData().Where(x => x.UserId == user.Id); 111 | // Loop into List of Roles and Set Roles 112 | UsersRolesManager.ClearRoles(); 113 | foreach (var item in ListRoles) 114 | { 115 | UsersRolesManager.Register(item.Key, item.Value); 116 | } 117 | 118 | // Save System Records 119 | SystemRecords systemRecords = new SystemRecords 120 | { 121 | Title = " تسجيل دخول", 122 | UserName = Properties.Settings.Default.UserName, 123 | Details = "تم تسجيل دخول المستخدم " + user.UserName, 124 | AddedDate = DateTime.Now 125 | }; 126 | dataHelperSystemRecords.Add(systemRecords); 127 | return 1; 128 | } 129 | else 130 | { 131 | return 0; 132 | } 133 | } 134 | catch 135 | { 136 | return 2; 137 | } 138 | 139 | } 140 | 141 | 142 | #endregion 143 | 144 | private void UserLoginForm_FormClosed(object sender, FormClosedEventArgs e) 145 | { 146 | Application.Exit(); 147 | } 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /Asrfly/StartForm.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Asrfly 3 | { 4 | partial class StartForm 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 33 | this.progressBar1 = new System.Windows.Forms.ProgressBar(); 34 | this.labelState = new System.Windows.Forms.Label(); 35 | this.label2 = new System.Windows.Forms.Label(); 36 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 37 | this.SuspendLayout(); 38 | // 39 | // pictureBox1 40 | // 41 | this.pictureBox1.Image = global::Asrfly.Properties.Resources.Asrfly1; 42 | this.pictureBox1.Location = new System.Drawing.Point(107, 32); 43 | this.pictureBox1.Name = "pictureBox1"; 44 | this.pictureBox1.Size = new System.Drawing.Size(421, 276); 45 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 46 | this.pictureBox1.TabIndex = 0; 47 | this.pictureBox1.TabStop = false; 48 | // 49 | // progressBar1 50 | // 51 | this.progressBar1.Location = new System.Drawing.Point(57, 347); 52 | this.progressBar1.Name = "progressBar1"; 53 | this.progressBar1.Size = new System.Drawing.Size(534, 29); 54 | this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; 55 | this.progressBar1.TabIndex = 1; 56 | // 57 | // labelState 58 | // 59 | this.labelState.AutoSize = true; 60 | this.labelState.Location = new System.Drawing.Point(57, 306); 61 | this.labelState.Name = "labelState"; 62 | this.labelState.Size = new System.Drawing.Size(70, 37); 63 | this.labelState.TabIndex = 2; 64 | this.labelState.Text = "البداية"; 65 | // 66 | // label2 67 | // 68 | this.label2.AutoSize = true; 69 | this.label2.Font = new System.Drawing.Font("Cairo", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); 70 | this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); 71 | this.label2.Location = new System.Drawing.Point(370, 379); 72 | this.label2.Name = "label2"; 73 | this.label2.Size = new System.Drawing.Size(221, 32); 74 | this.label2.TabIndex = 2; 75 | this.label2.Text = "جميع الحقوق محفوظة 2023"; 76 | // 77 | // StartForm 78 | // 79 | this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 37F); 80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 81 | this.ClientSize = new System.Drawing.Size(615, 425); 82 | this.Controls.Add(this.label2); 83 | this.Controls.Add(this.labelState); 84 | this.Controls.Add(this.progressBar1); 85 | this.Controls.Add(this.pictureBox1); 86 | this.Font = new System.Drawing.Font("Cairo", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); 87 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 88 | this.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); 89 | this.Name = "StartForm"; 90 | this.RightToLeft = System.Windows.Forms.RightToLeft.Yes; 91 | this.RightToLeftLayout = true; 92 | this.ShowIcon = false; 93 | this.ShowInTaskbar = false; 94 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 95 | this.Text = "البداية"; 96 | this.Load += new System.EventHandler(this.Form1_Load); 97 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 98 | this.ResumeLayout(false); 99 | this.PerformLayout(); 100 | 101 | } 102 | 103 | #endregion 104 | 105 | private System.Windows.Forms.PictureBox pictureBox1; 106 | private System.Windows.Forms.ProgressBar progressBar1; 107 | private System.Windows.Forms.Label labelState; 108 | private System.Windows.Forms.Label label2; 109 | } 110 | } -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230312155508_AddSupplierTable.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Asrfly.Data.SqlServer; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | namespace Asrfly.Data.Migrations 11 | { 12 | [DbContext(typeof(DBContext))] 13 | [Migration("20230312155508_AddSupplierTable")] 14 | partial class AddSupplierTable 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .UseIdentityColumns() 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 22 | .HasAnnotation("ProductVersion", "5.0.0"); 23 | 24 | modelBuilder.Entity("Asrfly.Core.Categories", b => 25 | { 26 | b.Property("Id") 27 | .ValueGeneratedOnAdd() 28 | .HasColumnType("int") 29 | .UseIdentityColumn(); 30 | 31 | b.Property("AddedDate") 32 | .HasColumnType("datetime2"); 33 | 34 | b.Property("Balance") 35 | .HasColumnType("float"); 36 | 37 | b.Property("Details") 38 | .HasColumnType("nvarchar(max)"); 39 | 40 | b.Property("Name") 41 | .HasColumnType("nvarchar(max)"); 42 | 43 | b.Property("Type") 44 | .HasColumnType("nvarchar(max)"); 45 | 46 | b.HasKey("Id"); 47 | 48 | b.ToTable("Categories"); 49 | }); 50 | 51 | modelBuilder.Entity("Asrfly.Core.Customers", b => 52 | { 53 | b.Property("Id") 54 | .ValueGeneratedOnAdd() 55 | .HasColumnType("int") 56 | .UseIdentityColumn(); 57 | 58 | b.Property("AddedDate") 59 | .HasColumnType("datetime2"); 60 | 61 | b.Property("Address") 62 | .HasColumnType("nvarchar(max)"); 63 | 64 | b.Property("Balance") 65 | .HasColumnType("float"); 66 | 67 | b.Property("Details") 68 | .HasColumnType("nvarchar(max)"); 69 | 70 | b.Property("Email") 71 | .HasColumnType("nvarchar(max)"); 72 | 73 | b.Property("Name") 74 | .HasColumnType("nvarchar(max)"); 75 | 76 | b.Property("PhoneNumber") 77 | .HasColumnType("nvarchar(max)"); 78 | 79 | b.HasKey("Id"); 80 | 81 | b.ToTable("Customers"); 82 | }); 83 | 84 | modelBuilder.Entity("Asrfly.Core.Suppliers", b => 85 | { 86 | b.Property("Id") 87 | .ValueGeneratedOnAdd() 88 | .HasColumnType("int") 89 | .UseIdentityColumn(); 90 | 91 | b.Property("AddedDate") 92 | .HasColumnType("datetime2"); 93 | 94 | b.Property("Address") 95 | .HasColumnType("nvarchar(max)"); 96 | 97 | b.Property("Balance") 98 | .HasColumnType("float"); 99 | 100 | b.Property("Details") 101 | .HasColumnType("nvarchar(max)"); 102 | 103 | b.Property("Email") 104 | .HasColumnType("nvarchar(max)"); 105 | 106 | b.Property("Name") 107 | .HasColumnType("nvarchar(max)"); 108 | 109 | b.Property("PhoneNumber") 110 | .HasColumnType("nvarchar(max)"); 111 | 112 | b.HasKey("Id"); 113 | 114 | b.ToTable("Suppliers"); 115 | }); 116 | 117 | modelBuilder.Entity("Asrfly.Core.SystemRecords", b => 118 | { 119 | b.Property("Id") 120 | .ValueGeneratedOnAdd() 121 | .HasColumnType("int") 122 | .UseIdentityColumn(); 123 | 124 | b.Property("AddedDate") 125 | .HasColumnType("datetime2"); 126 | 127 | b.Property("Details") 128 | .HasColumnType("nvarchar(max)"); 129 | 130 | b.Property("Title") 131 | .HasColumnType("nvarchar(max)"); 132 | 133 | b.Property("UserName") 134 | .HasColumnType("nvarchar(max)"); 135 | 136 | b.HasKey("Id"); 137 | 138 | b.ToTable("SystemRecords"); 139 | }); 140 | #pragma warning restore 612, 618 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiHome/HomeUserControl.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Code; 2 | using Asrfly.Core; 3 | using Asrfly.Data; 4 | using Asrfly.Gui.GuiCategories; 5 | using Asrfly.Gui.GuiCustomers; 6 | using Asrfly.Gui.GuiIncome; 7 | using Asrfly.Gui.GuiOutcome; 8 | using Asrfly.Gui.GuiProjects; 9 | using Asrfly.Gui.GuiSuppliers; 10 | using Asrfly.Gui.GuiUsers; 11 | using System; 12 | using System.Collections.Generic; 13 | using System.ComponentModel; 14 | using System.Data; 15 | using System.Drawing; 16 | using System.IO; 17 | using System.Linq; 18 | using System.Text; 19 | using System.Windows.Forms; 20 | 21 | namespace Asrfly.Gui.GuiHome 22 | { 23 | public partial class HomeUserControl : UserControl 24 | { 25 | private static HomeUserControl _HomeUserControl; 26 | private int ProjectId; 27 | private readonly IDataHelper dataHelper; 28 | 29 | public HomeUserControl() 30 | { 31 | InitializeComponent(); 32 | dataHelper = (IDataHelper)ConfigrationObjectManager.GetObject("Projects"); 33 | SetRoles(); 34 | SetGeneralSettings(); 35 | SetHello(); 36 | } 37 | 38 | public static HomeUserControl Instance() 39 | { 40 | return _HomeUserControl ?? (new HomeUserControl()); 41 | } 42 | 43 | private void SetRoles() 44 | { 45 | if (!UsersRolesManager.GetRole("checkBoxAccessCategory")) 46 | { 47 | buttonAddCategory.Visible = false; 48 | } 49 | if (!UsersRolesManager.GetRole("checkBoxAccessCategory")) 50 | { 51 | buttonAddCategory.Visible = false; 52 | } 53 | if (!UsersRolesManager.GetRole("checkBoxAccessSupllier")) 54 | { 55 | buttonAddSupplier.Visible = false; 56 | } 57 | if (!UsersRolesManager.GetRole("checkBoxAccessCusteorm")) 58 | { 59 | buttonAddCustomer.Visible = false; 60 | } 61 | if (!UsersRolesManager.GetRole("checkBoxAccessProjects")) 62 | { 63 | buttonAddProject.Visible = false; 64 | } 65 | if (!UsersRolesManager.GetRole("checkBoxAccessUsers")) 66 | { 67 | buttonAddUser.Visible = false; 68 | } 69 | if (!UsersRolesManager.GetRole("checkBoxAccessOutcome")) 70 | { 71 | buttonAddOutput.Visible = false; 72 | } 73 | if (!UsersRolesManager.GetRole("checkBoxAccesIncome")) 74 | { 75 | buttonAddInput.Visible = false; 76 | } 77 | } 78 | 79 | private void SetGeneralSettings() 80 | { 81 | labelCompanyName.Text = Properties.Settings.Default.CompanyName; 82 | 83 | // Set Picture 84 | 85 | if (Properties.Settings.Default.CompanyLogo != string.Empty) // Check if first open 86 | { 87 | var ImgaeAsByte = Convert.FromBase64String(Properties.Settings.Default.CompanyLogo); // Convert string to byte 88 | 89 | using (MemoryStream ma = new MemoryStream(ImgaeAsByte)) 90 | { 91 | pictureBoxLogo.Image = Image.FromStream(ma); // Set picture 92 | } 93 | } 94 | } 95 | 96 | private void SetHello() 97 | { 98 | labelWellcome.Text = "مرحبا بك "+ Properties.Settings.Default.UserName; 99 | } 100 | 101 | private void buttonAddCategory_Click(object sender, EventArgs e) 102 | { 103 | AddCategoryForm addCategoryForm = new AddCategoryForm(0, new CategoryUserControl()); 104 | addCategoryForm.Show(); 105 | } 106 | 107 | private void buttonAddCustomer_Click(object sender, EventArgs e) 108 | { 109 | AddCustomersForm addCustomersForm = new AddCustomersForm(0, new CustomersUserControl()); 110 | addCustomersForm.Show(); 111 | } 112 | 113 | private void buttonAddSupplier_Click(object sender, EventArgs e) 114 | { 115 | AddSuppliersForm addSuppliersForm = new AddSuppliersForm(0, new SuppliersUserControl()); 116 | addSuppliersForm.Show(); 117 | } 118 | 119 | private void buttonAddProject_Click(object sender, EventArgs e) 120 | { 121 | AddProjectForm addProjectsForm = new AddProjectForm(0, new ProjectsUserControl()); 122 | addProjectsForm.Show(); 123 | } 124 | 125 | private void buttonAddUser_Click(object sender, EventArgs e) 126 | { 127 | AddUserForm addCategoryForm = new AddUserForm(0, new UsersControl(), false); 128 | addCategoryForm.Show(); 129 | } 130 | 131 | private async void HomeUserControl_Load(object sender, EventArgs e) 132 | { 133 | // Get List of Suppliers 134 | var ListOfProjects = await dataHelper.GetAllDataAsync(); 135 | comboBoxProject.DataSource = ListOfProjects.Select(x => x.Name).ToList(); // Fill 136 | // Auto Complete 137 | AutoCompleteStringCollection autoCompleteString = new AutoCompleteStringCollection(); 138 | autoCompleteString.AddRange(ListOfProjects.Select(x => x.Name).ToArray()); 139 | comboBoxProject.AutoCompleteCustomSource = autoCompleteString; 140 | 141 | ListOfProjects.Clear(); // clear 142 | } 143 | 144 | private void comboBoxProject_SelectedIndexChanged(object sender, EventArgs e) 145 | { 146 | var projectName = comboBoxProject.SelectedItem.ToString(); 147 | ProjectId = dataHelper.GetAllData().Where(X => X.Name == projectName).Select(x => x.Id).FirstOrDefault(); 148 | } 149 | 150 | private void buttonAddOutput_Click(object sender, EventArgs e) 151 | { 152 | if (ProjectId > 0) 153 | { 154 | AddOutcomeForm addOutcomeForm = new AddOutcomeForm(0, ProjectId, new OutcomeUserControl(ProjectId)); 155 | addOutcomeForm.Show(); 156 | } 157 | else 158 | { 159 | MessageBox.Show("اختر المشروع لطفا"); 160 | } 161 | } 162 | 163 | private void buttonAddInput_Click(object sender, EventArgs e) 164 | { 165 | if (ProjectId > 0) 166 | { 167 | AddIncomeForm addIncomeForm = new AddIncomeForm(0, ProjectId, new IncomeUserControl(ProjectId)); 168 | addIncomeForm.Show(); 169 | } 170 | else 171 | { 172 | MessageBox.Show("اختر المشروع لطفا"); 173 | } 174 | } 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /Asrfly.Data/Migrations/20230313165737_AddProjectTable.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Asrfly.Data.SqlServer; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | namespace Asrfly.Data.Migrations 11 | { 12 | [DbContext(typeof(DBContext))] 13 | [Migration("20230313165737_AddProjectTable")] 14 | partial class AddProjectTable 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .UseIdentityColumns() 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 22 | .HasAnnotation("ProductVersion", "5.0.0"); 23 | 24 | modelBuilder.Entity("Asrfly.Core.Categories", b => 25 | { 26 | b.Property("Id") 27 | .ValueGeneratedOnAdd() 28 | .HasColumnType("int") 29 | .UseIdentityColumn(); 30 | 31 | b.Property("AddedDate") 32 | .HasColumnType("datetime2"); 33 | 34 | b.Property("Balance") 35 | .HasColumnType("float"); 36 | 37 | b.Property("Details") 38 | .HasColumnType("nvarchar(max)"); 39 | 40 | b.Property("Name") 41 | .HasColumnType("nvarchar(max)"); 42 | 43 | b.Property("Type") 44 | .HasColumnType("nvarchar(max)"); 45 | 46 | b.HasKey("Id"); 47 | 48 | b.ToTable("Categories"); 49 | }); 50 | 51 | modelBuilder.Entity("Asrfly.Core.Customers", b => 52 | { 53 | b.Property("Id") 54 | .ValueGeneratedOnAdd() 55 | .HasColumnType("int") 56 | .UseIdentityColumn(); 57 | 58 | b.Property("AddedDate") 59 | .HasColumnType("datetime2"); 60 | 61 | b.Property("Address") 62 | .HasColumnType("nvarchar(max)"); 63 | 64 | b.Property("Balance") 65 | .HasColumnType("float"); 66 | 67 | b.Property("Details") 68 | .HasColumnType("nvarchar(max)"); 69 | 70 | b.Property("Email") 71 | .HasColumnType("nvarchar(max)"); 72 | 73 | b.Property("Name") 74 | .HasColumnType("nvarchar(max)"); 75 | 76 | b.Property("PhoneNumber") 77 | .HasColumnType("nvarchar(max)"); 78 | 79 | b.HasKey("Id"); 80 | 81 | b.ToTable("Customers"); 82 | }); 83 | 84 | modelBuilder.Entity("Asrfly.Core.Projects", b => 85 | { 86 | b.Property("Id") 87 | .ValueGeneratedOnAdd() 88 | .HasColumnType("int") 89 | .UseIdentityColumn(); 90 | 91 | b.Property("AddedDate") 92 | .HasColumnType("datetime2"); 93 | 94 | b.Property("Address") 95 | .HasColumnType("nvarchar(max)"); 96 | 97 | b.Property("Company") 98 | .HasColumnType("nvarchar(max)"); 99 | 100 | b.Property("Customer") 101 | .HasColumnType("nvarchar(max)"); 102 | 103 | b.Property("Details") 104 | .HasColumnType("nvarchar(max)"); 105 | 106 | b.Property("FinishDate") 107 | .HasColumnType("datetime2"); 108 | 109 | b.Property("Income") 110 | .HasColumnType("float"); 111 | 112 | b.Property("Name") 113 | .HasColumnType("nvarchar(max)"); 114 | 115 | b.Property("Outcome") 116 | .HasColumnType("float"); 117 | 118 | b.Property("Revenue") 119 | .HasColumnType("float"); 120 | 121 | b.Property("StartDate") 122 | .HasColumnType("datetime2"); 123 | 124 | b.HasKey("Id"); 125 | 126 | b.ToTable("Projects"); 127 | }); 128 | 129 | modelBuilder.Entity("Asrfly.Core.Suppliers", b => 130 | { 131 | b.Property("Id") 132 | .ValueGeneratedOnAdd() 133 | .HasColumnType("int") 134 | .UseIdentityColumn(); 135 | 136 | b.Property("AddedDate") 137 | .HasColumnType("datetime2"); 138 | 139 | b.Property("Address") 140 | .HasColumnType("nvarchar(max)"); 141 | 142 | b.Property("Balance") 143 | .HasColumnType("float"); 144 | 145 | b.Property("Details") 146 | .HasColumnType("nvarchar(max)"); 147 | 148 | b.Property("Email") 149 | .HasColumnType("nvarchar(max)"); 150 | 151 | b.Property("Name") 152 | .HasColumnType("nvarchar(max)"); 153 | 154 | b.Property("PhoneNumber") 155 | .HasColumnType("nvarchar(max)"); 156 | 157 | b.HasKey("Id"); 158 | 159 | b.ToTable("Suppliers"); 160 | }); 161 | 162 | modelBuilder.Entity("Asrfly.Core.SystemRecords", b => 163 | { 164 | b.Property("Id") 165 | .ValueGeneratedOnAdd() 166 | .HasColumnType("int") 167 | .UseIdentityColumn(); 168 | 169 | b.Property("AddedDate") 170 | .HasColumnType("datetime2"); 171 | 172 | b.Property("Details") 173 | .HasColumnType("nvarchar(max)"); 174 | 175 | b.Property("Title") 176 | .HasColumnType("nvarchar(max)"); 177 | 178 | b.Property("UserName") 179 | .HasColumnType("nvarchar(max)"); 180 | 181 | b.HasKey("Id"); 182 | 183 | b.ToTable("SystemRecords"); 184 | }); 185 | #pragma warning restore 612, 618 186 | } 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiCategories/AddCategoryForm.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Code; 2 | using Asrfly.Core; 3 | using Asrfly.Data; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel; 7 | using System.Data; 8 | using System.Drawing; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | 13 | namespace Asrfly.Gui.GuiCategories 14 | { 15 | public partial class AddCategoryForm : Form 16 | { 17 | // Variables 18 | private readonly int ID; 19 | private readonly CategoryUserControl categoryUserControl; 20 | private Categories categories; 21 | private readonly IDataHelper dataHelper; 22 | private readonly GuiLoading.LoadingForm loadingForm; 23 | private readonly IDataHelper dataHelperSystemRecords; 24 | 25 | public AddCategoryForm(int Id, CategoryUserControl ctegoryUserControl) 26 | { 27 | InitializeComponent(); 28 | dataHelper = (IDataHelper)ConfigrationObjectManager.GetObject("Categories"); 29 | dataHelperSystemRecords = (IDataHelper)ConfigrationObjectManager.GetObject("SystemRecords"); 30 | 31 | loadingForm = new GuiLoading.LoadingForm(); 32 | this.ID = Id; 33 | this.categoryUserControl = ctegoryUserControl; 34 | 35 | } 36 | 37 | #region Events 38 | private async void buttonSaveAndClose_Click(object sender, EventArgs e) 39 | { 40 | if (IsFiledsEmpty()) 41 | { 42 | MessageCollections.ShowFiledsRequired(); 43 | } 44 | else 45 | { 46 | loadingForm.Show(); 47 | if (await SaveData()) 48 | { 49 | if (ID == 0) 50 | { 51 | this.DialogResult = DialogResult.OK; 52 | MessageCollections.ShowAddNotificaiton(); 53 | } 54 | else 55 | { 56 | MessageCollections.ShowUpdateNotificaiton(); 57 | } 58 | Close(); 59 | } 60 | else 61 | { 62 | MessageCollections.ShowErrorServer(); 63 | } 64 | loadingForm.Hide(); 65 | } 66 | } 67 | 68 | private async void buttonSave_Click(object sender, EventArgs e) 69 | { 70 | if (IsFiledsEmpty()) 71 | { 72 | MessageCollections.ShowFiledsRequired(); 73 | } 74 | else 75 | { 76 | loadingForm.Show(); 77 | if (await SaveData()) 78 | { 79 | if (ID == 0) 80 | { 81 | MessageCollections.ShowAddNotificaiton(); 82 | this.DialogResult = DialogResult.OK; 83 | } 84 | else 85 | { 86 | MessageCollections.ShowUpdateNotificaiton(); 87 | } 88 | } 89 | else 90 | { 91 | MessageCollections.ShowErrorServer(); 92 | } 93 | loadingForm.Hide(); 94 | } 95 | } 96 | private void AddCategoryForm_Load(object sender, EventArgs e) 97 | { 98 | loadingForm.Show(); 99 | SetFiledData(); 100 | loadingForm.Hide(); 101 | 102 | } 103 | #endregion 104 | 105 | #region Methods 106 | 107 | private async Task SaveData() 108 | { 109 | // Add 110 | if (ID == 0) 111 | { 112 | return await AddData(); 113 | } 114 | // Edit 115 | else 116 | { 117 | return await EditData(); 118 | } 119 | } 120 | 121 | private bool IsFiledsEmpty() 122 | { 123 | if (textBoxName.Text == string.Empty || comboBoxType.Text == string.Empty) 124 | { 125 | return true; 126 | } 127 | else 128 | { 129 | return false; 130 | } 131 | } 132 | 133 | private async Task AddData() 134 | { 135 | // Set Data 136 | categories = new Categories 137 | { 138 | Name = textBoxName.Text, 139 | Type = comboBoxType.SelectedItem.ToString(), 140 | Details = richTextBoxDetails.Text, 141 | AddedDate = DateTime.Now, 142 | }; 143 | // Sumbit 144 | var result = await dataHelper.AddAsync(categories); 145 | if (result == 1) 146 | { 147 | // Save System Records 148 | SystemRecords systemRecords = new SystemRecords 149 | { 150 | Title = " اضافة صنف", 151 | UserName = Properties.Settings.Default.UserName, 152 | Details = "تمت اضافة صنف "+categories.Name, 153 | AddedDate = DateTime.Now 154 | }; 155 | await dataHelperSystemRecords.AddAsync(systemRecords); 156 | categoryUserControl.LoadData(); 157 | return true; 158 | } 159 | else 160 | { 161 | return false; 162 | } 163 | } 164 | 165 | private async Task EditData() 166 | { 167 | // Set Data 168 | categories = new Categories 169 | { 170 | Id = ID, 171 | Name = textBoxName.Text, 172 | Type = comboBoxType.SelectedItem.ToString(), 173 | Details = richTextBoxDetails.Text, 174 | AddedDate = DateTime.Now, 175 | }; 176 | // Sumbit 177 | var result = await dataHelper.EditAsync(categories); 178 | if (result == 1) 179 | { 180 | // Save System Records 181 | SystemRecords systemRecords = new SystemRecords 182 | { 183 | Title = " تعديل صنف", 184 | UserName = Properties.Settings.Default.UserName, 185 | Details = "تم تعديل صنف " + categories.Name, 186 | AddedDate = DateTime.Now 187 | }; 188 | await dataHelperSystemRecords.AddAsync(systemRecords); 189 | // Toast 190 | categoryUserControl.LoadData(); 191 | return true; 192 | } 193 | else 194 | { 195 | return false; 196 | } 197 | } 198 | 199 | private async void SetFiledData() 200 | { 201 | if (ID > 0) 202 | { 203 | // Set Filed 204 | categories = await dataHelper.FindAsync(ID); 205 | if (categories != null) 206 | { 207 | textBoxName.Text = categories.Name; 208 | textBoxBalance.Text = categories.Balance.ToString(); 209 | comboBoxType.SelectedItem = categories.Type; 210 | richTextBoxDetails.Text = categories.Details; 211 | } 212 | else 213 | { 214 | MessageCollections.ShowErrorServer(); 215 | } 216 | } 217 | } 218 | #endregion 219 | 220 | 221 | } 222 | } 223 | -------------------------------------------------------------------------------- /Asrfly.Data/SqlServer/UsersRolesEntity.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace Asrfly.Data.SqlServer 8 | { 9 | public class UsersRolesRolesEntity : IDataHelper 10 | { 11 | 12 | // Variables 13 | private DBContext db; 14 | private UsersRoles table; 15 | // Constructors 16 | public UsersRolesRolesEntity() 17 | { 18 | db = new DBContext(); 19 | } 20 | 21 | #region Methods 22 | public int Add(UsersRoles table) 23 | { 24 | try 25 | { 26 | if (db.Database.CanConnect()) 27 | { 28 | db.UsersRoles.Add(table); 29 | db.SaveChanges(); 30 | return 1; 31 | } 32 | else 33 | { 34 | return 0; 35 | } 36 | } 37 | catch 38 | { 39 | return 0; 40 | } 41 | } 42 | 43 | public async Task AddAsync(UsersRoles table) 44 | { 45 | try 46 | { 47 | if (await db.Database.CanConnectAsync()) 48 | { 49 | await db.UsersRoles.AddAsync(table); 50 | await db.SaveChangesAsync(); 51 | return 1; 52 | } 53 | else 54 | { 55 | return 0; 56 | } 57 | } 58 | catch 59 | { 60 | return 0; 61 | } 62 | } 63 | 64 | public int Delete(int Id) 65 | { 66 | try 67 | { 68 | if (db.Database.CanConnect()) 69 | { 70 | table = Find(Id); 71 | db.UsersRoles.Remove(table); 72 | db.SaveChanges(); 73 | return 1; 74 | } 75 | else 76 | { 77 | return 0; 78 | } 79 | } 80 | catch 81 | { 82 | return 0; 83 | } 84 | } 85 | 86 | public async Task DeleteAsync(int Id) 87 | { 88 | try 89 | { 90 | if (await db.Database.CanConnectAsync()) 91 | { 92 | table = await FindAsync(Id); 93 | await Task.Run(() => db.UsersRoles.Remove(table)); 94 | await db.SaveChangesAsync(); 95 | return 1; 96 | } 97 | else 98 | { 99 | return 0; 100 | } 101 | } 102 | catch 103 | { 104 | return 0; 105 | } 106 | } 107 | 108 | public int Edit(UsersRoles table) 109 | { 110 | try 111 | { 112 | if (db.Database.CanConnect()) 113 | { 114 | db = new DBContext(); 115 | db.UsersRoles.Update(table); 116 | db.SaveChanges(); 117 | return 1; 118 | } 119 | else 120 | { 121 | return 0; 122 | } 123 | } 124 | catch 125 | { 126 | return 0; 127 | } 128 | } 129 | 130 | public async Task EditAsync(UsersRoles table) 131 | { 132 | try 133 | { 134 | if (await db.Database.CanConnectAsync()) 135 | { 136 | db = new DBContext(); 137 | await Task.Run(() => db.UsersRoles.Update(table)); 138 | await db.SaveChangesAsync(); 139 | return 1; 140 | } 141 | else 142 | { 143 | return 0; 144 | } 145 | } 146 | catch 147 | { 148 | return 0; 149 | } 150 | } 151 | 152 | public UsersRoles Find(int Id) 153 | { 154 | try 155 | { 156 | if (db.Database.CanConnect()) 157 | { 158 | return db.UsersRoles.Where(x => x.Id == Id).First(); 159 | } 160 | else 161 | { 162 | return null; 163 | } 164 | } 165 | catch 166 | { 167 | return null; 168 | } 169 | } 170 | 171 | public async Task FindAsync(int Id) 172 | { 173 | try 174 | { 175 | if (await db.Database.CanConnectAsync()) 176 | { 177 | return await Task.Run(() => db.UsersRoles.Where(x => x.Id == Id).First()); 178 | } 179 | else 180 | { 181 | return null; 182 | } 183 | } 184 | catch 185 | { 186 | return null; 187 | } 188 | } 189 | 190 | public List GetAllData() 191 | { 192 | try 193 | { 194 | if (db.Database.CanConnect()) 195 | { 196 | return db.UsersRoles.ToList(); 197 | } 198 | else 199 | { 200 | return null; 201 | } 202 | } 203 | catch 204 | { 205 | return null; 206 | } 207 | } 208 | 209 | public async Task> GetAllDataAsync() 210 | { 211 | try 212 | { 213 | if (await db.Database.CanConnectAsync()) 214 | { 215 | return await Task.Run(() => db.UsersRoles.ToList()); 216 | } 217 | else 218 | { 219 | return null; 220 | } 221 | } 222 | catch 223 | { 224 | return null; 225 | } 226 | } 227 | 228 | public List Search(string SearchItem) 229 | { 230 | try 231 | { 232 | if (db.Database.CanConnect()) 233 | { 234 | return db.UsersRoles.Where(x => x.Id.ToString() == SearchItem 235 | || x.Key.Contains(SearchItem) 236 | ) 237 | .ToList(); 238 | } 239 | else 240 | { 241 | return null; 242 | } 243 | } 244 | catch 245 | { 246 | return null; 247 | } 248 | } 249 | 250 | public async Task> SearchAsync(string SearchItem) 251 | { 252 | try 253 | { 254 | if (await db.Database.CanConnectAsync()) 255 | { 256 | return await Task.Run(() => db.UsersRoles.Where(x => x.Id.ToString() == SearchItem 257 | || x.Key.Contains(SearchItem) 258 | ) 259 | .ToList()); 260 | } 261 | else 262 | { 263 | return null; 264 | } 265 | } 266 | catch 267 | { 268 | return null; 269 | } 270 | } 271 | #endregion 272 | } 273 | } 274 | -------------------------------------------------------------------------------- /Asrfly/Gui/GuiSuppliers/AddSuppliersForm.cs: -------------------------------------------------------------------------------- 1 | using Asrfly.Code; 2 | using Asrfly.Core; 3 | using Asrfly.Data; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel; 7 | using System.Data; 8 | using System.Drawing; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | 13 | namespace Asrfly.Gui.GuiSuppliers 14 | { 15 | public partial class AddSuppliersForm : Form 16 | { 17 | // Variables 18 | private readonly int ID; 19 | private readonly SuppliersUserControl categoryUserControl; 20 | private Suppliers suppliers; 21 | private readonly IDataHelper dataHelper; 22 | private readonly GuiLoading.LoadingForm loadingForm; 23 | private readonly IDataHelper dataHelperSystemRecords; 24 | 25 | public AddSuppliersForm(int Id, SuppliersUserControl ctegoryUserControl) 26 | { 27 | InitializeComponent(); 28 | dataHelper = (IDataHelper)ConfigrationObjectManager.GetObject("Suppliers"); 29 | dataHelperSystemRecords = (IDataHelper)ConfigrationObjectManager.GetObject("SystemRecords"); 30 | 31 | loadingForm = new GuiLoading.LoadingForm(); 32 | this.ID = Id; 33 | this.categoryUserControl = ctegoryUserControl; 34 | 35 | } 36 | 37 | #region Events 38 | private async void buttonSaveAndClose_Click(object sender, EventArgs e) 39 | { 40 | if (IsFiledsEmpty()) 41 | { 42 | MessageCollections.ShowFiledsRequired(); 43 | } 44 | else 45 | { 46 | loadingForm.Show(); 47 | if (await SaveData()) 48 | { 49 | if (ID == 0) 50 | { 51 | MessageCollections.ShowAddNotificaiton(); 52 | } 53 | else 54 | { 55 | MessageCollections.ShowUpdateNotificaiton(); 56 | } 57 | Close(); 58 | } 59 | else 60 | { 61 | MessageCollections.ShowErrorServer(); 62 | } 63 | loadingForm.Hide(); 64 | } 65 | } 66 | 67 | private async void buttonSave_Click(object sender, EventArgs e) 68 | { 69 | if (IsFiledsEmpty()) 70 | { 71 | MessageCollections.ShowFiledsRequired(); 72 | } 73 | else 74 | { 75 | loadingForm.Show(); 76 | if (await SaveData()) 77 | { 78 | if (ID == 0) 79 | { 80 | this.DialogResult = DialogResult.OK; 81 | MessageCollections.ShowAddNotificaiton(); 82 | } 83 | else 84 | { 85 | MessageCollections.ShowUpdateNotificaiton(); 86 | } 87 | } 88 | else 89 | { 90 | MessageCollections.ShowErrorServer(); 91 | } 92 | loadingForm.Hide(); 93 | } 94 | } 95 | private void AddCategoryForm_Load(object sender, EventArgs e) 96 | { 97 | loadingForm.Show(); 98 | SetFiledData(); 99 | loadingForm.Hide(); 100 | 101 | } 102 | #endregion 103 | 104 | #region Methods 105 | 106 | private async Task SaveData() 107 | { 108 | // Add 109 | if (ID == 0) 110 | { 111 | return await AddData(); 112 | } 113 | // Edit 114 | else 115 | { 116 | return await EditData(); 117 | } 118 | } 119 | 120 | private bool IsFiledsEmpty() 121 | { 122 | if (textBoxName.Text == string.Empty) 123 | { 124 | return true; 125 | } 126 | else 127 | { 128 | return false; 129 | } 130 | } 131 | 132 | private async Task AddData() 133 | { 134 | // Set Data 135 | suppliers = new Suppliers 136 | { 137 | Name = textBoxName.Text, 138 | Address=textBoxAddress.Text, 139 | PhoneNumber=textBoxPhoneNumber.Text, 140 | Details = richTextBoxDetails.Text, 141 | AddedDate = DateTime.Now, 142 | Email=textBoxEmail.Text, 143 | }; 144 | // Sumbit 145 | var result = await dataHelper.AddAsync(suppliers); 146 | if (result == 1) 147 | { 148 | // Save System Records 149 | SystemRecords systemRecords = new SystemRecords 150 | { 151 | Title = " اضافة مورد", 152 | UserName = Properties.Settings.Default.UserName, 153 | Details = "تمت اضافة مورد "+suppliers.Name, 154 | AddedDate = DateTime.Now 155 | }; 156 | await dataHelperSystemRecords.AddAsync(systemRecords); 157 | categoryUserControl.LoadData(); 158 | return true; 159 | } 160 | else 161 | { 162 | return false; 163 | } 164 | } 165 | 166 | private async Task EditData() 167 | { 168 | // Set Data 169 | suppliers = new Suppliers 170 | { 171 | Id = ID, 172 | Name = textBoxName.Text, 173 | Address = textBoxAddress.Text, 174 | PhoneNumber = textBoxPhoneNumber.Text, 175 | Details = richTextBoxDetails.Text, 176 | AddedDate = DateTime.Now, 177 | Email = textBoxEmail.Text, 178 | }; 179 | // Sumbit 180 | var result = await dataHelper.EditAsync(suppliers); 181 | if (result == 1) 182 | { 183 | // Save System Records 184 | SystemRecords systemRecords = new SystemRecords 185 | { 186 | Title = " تعديل مورد", 187 | UserName = Properties.Settings.Default.UserName, 188 | Details = "تم تعديل مورد " + suppliers.Name, 189 | AddedDate = DateTime.Now 190 | }; 191 | await dataHelperSystemRecords.AddAsync(systemRecords); 192 | // Toast 193 | categoryUserControl.LoadData(); 194 | return true; 195 | } 196 | else 197 | { 198 | return false; 199 | } 200 | } 201 | 202 | private async void SetFiledData() 203 | { 204 | if (ID > 0) 205 | { 206 | // Set Filed 207 | suppliers = await dataHelper.FindAsync(ID); 208 | if (suppliers != null) 209 | { 210 | textBoxName.Text = suppliers.Name; 211 | textBoxEmail.Text = suppliers.Email; 212 | textBoxPhoneNumber.Text = suppliers.PhoneNumber; 213 | textBoxAddress.Text = suppliers.Address; 214 | textBoxBalance.Text = suppliers.Balance.ToString(); 215 | richTextBoxDetails.Text = suppliers.Details; 216 | } 217 | else 218 | { 219 | MessageCollections.ShowErrorServer(); 220 | } 221 | } 222 | } 223 | #endregion 224 | 225 | 226 | } 227 | } 228 | --------------------------------------------------------------------------------