├── .gitattributes ├── .gitignore ├── App.config ├── DBConnection.cs ├── FodyWeavers.xml ├── GGMSYS-removebg-preview.ico ├── GGMSYS.csproj ├── GGMSYS.sln ├── GGMSYS.sql ├── GGMSYS2.sql ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs ├── Settings.settings └── app.manifest ├── README.md ├── Resources ├── icons8-add-basket-30.png ├── icons8-delete-30.png ├── icons8-filter-30.png └── icons8-save-30.png ├── apppic ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png └── 8.png ├── frm_Client.Designer.cs ├── frm_Client.cs ├── frm_Client.resx ├── frm_Login.Designer.cs ├── frm_Login.cs ├── frm_Login.resx ├── frm_Main.Designer.cs ├── frm_Main.cs ├── frm_Main.resx ├── frm_Reports.Designer.cs ├── frm_Reports.cs ├── frm_Reports.resx ├── frm_Sales.Designer.cs ├── frm_Sales.cs ├── frm_Sales.resx ├── frm_Stock.Designer.cs ├── frm_Stock.cs ├── frm_Stock.resx ├── frm_StockActivity.Designer.cs ├── frm_StockActivity.cs ├── frm_StockActivity.resx ├── frm_Users.Designer.cs ├── frm_Users.cs ├── frm_Users.resx └── packages.config /.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /DBConnection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using System.Data.SqlClient; 4 | 5 | public static class DBHelper 6 | { 7 | private static string connectionString = "Server=DATASRV;Database=GGMSYS;Trusted_Connection=True;"; 8 | 9 | // Veritabanı bağlantısı almak için kullanılır 10 | public static SqlConnection GetConnection() 11 | { 12 | return new SqlConnection(connectionString); 13 | } 14 | 15 | // SELECT sorguları için kullanılır 16 | public static DataTable ExecuteSelectCommand(string commandText, CommandType cmdType, SqlParameter[] parameters = null) 17 | { 18 | DataTable table = new DataTable(); 19 | using (SqlConnection conn = GetConnection()) 20 | { 21 | using (SqlCommand cmd = new SqlCommand(commandText, conn)) 22 | { 23 | cmd.CommandType = cmdType; 24 | if (parameters != null) 25 | { 26 | cmd.Parameters.AddRange(parameters); 27 | } 28 | conn.Open(); 29 | using (SqlDataAdapter da = new SqlDataAdapter(cmd)) 30 | { 31 | da.Fill(table); 32 | } 33 | } 34 | } 35 | return table; 36 | } 37 | 38 | 39 | public static object ExecuteScalar(string commandText, CommandType commandType = CommandType.Text, SqlParameter[] parameters = null) 40 | { 41 | using (SqlConnection connection = new SqlConnection(connectionString)) 42 | { 43 | using (SqlCommand command = new SqlCommand(commandText, connection)) 44 | { 45 | command.CommandType = commandType; 46 | 47 | if (parameters != null) 48 | { 49 | command.Parameters.AddRange(parameters); 50 | } 51 | 52 | connection.Open(); 53 | return command.ExecuteScalar(); 54 | } 55 | } 56 | } 57 | 58 | // INSERT, UPDATE, DELETE sorguları için kullanılır 59 | public static int ExecuteNonQuery(string commandText, CommandType cmdType, SqlParameter[] parameters = null) 60 | { 61 | int result = 0; 62 | using (SqlConnection conn = GetConnection()) 63 | { 64 | using (SqlCommand cmd = new SqlCommand(commandText, conn)) 65 | { 66 | cmd.CommandType = cmdType; 67 | if (parameters != null) 68 | { 69 | cmd.Parameters.AddRange(parameters); 70 | } 71 | conn.Open(); 72 | result = cmd.ExecuteNonQuery(); 73 | } 74 | } 75 | return result; 76 | } 77 | 78 | 79 | } 80 | -------------------------------------------------------------------------------- /FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /GGMSYS-removebg-preview.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/GGMSYS-removebg-preview.ico -------------------------------------------------------------------------------- /GGMSYS.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.9.34723.18 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GGMSYS", "GGMSYS.csproj", "{177AE64F-82C3-4F32-88A2-732F5242EEA7}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {177AE64F-82C3-4F32-88A2-732F5242EEA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {177AE64F-82C3-4F32-88A2-732F5242EEA7}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {177AE64F-82C3-4F32-88A2-732F5242EEA7}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {177AE64F-82C3-4F32-88A2-732F5242EEA7}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {99F330E9-E1D1-4F40-8FA8-BF4CD5E9AEA8} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /GGMSYS.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/GGMSYS.sql -------------------------------------------------------------------------------- /GGMSYS2.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/GGMSYS2.sql -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace GGMSYS 8 | { 9 | internal static class Program 10 | { 11 | /// 12 | /// Uygulamanın ana girdi noktası. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new frm_Login()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Bir bütünleştirilmiş koda ilişkin Genel Bilgiler aşağıdaki öznitelikler kümesiyle 6 | // denetlenir. Bütünleştirilmiş kod ile ilişkili bilgileri değiştirmek için 7 | // bu öznitelik değerlerini değiştirin. 8 | [assembly: AssemblyTitle("GGMSYS")] 9 | [assembly: AssemblyDescription("Satış ve Stok Yönetimi")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Gemciler Güven Metal")] 12 | [assembly: AssemblyProduct("GGMSYS")] 13 | [assembly: AssemblyCopyright("Copyright © 2024 aoaydin")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible özniteliğinin false olarak ayarlanması bu bütünleştirilmiş koddaki türleri 18 | // COM bileşenleri için görünmez yapar. Bu bütünleştirilmiş koddaki bir türe 19 | // erişmeniz gerekirse ComVisible özniteliğini o türde true olarak ayarlayın. 20 | [assembly: ComVisible(false)] 21 | 22 | // Bu proje COM'un kullanımına sunulursa, aşağıdaki GUID tür kitaplığının kimliği içindir 23 | [assembly: Guid("177ae64f-82c3-4f32-88a2-732f5242eea7")] 24 | 25 | // Bir derlemenin sürüm bilgileri aşağıdaki dört değerden oluşur: 26 | // 27 | // Ana Sürüm 28 | // İkincil Sürüm 29 | // Yapı Numarası 30 | // Düzeltme 31 | // 32 | // Tüm değerleri belirtebilir veya varsayılan Derleme ve Düzeltme Numaralarını kullanmak için 33 | // aşağıda gösterildiği gibi '*' kullanabilirsiniz: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Bu kod araç tarafından oluşturuldu. 4 | // Çalışma Zamanı Sürümü:4.0.30319.42000 5 | // 6 | // Bu dosyada yapılacak değişiklikler yanlış davranışa neden olabilir ve 7 | // kod yeniden oluşturulursa kaybolur. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GGMSYS.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// Yerelleştirilmiş dizeleri aramak gibi işlemler için, türü kesin olarak belirtilmiş kaynak sınıfı. 17 | /// 18 | // Bu sınıf ResGen veya Visual Studio gibi bir araç kullanılarak StronglyTypedResourceBuilder 19 | // sınıfı tarafından otomatik olarak oluşturuldu. 20 | // Üye eklemek veya kaldırmak için .ResX dosyanızı düzenleyin ve sonra da ResGen 21 | // komutunu /str seçeneğiyle yeniden çalıştırın veya VS projenizi yeniden oluşturun. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Bu sınıf tarafından kullanılan, önbelleğe alınmış ResourceManager örneğini döndürür. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GGMSYS.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Tümü için geçerli iş parçacığının CurrentUICulture özelliğini geçersiz kular 51 | /// CurrentUICulture özelliğini tüm kaynak aramaları için geçersiz kılar. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// System.Drawing.Bitmap türünde yerelleştirilmiş bir kaynak arar. 65 | /// 66 | internal static System.Drawing.Bitmap icons8_add_basket_30 { 67 | get { 68 | object obj = ResourceManager.GetObject("icons8-add-basket-30", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// System.Drawing.Bitmap türünde yerelleştirilmiş bir kaynak arar. 75 | /// 76 | internal static System.Drawing.Bitmap icons8_delete_30 { 77 | get { 78 | object obj = ResourceManager.GetObject("icons8-delete-30", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// System.Drawing.Bitmap türünde yerelleştirilmiş bir kaynak arar. 85 | /// 86 | internal static System.Drawing.Bitmap icons8_filter_30 { 87 | get { 88 | object obj = ResourceManager.GetObject("icons8-filter-30", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// System.Drawing.Bitmap türünde yerelleştirilmiş bir kaynak arar. 95 | /// 96 | internal static System.Drawing.Bitmap icons8_save_30 { 97 | get { 98 | object obj = ResourceManager.GetObject("icons8-save-30", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\icons8-save-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\Resources\icons8-delete-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | 128 | ..\Resources\icons8-filter-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | 131 | ..\Resources\icons8-add-basket-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 132 | 133 | -------------------------------------------------------------------------------- /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 GGMSYS.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Properties/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 50 | 58 | 59 | 73 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GGMSYS Windows Forms Application 2 | 3 | This is a Windows Forms application developed in C# using Visual Studio. The application includes functionalities for managing clients, sales, and stock activities. The application is designed to be responsive and includes features for exporting data to Excel files. 4 | 5 | ## Features 6 | 7 | - **Client Management**: Add, edit, and delete client information. Export client data to Excel. 8 | - **Sales Management**: View and filter sales data. Export sales data to Excel. 9 | - **Stock Management**: View stock information. Export stock data to Excel. 10 | - **Responsive Design**: The application is designed to be responsive, adjusting the layout based on the window size. 11 | 12 | ## Getting Started 13 | 14 | ### Prerequisites 15 | 16 | - .NET Framework 17 | - Visual Studio 18 | - ClosedXML library for Excel export 19 | 20 | ### Installation 21 | 22 | 1. Clone the repository: 23 | ```sh 24 | git clone https://github.com/aoaydin/ggmsys.git 25 | ``` 26 | 27 | 2. Open the solution in Visual Studio. 28 | 29 | 3. Restore the NuGet packages: 30 | ```sh 31 | Install-Package ClosedXML 32 | ``` 33 | 34 | 4. Build and run the application. 35 | 36 | ## Usage 37 | 38 | ### Client Management 39 | 40 | - **View Clients**: Display all clients with their details. 41 | - **Export Clients to Excel**: Click the "Export Clients" button to save client data to an Excel file. The system will prompt you to choose the save location. 42 | 43 | ### Sales Management 44 | 45 | - **View Sales**: Display all sales with detailed information including client and stock details. 46 | - **Filter Sales**: Filter sales data based on various criteria. 47 | - **Export Sales to Excel**: Click the "Export Sales" button to save sales data to an Excel file. The system will prompt you to choose the save location. 48 | 49 | ### Stock Management 50 | 51 | - **View Stock**: Display all stock items with their details. 52 | - **Export Stock to Excel**: Click the "Export Stock" button to save stock data to an Excel file. The system will prompt you to choose the save location. 53 | 54 | 55 | ## App Pictures 56 | 57 | ![Login](https://raw.githubusercontent.com/aoaydin/GGMSYS/master/apppic/1.png?token=GHSAT0AAAAAACS52C4YEUUYX42OUVVZRXSGZT5FSSQ) 58 | ![Main Menu](https://raw.githubusercontent.com/aoaydin/GGMSYS/master/apppic/2.png?token=GHSAT0AAAAAACS52C4YEUUYX42OUVVZRXSGZT5FSSQ) 59 | ![Stock List](https://raw.githubusercontent.com/aoaydin/GGMSYS/master/apppic/3.png?token=GHSAT0AAAAAACS52C4YEUUYX42OUVVZRXSGZT5FSSQ) 60 | ![Company List](https://raw.githubusercontent.com/aoaydin/GGMSYS/master/apppic/4.png?token=GHSAT0AAAAAACS52C4YEUUYX42OUVVZRXSGZT5FSSQ) 61 | ![](https://raw.githubusercontent.com/aoaydin/GGMSYS/master/apppic/5.png?token=GHSAT0AAAAAACS52C4YEUUYX42OUVVZRXSGZT5FSSQ) 62 | ![](https://raw.githubusercontent.com/aoaydin/GGMSYS/master/apppic/6.png?token=GHSAT0AAAAAACS52C4YEUUYX42OUVVZRXSGZT5FSSQ) 63 | ![](https://raw.githubusercontent.com/aoaydin/GGMSYS/master/apppic/7.png?token=GHSAT0AAAAAACS52C4YEUUYX42OUVVZRXSGZT5FSSQ) 64 | ![](https://raw.githubusercontent.com/aoaydin/GGMSYS/master/apppic/8.png?token=GHSAT0AAAAAACS52C4YEUUYX42OUVVZRXSGZT5FSSQ) 65 | 66 | ## Code Examples 67 | 68 | 69 | 70 | ### Load Sales Data 71 | 72 | ```csharp 73 | private void LoadSalesData() 74 | { 75 | try 76 | { 77 | string query = @" 78 | SELECT 79 | s.Evrak_Seri AS 'Evrak Seri', 80 | s.Evrak_Sira AS 'Evrak Sıra', 81 | s.ClientID AS 'Müşteri Kodu', 82 | c.CompanyName AS 'Firma Adı', 83 | st.StockCode AS 'Stok Kodu', 84 | st.StockName AS 'Stok Adı', 85 | s.Quantity AS 'Miktar', 86 | s.SalePrice AS 'Satış Fiyatı', 87 | (s.Quantity * s.SalePrice) AS 'Toplam Tutar', 88 | s.Quantity AS 'Toplam Miktar', 89 | CASE WHEN s.IsInStock = 1 THEN 'Giriş' ELSE 'Çıkış' END AS 'Stok Durumu', 90 | s.CreateDate AS 'Oluşturma Tarihi', 91 | s.UpdateDate AS 'Güncelleme Tarihi' 92 | FROM Sales s 93 | JOIN Stocks st ON s.StockID = st.StockID 94 | JOIN Clients c ON s.ClientID = c.ClientID"; 95 | DataTable salesTable = DBHelper.ExecuteSelectCommand(query, CommandType.Text); 96 | data_StockActivity.DataSource = salesTable; 97 | } 98 | catch (Exception ex) 99 | { 100 | MessageBox.Show($"Satış verileri yüklenirken bir hata oluştu: {ex.Message}", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Resources/icons8-add-basket-30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/Resources/icons8-add-basket-30.png -------------------------------------------------------------------------------- /Resources/icons8-delete-30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/Resources/icons8-delete-30.png -------------------------------------------------------------------------------- /Resources/icons8-filter-30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/Resources/icons8-filter-30.png -------------------------------------------------------------------------------- /Resources/icons8-save-30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/Resources/icons8-save-30.png -------------------------------------------------------------------------------- /apppic/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/apppic/1.png -------------------------------------------------------------------------------- /apppic/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/apppic/2.png -------------------------------------------------------------------------------- /apppic/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/apppic/3.png -------------------------------------------------------------------------------- /apppic/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/apppic/4.png -------------------------------------------------------------------------------- /apppic/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/apppic/5.png -------------------------------------------------------------------------------- /apppic/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/apppic/6.png -------------------------------------------------------------------------------- /apppic/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/apppic/7.png -------------------------------------------------------------------------------- /apppic/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoaydin/GGMSYS/6131c18d9e53b4568dbe81ab8ef2418c7e2f1440/apppic/8.png -------------------------------------------------------------------------------- /frm_Client.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace GGMSYS 2 | { 3 | partial class frm_Client 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frm_Client)); 32 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 33 | this.check_SaleOff = new System.Windows.Forms.CheckBox(); 34 | this.text_ClientPhone = new System.Windows.Forms.TextBox(); 35 | this.text_ClientMail = new System.Windows.Forms.TextBox(); 36 | this.label8 = new System.Windows.Forms.Label(); 37 | this.label9 = new System.Windows.Forms.Label(); 38 | this.text_ClientName = new System.Windows.Forms.TextBox(); 39 | this.text_CompanyName = new System.Windows.Forms.TextBox(); 40 | this.label6 = new System.Windows.Forms.Label(); 41 | this.label7 = new System.Windows.Forms.Label(); 42 | this.text_CompanySearch = new System.Windows.Forms.TextBox(); 43 | this.label5 = new System.Windows.Forms.Label(); 44 | this.btn_Delete = new System.Windows.Forms.Button(); 45 | this.btn_Save = new System.Windows.Forms.Button(); 46 | this.text_ClientSurname = new System.Windows.Forms.TextBox(); 47 | this.text_CompanyPhoneNo = new System.Windows.Forms.TextBox(); 48 | this.text_CompanyAddress = new System.Windows.Forms.TextBox(); 49 | this.text_ClientID = new System.Windows.Forms.TextBox(); 50 | this.label4 = new System.Windows.Forms.Label(); 51 | this.label3 = new System.Windows.Forms.Label(); 52 | this.label2 = new System.Windows.Forms.Label(); 53 | this.label1 = new System.Windows.Forms.Label(); 54 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 55 | this.data_CompanyList = new System.Windows.Forms.DataGridView(); 56 | this.groupBox1.SuspendLayout(); 57 | this.groupBox2.SuspendLayout(); 58 | ((System.ComponentModel.ISupportInitialize)(this.data_CompanyList)).BeginInit(); 59 | this.SuspendLayout(); 60 | // 61 | // groupBox1 62 | // 63 | this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 64 | | System.Windows.Forms.AnchorStyles.Right))); 65 | this.groupBox1.BackColor = System.Drawing.SystemColors.ActiveCaption; 66 | this.groupBox1.Controls.Add(this.check_SaleOff); 67 | this.groupBox1.Controls.Add(this.text_ClientPhone); 68 | this.groupBox1.Controls.Add(this.text_ClientMail); 69 | this.groupBox1.Controls.Add(this.label8); 70 | this.groupBox1.Controls.Add(this.label9); 71 | this.groupBox1.Controls.Add(this.text_ClientName); 72 | this.groupBox1.Controls.Add(this.text_CompanyName); 73 | this.groupBox1.Controls.Add(this.label6); 74 | this.groupBox1.Controls.Add(this.label7); 75 | this.groupBox1.Controls.Add(this.text_CompanySearch); 76 | this.groupBox1.Controls.Add(this.label5); 77 | this.groupBox1.Controls.Add(this.btn_Delete); 78 | this.groupBox1.Controls.Add(this.btn_Save); 79 | this.groupBox1.Controls.Add(this.text_ClientSurname); 80 | this.groupBox1.Controls.Add(this.text_CompanyPhoneNo); 81 | this.groupBox1.Controls.Add(this.text_CompanyAddress); 82 | this.groupBox1.Controls.Add(this.text_ClientID); 83 | this.groupBox1.Controls.Add(this.label4); 84 | this.groupBox1.Controls.Add(this.label3); 85 | this.groupBox1.Controls.Add(this.label2); 86 | this.groupBox1.Controls.Add(this.label1); 87 | this.groupBox1.Location = new System.Drawing.Point(3, 2); 88 | this.groupBox1.Name = "groupBox1"; 89 | this.groupBox1.Size = new System.Drawing.Size(793, 253); 90 | this.groupBox1.TabIndex = 2; 91 | this.groupBox1.TabStop = false; 92 | this.groupBox1.Text = "Ürün Detayları"; 93 | // 94 | // check_SaleOff 95 | // 96 | this.check_SaleOff.AutoSize = true; 97 | this.check_SaleOff.Location = new System.Drawing.Point(656, 215); 98 | this.check_SaleOff.Name = "check_SaleOff"; 99 | this.check_SaleOff.Size = new System.Drawing.Size(108, 20); 100 | this.check_SaleOff.TabIndex = 7; 101 | this.check_SaleOff.Text = "Satışa Kapalı"; 102 | this.check_SaleOff.UseVisualStyleBackColor = true; 103 | // 104 | // text_ClientPhone 105 | // 106 | this.text_ClientPhone.Location = new System.Drawing.Point(450, 158); 107 | this.text_ClientPhone.Name = "text_ClientPhone"; 108 | this.text_ClientPhone.Size = new System.Drawing.Size(176, 22); 109 | this.text_ClientPhone.TabIndex = 6; 110 | // 111 | // text_ClientMail 112 | // 113 | this.text_ClientMail.Location = new System.Drawing.Point(107, 155); 114 | this.text_ClientMail.Name = "text_ClientMail"; 115 | this.text_ClientMail.Size = new System.Drawing.Size(176, 22); 116 | this.text_ClientMail.TabIndex = 2; 117 | // 118 | // label8 119 | // 120 | this.label8.AutoSize = true; 121 | this.label8.Location = new System.Drawing.Point(358, 158); 122 | this.label8.Name = "label8"; 123 | this.label8.Size = new System.Drawing.Size(56, 16); 124 | this.label8.TabIndex = 17; 125 | this.label8.Text = "Cep No:"; 126 | // 127 | // label9 128 | // 129 | this.label9.AutoSize = true; 130 | this.label9.Location = new System.Drawing.Point(29, 158); 131 | this.label9.Name = "label9"; 132 | this.label9.Size = new System.Drawing.Size(77, 16); 133 | this.label9.TabIndex = 16; 134 | this.label9.Text = "Mail Adresi:"; 135 | // 136 | // text_ClientName 137 | // 138 | this.text_ClientName.Location = new System.Drawing.Point(450, 79); 139 | this.text_ClientName.Name = "text_ClientName"; 140 | this.text_ClientName.Size = new System.Drawing.Size(176, 22); 141 | this.text_ClientName.TabIndex = 4; 142 | // 143 | // text_CompanyName 144 | // 145 | this.text_CompanyName.Location = new System.Drawing.Point(107, 76); 146 | this.text_CompanyName.Name = "text_CompanyName"; 147 | this.text_CompanyName.Size = new System.Drawing.Size(176, 22); 148 | this.text_CompanyName.TabIndex = 0; 149 | // 150 | // label6 151 | // 152 | this.label6.AutoSize = true; 153 | this.label6.Location = new System.Drawing.Point(356, 79); 154 | this.label6.Name = "label6"; 155 | this.label6.Size = new System.Drawing.Size(69, 16); 156 | this.label6.TabIndex = 13; 157 | this.label6.Text = "Yetkili Adı:"; 158 | // 159 | // label7 160 | // 161 | this.label7.AutoSize = true; 162 | this.label7.Location = new System.Drawing.Point(29, 79); 163 | this.label7.Name = "label7"; 164 | this.label7.Size = new System.Drawing.Size(67, 16); 165 | this.label7.TabIndex = 12; 166 | this.label7.Text = "Firma Adı:"; 167 | // 168 | // text_CompanySearch 169 | // 170 | this.text_CompanySearch.Location = new System.Drawing.Point(107, 213); 171 | this.text_CompanySearch.Name = "text_CompanySearch"; 172 | this.text_CompanySearch.Size = new System.Drawing.Size(519, 22); 173 | this.text_CompanySearch.TabIndex = 10; 174 | this.text_CompanySearch.TextChanged += new System.EventHandler(this.text_CompanySearch_TextChanged); 175 | // 176 | // label5 177 | // 178 | this.label5.AutoSize = true; 179 | this.label5.Location = new System.Drawing.Point(29, 215); 180 | this.label5.Name = "label5"; 181 | this.label5.Size = new System.Drawing.Size(31, 16); 182 | this.label5.TabIndex = 10; 183 | this.label5.Text = "Ara:"; 184 | // 185 | // btn_Delete 186 | // 187 | this.btn_Delete.Image = global::GGMSYS.Properties.Resources.icons8_delete_30; 188 | this.btn_Delete.Location = new System.Drawing.Point(643, 83); 189 | this.btn_Delete.Name = "btn_Delete"; 190 | this.btn_Delete.Size = new System.Drawing.Size(129, 47); 191 | this.btn_Delete.TabIndex = 9; 192 | this.btn_Delete.Text = "Sil"; 193 | this.btn_Delete.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 194 | this.btn_Delete.UseVisualStyleBackColor = true; 195 | this.btn_Delete.Click += new System.EventHandler(this.btn_Delete_Click); 196 | // 197 | // btn_Save 198 | // 199 | this.btn_Save.ForeColor = System.Drawing.SystemColors.ControlText; 200 | this.btn_Save.Image = global::GGMSYS.Properties.Resources.icons8_save_30; 201 | this.btn_Save.Location = new System.Drawing.Point(643, 23); 202 | this.btn_Save.Name = "btn_Save"; 203 | this.btn_Save.Size = new System.Drawing.Size(129, 54); 204 | this.btn_Save.TabIndex = 8; 205 | this.btn_Save.Text = "Kaydet Güncelle"; 206 | this.btn_Save.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 207 | this.btn_Save.UseVisualStyleBackColor = true; 208 | this.btn_Save.Click += new System.EventHandler(this.btn_Save_Click); 209 | // 210 | // text_ClientSurname 211 | // 212 | this.text_ClientSurname.Location = new System.Drawing.Point(450, 118); 213 | this.text_ClientSurname.Name = "text_ClientSurname"; 214 | this.text_ClientSurname.Size = new System.Drawing.Size(176, 22); 215 | this.text_ClientSurname.TabIndex = 5; 216 | // 217 | // text_CompanyPhoneNo 218 | // 219 | this.text_CompanyPhoneNo.Location = new System.Drawing.Point(107, 115); 220 | this.text_CompanyPhoneNo.Name = "text_CompanyPhoneNo"; 221 | this.text_CompanyPhoneNo.Size = new System.Drawing.Size(176, 22); 222 | this.text_CompanyPhoneNo.TabIndex = 1; 223 | // 224 | // text_CompanyAddress 225 | // 226 | this.text_CompanyAddress.Location = new System.Drawing.Point(450, 36); 227 | this.text_CompanyAddress.Name = "text_CompanyAddress"; 228 | this.text_CompanyAddress.Size = new System.Drawing.Size(176, 22); 229 | this.text_CompanyAddress.TabIndex = 3; 230 | // 231 | // text_ClientID 232 | // 233 | this.text_ClientID.Location = new System.Drawing.Point(107, 37); 234 | this.text_ClientID.Name = "text_ClientID"; 235 | this.text_ClientID.ReadOnly = true; 236 | this.text_ClientID.Size = new System.Drawing.Size(176, 22); 237 | this.text_ClientID.TabIndex = 15; 238 | // 239 | // label4 240 | // 241 | this.label4.AutoSize = true; 242 | this.label4.Location = new System.Drawing.Point(357, 118); 243 | this.label4.Name = "label4"; 244 | this.label4.Size = new System.Drawing.Size(86, 16); 245 | this.label4.TabIndex = 3; 246 | this.label4.Text = "Yetkil Soyad:"; 247 | // 248 | // label3 249 | // 250 | this.label3.AutoSize = true; 251 | this.label3.Location = new System.Drawing.Point(29, 118); 252 | this.label3.Name = "label3"; 253 | this.label3.Size = new System.Drawing.Size(77, 16); 254 | this.label3.TabIndex = 2; 255 | this.label3.Text = "Telefon No:"; 256 | // 257 | // label2 258 | // 259 | this.label2.AutoSize = true; 260 | this.label2.Location = new System.Drawing.Point(358, 39); 261 | this.label2.Name = "label2"; 262 | this.label2.Size = new System.Drawing.Size(49, 16); 263 | this.label2.TabIndex = 1; 264 | this.label2.Text = "Adresi:"; 265 | // 266 | // label1 267 | // 268 | this.label1.AutoSize = true; 269 | this.label1.Location = new System.Drawing.Point(29, 40); 270 | this.label1.Name = "label1"; 271 | this.label1.Size = new System.Drawing.Size(81, 16); 272 | this.label1.TabIndex = 0; 273 | this.label1.Text = "Firma Kodu :"; 274 | // 275 | // groupBox2 276 | // 277 | this.groupBox2.BackColor = System.Drawing.SystemColors.ActiveCaption; 278 | this.groupBox2.Controls.Add(this.data_CompanyList); 279 | this.groupBox2.Location = new System.Drawing.Point(3, 261); 280 | this.groupBox2.Name = "groupBox2"; 281 | this.groupBox2.Size = new System.Drawing.Size(793, 467); 282 | this.groupBox2.TabIndex = 3; 283 | this.groupBox2.TabStop = false; 284 | this.groupBox2.Text = "Firma Bilgileri Listesi"; 285 | // 286 | // data_CompanyList 287 | // 288 | this.data_CompanyList.AllowUserToAddRows = false; 289 | this.data_CompanyList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 290 | | System.Windows.Forms.AnchorStyles.Left) 291 | | System.Windows.Forms.AnchorStyles.Right))); 292 | this.data_CompanyList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 293 | this.data_CompanyList.Location = new System.Drawing.Point(8, 26); 294 | this.data_CompanyList.Name = "data_CompanyList"; 295 | this.data_CompanyList.ReadOnly = true; 296 | this.data_CompanyList.RowHeadersWidth = 51; 297 | this.data_CompanyList.RowTemplate.Height = 24; 298 | this.data_CompanyList.Size = new System.Drawing.Size(795, 440); 299 | this.data_CompanyList.TabIndex = 0; 300 | this.data_CompanyList.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.data_CompanyList_CellDoubleClick); 301 | // 302 | // frm_Client 303 | // 304 | this.AcceptButton = this.btn_Save; 305 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 306 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 307 | this.BackColor = System.Drawing.SystemColors.ActiveCaption; 308 | this.ClientSize = new System.Drawing.Size(800, 731); 309 | this.Controls.Add(this.groupBox1); 310 | this.Controls.Add(this.groupBox2); 311 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 312 | this.MaximizeBox = false; 313 | this.Name = "frm_Client"; 314 | this.Text = "Firma Kayıt - Liste"; 315 | this.Load += new System.EventHandler(this.frm_Client_Load); 316 | this.groupBox1.ResumeLayout(false); 317 | this.groupBox1.PerformLayout(); 318 | this.groupBox2.ResumeLayout(false); 319 | ((System.ComponentModel.ISupportInitialize)(this.data_CompanyList)).EndInit(); 320 | this.ResumeLayout(false); 321 | 322 | } 323 | 324 | #endregion 325 | 326 | private System.Windows.Forms.GroupBox groupBox1; 327 | private System.Windows.Forms.TextBox text_CompanySearch; 328 | private System.Windows.Forms.Label label5; 329 | private System.Windows.Forms.Button btn_Delete; 330 | private System.Windows.Forms.Button btn_Save; 331 | private System.Windows.Forms.TextBox text_ClientSurname; 332 | private System.Windows.Forms.TextBox text_CompanyPhoneNo; 333 | private System.Windows.Forms.TextBox text_CompanyAddress; 334 | private System.Windows.Forms.TextBox text_ClientID; 335 | private System.Windows.Forms.Label label4; 336 | private System.Windows.Forms.Label label3; 337 | private System.Windows.Forms.Label label2; 338 | private System.Windows.Forms.Label label1; 339 | private System.Windows.Forms.GroupBox groupBox2; 340 | private System.Windows.Forms.DataGridView data_CompanyList; 341 | private System.Windows.Forms.TextBox text_ClientPhone; 342 | private System.Windows.Forms.TextBox text_ClientMail; 343 | private System.Windows.Forms.Label label8; 344 | private System.Windows.Forms.Label label9; 345 | private System.Windows.Forms.TextBox text_ClientName; 346 | private System.Windows.Forms.Label label6; 347 | private System.Windows.Forms.Label label7; 348 | private System.Windows.Forms.CheckBox check_SaleOff; 349 | private System.Windows.Forms.TextBox text_CompanyName; 350 | } 351 | } -------------------------------------------------------------------------------- /frm_Client.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Data.SqlClient; 5 | using System.Windows.Forms; 6 | 7 | namespace GGMSYS 8 | { 9 | public partial class frm_Client : Form 10 | { 11 | private DataTable clientsTable; 12 | 13 | public frm_Client() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | private void frm_Client_Load(object sender, EventArgs e) 19 | { 20 | RefreshClientList(); 21 | } 22 | 23 | private void btn_Save_Click(object sender, EventArgs e) 24 | { 25 | if (string.IsNullOrWhiteSpace(text_ClientName.Text) || string.IsNullOrWhiteSpace(text_ClientSurname.Text)) 26 | { 27 | MessageBox.Show("Lütfen müşteri adı ve soyadı alanlarını doldurun.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); 28 | return; 29 | } 30 | 31 | string ClientID = text_ClientID.Text.Trim(); 32 | string companyName = text_CompanyName.Text.Trim(); 33 | 34 | // Aynı firma kodu veya benzer firma adı olan firmaları kontrol et 35 | if (IsDuplicateClient(ClientID, companyName)) 36 | { 37 | DialogResult result = MessageBox.Show("Bu firma kodu veya benzer bir firma adı zaten var. Kayıt yapmaya devam etmek istiyor musunuz?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); 38 | if (result != DialogResult.Yes) 39 | { 40 | return; // Kayıt yapmamayı tercih ettiğinde işlemi sonlandır 41 | } 42 | } 43 | 44 | string commandText; 45 | List parameters = new List 46 | { 47 | new SqlParameter("@ClientName", text_ClientName.Text), 48 | new SqlParameter("@ClientSurname", text_ClientSurname.Text), 49 | new SqlParameter("@CompanyName", companyName), 50 | new SqlParameter("@ClientPhone", text_ClientPhone.Text), 51 | new SqlParameter("@ClientMail", text_ClientMail.Text), 52 | new SqlParameter("@CompanyPhoneNo", text_CompanyPhoneNo.Text), 53 | new SqlParameter("@CompanyAddress", text_CompanyAddress.Text), 54 | new SqlParameter("@SaleOff", check_SaleOff.Checked ? 1 : 0) 55 | }; 56 | 57 | if (string.IsNullOrEmpty(text_ClientID.Tag as string)) // Yeni müşteri için 58 | { 59 | commandText = @"INSERT INTO Clients (ClientName, ClientSurname, CompanyName, ClientPhone, ClientMail, CompanyPhoneNo, CompanyAddress, SaleOff, CreateDate) 60 | VALUES (@ClientName, @ClientSurname, @CompanyName, @ClientPhone, @ClientMail, @CompanyPhoneNo, @CompanyAddress, @SaleOff, GETDATE())"; 61 | } 62 | else // Mevcut müşteriyi güncelleme için 63 | { 64 | commandText = @"UPDATE Clients SET ClientName=@ClientName, ClientSurname=@ClientSurname, CompanyName=@CompanyName, 65 | ClientPhone=@ClientPhone, ClientMail=@ClientMail, CompanyPhoneNo=@CompanyPhoneNo, CompanyAddress=@CompanyAddress, SaleOff=@SaleOff, UpdateDate=GETDATE() 66 | WHERE ClientID=@ClientID"; 67 | parameters.Add(new SqlParameter("@ClientID", Convert.ToInt32(text_ClientID.Tag))); // Güncelleme için ClientID parametresini ekleyin 68 | } 69 | 70 | DBHelper.ExecuteNonQuery(commandText, CommandType.Text, parameters.ToArray()); 71 | RefreshClientList(); // Müşteri listesini güncelle 72 | frm_Client_Load(sender, e); //Fromu yenile 73 | MessageBox.Show("Müşteri bilgileri başarıyla kaydedildi.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); 74 | } 75 | 76 | private bool IsDuplicateClient(string ClientID, string companyName) 77 | { 78 | string commandText = "SELECT COUNT(*) FROM Clients WHERE ClientID = @ClientID OR CompanyName LIKE @CompanyName"; 79 | SqlParameter[] parameters = new SqlParameter[] 80 | { 81 | new SqlParameter("@ClientID", ClientID), 82 | new SqlParameter("@CompanyName", "%" + companyName + "%") 83 | }; 84 | 85 | int count = Convert.ToInt32(DBHelper.ExecuteScalar(commandText, CommandType.Text, parameters)); 86 | return count > 0; 87 | } 88 | 89 | private void data_CompanyList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) 90 | { 91 | if (e.RowIndex != -1) 92 | { 93 | DataGridViewRow row = data_CompanyList.Rows[e.RowIndex]; 94 | 95 | // Güncelleme için kullanılacak ClientID'yi sakla 96 | text_ClientID.Text = row.Cells["ClientID"].Value.ToString(); 97 | 98 | text_ClientName.Text = row.Cells["ClientName"].Value.ToString(); 99 | text_ClientSurname.Text = row.Cells["ClientSurname"].Value.ToString(); 100 | text_CompanyName.Text = row.Cells["CompanyName"].Value.ToString(); 101 | text_ClientPhone.Text = row.Cells["ClientPhone"].Value.ToString(); 102 | text_ClientMail.Text = row.Cells["ClientMail"].Value.ToString(); 103 | text_CompanyPhoneNo.Text = row.Cells["CompanyPhoneNo"].Value.ToString(); 104 | text_CompanyAddress.Text = row.Cells["CompanyAddress"].Value.ToString(); 105 | check_SaleOff.Checked = Convert.ToBoolean(row.Cells["SaleOff"].Value); 106 | 107 | text_ClientID.Tag = row.Cells["ClientID"].Value.ToString(); // Güncelleme için kullanılacak Tag 108 | } 109 | } 110 | 111 | private void RefreshClientList() 112 | { 113 | string commandText = @" 114 | SELECT 115 | ClientID as 'Müşteri ID', 116 | CompanyName as 'Firma Adı', 117 | CompanyPhoneNo as 'Firma Numarası', 118 | ClientName as 'Müşteri Adı', 119 | ClientSurname as 'Müşteri Soyadı', 120 | ClientPhone as 'Müşteri Numarası', 121 | ClientMail as 'Müşteri Mail', 122 | CompanyAddress as 'Firma Adresi', 123 | SaleOff as 'Satışa Kapalı?' 124 | FROM Clients"; 125 | 126 | DataTable clientsTable = DBHelper.ExecuteSelectCommand(commandText, CommandType.Text); 127 | data_CompanyList.DataSource = clientsTable; 128 | data_CompanyList.RowHeadersVisible = false; // Hides the row header column 129 | 130 | // Clear the text fields 131 | text_ClientID.Clear(); 132 | text_ClientName.Clear(); 133 | text_ClientSurname.Clear(); 134 | text_ClientPhone.Clear(); 135 | text_ClientMail.Clear(); 136 | text_CompanyPhoneNo.Clear(); 137 | text_CompanyAddress.Clear(); 138 | text_CompanySearch.Clear(); 139 | text_CompanyName.Clear(); 140 | } 141 | 142 | 143 | private void btn_Delete_Click(object sender, EventArgs e) 144 | { 145 | // text_ClientID.Tag değerinin boş olmadığını ve bir sayıya dönüştürülebileceğini kontrol ediyoruz. 146 | if (text_ClientID.Tag != null && int.TryParse(text_ClientID.Tag.ToString(), out int clientID)) 147 | { 148 | // İlk olarak, müşteriye ait satış veya alış kaydı olup olmadığını kontrol ediyoruz. 149 | string checkSalesCommandText = "SELECT COUNT(*) FROM Sales WHERE ClientID = @ClientID"; 150 | SqlParameter[] checkSalesParameters = { new SqlParameter("@ClientID", clientID) }; 151 | 152 | int salesCount = Convert.ToInt32(DBHelper.ExecuteScalar(checkSalesCommandText, CommandType.Text, checkSalesParameters)); 153 | 154 | if (salesCount > 0) 155 | { 156 | MessageBox.Show("Bu müşteri üzerinde alış veya satış işlemi olduğundan silinemez.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); 157 | return; 158 | } 159 | 160 | DialogResult dialogResult = MessageBox.Show("Seçilen kaydı silmek istediğinize emin misiniz?", "Kaydı Sil", MessageBoxButtons.YesNo, MessageBoxIcon.Question); 161 | if (dialogResult == DialogResult.Yes) 162 | { 163 | string commandText = "DELETE FROM Clients WHERE ClientID = @ClientID"; 164 | SqlParameter[] parameters = { new SqlParameter("@ClientID", clientID) }; 165 | 166 | int rowsAffected = DBHelper.ExecuteNonQuery(commandText, CommandType.Text, parameters); 167 | if (rowsAffected > 0) 168 | { 169 | MessageBox.Show("Kayıt başarıyla silindi.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); 170 | RefreshClientList(); // Listeyi yenileyerek silinen kaydın artık listelenmemesini sağlıyoruz. 171 | } 172 | else 173 | { 174 | MessageBox.Show("Kayıt silinirken bir sorun oluştu veya silinecek kayıt bulunamadı.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); 175 | } 176 | } 177 | } 178 | else 179 | { 180 | MessageBox.Show("Lütfen silmek istediğiniz kaydı seçin.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); 181 | } 182 | } 183 | 184 | 185 | private void text_CompanySearch_TextChanged(object sender, EventArgs e) 186 | { 187 | string searchText = text_CompanySearch.Text.ToLower(); 188 | DataView dv = clientsTable.DefaultView; 189 | dv.RowFilter = string.Format("CompanyName LIKE '%{0}%'", searchText); 190 | data_CompanyList.DataSource = dv; 191 | } 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /frm_Client.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | 123 | AAABAAEAGBgAAAEAIACICQAAFgAAACgAAAAYAAAAMAAAAAEAIAAAAAAAAAkAABMLAAATCwAAAAAAAAAA 124 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 125 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 126 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 127 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASQAA 128 | AOMAAADiAAAASAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 129 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4wAAAP8AAAD/AAAA4gAAAAAAAAAAAAAAAAAA 130 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 131 | AAAAAAAAAAAA4wAAAP8AAAD/AAAA4gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 132 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASwAAAOQAAADjAAAASQAA 133 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABJAAAA4wAA 134 | AOIAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEkAAADjAAAA4gAA 135 | AEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADjAAAA/wAAAP8AAADiAAAAAAAAAAAAAAAAAAAAAAAA 136 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOMAAAD/AAAA/wAAAOIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 137 | AAAAAADjAAAA/wAAAP8AAADiAAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAAAAAAAAAAA 138 | AOMAAAD/AAAA/wAAAOIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABLAAAA5AAAAOMAAABJAAAAAAAA 139 | AAAAAADQAAAA/wAAAP8AAAD/AAAA/wAAANcAAAAAAAAAAAAAAEsAAADkAAAA4wAAAEkAAAAAAAAAAAAA 140 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhAAAArgAAAO8AAADvAAAArQAA 141 | ACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 142 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 143 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASQAA 144 | AOMAAADiAAAASAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 145 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4wAAAP8AAAD/AAAA4gAAAAAAAAAAAAAAAAAA 146 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABJAAAA4wAAAOIAAABIAAAAAAAA 147 | AAAAAAAAAAAA4wAAAP8AAAD/AAAA4gAAAAAAAAAAAAAAAAAAAEkAAADjAAAA4gAAAEgAAAAAAAAAAAAA 148 | AAAAAAAAAAAAAAAAAAAAAADjAAAA/wAAAP8AAADiAAAAAAAAAAAAAAAAAAAASwAAAOQAAADjAAAASQAA 149 | AAAAAAAAAAAAAAAAAOMAAAD/AAAA/wAAAOIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADjAAAA/wAA 150 | AP8AAADiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOMAAAD/AAAA/wAA 151 | AOIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABLAAAA5AAAAOMAAABJAAAAAAAAAAAAAAAAAAAAAAAA 152 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEsAAADkAAAA4wAAAEkAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 153 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASQAAAOMAAADiAAAASAAAAAAAAAAAAAAAAAAA 154 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 155 | AAAAAAAAAAAA4wAAAP8AAAD/AAAA4gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 156 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4wAAAP8AAAD/AAAA4gAA 157 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 158 | AAAAAAAAAAAAAAAAAAAAAAAAAAAASwAAAOQAAADjAAAASQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 159 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 160 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 161 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 162 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP/D/wD/w/8A/8P/AP/D/wDh/4cA4f+HAOGB 163 | hwDhgYcA/4H/AP///wD/w/8A/8P/AOHDhwDhw4cA4f+HAOH/hwD/w/8A/8P/AP/D/wD/w/8A////AP// 164 | /wA= 165 | 166 | 167 | -------------------------------------------------------------------------------- /frm_Login.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace GGMSYS 2 | { 3 | partial class frm_Login 4 | { 5 | /// 6 | ///Gerekli tasarımcı değişkeni. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | ///Kullanılan tüm kaynakları temizleyin. 12 | /// 13 | ///yönetilen kaynaklar dispose edilmeliyse doğru; aksi halde yanlış. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer üretilen kod 24 | 25 | /// 26 | /// Tasarımcı desteği için gerekli metot - bu metodun 27 | ///içeriğini kod düzenleyici ile değiştirmeyin. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frm_Login)); 32 | this.label2 = new System.Windows.Forms.Label(); 33 | this.label1 = new System.Windows.Forms.Label(); 34 | this.text_Password = new System.Windows.Forms.TextBox(); 35 | this.btn_Login = new System.Windows.Forms.Button(); 36 | this.btn_Exit = new System.Windows.Forms.Button(); 37 | this.label3 = new System.Windows.Forms.Label(); 38 | this.combo_UserName = new System.Windows.Forms.ComboBox(); 39 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 40 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 41 | this.SuspendLayout(); 42 | // 43 | // label2 44 | // 45 | resources.ApplyResources(this.label2, "label2"); 46 | this.label2.BackColor = System.Drawing.Color.MidnightBlue; 47 | this.label2.ForeColor = System.Drawing.SystemColors.ButtonHighlight; 48 | this.label2.Name = "label2"; 49 | // 50 | // label1 51 | // 52 | resources.ApplyResources(this.label1, "label1"); 53 | this.label1.BackColor = System.Drawing.Color.MidnightBlue; 54 | this.label1.ForeColor = System.Drawing.SystemColors.ButtonHighlight; 55 | this.label1.Name = "label1"; 56 | // 57 | // text_Password 58 | // 59 | resources.ApplyResources(this.text_Password, "text_Password"); 60 | this.text_Password.Name = "text_Password"; 61 | // 62 | // btn_Login 63 | // 64 | this.btn_Login.BackColor = System.Drawing.Color.LightBlue; 65 | resources.ApplyResources(this.btn_Login, "btn_Login"); 66 | this.btn_Login.ForeColor = System.Drawing.Color.ForestGreen; 67 | this.btn_Login.Name = "btn_Login"; 68 | this.btn_Login.UseVisualStyleBackColor = false; 69 | this.btn_Login.Click += new System.EventHandler(this.btn_Login_Click); 70 | // 71 | // btn_Exit 72 | // 73 | this.btn_Exit.BackColor = System.Drawing.Color.LightBlue; 74 | this.btn_Exit.DialogResult = System.Windows.Forms.DialogResult.Cancel; 75 | resources.ApplyResources(this.btn_Exit, "btn_Exit"); 76 | this.btn_Exit.ForeColor = System.Drawing.Color.DarkRed; 77 | this.btn_Exit.Name = "btn_Exit"; 78 | this.btn_Exit.UseVisualStyleBackColor = false; 79 | this.btn_Exit.Click += new System.EventHandler(this.btn_Exit_Click); 80 | // 81 | // label3 82 | // 83 | resources.ApplyResources(this.label3, "label3"); 84 | this.label3.ForeColor = System.Drawing.SystemColors.ButtonHighlight; 85 | this.label3.Name = "label3"; 86 | // 87 | // combo_UserName 88 | // 89 | this.combo_UserName.FormattingEnabled = true; 90 | resources.ApplyResources(this.combo_UserName, "combo_UserName"); 91 | this.combo_UserName.Name = "combo_UserName"; 92 | // 93 | // pictureBox1 94 | // 95 | resources.ApplyResources(this.pictureBox1, "pictureBox1"); 96 | this.pictureBox1.Name = "pictureBox1"; 97 | this.pictureBox1.TabStop = false; 98 | // 99 | // frm_Login 100 | // 101 | this.AcceptButton = this.btn_Login; 102 | resources.ApplyResources(this, "$this"); 103 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 104 | this.BackColor = System.Drawing.Color.MidnightBlue; 105 | this.CancelButton = this.btn_Exit; 106 | this.Controls.Add(this.combo_UserName); 107 | this.Controls.Add(this.label3); 108 | this.Controls.Add(this.btn_Exit); 109 | this.Controls.Add(this.btn_Login); 110 | this.Controls.Add(this.text_Password); 111 | this.Controls.Add(this.label1); 112 | this.Controls.Add(this.label2); 113 | this.Controls.Add(this.pictureBox1); 114 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 115 | this.MaximizeBox = false; 116 | this.Name = "frm_Login"; 117 | this.Load += new System.EventHandler(this.frm_Login_Load); 118 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 119 | this.ResumeLayout(false); 120 | this.PerformLayout(); 121 | 122 | } 123 | 124 | #endregion 125 | 126 | private System.Windows.Forms.PictureBox pictureBox1; 127 | private System.Windows.Forms.Label label2; 128 | private System.Windows.Forms.Label label1; 129 | private System.Windows.Forms.TextBox text_Password; 130 | private System.Windows.Forms.Button btn_Login; 131 | private System.Windows.Forms.Button btn_Exit; 132 | private System.Windows.Forms.Label label3; 133 | private System.Windows.Forms.ComboBox combo_UserName; 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /frm_Login.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Data.SqlClient; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace GGMSYS 13 | { 14 | public partial class frm_Login : Form 15 | { 16 | public frm_Login() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | private void btn_Login_Click(object sender, EventArgs e) 22 | { 23 | string username = combo_UserName.Text; 24 | string password = text_Password.Text; 25 | 26 | if (username == "" && password == "") 27 | { 28 | this.Hide(); 29 | frm_Main mainForm = new frm_Main(); 30 | mainForm.Show(); 31 | } 32 | else 33 | { 34 | 35 | string commandText = "SELECT IsActive, IsAdmin FROM Users WHERE Username = @Username AND Password = @Password"; 36 | SqlParameter[] parameters = new SqlParameter[] 37 | { 38 | new SqlParameter("@Username", username), 39 | new SqlParameter("@Password", password) 40 | }; 41 | 42 | DataTable resultTable = DBHelper.ExecuteSelectCommand(commandText, CommandType.Text, parameters); 43 | 44 | if (resultTable.Rows.Count > 0) 45 | { 46 | bool isActive = Convert.ToBoolean(resultTable.Rows[0]["IsActive"]); 47 | bool isAdmin = Convert.ToBoolean(resultTable.Rows[0]["IsAdmin"]); 48 | 49 | if (!isActive) 50 | { 51 | MessageBox.Show("Kullanıcınız deaktif edilmiş."); 52 | return; 53 | } 54 | 55 | this.Hide(); 56 | frm_Main mainForm = new frm_Main(); 57 | mainForm.Show(); 58 | } 59 | else 60 | { 61 | MessageBox.Show("Kullanıcı adı veya şifre yanlış."); 62 | } 63 | } 64 | } 65 | 66 | private void btn_Exit_Click(object sender, EventArgs e) 67 | { 68 | Application.Exit(); 69 | } 70 | private void FillUsernames() 71 | { 72 | // Sadece aktif kullanıcıları seçecek 73 | string commandText = "SELECT Username FROM Users WHERE IsActive = 1"; 74 | DataTable usersTable = DBHelper.ExecuteSelectCommand(commandText, CommandType.Text); 75 | 76 | combo_UserName.Items.Clear(); // ComboBox'ı temizle 77 | 78 | foreach (DataRow row in usersTable.Rows) 79 | { 80 | combo_UserName.Items.Add(row["Username"].ToString()); 81 | } 82 | 83 | //if (combo_UserName.Items.Count > 0) 84 | //{ 85 | // combo_UserName.SelectedIndex = 0; // İlk elemanı varsayılan olarak seç 86 | //} 87 | } 88 | 89 | 90 | private void frm_Login_Load(object sender, EventArgs e) 91 | { 92 | FillUsernames(); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /frm_Main.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace GGMSYS 2 | { 3 | partial class frm_Main 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frm_Main)); 32 | this.panel1 = new System.Windows.Forms.Panel(); 33 | this.btn_Users = new System.Windows.Forms.Button(); 34 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 35 | this.btn_Sales = new System.Windows.Forms.Button(); 36 | this.btn_Reports = new System.Windows.Forms.Button(); 37 | this.btn_StokActivity = new System.Windows.Forms.Button(); 38 | this.btn_Client = new System.Windows.Forms.Button(); 39 | this.btn_Stock = new System.Windows.Forms.Button(); 40 | this.panel1.SuspendLayout(); 41 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 42 | this.SuspendLayout(); 43 | // 44 | // panel1 45 | // 46 | this.panel1.BackColor = System.Drawing.SystemColors.MenuHighlight; 47 | this.panel1.Controls.Add(this.btn_Users); 48 | this.panel1.Controls.Add(this.pictureBox1); 49 | this.panel1.Controls.Add(this.btn_Sales); 50 | this.panel1.Controls.Add(this.btn_Reports); 51 | this.panel1.Controls.Add(this.btn_StokActivity); 52 | this.panel1.Controls.Add(this.btn_Client); 53 | this.panel1.Controls.Add(this.btn_Stock); 54 | this.panel1.Location = new System.Drawing.Point(1, -2); 55 | this.panel1.Name = "panel1"; 56 | this.panel1.Size = new System.Drawing.Size(209, 757); 57 | this.panel1.TabIndex = 0; 58 | // 59 | // btn_Users 60 | // 61 | this.btn_Users.FlatStyle = System.Windows.Forms.FlatStyle.Popup; 62 | this.btn_Users.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 63 | this.btn_Users.Image = ((System.Drawing.Image)(resources.GetObject("btn_Users.Image"))); 64 | this.btn_Users.Location = new System.Drawing.Point(2, 641); 65 | this.btn_Users.Name = "btn_Users"; 66 | this.btn_Users.Size = new System.Drawing.Size(204, 76); 67 | this.btn_Users.TabIndex = 5; 68 | this.btn_Users.Text = "Kullanıcılar"; 69 | this.btn_Users.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 70 | this.btn_Users.UseVisualStyleBackColor = true; 71 | this.btn_Users.Click += new System.EventHandler(this.btn_Users_Click); 72 | // 73 | // pictureBox1 74 | // 75 | this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); 76 | this.pictureBox1.Location = new System.Drawing.Point(2, 3); 77 | this.pictureBox1.Name = "pictureBox1"; 78 | this.pictureBox1.Size = new System.Drawing.Size(204, 165); 79 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 80 | this.pictureBox1.TabIndex = 1; 81 | this.pictureBox1.TabStop = false; 82 | this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); 83 | // 84 | // btn_Sales 85 | // 86 | this.btn_Sales.FlatStyle = System.Windows.Forms.FlatStyle.Popup; 87 | this.btn_Sales.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 88 | this.btn_Sales.Image = ((System.Drawing.Image)(resources.GetObject("btn_Sales.Image"))); 89 | this.btn_Sales.Location = new System.Drawing.Point(2, 359); 90 | this.btn_Sales.Name = "btn_Sales"; 91 | this.btn_Sales.Size = new System.Drawing.Size(204, 76); 92 | this.btn_Sales.TabIndex = 4; 93 | this.btn_Sales.Text = "Alış/Satışlarım"; 94 | this.btn_Sales.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 95 | this.btn_Sales.UseVisualStyleBackColor = true; 96 | this.btn_Sales.Click += new System.EventHandler(this.button5_Click); 97 | // 98 | // btn_Reports 99 | // 100 | this.btn_Reports.FlatStyle = System.Windows.Forms.FlatStyle.Popup; 101 | this.btn_Reports.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 102 | this.btn_Reports.Image = ((System.Drawing.Image)(resources.GetObject("btn_Reports.Image"))); 103 | this.btn_Reports.Location = new System.Drawing.Point(3, 547); 104 | this.btn_Reports.Name = "btn_Reports"; 105 | this.btn_Reports.Size = new System.Drawing.Size(203, 76); 106 | this.btn_Reports.TabIndex = 4; 107 | this.btn_Reports.Text = "Raporlarım"; 108 | this.btn_Reports.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 109 | this.btn_Reports.UseVisualStyleBackColor = true; 110 | this.btn_Reports.Click += new System.EventHandler(this.btn_Reports_Click); 111 | // 112 | // btn_StokActivity 113 | // 114 | this.btn_StokActivity.FlatStyle = System.Windows.Forms.FlatStyle.Popup; 115 | this.btn_StokActivity.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 116 | this.btn_StokActivity.Image = ((System.Drawing.Image)(resources.GetObject("btn_StokActivity.Image"))); 117 | this.btn_StokActivity.Location = new System.Drawing.Point(3, 453); 118 | this.btn_StokActivity.Name = "btn_StokActivity"; 119 | this.btn_StokActivity.Size = new System.Drawing.Size(203, 76); 120 | this.btn_StokActivity.TabIndex = 3; 121 | this.btn_StokActivity.Text = "Stok Hareketlerim"; 122 | this.btn_StokActivity.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 123 | this.btn_StokActivity.UseVisualStyleBackColor = true; 124 | this.btn_StokActivity.Click += new System.EventHandler(this.btn_StockActivity_Click); 125 | // 126 | // btn_Client 127 | // 128 | this.btn_Client.FlatStyle = System.Windows.Forms.FlatStyle.Popup; 129 | this.btn_Client.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 130 | this.btn_Client.Image = ((System.Drawing.Image)(resources.GetObject("btn_Client.Image"))); 131 | this.btn_Client.Location = new System.Drawing.Point(3, 267); 132 | this.btn_Client.Name = "btn_Client"; 133 | this.btn_Client.Size = new System.Drawing.Size(203, 76); 134 | this.btn_Client.TabIndex = 2; 135 | this.btn_Client.Text = "Firmalarım"; 136 | this.btn_Client.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 137 | this.btn_Client.UseVisualStyleBackColor = true; 138 | this.btn_Client.Click += new System.EventHandler(this.btn_Client_Click); 139 | // 140 | // btn_Stock 141 | // 142 | this.btn_Stock.FlatStyle = System.Windows.Forms.FlatStyle.Popup; 143 | this.btn_Stock.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162))); 144 | this.btn_Stock.Image = ((System.Drawing.Image)(resources.GetObject("btn_Stock.Image"))); 145 | this.btn_Stock.Location = new System.Drawing.Point(3, 174); 146 | this.btn_Stock.Name = "btn_Stock"; 147 | this.btn_Stock.Size = new System.Drawing.Size(203, 76); 148 | this.btn_Stock.TabIndex = 1; 149 | this.btn_Stock.Text = "Ürün ve Stoklarım"; 150 | this.btn_Stock.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 151 | this.btn_Stock.UseVisualStyleBackColor = true; 152 | this.btn_Stock.Click += new System.EventHandler(this.btn_Stock_Click); 153 | // 154 | // frm_Main 155 | // 156 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 157 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 158 | this.ClientSize = new System.Drawing.Size(1446, 755); 159 | this.Controls.Add(this.panel1); 160 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 161 | this.MaximizeBox = false; 162 | this.Name = "frm_Main"; 163 | this.Text = "GGMSYS"; 164 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frm_Main_FormClosing); 165 | this.panel1.ResumeLayout(false); 166 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 167 | this.ResumeLayout(false); 168 | 169 | } 170 | 171 | #endregion 172 | 173 | private System.Windows.Forms.Panel panel1; 174 | private System.Windows.Forms.Button btn_StokActivity; 175 | private System.Windows.Forms.Button btn_Client; 176 | private System.Windows.Forms.Button btn_Stock; 177 | private System.Windows.Forms.Button btn_Reports; 178 | private System.Windows.Forms.Button btn_Users; 179 | private System.Windows.Forms.PictureBox pictureBox1; 180 | private System.Windows.Forms.Button btn_Sales; 181 | } 182 | } -------------------------------------------------------------------------------- /frm_Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace GGMSYS 12 | { 13 | public partial class frm_Main : Form 14 | { 15 | public frm_Main() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | 21 | 22 | private void btn_Stock_Click(object sender, EventArgs e) 23 | { 24 | frm_Stock frm_Stock = new frm_Stock(); 25 | frm_Stock.ShowDialog(); 26 | } 27 | 28 | private void btn_Client_Click(object sender, EventArgs e) 29 | { 30 | frm_Client frm_Client = new frm_Client(); 31 | frm_Client.ShowDialog(); 32 | } 33 | 34 | private void button5_Click(object sender, EventArgs e) 35 | { 36 | frm_Sales frm_Sales = new frm_Sales(); 37 | frm_Sales.ShowDialog(); 38 | } 39 | 40 | private void btn_StockActivity_Click(object sender, EventArgs e) 41 | { 42 | frm_StockActivity frm_StockActivity = new frm_StockActivity(); 43 | frm_StockActivity.ShowDialog(); 44 | } 45 | 46 | private void btn_Reports_Click(object sender, EventArgs e) 47 | { 48 | frm_Reports frm_Reports = new frm_Reports(); 49 | frm_Reports.ShowDialog(); 50 | } 51 | 52 | private void btn_Users_Click(object sender, EventArgs e) 53 | { 54 | frm_Users frm_Users = new frm_Users(); 55 | frm_Users.ShowDialog(); 56 | } 57 | 58 | private void frm_Main_FormClosing(object sender, FormClosingEventArgs e) 59 | { 60 | Application.Exit(); 61 | } 62 | 63 | private void pictureBox1_Click(object sender, EventArgs e) 64 | { 65 | string message = "Desing : Abdurrahman AYDIN\nCoder : Abdurrahman AYDIN\nYılı : 2024"; 66 | string caption = "Bilgilendirme"; 67 | MessageBoxButtons buttons = MessageBoxButtons.OK; 68 | 69 | // Mesaj kutusunu göster ve kullanıcı tamam düğmesine tıkladığında işlem yap 70 | DialogResult result = MessageBox.Show(message, caption, buttons); 71 | 72 | if (result == DialogResult.OK) 73 | { 74 | // Mesaj kutusu tamam düğmesine tıklanarak kapatıldı 75 | // İstenilen işlemler burada yapılabilir 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /frm_Reports.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace GGMSYS 2 | { 3 | partial class frm_Reports 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.btn_StockList = new System.Windows.Forms.Button(); 32 | this.btn_ClientList = new System.Windows.Forms.Button(); 33 | this.btn_StockStatus = new System.Windows.Forms.Button(); 34 | this.button4 = new System.Windows.Forms.Button(); 35 | this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); 36 | this.label1 = new System.Windows.Forms.Label(); 37 | this.label2 = new System.Windows.Forms.Label(); 38 | this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker(); 39 | this.SuspendLayout(); 40 | // 41 | // btn_StockList 42 | // 43 | this.btn_StockList.Location = new System.Drawing.Point(12, 141); 44 | this.btn_StockList.Name = "btn_StockList"; 45 | this.btn_StockList.Size = new System.Drawing.Size(98, 81); 46 | this.btn_StockList.TabIndex = 0; 47 | this.btn_StockList.Text = "Ürün Listesi"; 48 | this.btn_StockList.UseVisualStyleBackColor = true; 49 | this.btn_StockList.Click += new System.EventHandler(this.btn_StockList_Click); 50 | // 51 | // btn_ClientList 52 | // 53 | this.btn_ClientList.Location = new System.Drawing.Point(131, 141); 54 | this.btn_ClientList.Name = "btn_ClientList"; 55 | this.btn_ClientList.Size = new System.Drawing.Size(98, 81); 56 | this.btn_ClientList.TabIndex = 1; 57 | this.btn_ClientList.Text = "Firma Listesi"; 58 | this.btn_ClientList.UseVisualStyleBackColor = true; 59 | this.btn_ClientList.Click += new System.EventHandler(this.btn_ClientList_Click); 60 | // 61 | // btn_StockStatus 62 | // 63 | this.btn_StockStatus.Location = new System.Drawing.Point(257, 141); 64 | this.btn_StockStatus.Name = "btn_StockStatus"; 65 | this.btn_StockStatus.Size = new System.Drawing.Size(98, 81); 66 | this.btn_StockStatus.TabIndex = 2; 67 | this.btn_StockStatus.Text = "Güncel Stok Durumu"; 68 | this.btn_StockStatus.UseVisualStyleBackColor = true; 69 | // 70 | // button4 71 | // 72 | this.button4.Location = new System.Drawing.Point(12, 241); 73 | this.button4.Name = "button4"; 74 | this.button4.Size = new System.Drawing.Size(98, 81); 75 | this.button4.TabIndex = 3; 76 | this.button4.Text = "İki Tarih Arası Stok Durumu"; 77 | this.button4.UseVisualStyleBackColor = true; 78 | // 79 | // dateTimePicker1 80 | // 81 | this.dateTimePicker1.Location = new System.Drawing.Point(152, 14); 82 | this.dateTimePicker1.Name = "dateTimePicker1"; 83 | this.dateTimePicker1.Size = new System.Drawing.Size(164, 22); 84 | this.dateTimePicker1.TabIndex = 4; 85 | // 86 | // label1 87 | // 88 | this.label1.AutoSize = true; 89 | this.label1.Location = new System.Drawing.Point(12, 16); 90 | this.label1.Name = "label1"; 91 | this.label1.Size = new System.Drawing.Size(107, 16); 92 | this.label1.TabIndex = 5; 93 | this.label1.Text = "Başlangıç Tarihi:"; 94 | // 95 | // label2 96 | // 97 | this.label2.AutoSize = true; 98 | this.label2.Location = new System.Drawing.Point(47, 61); 99 | this.label2.Name = "label2"; 100 | this.label2.Size = new System.Drawing.Size(72, 16); 101 | this.label2.TabIndex = 6; 102 | this.label2.Text = "Bitiş Tarihi:"; 103 | // 104 | // dateTimePicker2 105 | // 106 | this.dateTimePicker2.CustomFormat = ""; 107 | this.dateTimePicker2.Location = new System.Drawing.Point(152, 56); 108 | this.dateTimePicker2.Name = "dateTimePicker2"; 109 | this.dateTimePicker2.Size = new System.Drawing.Size(164, 22); 110 | this.dateTimePicker2.TabIndex = 7; 111 | this.dateTimePicker2.Value = new System.DateTime(2024, 3, 29, 0, 0, 0, 0); 112 | // 113 | // frm_Reports 114 | // 115 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 116 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 117 | this.BackColor = System.Drawing.SystemColors.ActiveCaption; 118 | this.ClientSize = new System.Drawing.Size(385, 349); 119 | this.Controls.Add(this.dateTimePicker2); 120 | this.Controls.Add(this.label2); 121 | this.Controls.Add(this.label1); 122 | this.Controls.Add(this.dateTimePicker1); 123 | this.Controls.Add(this.button4); 124 | this.Controls.Add(this.btn_StockStatus); 125 | this.Controls.Add(this.btn_ClientList); 126 | this.Controls.Add(this.btn_StockList); 127 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; 128 | this.MaximizeBox = false; 129 | this.Name = "frm_Reports"; 130 | this.Text = "Raporlar"; 131 | this.ResumeLayout(false); 132 | this.PerformLayout(); 133 | 134 | } 135 | 136 | #endregion 137 | 138 | private System.Windows.Forms.Button btn_StockList; 139 | private System.Windows.Forms.Button btn_ClientList; 140 | private System.Windows.Forms.Button btn_StockStatus; 141 | private System.Windows.Forms.Button button4; 142 | private System.Windows.Forms.DateTimePicker dateTimePicker1; 143 | private System.Windows.Forms.Label label1; 144 | private System.Windows.Forms.Label label2; 145 | private System.Windows.Forms.DateTimePicker dateTimePicker2; 146 | } 147 | } -------------------------------------------------------------------------------- /frm_Reports.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace GGMSYS 12 | { 13 | public partial class frm_Reports : Form 14 | { 15 | public frm_Reports() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void btn_StockList_Click(object sender, EventArgs e) 21 | { 22 | try 23 | { 24 | // Step 1: Retrieve data from the Stocks table 25 | string query = @" 26 | SELECT 27 | StockCode AS 'Stok Kodu', 28 | StockName AS 'Stok Adı', 29 | StockQuantity AS 'Miktar', 30 | StockPrice AS 'Fiyat' 31 | FROM Stocks"; 32 | 33 | DataTable stocksTable = DBHelper.ExecuteSelectCommand(query, CommandType.Text); 34 | 35 | // Step 2: Export data to an Excel file 36 | using (SaveFileDialog saveFileDialog = new SaveFileDialog()) 37 | { 38 | saveFileDialog.Filter = "Excel Dosyaları|*.xlsx"; 39 | saveFileDialog.Title = "Bir Excel Dosyası Kaydedin"; 40 | saveFileDialog.FileName = "Stoklar.xlsx"; 41 | 42 | if (saveFileDialog.ShowDialog() == DialogResult.OK) 43 | { 44 | string filePath = saveFileDialog.FileName; 45 | 46 | using (var workbook = new ClosedXML.Excel.XLWorkbook()) 47 | { 48 | var worksheet = workbook.Worksheets.Add("Stocks"); 49 | worksheet.Cell(1, 1).InsertTable(stocksTable); 50 | workbook.SaveAs(filePath); 51 | } 52 | 53 | MessageBox.Show("Stok verileri başarıyla Excel'e aktarıldı.", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); 54 | } 55 | } 56 | } 57 | catch (Exception ex) 58 | { 59 | MessageBox.Show($"Stok verileri aktarılırken bir hata oluştu: {ex.Message}", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); 60 | } 61 | } 62 | 63 | private void btn_ClientList_Click(object sender, EventArgs e) 64 | { 65 | try 66 | { 67 | // Step 1: Retrieve data from the Clients table 68 | string query = @" 69 | SELECT 70 | ClientID AS 'Müşteri Kodu', 71 | CompanyName AS 'Firma Adı', 72 | CompanyPhoneNo AS 'Firma Numarası', 73 | ClientName AS 'Yetkili Adı', 74 | ClientSurname AS 'Yetkili Soyadı', 75 | ClientPhone AS 'Yetkili Telefon', 76 | ClientMail AS 'E-Posta', 77 | CASE 78 | WHEN SaleOff = 1 THEN 'Satışa Kapalı' 79 | ELSE 'Satışa Açık' 80 | END AS 'Satış Durumu' 81 | FROM Clients"; 82 | 83 | DataTable clientsTable = DBHelper.ExecuteSelectCommand(query, CommandType.Text); 84 | 85 | // Step 2: Export data to an Excel file 86 | using (SaveFileDialog saveFileDialog = new SaveFileDialog()) 87 | { 88 | saveFileDialog.Filter = "Excel Dosyaları|*.xlsx"; 89 | saveFileDialog.Title = "Bir Excel Dosyası Kaydedin"; 90 | saveFileDialog.FileName = "Clients.xlsx"; 91 | 92 | if (saveFileDialog.ShowDialog() == DialogResult.OK) 93 | { 94 | string filePath = saveFileDialog.FileName; 95 | 96 | using (var workbook = new ClosedXML.Excel.XLWorkbook()) 97 | { 98 | var worksheet = workbook.Worksheets.Add("Clients"); 99 | worksheet.Cell(1, 1).InsertTable(clientsTable); 100 | workbook.SaveAs(filePath); 101 | } 102 | 103 | MessageBox.Show("Müşteri verileri başarıyla Excel'e aktarıldı.", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); 104 | } 105 | } 106 | } 107 | catch (Exception ex) 108 | { 109 | MessageBox.Show($"Müşteri verileri aktarılırken bir hata oluştu: {ex.Message}", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); 110 | } 111 | } 112 | 113 | 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /frm_Reports.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /frm_Sales.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | True 122 | 123 | 124 | True 125 | 126 | 127 | True 128 | 129 | 130 | True 131 | 132 | 133 | True 134 | 135 | 136 | True 137 | 138 | 139 | True 140 | 141 | 142 | True 143 | 144 | 145 | True 146 | 147 | 148 | True 149 | 150 | 151 | True 152 | 153 | 154 | True 155 | 156 | 157 | True 158 | 159 | 160 | True 161 | 162 | 163 | True 164 | 165 | 166 | True 167 | 168 | 169 | True 170 | 171 | 172 | True 173 | 174 | 175 | True 176 | 177 | 178 | True 179 | 180 | -------------------------------------------------------------------------------- /frm_Stock.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace GGMSYS 2 | { 3 | partial class frm_Stock 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 32 | this.text_StockCode = new System.Windows.Forms.TextBox(); 33 | this.text_StockID = new System.Windows.Forms.TextBox(); 34 | this.text_StockName = new System.Windows.Forms.TextBox(); 35 | this.text_StockSearch = new System.Windows.Forms.TextBox(); 36 | this.label5 = new System.Windows.Forms.Label(); 37 | this.btn_Delete = new System.Windows.Forms.Button(); 38 | this.btn_Save = new System.Windows.Forms.Button(); 39 | this.text_StockPrice = new System.Windows.Forms.TextBox(); 40 | this.text_Stock = new System.Windows.Forms.TextBox(); 41 | this.label4 = new System.Windows.Forms.Label(); 42 | this.label3 = new System.Windows.Forms.Label(); 43 | this.label2 = new System.Windows.Forms.Label(); 44 | this.label1 = new System.Windows.Forms.Label(); 45 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 46 | this.data_StockList = new System.Windows.Forms.DataGridView(); 47 | this.groupBox1.SuspendLayout(); 48 | this.groupBox2.SuspendLayout(); 49 | ((System.ComponentModel.ISupportInitialize)(this.data_StockList)).BeginInit(); 50 | this.SuspendLayout(); 51 | // 52 | // groupBox1 53 | // 54 | this.groupBox1.BackColor = System.Drawing.SystemColors.ActiveCaption; 55 | this.groupBox1.Controls.Add(this.text_StockCode); 56 | this.groupBox1.Controls.Add(this.text_StockID); 57 | this.groupBox1.Controls.Add(this.text_StockName); 58 | this.groupBox1.Controls.Add(this.text_StockSearch); 59 | this.groupBox1.Controls.Add(this.label5); 60 | this.groupBox1.Controls.Add(this.btn_Delete); 61 | this.groupBox1.Controls.Add(this.btn_Save); 62 | this.groupBox1.Controls.Add(this.text_StockPrice); 63 | this.groupBox1.Controls.Add(this.text_Stock); 64 | this.groupBox1.Controls.Add(this.label4); 65 | this.groupBox1.Controls.Add(this.label3); 66 | this.groupBox1.Controls.Add(this.label2); 67 | this.groupBox1.Controls.Add(this.label1); 68 | this.groupBox1.Location = new System.Drawing.Point(1, 4); 69 | this.groupBox1.Name = "groupBox1"; 70 | this.groupBox1.Size = new System.Drawing.Size(798, 153); 71 | this.groupBox1.TabIndex = 0; 72 | this.groupBox1.TabStop = false; 73 | this.groupBox1.Text = "Ürün Detayları"; 74 | // 75 | // text_StockCode 76 | // 77 | this.text_StockCode.Location = new System.Drawing.Point(107, 35); 78 | this.text_StockCode.Name = "text_StockCode"; 79 | this.text_StockCode.ReadOnly = true; 80 | this.text_StockCode.Size = new System.Drawing.Size(176, 22); 81 | this.text_StockCode.TabIndex = 9; 82 | // 83 | // text_StockID 84 | // 85 | this.text_StockID.Location = new System.Drawing.Point(207, 35); 86 | this.text_StockID.Name = "text_StockID"; 87 | this.text_StockID.ReadOnly = true; 88 | this.text_StockID.Size = new System.Drawing.Size(34, 22); 89 | this.text_StockID.TabIndex = 11; 90 | // 91 | // text_StockName 92 | // 93 | this.text_StockName.Location = new System.Drawing.Point(450, 32); 94 | this.text_StockName.Name = "text_StockName"; 95 | this.text_StockName.Size = new System.Drawing.Size(176, 22); 96 | this.text_StockName.TabIndex = 0; 97 | // 98 | // text_StockSearch 99 | // 100 | this.text_StockSearch.Location = new System.Drawing.Point(107, 120); 101 | this.text_StockSearch.Name = "text_StockSearch"; 102 | this.text_StockSearch.Size = new System.Drawing.Size(519, 22); 103 | this.text_StockSearch.TabIndex = 5; 104 | this.text_StockSearch.TextChanged += new System.EventHandler(this.text_StockSearch_TextChanged); 105 | // 106 | // label5 107 | // 108 | this.label5.AutoSize = true; 109 | this.label5.Location = new System.Drawing.Point(29, 122); 110 | this.label5.Name = "label5"; 111 | this.label5.Size = new System.Drawing.Size(31, 16); 112 | this.label5.TabIndex = 10; 113 | this.label5.Text = "Ara:"; 114 | // 115 | // btn_Delete 116 | // 117 | this.btn_Delete.Image = global::GGMSYS.Properties.Resources.icons8_delete_30; 118 | this.btn_Delete.Location = new System.Drawing.Point(652, 78); 119 | this.btn_Delete.Name = "btn_Delete"; 120 | this.btn_Delete.Size = new System.Drawing.Size(137, 60); 121 | this.btn_Delete.TabIndex = 4; 122 | this.btn_Delete.Text = "Sil"; 123 | this.btn_Delete.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 124 | this.btn_Delete.UseVisualStyleBackColor = true; 125 | this.btn_Delete.Click += new System.EventHandler(this.btn_Delete_Click); 126 | // 127 | // btn_Save 128 | // 129 | this.btn_Save.Image = global::GGMSYS.Properties.Resources.icons8_save_30; 130 | this.btn_Save.ImageAlign = System.Drawing.ContentAlignment.TopCenter; 131 | this.btn_Save.Location = new System.Drawing.Point(652, 10); 132 | this.btn_Save.Name = "btn_Save"; 133 | this.btn_Save.Size = new System.Drawing.Size(137, 62); 134 | this.btn_Save.TabIndex = 3; 135 | this.btn_Save.Text = "Kaydet Güncelle"; 136 | this.btn_Save.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 137 | this.btn_Save.UseVisualStyleBackColor = true; 138 | this.btn_Save.Click += new System.EventHandler(this.btn_Save_Click); 139 | // 140 | // text_StockPrice 141 | // 142 | this.text_StockPrice.Location = new System.Drawing.Point(450, 81); 143 | this.text_StockPrice.Name = "text_StockPrice"; 144 | this.text_StockPrice.Size = new System.Drawing.Size(176, 22); 145 | this.text_StockPrice.TabIndex = 2; 146 | // 147 | // text_Stock 148 | // 149 | this.text_Stock.Location = new System.Drawing.Point(107, 78); 150 | this.text_Stock.Name = "text_Stock"; 151 | this.text_Stock.Size = new System.Drawing.Size(176, 22); 152 | this.text_Stock.TabIndex = 1; 153 | // 154 | // label4 155 | // 156 | this.label4.AutoSize = true; 157 | this.label4.Location = new System.Drawing.Point(372, 81); 158 | this.label4.Name = "label4"; 159 | this.label4.Size = new System.Drawing.Size(72, 16); 160 | this.label4.TabIndex = 3; 161 | this.label4.Text = "Stok Fiyatı:"; 162 | // 163 | // label3 164 | // 165 | this.label3.AutoSize = true; 166 | this.label3.Location = new System.Drawing.Point(29, 81); 167 | this.label3.Name = "label3"; 168 | this.label3.Size = new System.Drawing.Size(76, 16); 169 | this.label3.TabIndex = 2; 170 | this.label3.Text = "Stok Miktarı"; 171 | // 172 | // label2 173 | // 174 | this.label2.AutoSize = true; 175 | this.label2.Location = new System.Drawing.Point(372, 37); 176 | this.label2.Name = "label2"; 177 | this.label2.Size = new System.Drawing.Size(64, 16); 178 | this.label2.TabIndex = 1; 179 | this.label2.Text = "Stok İsmi:"; 180 | // 181 | // label1 182 | // 183 | this.label1.AutoSize = true; 184 | this.label1.Location = new System.Drawing.Point(29, 38); 185 | this.label1.Name = "label1"; 186 | this.label1.Size = new System.Drawing.Size(71, 16); 187 | this.label1.TabIndex = 0; 188 | this.label1.Text = "Stok Kodu:"; 189 | // 190 | // groupBox2 191 | // 192 | this.groupBox2.BackColor = System.Drawing.SystemColors.ActiveCaption; 193 | this.groupBox2.Controls.Add(this.data_StockList); 194 | this.groupBox2.Location = new System.Drawing.Point(1, 163); 195 | this.groupBox2.Name = "groupBox2"; 196 | this.groupBox2.Size = new System.Drawing.Size(798, 487); 197 | this.groupBox2.TabIndex = 1; 198 | this.groupBox2.TabStop = false; 199 | this.groupBox2.Text = "Ürün ve Stok Listesi"; 200 | // 201 | // data_StockList 202 | // 203 | this.data_StockList.AllowUserToAddRows = false; 204 | this.data_StockList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 205 | this.data_StockList.Location = new System.Drawing.Point(6, 21); 206 | this.data_StockList.Name = "data_StockList"; 207 | this.data_StockList.ReadOnly = true; 208 | this.data_StockList.RowHeadersWidth = 51; 209 | this.data_StockList.RowTemplate.Height = 24; 210 | this.data_StockList.Size = new System.Drawing.Size(792, 458); 211 | this.data_StockList.TabIndex = 0; 212 | this.data_StockList.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.data_StockList_CellDoubleClick); 213 | // 214 | // frm_Stock 215 | // 216 | this.AcceptButton = this.btn_Save; 217 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 218 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 219 | this.BackColor = System.Drawing.SystemColors.ActiveCaption; 220 | this.ClientSize = new System.Drawing.Size(802, 654); 221 | this.Controls.Add(this.groupBox2); 222 | this.Controls.Add(this.groupBox1); 223 | this.MaximizeBox = false; 224 | this.Name = "frm_Stock"; 225 | this.Text = "Ürün Kayıt ve Stok Bilgisi"; 226 | this.Load += new System.EventHandler(this.frm_Stock_Load); 227 | this.groupBox1.ResumeLayout(false); 228 | this.groupBox1.PerformLayout(); 229 | this.groupBox2.ResumeLayout(false); 230 | ((System.ComponentModel.ISupportInitialize)(this.data_StockList)).EndInit(); 231 | this.ResumeLayout(false); 232 | 233 | } 234 | 235 | #endregion 236 | 237 | private System.Windows.Forms.GroupBox groupBox1; 238 | private System.Windows.Forms.Label label4; 239 | private System.Windows.Forms.Label label3; 240 | private System.Windows.Forms.Label label2; 241 | private System.Windows.Forms.Label label1; 242 | private System.Windows.Forms.TextBox text_StockPrice; 243 | private System.Windows.Forms.TextBox text_Stock; 244 | private System.Windows.Forms.TextBox text_StockCode; 245 | private System.Windows.Forms.TextBox text_StockSearch; 246 | private System.Windows.Forms.Label label5; 247 | private System.Windows.Forms.Button btn_Delete; 248 | private System.Windows.Forms.Button btn_Save; 249 | private System.Windows.Forms.GroupBox groupBox2; 250 | private System.Windows.Forms.DataGridView data_StockList; 251 | private System.Windows.Forms.TextBox text_StockName; 252 | private System.Windows.Forms.TextBox text_StockID; 253 | } 254 | } -------------------------------------------------------------------------------- /frm_Stock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Data.SqlClient; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace GGMSYS 13 | { 14 | public partial class frm_Stock : Form 15 | { 16 | public frm_Stock() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | private void btn_Save_Click(object sender, EventArgs e) 22 | { 23 | // Gerekli alanların kontrolü 24 | if (string.IsNullOrWhiteSpace(text_StockCode.Text) || 25 | string.IsNullOrWhiteSpace(text_StockName.Text) || 26 | string.IsNullOrWhiteSpace(text_StockPrice.Text)) 27 | { 28 | MessageBox.Show("Lütfen tüm zorunlu alanları doldurun.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); 29 | return; 30 | } 31 | 32 | string commandText; 33 | List parameters = new List 34 | { 35 | new SqlParameter("@StockCode", text_StockCode.Text), 36 | new SqlParameter("@StockName", text_StockName.Text), 37 | new SqlParameter("@StockQuantity", text_Stock.Text), 38 | new SqlParameter("@StockPrice", decimal.Parse(text_StockPrice.Text)) 39 | }; 40 | 41 | if (string.IsNullOrEmpty(text_StockCode.Tag as string)) // Yeni stok ekleme 42 | { 43 | commandText = @"INSERT INTO Stocks (StockCode, StockName, StockQuantity, StockPrice, CreateDate) 44 | VALUES (@StockCode, @StockName, @StockQuantity, @StockPrice, GETDATE())"; 45 | } 46 | else // Stok güncelleme 47 | { 48 | commandText = @"UPDATE Stocks SET StockCode=@StockCode, StockName=@StockName, StockQuantity=@StockQuantity, StockPrice=@StockPrice, UpdateDate=GETDATE() 49 | WHERE StockID=@StockID"; 50 | parameters.Add(new SqlParameter("@StockID", int.Parse(text_StockCode.Tag.ToString()))); // Güncelleme için StockID 51 | } 52 | 53 | DBHelper.ExecuteNonQuery(commandText, CommandType.Text, parameters.ToArray()); 54 | RefreshStockList(); 55 | frm_Stock_Load(sender, e); 56 | MessageBox.Show("Stok bilgileri başarıyla kaydedildi.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); 57 | } 58 | 59 | private void RefreshStockList() 60 | { 61 | string commandText = @" 62 | SELECT 63 | StockID, 64 | StockCode as 'Stok Kodu', 65 | StockName as 'Stok Adı', 66 | StockQuantity as 'Stok Miktarı', 67 | StockPrice as 'Fiyatı', 68 | CreateDate as 'Oluşturma Tarihi', 69 | UpdateDate as 'Güncelleme Tarihi' 70 | FROM Stocks"; 71 | 72 | DataTable stockTable = DBHelper.ExecuteSelectCommand(commandText, CommandType.Text); 73 | data_StockList.DataSource = stockTable; 74 | 75 | // Hide ID and date columns 76 | data_StockList.Columns["StockID"].Visible = false; 77 | data_StockList.Columns["Oluşturma Tarihi"].Visible = false; 78 | data_StockList.Columns["Güncelleme Tarihi"].Visible = false; 79 | 80 | // Adjust column sizes 81 | data_StockList.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; 82 | data_StockList.RowHeadersVisible = false; 83 | 84 | // Clear the text fields 85 | text_Stock.Clear(); 86 | text_StockCode.Clear(); 87 | text_StockPrice.Clear(); 88 | text_StockSearch.Clear(); 89 | text_StockName.Clear(); 90 | } 91 | 92 | 93 | private void data_StockList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) 94 | { 95 | if (e.RowIndex != -1) 96 | { 97 | DataGridViewRow row = data_StockList.Rows[e.RowIndex]; 98 | text_StockCode.Tag = row.Cells["StockID"].Value.ToString(); // Güncelleme için StockID'yi sakla 99 | text_StockCode.Text = row.Cells["StockCode"].Value.ToString(); 100 | text_StockName.Text = row.Cells["StockName"].Value.ToString(); 101 | text_Stock.Text = row.Cells["StockQuantity"].Value.ToString(); 102 | text_StockPrice.Text = row.Cells["StockPrice"].Value.ToString(); 103 | } 104 | } 105 | 106 | private void btn_Delete_Click(object sender, EventArgs e) 107 | { 108 | if (!string.IsNullOrEmpty(text_StockCode.Tag as string)) 109 | { 110 | DialogResult dialogResult = MessageBox.Show("Seçilen stok kaydını silmek istediğinize emin misiniz?", "Stok Kaydını Sil", MessageBoxButtons.YesNo, MessageBoxIcon.Question); 111 | if (dialogResult == DialogResult.Yes) 112 | { 113 | int stockID = Convert.ToInt32(text_StockCode.Tag); 114 | string checkSalesCommandText = "SELECT COUNT(*) FROM Sales WHERE StockID = @StockID"; 115 | SqlParameter[] checkSalesParameters = { new SqlParameter("@StockID", stockID) }; 116 | 117 | int salesCount = Convert.ToInt32(DBHelper.ExecuteScalar(checkSalesCommandText, CommandType.Text, checkSalesParameters)); 118 | 119 | if (salesCount > 0) 120 | { 121 | MessageBox.Show("Bu stok kaydı üzerinde satış veya alış işlemi olduğundan silinemez.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); 122 | return; 123 | } 124 | 125 | string deleteCommandText = "DELETE FROM Stocks WHERE StockID = @StockID"; 126 | SqlParameter[] deleteParameters = { new SqlParameter("@StockID", stockID) }; 127 | 128 | DBHelper.ExecuteNonQuery(deleteCommandText, CommandType.Text, deleteParameters); 129 | RefreshStockList(); 130 | MessageBox.Show("Stok kaydı silindi.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); 131 | } 132 | } 133 | else 134 | { 135 | MessageBox.Show("Lütfen silmek istediğiniz stok kaydını seçin.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); 136 | } 137 | } 138 | 139 | 140 | 141 | private void frm_Stock_Load(object sender, EventArgs e) 142 | { 143 | RefreshStockList(); 144 | SetNextStockCode(); 145 | } 146 | 147 | private void SetNextStockCode() 148 | { 149 | string commandText = "SELECT ISNULL(MAX(CAST(StockCode AS INT)), 99) + 1 FROM Stocks"; 150 | object result = DBHelper.ExecuteScalar(commandText, CommandType.Text); 151 | 152 | if (result != null) 153 | { 154 | text_StockCode.Text = result.ToString(); 155 | } 156 | else 157 | { 158 | text_StockCode.Text = "100"; 159 | } 160 | } 161 | 162 | private void text_StockSearch_TextChanged(object sender, EventArgs e) 163 | { 164 | string searchText = text_StockSearch.Text.ToLower(); 165 | foreach (DataGridViewRow row in data_StockList.Rows) 166 | { 167 | if (row.Cells["StockName"].Value != null) 168 | { 169 | string stockName = row.Cells["StockName"].Value.ToString().ToLower(); 170 | row.Visible = stockName.Contains(searchText); 171 | } 172 | } 173 | } 174 | } 175 | } -------------------------------------------------------------------------------- /frm_Stock.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /frm_StockActivity.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace GGMSYS 2 | { 3 | partial class frm_StockActivity 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 32 | this.btn_Fliter = new System.Windows.Forms.Button(); 33 | this.text_EvrakSira = new System.Windows.Forms.TextBox(); 34 | this.label7 = new System.Windows.Forms.Label(); 35 | this.combo_StockName = new System.Windows.Forms.ComboBox(); 36 | this.combo_CompanyName = new System.Windows.Forms.ComboBox(); 37 | this.date_EndTime = new System.Windows.Forms.DateTimePicker(); 38 | this.date_StartTime = new System.Windows.Forms.DateTimePicker(); 39 | this.label6 = new System.Windows.Forms.Label(); 40 | this.label5 = new System.Windows.Forms.Label(); 41 | this.text_EvrakSeri = new System.Windows.Forms.TextBox(); 42 | this.label4 = new System.Windows.Forms.Label(); 43 | this.radio_FilterOutput = new System.Windows.Forms.RadioButton(); 44 | this.radio_FilterInput = new System.Windows.Forms.RadioButton(); 45 | this.radio_FilterAll = new System.Windows.Forms.RadioButton(); 46 | this.text_StockCode = new System.Windows.Forms.TextBox(); 47 | this.label3 = new System.Windows.Forms.Label(); 48 | this.label2 = new System.Windows.Forms.Label(); 49 | this.label1 = new System.Windows.Forms.Label(); 50 | this.data_StockActivity = new System.Windows.Forms.DataGridView(); 51 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 52 | this.groupBox1.SuspendLayout(); 53 | ((System.ComponentModel.ISupportInitialize)(this.data_StockActivity)).BeginInit(); 54 | this.groupBox2.SuspendLayout(); 55 | this.SuspendLayout(); 56 | // 57 | // groupBox1 58 | // 59 | this.groupBox1.BackColor = System.Drawing.SystemColors.ActiveCaption; 60 | this.groupBox1.Controls.Add(this.btn_Fliter); 61 | this.groupBox1.Controls.Add(this.text_EvrakSira); 62 | this.groupBox1.Controls.Add(this.label7); 63 | this.groupBox1.Controls.Add(this.combo_StockName); 64 | this.groupBox1.Controls.Add(this.combo_CompanyName); 65 | this.groupBox1.Controls.Add(this.date_EndTime); 66 | this.groupBox1.Controls.Add(this.date_StartTime); 67 | this.groupBox1.Controls.Add(this.label6); 68 | this.groupBox1.Controls.Add(this.label5); 69 | this.groupBox1.Controls.Add(this.text_EvrakSeri); 70 | this.groupBox1.Controls.Add(this.label4); 71 | this.groupBox1.Controls.Add(this.radio_FilterOutput); 72 | this.groupBox1.Controls.Add(this.radio_FilterInput); 73 | this.groupBox1.Controls.Add(this.radio_FilterAll); 74 | this.groupBox1.Controls.Add(this.text_StockCode); 75 | this.groupBox1.Controls.Add(this.label3); 76 | this.groupBox1.Controls.Add(this.label2); 77 | this.groupBox1.Controls.Add(this.label1); 78 | this.groupBox1.Location = new System.Drawing.Point(2, 3); 79 | this.groupBox1.Name = "groupBox1"; 80 | this.groupBox1.Size = new System.Drawing.Size(795, 178); 81 | this.groupBox1.TabIndex = 0; 82 | this.groupBox1.TabStop = false; 83 | this.groupBox1.Text = "Flitreler"; 84 | // 85 | // btn_Fliter 86 | // 87 | this.btn_Fliter.Image = global::GGMSYS.Properties.Resources.icons8_filter_30; 88 | this.btn_Fliter.Location = new System.Drawing.Point(607, 118); 89 | this.btn_Fliter.Name = "btn_Fliter"; 90 | this.btn_Fliter.Size = new System.Drawing.Size(137, 38); 91 | this.btn_Fliter.TabIndex = 21; 92 | this.btn_Fliter.Text = "Fitrele"; 93 | this.btn_Fliter.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 94 | this.btn_Fliter.UseVisualStyleBackColor = true; 95 | this.btn_Fliter.Click += new System.EventHandler(this.btn_Fliter_Click); 96 | // 97 | // text_EvrakSira 98 | // 99 | this.text_EvrakSira.Location = new System.Drawing.Point(349, 134); 100 | this.text_EvrakSira.Name = "text_EvrakSira"; 101 | this.text_EvrakSira.Size = new System.Drawing.Size(170, 22); 102 | this.text_EvrakSira.TabIndex = 20; 103 | this.text_EvrakSira.TextChanged += new System.EventHandler(this.text_EvrakSira_TextChanged); 104 | // 105 | // label7 106 | // 107 | this.label7.AutoSize = true; 108 | this.label7.Location = new System.Drawing.Point(275, 137); 109 | this.label7.Name = "label7"; 110 | this.label7.Size = new System.Drawing.Size(72, 16); 111 | this.label7.TabIndex = 19; 112 | this.label7.Text = "Evrak Sıra:"; 113 | // 114 | // combo_StockName 115 | // 116 | this.combo_StockName.FormattingEnabled = true; 117 | this.combo_StockName.Location = new System.Drawing.Point(87, 60); 118 | this.combo_StockName.Name = "combo_StockName"; 119 | this.combo_StockName.Size = new System.Drawing.Size(170, 24); 120 | this.combo_StockName.TabIndex = 18; 121 | // 122 | // combo_CompanyName 123 | // 124 | this.combo_CompanyName.FormattingEnabled = true; 125 | this.combo_CompanyName.Location = new System.Drawing.Point(87, 26); 126 | this.combo_CompanyName.Name = "combo_CompanyName"; 127 | this.combo_CompanyName.Size = new System.Drawing.Size(170, 24); 128 | this.combo_CompanyName.TabIndex = 17; 129 | // 130 | // date_EndTime 131 | // 132 | this.date_EndTime.Location = new System.Drawing.Point(607, 66); 133 | this.date_EndTime.Name = "date_EndTime"; 134 | this.date_EndTime.Size = new System.Drawing.Size(137, 22); 135 | this.date_EndTime.TabIndex = 16; 136 | this.date_EndTime.ValueChanged += new System.EventHandler(this.date_EndTime_ValueChanged); 137 | // 138 | // date_StartTime 139 | // 140 | this.date_StartTime.Location = new System.Drawing.Point(607, 32); 141 | this.date_StartTime.Name = "date_StartTime"; 142 | this.date_StartTime.Size = new System.Drawing.Size(137, 22); 143 | this.date_StartTime.TabIndex = 15; 144 | this.date_StartTime.ValueChanged += new System.EventHandler(this.date_StartTime_ValueChanged); 145 | // 146 | // label6 147 | // 148 | this.label6.AutoSize = true; 149 | this.label6.Location = new System.Drawing.Point(486, 66); 150 | this.label6.Name = "label6"; 151 | this.label6.Size = new System.Drawing.Size(72, 16); 152 | this.label6.TabIndex = 14; 153 | this.label6.Text = "Bitiş Tarihi:"; 154 | // 155 | // label5 156 | // 157 | this.label5.AutoSize = true; 158 | this.label5.Location = new System.Drawing.Point(486, 33); 159 | this.label5.Name = "label5"; 160 | this.label5.Size = new System.Drawing.Size(107, 16); 161 | this.label5.TabIndex = 13; 162 | this.label5.Text = "Başlangıç Tarihi:"; 163 | // 164 | // text_EvrakSeri 165 | // 166 | this.text_EvrakSeri.Location = new System.Drawing.Point(87, 131); 167 | this.text_EvrakSeri.Name = "text_EvrakSeri"; 168 | this.text_EvrakSeri.Size = new System.Drawing.Size(170, 22); 169 | this.text_EvrakSeri.TabIndex = 12; 170 | this.text_EvrakSeri.TextChanged += new System.EventHandler(this.text_EvrakSeri_TextChanged); 171 | // 172 | // label4 173 | // 174 | this.label4.AutoSize = true; 175 | this.label4.Location = new System.Drawing.Point(13, 134); 176 | this.label4.Name = "label4"; 177 | this.label4.Size = new System.Drawing.Size(72, 16); 178 | this.label4.TabIndex = 11; 179 | this.label4.Text = "Evrak Seri:"; 180 | // 181 | // radio_FilterOutput 182 | // 183 | this.radio_FilterOutput.AutoSize = true; 184 | this.radio_FilterOutput.Location = new System.Drawing.Point(366, 95); 185 | this.radio_FilterOutput.Name = "radio_FilterOutput"; 186 | this.radio_FilterOutput.Size = new System.Drawing.Size(57, 20); 187 | this.radio_FilterOutput.TabIndex = 10; 188 | this.radio_FilterOutput.Text = "Çıkış"; 189 | this.radio_FilterOutput.UseVisualStyleBackColor = true; 190 | this.radio_FilterOutput.CheckedChanged += new System.EventHandler(this.radio_FilterOutput_CheckedChanged); 191 | // 192 | // radio_FilterInput 193 | // 194 | this.radio_FilterInput.AutoSize = true; 195 | this.radio_FilterInput.Location = new System.Drawing.Point(366, 60); 196 | this.radio_FilterInput.Name = "radio_FilterInput"; 197 | this.radio_FilterInput.Size = new System.Drawing.Size(55, 20); 198 | this.radio_FilterInput.TabIndex = 9; 199 | this.radio_FilterInput.Text = "Giriş"; 200 | this.radio_FilterInput.UseVisualStyleBackColor = true; 201 | this.radio_FilterInput.CheckedChanged += new System.EventHandler(this.radio_FilterInput_CheckedChanged); 202 | // 203 | // radio_FilterAll 204 | // 205 | this.radio_FilterAll.AutoSize = true; 206 | this.radio_FilterAll.Checked = true; 207 | this.radio_FilterAll.Location = new System.Drawing.Point(366, 27); 208 | this.radio_FilterAll.Name = "radio_FilterAll"; 209 | this.radio_FilterAll.Size = new System.Drawing.Size(62, 20); 210 | this.radio_FilterAll.TabIndex = 8; 211 | this.radio_FilterAll.TabStop = true; 212 | this.radio_FilterAll.Text = "Tümü"; 213 | this.radio_FilterAll.UseVisualStyleBackColor = true; 214 | this.radio_FilterAll.CheckedChanged += new System.EventHandler(this.radio_FilterAll_CheckedChanged); 215 | // 216 | // text_StockCode 217 | // 218 | this.text_StockCode.Location = new System.Drawing.Point(87, 95); 219 | this.text_StockCode.Name = "text_StockCode"; 220 | this.text_StockCode.Size = new System.Drawing.Size(170, 22); 221 | this.text_StockCode.TabIndex = 5; 222 | this.text_StockCode.TextChanged += new System.EventHandler(this.text_StockCode_TextChanged); 223 | // 224 | // label3 225 | // 226 | this.label3.AutoSize = true; 227 | this.label3.Location = new System.Drawing.Point(13, 98); 228 | this.label3.Name = "label3"; 229 | this.label3.Size = new System.Drawing.Size(72, 16); 230 | this.label3.TabIndex = 4; 231 | this.label3.Text = "Ürün Kodu:"; 232 | // 233 | // label2 234 | // 235 | this.label2.AutoSize = true; 236 | this.label2.Location = new System.Drawing.Point(13, 63); 237 | this.label2.Name = "label2"; 238 | this.label2.Size = new System.Drawing.Size(61, 16); 239 | this.label2.TabIndex = 2; 240 | this.label2.Text = "Ürün Adı:"; 241 | // 242 | // label1 243 | // 244 | this.label1.AutoSize = true; 245 | this.label1.Location = new System.Drawing.Point(13, 30); 246 | this.label1.Name = "label1"; 247 | this.label1.Size = new System.Drawing.Size(67, 16); 248 | this.label1.TabIndex = 0; 249 | this.label1.Text = "Firma Adı:"; 250 | // 251 | // data_StockActivity 252 | // 253 | this.data_StockActivity.AllowUserToAddRows = false; 254 | this.data_StockActivity.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 255 | this.data_StockActivity.Location = new System.Drawing.Point(0, 25); 256 | this.data_StockActivity.Name = "data_StockActivity"; 257 | this.data_StockActivity.ReadOnly = true; 258 | this.data_StockActivity.RowHeadersWidth = 51; 259 | this.data_StockActivity.RowTemplate.Height = 24; 260 | this.data_StockActivity.Size = new System.Drawing.Size(795, 553); 261 | this.data_StockActivity.TabIndex = 1; 262 | // 263 | // groupBox2 264 | // 265 | this.groupBox2.BackColor = System.Drawing.SystemColors.ActiveCaption; 266 | this.groupBox2.Controls.Add(this.data_StockActivity); 267 | this.groupBox2.Location = new System.Drawing.Point(2, 187); 268 | this.groupBox2.Name = "groupBox2"; 269 | this.groupBox2.Size = new System.Drawing.Size(795, 578); 270 | this.groupBox2.TabIndex = 2; 271 | this.groupBox2.TabStop = false; 272 | this.groupBox2.Text = "Stok Haraketleri"; 273 | // 274 | // frm_StockActivity 275 | // 276 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 277 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 278 | this.BackColor = System.Drawing.SystemColors.ActiveCaption; 279 | this.ClientSize = new System.Drawing.Size(802, 767); 280 | this.Controls.Add(this.groupBox2); 281 | this.Controls.Add(this.groupBox1); 282 | this.Name = "frm_StockActivity"; 283 | this.Text = "Stok Haraketleri"; 284 | this.Load += new System.EventHandler(this.frm_StockActivity_Load); 285 | this.groupBox1.ResumeLayout(false); 286 | this.groupBox1.PerformLayout(); 287 | ((System.ComponentModel.ISupportInitialize)(this.data_StockActivity)).EndInit(); 288 | this.groupBox2.ResumeLayout(false); 289 | this.ResumeLayout(false); 290 | 291 | } 292 | 293 | #endregion 294 | 295 | private System.Windows.Forms.GroupBox groupBox1; 296 | private System.Windows.Forms.DataGridView data_StockActivity; 297 | private System.Windows.Forms.Label label1; 298 | private System.Windows.Forms.TextBox text_EvrakSeri; 299 | private System.Windows.Forms.Label label4; 300 | private System.Windows.Forms.RadioButton radio_FilterOutput; 301 | private System.Windows.Forms.RadioButton radio_FilterInput; 302 | private System.Windows.Forms.RadioButton radio_FilterAll; 303 | private System.Windows.Forms.TextBox text_StockCode; 304 | private System.Windows.Forms.Label label3; 305 | private System.Windows.Forms.Label label2; 306 | private System.Windows.Forms.GroupBox groupBox2; 307 | private System.Windows.Forms.DateTimePicker date_EndTime; 308 | private System.Windows.Forms.DateTimePicker date_StartTime; 309 | private System.Windows.Forms.Label label6; 310 | private System.Windows.Forms.Label label5; 311 | private System.Windows.Forms.ComboBox combo_StockName; 312 | private System.Windows.Forms.ComboBox combo_CompanyName; 313 | private System.Windows.Forms.TextBox text_EvrakSira; 314 | private System.Windows.Forms.Label label7; 315 | private System.Windows.Forms.Button btn_Fliter; 316 | } 317 | } -------------------------------------------------------------------------------- /frm_StockActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Data.SqlClient; 5 | using System.Windows.Forms; 6 | 7 | namespace GGMSYS 8 | { 9 | public partial class frm_StockActivity : Form 10 | { 11 | public frm_StockActivity() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | private void frm_StockActivity_Load(object sender, EventArgs e) 17 | { 18 | FillCompanyComboBox(); 19 | FillStockComboBox(); 20 | LoadSalesData(); 21 | } 22 | 23 | private void FillCompanyComboBox() 24 | { 25 | try 26 | { 27 | string commandText = "SELECT ClientID, CompanyName FROM Clients WHERE SaleOff = 0"; 28 | DataTable companiesTable = DBHelper.ExecuteSelectCommand(commandText, CommandType.Text); 29 | combo_CompanyName.DataSource = companiesTable; 30 | combo_CompanyName.DisplayMember = "CompanyName"; 31 | combo_CompanyName.ValueMember = "ClientID"; 32 | combo_CompanyName.SelectedIndex = -1; 33 | } 34 | catch (Exception ex) 35 | { 36 | MessageBox.Show($"Error loading company names: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 37 | } 38 | } 39 | 40 | private void FillStockComboBox() 41 | { 42 | try 43 | { 44 | string commandText = "SELECT StockID, StockName, StockCode FROM Stocks"; 45 | DataTable stockTable = DBHelper.ExecuteSelectCommand(commandText, CommandType.Text); 46 | combo_StockName.DataSource = stockTable; 47 | combo_StockName.DisplayMember = "StockName"; 48 | combo_StockName.ValueMember = "StockID"; 49 | combo_StockName.SelectedIndex = -1; 50 | } 51 | catch (Exception ex) 52 | { 53 | MessageBox.Show($"Error loading stock names: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 54 | } 55 | } 56 | 57 | private void LoadSalesData() 58 | { 59 | try 60 | { 61 | string query = @" 62 | SELECT 63 | s.Evrak_Seri AS 'Evrak Seri', 64 | s.Evrak_Sira AS 'Evrak Sıra', 65 | s.ClientID AS 'Müşteri Kodu', 66 | c.CompanyName AS 'Firma Adı', 67 | st.StockCode AS 'Stok Kodu', 68 | st.StockName AS 'Stok Adı', 69 | s.Quantity AS 'Miktar', 70 | s.SalePrice AS 'Satış Fiyatı', 71 | (s.Quantity * s.SalePrice) AS 'Toplam Tutar', 72 | s.Quantity AS 'Toplam Miktar', 73 | CASE WHEN s.IsInStock = 1 THEN 'Giriş' ELSE 'Çıkış' END AS 'Stok Durumu', 74 | s.CreateDate AS 'Oluşturma Tarihi', 75 | s.UpdateDate AS 'Güncelleme Tarihi' 76 | FROM Sales s 77 | JOIN Stocks st ON s.StockID = st.StockID 78 | JOIN Clients c ON s.ClientID = c.ClientID"; 79 | DataTable salesTable = DBHelper.ExecuteSelectCommand(query, CommandType.Text); 80 | data_StockActivity.DataSource = salesTable; 81 | } 82 | catch (Exception ex) 83 | { 84 | MessageBox.Show($"Satış verileri yüklenirken bir hata oluştu: {ex.Message}", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); 85 | } 86 | } 87 | 88 | 89 | 90 | 91 | 92 | private void combo_CompanyName_SelectedIndexChanged(object sender, EventArgs e) 93 | { 94 | FilterSales(); 95 | } 96 | 97 | private void combo_StockName_SelectedIndexChanged(object sender, EventArgs e) 98 | { 99 | if (combo_StockName.SelectedIndex != -1) 100 | { 101 | DataRowView drv = combo_StockName.SelectedItem as DataRowView; 102 | if (drv != null) 103 | { 104 | text_StockCode.Text = drv["StockCode"].ToString(); 105 | } 106 | } 107 | else 108 | { 109 | text_StockCode.Text = string.Empty; 110 | } 111 | FilterSales(); 112 | } 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | private void FilterSales() 125 | { 126 | try 127 | { 128 | string query = @" 129 | SELECT 130 | s.Evrak_Seri AS 'Evrak Seri', 131 | s.Evrak_Sira AS 'Evrak Sıra', 132 | s.ClientID AS 'Müşteri Kodu', 133 | c.CompanyName AS 'Firma Adı', 134 | st.StockCode AS 'Stok Kodu', 135 | st.StockName AS 'Stok Adı', 136 | s.Quantity AS 'Miktar', 137 | s.SalePrice AS 'Satış Fiyatı', 138 | (s.Quantity * s.SalePrice) AS 'Toplam Tutar', 139 | s.Quantity AS 'Toplam Miktar', 140 | CASE WHEN s.IsInStock = 1 THEN 'Giriş' ELSE 'Çıkış' END AS 'Stok Durumu', 141 | s.CreateDate AS 'Oluşturma Tarihi', 142 | s.UpdateDate AS 'Güncelleme Tarihi' 143 | FROM Sales s 144 | JOIN Stocks st ON s.StockID = st.StockID 145 | JOIN Clients c ON s.ClientID = c.ClientID 146 | WHERE 1=1"; 147 | 148 | List parameters = new List(); 149 | 150 | if (combo_CompanyName.SelectedIndex != -1) 151 | { 152 | query += " AND s.ClientID = @ClientID"; 153 | parameters.Add(new SqlParameter("@ClientID", combo_CompanyName.SelectedValue)); 154 | } 155 | 156 | if (combo_StockName.SelectedIndex != -1) 157 | { 158 | query += " AND s.StockID = @StockID"; 159 | parameters.Add(new SqlParameter("@StockID", combo_StockName.SelectedValue)); 160 | } 161 | 162 | if (!string.IsNullOrWhiteSpace(text_StockCode.Text)) 163 | { 164 | query += " AND s.StockID IN (SELECT StockID FROM Stocks WHERE StockCode = @StockCode)"; 165 | parameters.Add(new SqlParameter("@StockCode", text_StockCode.Text)); 166 | } 167 | 168 | if (!string.IsNullOrWhiteSpace(text_EvrakSeri.Text)) 169 | { 170 | query += " AND s.Evrak_Seri = @EvrakSeri"; 171 | parameters.Add(new SqlParameter("@EvrakSeri", text_EvrakSeri.Text)); 172 | } 173 | 174 | if (!string.IsNullOrWhiteSpace(text_EvrakSira.Text)) 175 | { 176 | query += " AND s.Evrak_Sira = @EvrakSira"; 177 | parameters.Add(new SqlParameter("@EvrakSira", text_EvrakSira.Text)); 178 | } 179 | 180 | if (radio_FilterInput.Checked) 181 | { 182 | query += " AND s.IsInStock = 1"; 183 | } 184 | else if (radio_FilterOutput.Checked) 185 | { 186 | query += " AND s.IsInStock = 0"; 187 | } 188 | 189 | if (date_StartTime.Value.Date != DateTime.Now.Date || date_EndTime.Value.Date != DateTime.Now.Date) 190 | { 191 | query += " AND s.CreateDate BETWEEN @StartTime AND @EndTime"; 192 | parameters.Add(new SqlParameter("@StartTime", date_StartTime.Value)); 193 | parameters.Add(new SqlParameter("@EndTime", date_EndTime.Value)); 194 | } 195 | 196 | DataTable filteredTable = DBHelper.ExecuteSelectCommand(query, CommandType.Text, parameters.ToArray()); 197 | data_StockActivity.DataSource = filteredTable; 198 | } 199 | catch (Exception ex) 200 | { 201 | MessageBox.Show($"Error filtering sales data: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 202 | } 203 | } 204 | 205 | 206 | private void radio_FilterAll_CheckedChanged(object sender, EventArgs e) 207 | { 208 | FilterSales(); 209 | } 210 | 211 | private void text_StockCode_TextChanged(object sender, EventArgs e) 212 | { 213 | FilterSales(); 214 | } 215 | 216 | private void text_EvrakSeri_TextChanged(object sender, EventArgs e) 217 | { 218 | FilterSales(); 219 | } 220 | 221 | private void text_EvrakSira_TextChanged(object sender, EventArgs e) 222 | { 223 | FilterSales(); 224 | } 225 | 226 | private void radio_FilterInput_CheckedChanged(object sender, EventArgs e) 227 | { 228 | FilterSales(); 229 | } 230 | 231 | private void radio_FilterOutput_CheckedChanged(object sender, EventArgs e) 232 | { 233 | FilterSales(); 234 | } 235 | 236 | private void date_StartTime_ValueChanged(object sender, EventArgs e) 237 | { 238 | FilterSales(); 239 | } 240 | 241 | private void btn_Fliter_Click(object sender, EventArgs e) 242 | { 243 | FilterSales(); 244 | } 245 | 246 | private void date_EndTime_ValueChanged(object sender, EventArgs e) 247 | { 248 | FilterSales(); 249 | } 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /frm_StockActivity.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /frm_Users.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace GGMSYS 2 | { 3 | partial class frm_Users 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 32 | this.text_Username = new System.Windows.Forms.TextBox(); 33 | this.text_UserID = new System.Windows.Forms.TextBox(); 34 | this.btn_Delete = new System.Windows.Forms.Button(); 35 | this.btn_Save = new System.Windows.Forms.Button(); 36 | this.text_Surname = new System.Windows.Forms.TextBox(); 37 | this.text_Name = new System.Windows.Forms.TextBox(); 38 | this.text_Password = new System.Windows.Forms.TextBox(); 39 | this.check_DeActive = new System.Windows.Forms.CheckBox(); 40 | this.check_Admin = new System.Windows.Forms.CheckBox(); 41 | this.label4 = new System.Windows.Forms.Label(); 42 | this.label3 = new System.Windows.Forms.Label(); 43 | this.label2 = new System.Windows.Forms.Label(); 44 | this.label1 = new System.Windows.Forms.Label(); 45 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 46 | this.data_UserList = new System.Windows.Forms.DataGridView(); 47 | this.groupBox1.SuspendLayout(); 48 | this.groupBox2.SuspendLayout(); 49 | ((System.ComponentModel.ISupportInitialize)(this.data_UserList)).BeginInit(); 50 | this.SuspendLayout(); 51 | // 52 | // groupBox1 53 | // 54 | this.groupBox1.BackColor = System.Drawing.SystemColors.ActiveCaption; 55 | this.groupBox1.Controls.Add(this.text_Username); 56 | this.groupBox1.Controls.Add(this.text_UserID); 57 | this.groupBox1.Controls.Add(this.btn_Delete); 58 | this.groupBox1.Controls.Add(this.btn_Save); 59 | this.groupBox1.Controls.Add(this.text_Surname); 60 | this.groupBox1.Controls.Add(this.text_Name); 61 | this.groupBox1.Controls.Add(this.text_Password); 62 | this.groupBox1.Controls.Add(this.check_DeActive); 63 | this.groupBox1.Controls.Add(this.check_Admin); 64 | this.groupBox1.Controls.Add(this.label4); 65 | this.groupBox1.Controls.Add(this.label3); 66 | this.groupBox1.Controls.Add(this.label2); 67 | this.groupBox1.Controls.Add(this.label1); 68 | this.groupBox1.Location = new System.Drawing.Point(2, 2); 69 | this.groupBox1.Name = "groupBox1"; 70 | this.groupBox1.Size = new System.Drawing.Size(488, 263); 71 | this.groupBox1.TabIndex = 0; 72 | this.groupBox1.TabStop = false; 73 | this.groupBox1.Text = "Kullanıcı Bilgisi"; 74 | // 75 | // text_Username 76 | // 77 | this.text_Username.Location = new System.Drawing.Point(121, 36); 78 | this.text_Username.Name = "text_Username"; 79 | this.text_Username.Size = new System.Drawing.Size(301, 22); 80 | this.text_Username.TabIndex = 0; 81 | // 82 | // text_UserID 83 | // 84 | this.text_UserID.Location = new System.Drawing.Point(281, 36); 85 | this.text_UserID.Name = "text_UserID"; 86 | this.text_UserID.ReadOnly = true; 87 | this.text_UserID.Size = new System.Drawing.Size(35, 22); 88 | this.text_UserID.TabIndex = 12; 89 | // 90 | // btn_Delete 91 | // 92 | this.btn_Delete.CausesValidation = false; 93 | this.btn_Delete.Image = global::GGMSYS.Properties.Resources.icons8_delete_30; 94 | this.btn_Delete.Location = new System.Drawing.Point(367, 182); 95 | this.btn_Delete.Name = "btn_Delete"; 96 | this.btn_Delete.Size = new System.Drawing.Size(99, 50); 97 | this.btn_Delete.TabIndex = 7; 98 | this.btn_Delete.Text = "Sil"; 99 | this.btn_Delete.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 100 | this.btn_Delete.UseVisualStyleBackColor = true; 101 | this.btn_Delete.Click += new System.EventHandler(this.btn_Delete_Click); 102 | // 103 | // btn_Save 104 | // 105 | this.btn_Save.Image = global::GGMSYS.Properties.Resources.icons8_save_30; 106 | this.btn_Save.ImageAlign = System.Drawing.ContentAlignment.TopCenter; 107 | this.btn_Save.Location = new System.Drawing.Point(244, 182); 108 | this.btn_Save.Name = "btn_Save"; 109 | this.btn_Save.Size = new System.Drawing.Size(117, 50); 110 | this.btn_Save.TabIndex = 6; 111 | this.btn_Save.Text = "Kaydet Güncelle"; 112 | this.btn_Save.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 113 | this.btn_Save.UseVisualStyleBackColor = true; 114 | this.btn_Save.Click += new System.EventHandler(this.btn_Save_Click); 115 | // 116 | // text_Surname 117 | // 118 | this.text_Surname.Location = new System.Drawing.Point(121, 138); 119 | this.text_Surname.Name = "text_Surname"; 120 | this.text_Surname.Size = new System.Drawing.Size(301, 22); 121 | this.text_Surname.TabIndex = 3; 122 | // 123 | // text_Name 124 | // 125 | this.text_Name.Location = new System.Drawing.Point(121, 106); 126 | this.text_Name.Name = "text_Name"; 127 | this.text_Name.Size = new System.Drawing.Size(301, 22); 128 | this.text_Name.TabIndex = 2; 129 | // 130 | // text_Password 131 | // 132 | this.text_Password.Location = new System.Drawing.Point(121, 70); 133 | this.text_Password.Name = "text_Password"; 134 | this.text_Password.Size = new System.Drawing.Size(301, 22); 135 | this.text_Password.TabIndex = 1; 136 | // 137 | // check_DeActive 138 | // 139 | this.check_DeActive.AutoSize = true; 140 | this.check_DeActive.Location = new System.Drawing.Point(121, 190); 141 | this.check_DeActive.Name = "check_DeActive"; 142 | this.check_DeActive.Size = new System.Drawing.Size(59, 20); 143 | this.check_DeActive.TabIndex = 5; 144 | this.check_DeActive.Text = "Pasif"; 145 | this.check_DeActive.UseVisualStyleBackColor = true; 146 | // 147 | // check_Admin 148 | // 149 | this.check_Admin.AutoSize = true; 150 | this.check_Admin.Location = new System.Drawing.Point(31, 190); 151 | this.check_Admin.Name = "check_Admin"; 152 | this.check_Admin.Size = new System.Drawing.Size(67, 20); 153 | this.check_Admin.TabIndex = 4; 154 | this.check_Admin.Text = "Admin"; 155 | this.check_Admin.UseVisualStyleBackColor = true; 156 | // 157 | // label4 158 | // 159 | this.label4.AutoSize = true; 160 | this.label4.Location = new System.Drawing.Point(28, 138); 161 | this.label4.Name = "label4"; 162 | this.label4.Size = new System.Drawing.Size(53, 16); 163 | this.label4.TabIndex = 3; 164 | this.label4.Text = "Soyadı:"; 165 | // 166 | // label3 167 | // 168 | this.label3.AutoSize = true; 169 | this.label3.Location = new System.Drawing.Point(28, 106); 170 | this.label3.Name = "label3"; 171 | this.label3.Size = new System.Drawing.Size(30, 16); 172 | this.label3.TabIndex = 2; 173 | this.label3.Text = "Adı:"; 174 | // 175 | // label2 176 | // 177 | this.label2.AutoSize = true; 178 | this.label2.Location = new System.Drawing.Point(28, 72); 179 | this.label2.Name = "label2"; 180 | this.label2.Size = new System.Drawing.Size(37, 16); 181 | this.label2.TabIndex = 1; 182 | this.label2.Text = "Şifre:"; 183 | // 184 | // label1 185 | // 186 | this.label1.AutoSize = true; 187 | this.label1.Location = new System.Drawing.Point(28, 39); 188 | this.label1.Name = "label1"; 189 | this.label1.Size = new System.Drawing.Size(82, 16); 190 | this.label1.TabIndex = 0; 191 | this.label1.Text = "Kullanıcı Adı:"; 192 | // 193 | // groupBox2 194 | // 195 | this.groupBox2.BackColor = System.Drawing.SystemColors.ActiveCaption; 196 | this.groupBox2.Controls.Add(this.data_UserList); 197 | this.groupBox2.Location = new System.Drawing.Point(2, 271); 198 | this.groupBox2.Name = "groupBox2"; 199 | this.groupBox2.Size = new System.Drawing.Size(488, 277); 200 | this.groupBox2.TabIndex = 1; 201 | this.groupBox2.TabStop = false; 202 | this.groupBox2.Text = "Kullanıcı Listesi"; 203 | // 204 | // data_UserList 205 | // 206 | this.data_UserList.AllowUserToAddRows = false; 207 | this.data_UserList.AllowUserToDeleteRows = false; 208 | this.data_UserList.AllowUserToOrderColumns = true; 209 | this.data_UserList.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; 210 | this.data_UserList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 211 | this.data_UserList.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; 212 | this.data_UserList.Location = new System.Drawing.Point(3, 18); 213 | this.data_UserList.MultiSelect = false; 214 | this.data_UserList.Name = "data_UserList"; 215 | this.data_UserList.ReadOnly = true; 216 | this.data_UserList.RowHeadersWidth = 51; 217 | this.data_UserList.RowTemplate.Height = 24; 218 | this.data_UserList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; 219 | this.data_UserList.Size = new System.Drawing.Size(485, 259); 220 | this.data_UserList.TabIndex = 0; 221 | this.data_UserList.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.data_UserList_CellDoubleClick); 222 | // 223 | // frm_Users 224 | // 225 | this.AcceptButton = this.btn_Save; 226 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 227 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 228 | this.BackColor = System.Drawing.SystemColors.ActiveCaption; 229 | this.ClientSize = new System.Drawing.Size(499, 557); 230 | this.Controls.Add(this.groupBox2); 231 | this.Controls.Add(this.groupBox1); 232 | this.MaximizeBox = false; 233 | this.Name = "frm_Users"; 234 | this.Text = "Kullanıcı Kayıt"; 235 | this.Load += new System.EventHandler(this.frm_Users_Load); 236 | this.groupBox1.ResumeLayout(false); 237 | this.groupBox1.PerformLayout(); 238 | this.groupBox2.ResumeLayout(false); 239 | ((System.ComponentModel.ISupportInitialize)(this.data_UserList)).EndInit(); 240 | this.ResumeLayout(false); 241 | 242 | } 243 | 244 | #endregion 245 | 246 | private System.Windows.Forms.GroupBox groupBox1; 247 | private System.Windows.Forms.GroupBox groupBox2; 248 | private System.Windows.Forms.TextBox text_Name; 249 | private System.Windows.Forms.TextBox text_Password; 250 | private System.Windows.Forms.TextBox text_Username; 251 | private System.Windows.Forms.CheckBox check_DeActive; 252 | private System.Windows.Forms.CheckBox check_Admin; 253 | private System.Windows.Forms.Label label4; 254 | private System.Windows.Forms.Label label3; 255 | private System.Windows.Forms.Label label2; 256 | private System.Windows.Forms.Label label1; 257 | private System.Windows.Forms.Button btn_Delete; 258 | private System.Windows.Forms.Button btn_Save; 259 | private System.Windows.Forms.TextBox text_Surname; 260 | private System.Windows.Forms.DataGridView data_UserList; 261 | private System.Windows.Forms.TextBox text_UserID; 262 | } 263 | } -------------------------------------------------------------------------------- /frm_Users.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Data.SqlClient; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace GGMSYS 13 | { 14 | public partial class frm_Users : Form 15 | { 16 | public frm_Users() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | private void btn_Save_Click(object sender, EventArgs e) 22 | { 23 | // Alanların doluluğunu kontrol et 24 | if (string.IsNullOrWhiteSpace(text_Username.Text) || 25 | string.IsNullOrWhiteSpace(text_Password.Text) || 26 | string.IsNullOrWhiteSpace(text_Name.Text) || 27 | string.IsNullOrWhiteSpace(text_Surname.Text)) 28 | { 29 | MessageBox.Show("Lütfen tüm alanları doldurun.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); 30 | return; 31 | } 32 | 33 | // Parametreleri hazırla 34 | List parameters = new List 35 | { 36 | new SqlParameter("@Username", text_Username.Text), 37 | new SqlParameter("@Password", text_Password.Text), 38 | new SqlParameter("@Name", text_Name.Text), 39 | new SqlParameter("@Surname", text_Surname.Text), 40 | new SqlParameter("@IsAdmin", check_Admin.Checked ? 1 : 0), 41 | new SqlParameter("@IsActive", !check_DeActive.Checked ? 1 : 0), 42 | }; 43 | 44 | string commandText; 45 | 46 | // Yeni kullanıcı ekleme veya mevcut kullanıcıyı güncelleme 47 | if (int.TryParse(text_UserID.Text, out int userID)) 48 | { 49 | // Mevcut kullanıcıyı güncelle 50 | commandText = @"UPDATE Users SET Username=@Username, Password=@Password, Name=@Name, Surname=@Surname, 51 | IsAdmin=@IsAdmin, IsActive=@IsActive, UpdateDate=GETDATE() WHERE UserID=@UserID"; 52 | parameters.Add(new SqlParameter("@UserID", userID)); 53 | } 54 | else 55 | { 56 | // Yeni kullanıcı ekle 57 | commandText = @"INSERT INTO Users (Username, Password, Name, Surname, IsAdmin, IsActive, CreateDate) 58 | VALUES (@Username, @Password, @Name, @Surname, @IsAdmin, @IsActive, GETDATE())"; 59 | } 60 | DBHelper.ExecuteNonQuery(commandText, CommandType.Text, parameters.ToArray()); 61 | RefreshUserList(); 62 | frm_Users_Load(sender, e); 63 | MessageBox.Show("İşlem başarıyla tamamlandı.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); 64 | } 65 | 66 | 67 | 68 | 69 | private void RefreshUserList() 70 | { 71 | string commandText = "SELECT UserID, Username, Password, Name, Surname, IsAdmin, IsActive FROM Users"; 72 | DataTable usersTable = DBHelper.ExecuteSelectCommand(commandText, CommandType.Text); 73 | data_UserList.DataSource = usersTable; 74 | data_UserList.RowHeadersVisible = false; // datagrid içerisinde ilk stunu gizliyor. 75 | 76 | text_Name.Clear(); 77 | text_Surname.Clear(); 78 | text_Username.Clear(); 79 | text_UserID.Clear(); 80 | text_Password.Clear(); 81 | 82 | ////////////////////////////////////// 83 | ///Row adlarını düzenle ///////////// 84 | data_UserList.Columns["Username"].HeaderText = "Kullanıcı Adı"; 85 | data_UserList.Columns["Password"].HeaderText = "Şifre"; 86 | data_UserList.Columns["Name"].HeaderText = "Adı"; 87 | data_UserList.Columns["Surname"].HeaderText = "Soyadı"; 88 | data_UserList.Columns["IsActive"].HeaderText = "Aktif Kullanıcı"; 89 | data_UserList.Columns["IsAdmin"].HeaderText = "Admin"; 90 | 91 | ///////////////////////////////////////////// 92 | 93 | } 94 | 95 | private void btn_Delete_Click(object sender, EventArgs e) 96 | { 97 | if (!string.IsNullOrEmpty(text_UserID.Text) && int.TryParse(text_UserID.Text, out int userID)) 98 | { 99 | DialogResult dialogResult = MessageBox.Show("Bu kullanıcıyı silmek istediğinize emin misiniz?", "Kullanıcıyı Sil", MessageBoxButtons.YesNo, MessageBoxIcon.Question); 100 | 101 | if (dialogResult == DialogResult.Yes) 102 | { 103 | string commandText = "DELETE FROM Users WHERE UserID=@UserID"; 104 | SqlParameter[] parameters = { new SqlParameter("@UserID", userID) }; 105 | 106 | int rowsAffected = DBHelper.ExecuteNonQuery(commandText, CommandType.Text, parameters); 107 | if (rowsAffected > 0) 108 | { 109 | MessageBox.Show("Kullanıcı başarıyla silindi.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); 110 | RefreshUserList(); // Kullanıcı listesini yenile 111 | } 112 | else 113 | { 114 | MessageBox.Show("Kullanıcı silinirken bir sorun oluştu.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); 115 | } 116 | } 117 | } 118 | else 119 | { 120 | MessageBox.Show("Lütfen silmek istediğiniz kullanıcıyı seçin.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); 121 | } 122 | } 123 | 124 | 125 | private void data_UserList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) 126 | { 127 | if (e.RowIndex != -1) 128 | { 129 | DataGridViewRow row = data_UserList.Rows[e.RowIndex]; 130 | text_UserID.Text = row.Cells["UserID"].Value.ToString(); // UserID'yi sakla 131 | 132 | // Diğer kullanıcı bilgilerini de ilgili TextBox'lara atayabilirsiniz 133 | text_Username.Text = row.Cells["Username"].Value.ToString(); 134 | text_Password.Text = row.Cells["Password"].Value.ToString(); 135 | text_Name.Text = row.Cells["Name"].Value.ToString(); 136 | text_Surname.Text = row.Cells["Surname"].Value.ToString(); 137 | check_Admin.Checked = Convert.ToBoolean(row.Cells["IsAdmin"].Value); 138 | check_DeActive.Checked = !Convert.ToBoolean(row.Cells["IsActive"].Value); 139 | } 140 | } 141 | 142 | 143 | private void frm_Users_Load(object sender, EventArgs e) 144 | { 145 | RefreshUserList(); 146 | 147 | } 148 | } 149 | } 150 | 151 | -------------------------------------------------------------------------------- /frm_Users.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | True 122 | 123 | 124 | True 125 | 126 | 127 | True 128 | 129 | -------------------------------------------------------------------------------- /packages.config: -------------------------------------------------------------------------------- 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 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | --------------------------------------------------------------------------------