From 70785760d8392d8c1aef83c11d9f03b6fb5f7ff3 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Sat, 5 May 2018 12:58:54 +0200 Subject: [PATCH] add some new projects --- betriebssystem/multi_cpu/multi_cpu.sln | 22 ++++ betriebssystem/multi_cpu/multi_cpu/App.config | 6 + .../multi_cpu/multi_cpu/Form1.Designer.cs | 118 +++++++++++++++++ betriebssystem/multi_cpu/multi_cpu/Form1.cs | 60 +++++++++ betriebssystem/multi_cpu/multi_cpu/Form1.resx | 120 ++++++++++++++++++ betriebssystem/multi_cpu/multi_cpu/Program.cs | 20 +++ .../multi_cpu/Properties/AssemblyInfo.cs | 36 ++++++ .../Properties/Resources.Designer.cs | 71 +++++++++++ .../multi_cpu/Properties/Resources.resx | 117 +++++++++++++++++ .../multi_cpu/Properties/Settings.Designer.cs | 30 +++++ .../multi_cpu/Properties/Settings.settings | 7 + .../multi_cpu/multi_cpu/multi_cpu.csproj | 82 ++++++++++++ .../GetNumberEight_Result.cs | 21 +++ .../2018-04-21-entity_framework/ProductDB.cs | 91 +++++++++++++ .../sp_helpdiagramdefinition_Result.cs | 19 +++ .../sp_helpdiagrams_Result.cs | 22 ++++ 16 files changed, 842 insertions(+) create mode 100644 betriebssystem/multi_cpu/multi_cpu.sln create mode 100644 betriebssystem/multi_cpu/multi_cpu/App.config create mode 100644 betriebssystem/multi_cpu/multi_cpu/Form1.Designer.cs create mode 100644 betriebssystem/multi_cpu/multi_cpu/Form1.cs create mode 100644 betriebssystem/multi_cpu/multi_cpu/Form1.resx create mode 100644 betriebssystem/multi_cpu/multi_cpu/Program.cs create mode 100644 betriebssystem/multi_cpu/multi_cpu/Properties/AssemblyInfo.cs create mode 100644 betriebssystem/multi_cpu/multi_cpu/Properties/Resources.Designer.cs create mode 100644 betriebssystem/multi_cpu/multi_cpu/Properties/Resources.resx create mode 100644 betriebssystem/multi_cpu/multi_cpu/Properties/Settings.Designer.cs create mode 100644 betriebssystem/multi_cpu/multi_cpu/Properties/Settings.settings create mode 100644 betriebssystem/multi_cpu/multi_cpu/multi_cpu.csproj create mode 100644 oop/2018-04-21-entity_framework/2018-04-21-entity_framework/GetNumberEight_Result.cs create mode 100644 oop/2018-04-21-entity_framework/2018-04-21-entity_framework/ProductDB.cs create mode 100644 oop/2018-04-21-entity_framework/2018-04-21-entity_framework/sp_helpdiagramdefinition_Result.cs create mode 100644 oop/2018-04-21-entity_framework/2018-04-21-entity_framework/sp_helpdiagrams_Result.cs diff --git a/betriebssystem/multi_cpu/multi_cpu.sln b/betriebssystem/multi_cpu/multi_cpu.sln new file mode 100644 index 0000000..cddf1dc --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "multi_cpu", "multi_cpu\multi_cpu.csproj", "{8632A050-3683-4E89-9E0B-620E6FD165FD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8632A050-3683-4E89-9E0B-620E6FD165FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8632A050-3683-4E89-9E0B-620E6FD165FD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8632A050-3683-4E89-9E0B-620E6FD165FD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8632A050-3683-4E89-9E0B-620E6FD165FD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/betriebssystem/multi_cpu/multi_cpu/App.config b/betriebssystem/multi_cpu/multi_cpu/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/betriebssystem/multi_cpu/multi_cpu/Form1.Designer.cs b/betriebssystem/multi_cpu/multi_cpu/Form1.Designer.cs new file mode 100644 index 0000000..10812d4 --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/Form1.Designer.cs @@ -0,0 +1,118 @@ +namespace multi_cpu +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button_number = new System.Windows.Forms.Button(); + this.button_range = new System.Windows.Forms.Button(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.labelResult = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // button_number + // + this.button_number.Location = new System.Drawing.Point(22, 188); + this.button_number.Name = "button_number"; + this.button_number.Size = new System.Drawing.Size(75, 47); + this.button_number.TabIndex = 0; + this.button_number.Text = "Einzelne Zahl Prüfen"; + this.button_number.UseVisualStyleBackColor = true; + this.button_number.Click += new System.EventHandler(this.ButtonSingleNumber_Click); + // + // button_range + // + this.button_range.Location = new System.Drawing.Point(342, 188); + this.button_range.Name = "button_range"; + this.button_range.Size = new System.Drawing.Size(75, 47); + this.button_range.TabIndex = 1; + this.button_range.Text = "Mehrere Zahlen prüfen"; + this.button_range.UseVisualStyleBackColor = true; + this.button_range.Click += new System.EventHandler(this.ButtonRange_Click); + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.Location = new System.Drawing.Point(244, 48); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(173, 134); + this.listBox1.TabIndex = 2; + // + // labelErgebnis + // + this.labelResult.AutoSize = true; + this.labelResult.Location = new System.Drawing.Point(19, 77); + this.labelResult.Name = "labelErgebnis"; + this.labelResult.Size = new System.Drawing.Size(48, 13); + this.labelResult.TabIndex = 3; + this.labelResult.Text = "Ergebnis"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(22, 12); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(161, 20); + this.textBox1.TabIndex = 4; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(244, 12); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(173, 20); + this.textBox2.TabIndex = 5; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(429, 419); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.labelResult); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.button_range); + this.Controls.Add(this.button_number); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button_number; + private System.Windows.Forms.Button button_range; + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Label labelResult; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + } +} + diff --git a/betriebssystem/multi_cpu/multi_cpu/Form1.cs b/betriebssystem/multi_cpu/multi_cpu/Form1.cs new file mode 100644 index 0000000..e21d62d --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/Form1.cs @@ -0,0 +1,60 @@ +using System; +using System.Windows.Forms; + + +namespace multi_cpu +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + int number; + private void ButtonSingleNumber_Click(object sender, EventArgs e) + { + number = Convert.ToInt32(textBox1.Text); + if (isPrime(number)) + { + labelResult.Text = number.ToString() + " ist eine Primzahl."; + } + else + { + labelResult.Text = number.ToString() + " ist keine Primzahl."; + } + } + + private bool isPrime(int testNumber) + { + int Divider = testNumber / 2; + while (testNumber % Divider != 0) + { + Divider--; + } + if (Divider == 1) + { + return true; + } + else + { + return false; + } + } + + private void ButtonRange_Click(object sender, EventArgs e) + { + int Range = Convert.ToInt32(textBox2.Text); + int Counter = 2; + + while (Counter < Range) + { + if (isPrime(Counter)) + { + listBox1.Items.Add(Convert.ToString(Counter)); + } + Counter++; + } + } + } +} diff --git a/betriebssystem/multi_cpu/multi_cpu/Form1.resx b/betriebssystem/multi_cpu/multi_cpu/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/betriebssystem/multi_cpu/multi_cpu/Program.cs b/betriebssystem/multi_cpu/multi_cpu/Program.cs new file mode 100644 index 0000000..d308d67 --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/Program.cs @@ -0,0 +1,20 @@ +using System; +using System.IO; +using System.Windows.Forms; + +namespace multi_cpu +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/betriebssystem/multi_cpu/multi_cpu/Properties/AssemblyInfo.cs b/betriebssystem/multi_cpu/multi_cpu/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2254942 --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("multi_cpu")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("multi_cpu")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8632a050-3683-4e89-9e0b-620e6fd165fd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/betriebssystem/multi_cpu/multi_cpu/Properties/Resources.Designer.cs b/betriebssystem/multi_cpu/multi_cpu/Properties/Resources.Designer.cs new file mode 100644 index 0000000..ce3c22c --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace multi_cpu.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("multi_cpu.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/betriebssystem/multi_cpu/multi_cpu/Properties/Resources.resx b/betriebssystem/multi_cpu/multi_cpu/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/betriebssystem/multi_cpu/multi_cpu/Properties/Settings.Designer.cs b/betriebssystem/multi_cpu/multi_cpu/Properties/Settings.Designer.cs new file mode 100644 index 0000000..8bdd7b0 --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace multi_cpu.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/betriebssystem/multi_cpu/multi_cpu/Properties/Settings.settings b/betriebssystem/multi_cpu/multi_cpu/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/betriebssystem/multi_cpu/multi_cpu/multi_cpu.csproj b/betriebssystem/multi_cpu/multi_cpu/multi_cpu.csproj new file mode 100644 index 0000000..5bc126a --- /dev/null +++ b/betriebssystem/multi_cpu/multi_cpu/multi_cpu.csproj @@ -0,0 +1,82 @@ + + + + + Debug + AnyCPU + {8632A050-3683-4E89-9E0B-620E6FD165FD} + WinExe + multi_cpu + multi_cpu + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/GetNumberEight_Result.cs b/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/GetNumberEight_Result.cs new file mode 100644 index 0000000..f0f1b7f --- /dev/null +++ b/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/GetNumberEight_Result.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace _2018_04_21_entity_framework +{ + using System; + + public partial class GetNumberEight_Result + { + public int ProductID { get; set; } + public string ProductName { get; set; } + public int CategoryID { get; set; } + public string Description { get; set; } + } +} diff --git a/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/ProductDB.cs b/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/ProductDB.cs new file mode 100644 index 0000000..d240061 --- /dev/null +++ b/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/ProductDB.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace _2018_04_21_entity_framework +{ + public class ProductDB + { + public List GetAllProducts() + { + using (ProductsEntities ctx = new ProductsEntities()) + { + return ctx.Products.ToList(); + } + + } + public bool CreateProduct(Product product) + { + try + { + using (ProductsEntities ctx = new ProductsEntities()) + { + ctx.Products.Add(product); + ctx.SaveChanges(); + } + return true; + } + catch (Exception) + { + Console.WriteLine("Couldn't create product."); + return false; + } + + } + public Product GetProductById(int id) + { + using (ProductsEntities ctx = new ProductsEntities()) + { + Product product = ctx.Products.SingleOrDefault(x => x.ProductID.Equals(id)); + if (product != null) + { + return product; + } + else + { + Console.WriteLine("This a a new product not yet in the database."); + return product; + } + } + } + public bool UpdateProduct(Product product) + { + try + { + using (ProductsEntities ctx = new ProductsEntities()) + { + ctx.Products.Attach(product); + ctx.Entry(product).State = System.Data.Entity.EntityState.Modified; + ctx.SaveChanges(); + } + return true; + } + catch (Exception) + { + Console.WriteLine("Couldn't update the product."); + return false; + } + + } + public bool DeleteProduct(Product product) + { + try + { + using (ProductsEntities ctx = new ProductsEntities()) + { + ctx.Products.Attach(product); + ctx.Products.Remove(product); + ctx.SaveChanges(); + } + return true; + } + catch (Exception) + { + Console.WriteLine("Couldn't delete objet."); + return false; + } + } + } +} diff --git a/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/sp_helpdiagramdefinition_Result.cs b/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/sp_helpdiagramdefinition_Result.cs new file mode 100644 index 0000000..d44b7fd --- /dev/null +++ b/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/sp_helpdiagramdefinition_Result.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace _2018_04_21_entity_framework +{ + using System; + + public partial class sp_helpdiagramdefinition_Result + { + public Nullable version { get; set; } + public byte[] definition { get; set; } + } +} diff --git a/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/sp_helpdiagrams_Result.cs b/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/sp_helpdiagrams_Result.cs new file mode 100644 index 0000000..6451675 --- /dev/null +++ b/oop/2018-04-21-entity_framework/2018-04-21-entity_framework/sp_helpdiagrams_Result.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace _2018_04_21_entity_framework +{ + using System; + + public partial class sp_helpdiagrams_Result + { + public string Database { get; set; } + public string Name { get; set; } + public int ID { get; set; } + public string Owner { get; set; } + public int OwnerID { get; set; } + } +}