From ae275b40b226802132d2d1dc720e67a4ce100fde Mon Sep 17 00:00:00 2001 From: hOLOlu Date: Wed, 30 Jun 2021 17:31:08 +0300 Subject: [PATCH] Add project files. --- ComboValue/Class1.cs | 25 ++ ComboValue/ComboValue.csproj | 61 +++ ComboValue/Properties/AssemblyInfo.cs | 36 ++ .../DigitalDisplayControl.cs | 181 +++++++++ .../DigitalDisplayControl.designer.cs | 47 +++ .../DigitalDisplayControl.resx | 120 ++++++ .../Owf.Controls.DigitalDisplayControl.csproj | 68 ++++ .../Properties/AssemblyInfo.cs | 35 ++ hSMS.sln | 28 ++ hSMS/App.config | 6 + hSMS/ComboboxValue.cs | 25 ++ hSMS/Form1.Designer.cs | 370 ++++++++++++++++++ hSMS/Form1.cs | 173 ++++++++ hSMS/Form1.resx | 126 ++++++ hSMS/Program.cs | 22 ++ hSMS/Properties/AssemblyInfo.cs | 36 ++ hSMS/Properties/Resources.Designer.cs | 71 ++++ hSMS/Properties/Resources.resx | 117 ++++++ hSMS/Properties/Settings.Designer.cs | 30 ++ hSMS/Properties/Settings.settings | 7 + hSMS/hMySQL.cs | 311 +++++++++++++++ hSMS/hSMS.csproj | 101 +++++ hSMS/mutlucell.cs | 124 ++++++ hSMS/sms.cs | 217 ++++++++++ 24 files changed, 2337 insertions(+) create mode 100644 ComboValue/Class1.cs create mode 100644 ComboValue/ComboValue.csproj create mode 100644 ComboValue/Properties/AssemblyInfo.cs create mode 100644 Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.cs create mode 100644 Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.designer.cs create mode 100644 Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.resx create mode 100644 Owf.Controls.DigitalDisplayControl/Owf.Controls.DigitalDisplayControl.csproj create mode 100644 Owf.Controls.DigitalDisplayControl/Properties/AssemblyInfo.cs create mode 100644 hSMS.sln create mode 100644 hSMS/App.config create mode 100644 hSMS/ComboboxValue.cs create mode 100644 hSMS/Form1.Designer.cs create mode 100644 hSMS/Form1.cs create mode 100644 hSMS/Form1.resx create mode 100644 hSMS/Program.cs create mode 100644 hSMS/Properties/AssemblyInfo.cs create mode 100644 hSMS/Properties/Resources.Designer.cs create mode 100644 hSMS/Properties/Resources.resx create mode 100644 hSMS/Properties/Settings.Designer.cs create mode 100644 hSMS/Properties/Settings.settings create mode 100644 hSMS/hMySQL.cs create mode 100644 hSMS/hSMS.csproj create mode 100644 hSMS/mutlucell.cs create mode 100644 hSMS/sms.cs diff --git a/ComboValue/Class1.cs b/ComboValue/Class1.cs new file mode 100644 index 0000000..f49aee1 --- /dev/null +++ b/ComboValue/Class1.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ComboValue +{ + public class ComboboxValue + { + public int Id { get; private set; } + public string Name { get; private set; } + + public ComboboxValue(int id, string name) + { + Id = id; + Name = name; + } + + public override string ToString() + { + return Name; + } + } +} diff --git a/ComboValue/ComboValue.csproj b/ComboValue/ComboValue.csproj new file mode 100644 index 0000000..8c48f88 --- /dev/null +++ b/ComboValue/ComboValue.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + 90afd5a7-5ac1-4a3a-a202-5c97ee9deb1d + Library + Properties + ComboValue + ComboValue + v4.5.2 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ComboValue/Properties/AssemblyInfo.cs b/ComboValue/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..967aa59 --- /dev/null +++ b/ComboValue/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("ComboValue")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ComboValue")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[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("90afd5a7-5ac1-4a3a-a202-5c97ee9deb1d")] + +// 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/Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.cs b/Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.cs new file mode 100644 index 0000000..3045d15 --- /dev/null +++ b/Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; + +namespace Owf.Controls +{ + public partial class DigitalDisplayControl : UserControl + { + private Color _digitColor = Color.GreenYellow; + [Browsable(true), DefaultValue("Color.GreenYellow")] + public Color DigitColor + { + get { return _digitColor; } + set { _digitColor = value; Invalidate(); } + } + + private string _digitText = "88.88"; + [Browsable(true), DefaultValue("88.88")] + public string DigitText + { + get { return _digitText; } + set { _digitText = value; Invalidate(); } + } + + public DigitalDisplayControl() + { + this.SetStyle(ControlStyles.DoubleBuffer, true); + this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); + this.SetStyle(ControlStyles.ResizeRedraw, true); + this.SetStyle(ControlStyles.UserPaint, true); + this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); + InitializeComponent(); + this.BackColor = Color.Transparent; + } + + private void DigitalGauge_Paint(object sender, PaintEventArgs e) + { + e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + + SevenSegmentHelper sevenSegmentHelper = new SevenSegmentHelper(e.Graphics); + + SizeF digitSizeF = sevenSegmentHelper.GetStringSize(_digitText, Font); + float scaleFactor = Math.Min(ClientSize.Width / digitSizeF.Width, ClientSize.Height / digitSizeF.Height); + Font font = new Font(Font.FontFamily, scaleFactor * Font.SizeInPoints); + digitSizeF = sevenSegmentHelper.GetStringSize(_digitText, font); + + using (SolidBrush brush = new SolidBrush(_digitColor)) + { + using (SolidBrush lightBrush = new SolidBrush(Color.FromArgb(20, _digitColor))) + { + sevenSegmentHelper.DrawDigits( + _digitText, font, brush, lightBrush, + (ClientSize.Width - digitSizeF.Width) / 2, + (ClientSize.Height - digitSizeF.Height) / 2); + } + } + } + } + + public class SevenSegmentHelper + { + Graphics _graphics; + + // Indicates what segments are illuminated for all 10 digits + static byte[,] _segmentData = {{1, 1, 1, 0, 1, 1, 1}, + {0, 0, 1, 0, 0, 1, 0}, + {1, 0, 1, 1, 1, 0, 1}, + {1, 0, 1, 1, 0, 1, 1}, + {0, 1, 1, 1, 0, 1, 0}, + {1, 1, 0, 1, 0, 1, 1}, + {1, 1, 0, 1, 1, 1, 1}, + {1, 0, 1, 0, 0, 1, 0}, + {1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 0, 1, 1}}; + + // Points that define each of the seven segments + readonly Point[][] _segmentPoints = new Point[7][]; + + public SevenSegmentHelper(Graphics graphics) + { + this._graphics = graphics; + _segmentPoints[0] = new Point[] {new Point( 3, 2), new Point(39, 2), new Point(31, 10), new Point(11, 10)}; + _segmentPoints[1] = new Point[] {new Point( 2, 3), new Point(10, 11), new Point(10, 31), new Point( 2, 35)}; + _segmentPoints[2] = new Point[] {new Point(40, 3), new Point(40, 35), new Point(32, 31), new Point(32, 11)}; + _segmentPoints[3] = new Point[] {new Point( 3, 36), new Point(11, 32), new Point(31, 32), new Point(39, 36), new Point(31, 40), new Point(11, 40)}; + _segmentPoints[4] = new Point[] {new Point( 2, 37), new Point(10, 41), new Point(10, 61), new Point( 2, 69)}; + _segmentPoints[5] = new Point[] {new Point(40, 37), new Point(40, 69), new Point(32, 61), new Point(32, 41)}; + _segmentPoints[6] = new Point[] {new Point(11, 62), new Point(31, 62), new Point(39, 70), new Point( 3, 70)}; + } + + public SizeF GetStringSize(string text, Font font) + { + SizeF sizef = new SizeF(0, _graphics.DpiX * font.SizeInPoints / 72); + + for (int i = 0; i < text.Length; i++) + { + if (Char.IsDigit(text[i])) + sizef.Width += 42 * _graphics.DpiX * font.SizeInPoints / 72 / 72; + else if (text[i] == ':' || text[i] == '.') + sizef.Width += 12 * _graphics.DpiX * font.SizeInPoints / 72 / 72; + } + return sizef; + } + + public void DrawDigits(string text, Font font, Brush brush, Brush brushLight, float x, float y) + { + for (int cnt = 0; cnt < text.Length; cnt++) + { + // For digits 0-9 + if (Char.IsDigit(text[cnt])) + x = DrawDigit(text[cnt] - '0', font, brush, brushLight, x, y); + // For colon : + else if (text[cnt] == ':') + x = DrawColon(font, brush, x, y); + // For dot . + else if (text[cnt] == '.') + x = DrawDot(font, brush, x, y); + } + } + + private float DrawDigit(int num, Font font, Brush brush, Brush brushLight, float x, float y) + { + for (int cnt = 0; cnt < _segmentPoints.Length; cnt++) + { + if (_segmentData[num, cnt] == 1) + { + FillPolygon(_segmentPoints[cnt], font, brush, x, y); + } + else + { + FillPolygon(_segmentPoints[cnt], font, brushLight, x, y); + } + } + return x + 42 * _graphics.DpiX * font.SizeInPoints / 72 / 72; + } + + private float DrawDot(Font font, Brush brush, float x, float y) + { + Point[][] dotPoints = new Point[1][]; + + dotPoints[0] = new Point[] {new Point( 2, 64), new Point( 6, 61), + new Point(10, 64), new Point( 6, 69)}; + + for (int cnt = 0; cnt < dotPoints.Length; cnt++) + { + FillPolygon(dotPoints[cnt], font, brush, x, y); + } + return x + 12 * _graphics.DpiX * font.SizeInPoints / 72 / 72; + } + + private float DrawColon(Font font, Brush brush, float x, float y) + { + Point[][] colonPoints = new Point[2][]; + + colonPoints[0] = new Point[] {new Point( 2, 21), new Point( 6, 17), new Point(10, 21), new Point( 6, 25)}; + colonPoints[1] = new Point[] {new Point( 2, 51), new Point( 6, 47), new Point(10, 51), new Point( 6, 55)}; + + for (int cnt = 0; cnt < colonPoints.Length; cnt++) + { + FillPolygon(colonPoints[cnt], font, brush, x, y); + } + return x + 12 * _graphics.DpiX * font.SizeInPoints / 72 / 72; + } + + private void FillPolygon(Point[] polygonPoints, Font font, Brush brush, float x, float y) + { + PointF[] polygonPointsF = new PointF[polygonPoints.Length]; + + for (int cnt = 0; cnt < polygonPoints.Length; cnt++) + { + polygonPointsF[cnt].X = x + polygonPoints[cnt].X * _graphics.DpiX * font.SizeInPoints / 72 / 72; + polygonPointsF[cnt].Y = y + polygonPoints[cnt].Y * _graphics.DpiY * font.SizeInPoints / 72 / 72; + } + _graphics.FillPolygon(brush, polygonPointsF); + } + } +} diff --git a/Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.designer.cs b/Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.designer.cs new file mode 100644 index 0000000..fa4f3ab --- /dev/null +++ b/Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.designer.cs @@ -0,0 +1,47 @@ +namespace Owf.Controls +{ + partial class DigitalDisplayControl + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // DigitalDisplayControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Transparent; + this.Name = "DigitalDisplayControl"; + this.Size = new System.Drawing.Size(150, 70); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.DigitalGauge_Paint); + this.ResumeLayout(false); + + } + + #endregion + } +} diff --git a/Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.resx b/Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.resx new file mode 100644 index 0000000..d58980a --- /dev/null +++ b/Owf.Controls.DigitalDisplayControl/DigitalDisplayControl.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/Owf.Controls.DigitalDisplayControl/Owf.Controls.DigitalDisplayControl.csproj b/Owf.Controls.DigitalDisplayControl/Owf.Controls.DigitalDisplayControl.csproj new file mode 100644 index 0000000..f606fc5 --- /dev/null +++ b/Owf.Controls.DigitalDisplayControl/Owf.Controls.DigitalDisplayControl.csproj @@ -0,0 +1,68 @@ + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {5D082F88-4290-4049-9984-FCB126A7BD4E} + Library + Properties + Owf.Controls.DigitalDisplayControl + Owf.Controls.DigitalDisplayControl + v4.0 + + + + + 2.0 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + UserControl + + + DigitalDisplayControl.cs + + + + + + + DigitalDisplayControl.cs + Designer + + + + + \ No newline at end of file diff --git a/Owf.Controls.DigitalDisplayControl/Properties/AssemblyInfo.cs b/Owf.Controls.DigitalDisplayControl/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..49314b4 --- /dev/null +++ b/Owf.Controls.DigitalDisplayControl/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("Owf.Controls.DigitalDisplayControl")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Owf.Controls.DigitalDisplayControl")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[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("464778c1-a779-407b-b4df-d2d61250c05c")] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/hSMS.sln b/hSMS.sln new file mode 100644 index 0000000..ae22dfe --- /dev/null +++ b/hSMS.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hSMS", "hSMS\hSMS.csproj", "{E8668B7D-8116-4418-B49D-766C0F31A454}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Owf.Controls.DigitalDisplayControl", "Owf.Controls.DigitalDisplayControl\Owf.Controls.DigitalDisplayControl.csproj", "{5D082F88-4290-4049-9984-FCB126A7BD4E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E8668B7D-8116-4418-B49D-766C0F31A454}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8668B7D-8116-4418-B49D-766C0F31A454}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8668B7D-8116-4418-B49D-766C0F31A454}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8668B7D-8116-4418-B49D-766C0F31A454}.Release|Any CPU.Build.0 = Release|Any CPU + {5D082F88-4290-4049-9984-FCB126A7BD4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5D082F88-4290-4049-9984-FCB126A7BD4E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D082F88-4290-4049-9984-FCB126A7BD4E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5D082F88-4290-4049-9984-FCB126A7BD4E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/hSMS/App.config b/hSMS/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/hSMS/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/hSMS/ComboboxValue.cs b/hSMS/ComboboxValue.cs new file mode 100644 index 0000000..f49aee1 --- /dev/null +++ b/hSMS/ComboboxValue.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ComboValue +{ + public class ComboboxValue + { + public int Id { get; private set; } + public string Name { get; private set; } + + public ComboboxValue(int id, string name) + { + Id = id; + Name = name; + } + + public override string ToString() + { + return Name; + } + } +} diff --git a/hSMS/Form1.Designer.cs b/hSMS/Form1.Designer.cs new file mode 100644 index 0000000..f67da9e --- /dev/null +++ b/hSMS/Form1.Designer.cs @@ -0,0 +1,370 @@ +namespace hSMS +{ + 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.groupBox1 = new System.Windows.Forms.GroupBox(); + this.txtPass = new System.Windows.Forms.TextBox(); + this.txtUser = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.Liste = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.cmbMesajlar = new System.Windows.Forms.ComboBox(); + this.label4 = new System.Windows.Forms.Label(); + this.txtMesaj = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.btnGonder = new System.Windows.Forms.Button(); + this.label5 = new System.Windows.Forms.Label(); + this.cmbBirimler = new System.Windows.Forms.ComboBox(); + this.dgSecili = new Owf.Controls.DigitalDisplayControl(); + this.dgMM = new Owf.Controls.DigitalDisplayControl(); + this.dgMUz = new Owf.Controls.DigitalDisplayControl(); + this.dhKacKontor = new Owf.Controls.DigitalDisplayControl(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.txtPass); + this.groupBox1.Controls.Add(this.txtUser); + this.groupBox1.Controls.Add(this.label3); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Location = new System.Drawing.Point(12, 7); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(266, 77); + this.groupBox1.TabIndex = 2; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "SMS Kullanıcı Bilgileri"; + // + // txtPass + // + this.txtPass.Location = new System.Drawing.Point(83, 44); + this.txtPass.MaxLength = 30; + this.txtPass.Name = "txtPass"; + this.txtPass.PasswordChar = '*'; + this.txtPass.Size = new System.Drawing.Size(176, 20); + this.txtPass.TabIndex = 1; + // + // txtUser + // + this.txtUser.Location = new System.Drawing.Point(83, 17); + this.txtUser.Name = "txtUser"; + this.txtUser.Size = new System.Drawing.Size(176, 20); + this.txtUser.TabIndex = 0; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(34, 42); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(43, 13); + this.label3.TabIndex = 1; + this.label3.Text = "Parola :"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(7, 20); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(70, 13); + this.label2.TabIndex = 0; + this.label2.Text = "Kullanıcı Adı :"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.dhKacKontor); + this.groupBox2.Location = new System.Drawing.Point(12, 95); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(266, 100); + this.groupBox2.TabIndex = 4; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Mevcut SMS Durumu"; + // + // Liste + // + this.Liste.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.Liste.CheckBoxes = true; + this.Liste.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2, + this.columnHeader3, + this.columnHeader4, + this.columnHeader5, + this.columnHeader6}); + this.Liste.Font = new System.Drawing.Font("Trebuchet MS", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); + this.Liste.FullRowSelect = true; + this.Liste.GridLines = true; + this.Liste.Location = new System.Drawing.Point(288, 39); + this.Liste.Name = "Liste"; + this.Liste.Size = new System.Drawing.Size(588, 506); + this.Liste.TabIndex = 4; + this.Liste.UseCompatibleStateImageBehavior = false; + this.Liste.View = System.Windows.Forms.View.Details; + this.Liste.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.Liste_ItemCheck); + this.Liste.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.Liste_ItemChecked); + // + // columnHeader1 + // + this.columnHeader1.Text = "Ad Soyad"; + this.columnHeader1.Width = 160; + // + // columnHeader2 + // + this.columnHeader2.Text = "GSM No 1"; + this.columnHeader2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.columnHeader2.Width = 90; + // + // columnHeader3 + // + this.columnHeader3.Text = "GSM No 2"; + this.columnHeader3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.columnHeader3.Width = 90; + // + // columnHeader4 + // + this.columnHeader4.Text = "T.C."; + this.columnHeader4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.columnHeader4.Width = 100; + // + // columnHeader5 + // + this.columnHeader5.Text = "Kan"; + this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + // + // columnHeader6 + // + this.columnHeader6.Text = "Cinsiyet"; + this.columnHeader6.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + // + // statusStrip1 + // + this.statusStrip1.Location = new System.Drawing.Point(0, 551); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(884, 22); + this.statusStrip1.TabIndex = 6; + this.statusStrip1.Text = "statusStrip1"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.cmbMesajlar); + this.groupBox3.Controls.Add(this.dgMM); + this.groupBox3.Controls.Add(this.label4); + this.groupBox3.Controls.Add(this.txtMesaj); + this.groupBox3.Controls.Add(this.label1); + this.groupBox3.Controls.Add(this.dgMUz); + this.groupBox3.Location = new System.Drawing.Point(12, 201); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(266, 308); + this.groupBox3.TabIndex = 3; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Gönderilecek Mesaj"; + // + // cmbMesajlar + // + this.cmbMesajlar.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbMesajlar.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.cmbMesajlar.FormattingEnabled = true; + this.cmbMesajlar.Location = new System.Drawing.Point(5, 19); + this.cmbMesajlar.Name = "cmbMesajlar"; + this.cmbMesajlar.Size = new System.Drawing.Size(254, 21); + this.cmbMesajlar.TabIndex = 5; + this.cmbMesajlar.SelectedIndexChanged += new System.EventHandler(this.cmbMesajlar_SelectedIndexChanged); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(7, 276); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(74, 13); + this.label4.TabIndex = 3; + this.label4.Text = "Kontör Sayısı :"; + // + // txtMesaj + // + this.txtMesaj.Location = new System.Drawing.Point(5, 46); + this.txtMesaj.Multiline = true; + this.txtMesaj.Name = "txtMesaj"; + this.txtMesaj.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtMesaj.Size = new System.Drawing.Size(254, 225); + this.txtMesaj.TabIndex = 2; + this.txtMesaj.TextChanged += new System.EventHandler(this.txtMesaj_TextChanged); + this.txtMesaj.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtMesaj_KeyUp); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(154, 277); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(53, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Karakter :"; + // + // btnGonder + // + this.btnGonder.Location = new System.Drawing.Point(215, 515); + this.btnGonder.Name = "btnGonder"; + this.btnGonder.Size = new System.Drawing.Size(63, 30); + this.btnGonder.TabIndex = 3; + this.btnGonder.Text = "&Gönder"; + this.btnGonder.UseVisualStyleBackColor = true; + this.btnGonder.Click += new System.EventHandler(this.btnGonder_Click); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(32, 515); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(57, 13); + this.label5.TabIndex = 7; + this.label5.Text = "Seçili Kişi :"; + // + // cmbBirimler + // + this.cmbBirimler.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbBirimler.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.cmbBirimler.FormattingEnabled = true; + this.cmbBirimler.Location = new System.Drawing.Point(288, 12); + this.cmbBirimler.Name = "cmbBirimler"; + this.cmbBirimler.Size = new System.Drawing.Size(588, 21); + this.cmbBirimler.TabIndex = 8; + this.cmbBirimler.SelectedIndexChanged += new System.EventHandler(this.cmbBirimler_SelectedIndexChanged); + // + // dgSecili + // + this.dgSecili.BackColor = System.Drawing.Color.Transparent; + this.dgSecili.DigitColor = System.Drawing.Color.DarkGreen; + this.dgSecili.DigitText = "0000"; + this.dgSecili.Location = new System.Drawing.Point(88, 510); + this.dgSecili.Name = "dgSecili"; + this.dgSecili.Size = new System.Drawing.Size(80, 35); + this.dgSecili.TabIndex = 6; + // + // dgMM + // + this.dgMM.BackColor = System.Drawing.Color.Transparent; + this.dgMM.DigitColor = System.Drawing.Color.MidnightBlue; + this.dgMM.DigitText = "01"; + this.dgMM.Location = new System.Drawing.Point(76, 272); + this.dgMM.Name = "dgMM"; + this.dgMM.Size = new System.Drawing.Size(39, 31); + this.dgMM.TabIndex = 4; + // + // dgMUz + // + this.dgMUz.BackColor = System.Drawing.Color.Transparent; + this.dgMUz.DigitColor = System.Drawing.Color.Brown; + this.dgMUz.DigitText = "000"; + this.dgMUz.Location = new System.Drawing.Point(206, 272); + this.dgMUz.Name = "dgMUz"; + this.dgMUz.Size = new System.Drawing.Size(52, 31); + this.dgMUz.TabIndex = 0; + // + // dhKacKontor + // + this.dhKacKontor.BackColor = System.Drawing.Color.Transparent; + this.dhKacKontor.DigitColor = System.Drawing.Color.OliveDrab; + this.dhKacKontor.DigitText = "000000"; + this.dhKacKontor.Location = new System.Drawing.Point(6, 17); + this.dhKacKontor.Name = "dhKacKontor"; + this.dhKacKontor.Size = new System.Drawing.Size(254, 70); + this.dhKacKontor.TabIndex = 0; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(884, 573); + this.Controls.Add(this.cmbBirimler); + this.Controls.Add(this.label5); + this.Controls.Add(this.btnGonder); + this.Controls.Add(this.dgSecili); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.Liste); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.MinimumSize = new System.Drawing.Size(900, 612); + this.Name = "Form1"; + this.Text = "hSMS"; + this.Load += new System.EventHandler(this.Form1_Load); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.ListView Liste; + private Owf.Controls.DigitalDisplayControl dhKacKontor; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox txtMesaj; + private System.Windows.Forms.Label label1; + private Owf.Controls.DigitalDisplayControl dgMUz; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button btnGonder; + private System.Windows.Forms.TextBox txtPass; + private System.Windows.Forms.TextBox txtUser; + private System.Windows.Forms.Label label4; + private Owf.Controls.DigitalDisplayControl dgMM; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.ColumnHeader columnHeader2; + private System.Windows.Forms.ColumnHeader columnHeader3; + private System.Windows.Forms.ColumnHeader columnHeader4; + private System.Windows.Forms.ColumnHeader columnHeader5; + private System.Windows.Forms.ColumnHeader columnHeader6; + private System.Windows.Forms.ComboBox cmbMesajlar; + private System.Windows.Forms.Label label5; + private Owf.Controls.DigitalDisplayControl dgSecili; + private System.Windows.Forms.ComboBox cmbBirimler; + } +} + diff --git a/hSMS/Form1.cs b/hSMS/Form1.cs new file mode 100644 index 0000000..5b29117 --- /dev/null +++ b/hSMS/Form1.cs @@ -0,0 +1,173 @@ +using System; +using System.Data; +using System.Windows.Forms; +using hSMSpaketi; +using MySql.Data; +using MySql.Data.MySqlClient; +using ComboValue; + +namespace hSMS +{ + + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void txtMesaj_KeyUp(object sender, KeyEventArgs e) + { + //dgMUz.DigitText = string.Format("{0###}", txtMesaj.Text.Length); + dgMUz.DigitText = txtMesaj.Text.Length.ToString("000"); + if (txtMesaj.Text.Length > 0) dgMM.DigitText = ((txtMesaj.Text.Length / 160)+1 ).ToString("00"); + } + + private void txtMesaj_TextChanged(object sender, EventArgs e) + { + dgMUz.DigitText = txtMesaj.Text.Length.ToString("000"); + if (txtMesaj.Text.Length > 0) dgMM.DigitText = ((txtMesaj.Text.Length / 160)+1) .ToString("00"); + } + + private void KalanKontur() + { + //sms Paket = sms("61mobs0077", "610077",""); + string kactane = SMSPaketi.Kackontur(txtUser.Text, txtPass.Text); + string[] kac = kactane.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); + //if (kac[0] == "OK") dhKacKontor.DigitText = kac[1]; + dhKacKontor.DigitText = kac[0].ToString(); + } + + private void mesajdoldur() + { + hMySQL db = new hMySQL(); + db.db_connect(); + cmbMesajlar.Items.Clear(); + + foreach (DataRow row in db.sql_select_dt("select * from sms_mesajlar order by dGontar DESC").Rows) + { + cmbMesajlar.Items.Add(row["dMesaj"].ToString()); + } + + foreach (DataRow row in db.sql_select_dt("select * from sms_subekodu order by dSubeAdi").Rows) + { + Liste.Groups.Add(new ListViewGroup(row["dOto"].ToString(),row["dSubeAdi"].ToString())); + //cmbBirimler.Items.Add(row["dSubeAdi"].ToString()); + cmbBirimler.Items.Add(new ComboboxValue(Convert.ToInt32(row["dOto"]), row["dSubeAdi"].ToString())); + //cmbMesajlar.SelectedItem = row["dOto].ToString(); + + //ComboboxValue tmpComboboxValue = (ComboboxValue)cb.SelectedItem; + } + } + + private void Form1_Load(object sender, EventArgs e) + { + Liste.Items.Clear(); + + txtUser.Text = "dsi22trb"; // "61mobs0077"; + txtPass.Text = "Oy333544Y"; // "610077"; + + KalanKontur(); + mesajdoldur(); + + +/* ListViewGroup grup1 = new ListViewGroup("Personeller"); + ListViewGroup grup2 = new ListViewGroup("Bölge"); + + Liste.Groups.Add(grup1); + Liste.Groups.Add(grup2); +*/ + + Random rnd = new Random(); + hMySQL db = new hMySQL(); + db.db_connect(); + foreach (DataRow row in db.sql_select_dt("select * from sms_rehber order by ADSOYAD").Rows) + { + ListViewItem lv = new ListViewItem(row["ADSOYAD"].ToString(), Liste.Groups[rnd.Next(cmbBirimler.Items.Count)]); + lv.SubItems.Add(row["GSMNO"].ToString()); + lv.SubItems.Add(row["GSMNO1"].ToString()); + lv.SubItems.Add(row["TC_KIMLIKNO"].ToString()); + Liste.Items.Add(lv); + } + + + } + + private void btnGonder_Click(object sender, EventArgs e) + { + + try + { + int i = 0; + string ne = ""; + + ListView.CheckedListViewItemCollection checkedItems = Liste.CheckedItems; + foreach (ListViewItem item in checkedItems) + { + ne += item.SubItems[1].Text + "," ; + } + + /* + for (i = 0; i <= Liste.CheckedItems.Count; i++); + { + ne= ne + Liste.CheckedItems[i].SubItems[1].Text + ","; + } + */ + + ne = ne.Substring(1, ne.Length - 2); + + String[] numaralar = { ne }; + //sms smspak = new sms(txtUser.Text, txtPass.Text, ""); + //smspak.SMSEkle(txtMesaj.Text, numaralar); + //String sonuc = smspak.Gonder(); + + SMSPaketi smspak = new SMSPaketi(txtUser.Text, txtPass.Text, "DSI22.BOLGE"); + smspak.addSMS(txtMesaj.Text, numaralar); + String sonuc = smspak.gonder(); + + MessageBox.Show(sonuc); + } + catch (Exception ex) + { + MessageBox.Show("Hata: " + ex); + } + + + + /* hMySQL db = new hMySQL(); + db.db_connect(); + db.insert_values("dMesaj", txtMesaj.Text); + db.insert_values("dGonTar", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); + db.sql_query(db.sql_insert("sms_mesajlar")); + + mesajdoldur(); + */ + + } + + private void cmbMesajlar_SelectedIndexChanged(object sender, EventArgs e) + { + txtMesaj.Text = cmbMesajlar.Text; + } + + private void Liste_ItemChecked(object sender, ItemCheckedEventArgs e) + { + dgSecili.DigitText = Liste.CheckedItems.Count.ToString("#0000"); + } + + private void Liste_ItemCheck(object sender, ItemCheckEventArgs e) + { + //Liste.Items.gr = grup2; + + } + + private void cmbBirimler_SelectedIndexChanged(object sender, EventArgs e) + { + ComboboxValue tmpComboboxValue = (ComboboxValue)cmbBirimler.SelectedItem; + // MessageBox.Show(tmpComboboxValue.Id.ToString() ); + + } + } + + +} \ No newline at end of file diff --git a/hSMS/Form1.resx b/hSMS/Form1.resx new file mode 100644 index 0000000..44639ff --- /dev/null +++ b/hSMS/Form1.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + + 25 + + \ No newline at end of file diff --git a/hSMS/Program.cs b/hSMS/Program.cs new file mode 100644 index 0000000..0140927 --- /dev/null +++ b/hSMS/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace hSMS +{ + 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/hSMS/Properties/AssemblyInfo.cs b/hSMS/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6decfbc --- /dev/null +++ b/hSMS/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("hSMS")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("hSMS")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[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("e8668b7d-8116-4418-b49d-766c0f31a454")] + +// 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/hSMS/Properties/Resources.Designer.cs b/hSMS/Properties/Resources.Designer.cs new file mode 100644 index 0000000..8b4c70f --- /dev/null +++ b/hSMS/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 hSMS.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("hSMS.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/hSMS/Properties/Resources.resx b/hSMS/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/hSMS/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/hSMS/Properties/Settings.Designer.cs b/hSMS/Properties/Settings.Designer.cs new file mode 100644 index 0000000..9a3e289 --- /dev/null +++ b/hSMS/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 hSMS.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/hSMS/Properties/Settings.settings b/hSMS/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/hSMS/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hSMS/hMySQL.cs b/hSMS/hMySQL.cs new file mode 100644 index 0000000..e97ade0 --- /dev/null +++ b/hSMS/hMySQL.cs @@ -0,0 +1,311 @@ +using System; +using System.Data; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using MySql.Data; +using MySql.Data.MySqlClient; + + +namespace hSMS +{ + class hMySQL + { + + MySqlConnection connection; + MySqlCommand command; + MySqlDataReader reader; + MySqlDataAdapter adapter; + DataTable table; + + private string server = "10.122.1.102"; // database hostname. + private string database = "dsi22"; // database name + private string user = "dsi22"; // database username. + private string password = "1q2w3e4r"; // database password + + private string sql = ""; + private string field = ""; + private string value = ""; + private int t = 0; + + private bool conn; + + /* + * database connection + * + * MySql Sunucusuyla bağlanti kurmamızı sağlayan bağlanti fonksiyonu + */ + + public void db_connect() + { + + this.conn = true; + this.connection = new MySqlConnection("server=" + this.server + ";database=" + this.database + ";user=" + this.user + ";password=" + this.password + ";charset=utf8"); + + try + { + this.connection.Open(); + } + + catch (Exception e) + { + this.conn = false; + + MessageBox.Show("MysqlServer'ın çalıştığından emin olun. \n" + e.Message,"Bağlantı Hatası", MessageBoxButtons.OK,MessageBoxIcon.Error); + Application.Exit(); + } + } + + /* + * sql select extra + * + * SELECT SQL sorgusuna extra sorgu eklemek için kullanılır + */ + + public string sql_select_extra(string sql) + { + + this.sql = this.sql + " WHERE " + sql; + + return this.sql; + + } + + /* Data Table */ + public DataTable sql_select_dt(string sql) + { + DataTable dt = new DataTable(); + if (this.conn) + { + try + { + MySqlDataAdapter ada = new MySqlDataAdapter(sql, this.connection); + ada.Fill(dt); + } + + catch (Exception e) + { + MessageBox.Show("Sorgunuzu kontrol Ediniz." + e.Message); + } + } + + return dt; + + } + + /* + * sql select + * + * Temel SELECT sorgusu oluşturmak için kullanılır + */ + + public string sql_select(string tableName, string field) + { + + this.sql = "SELECT " + field + " FROM " + tableName; + + return sql; + + } + + /* + * sql insert_values + * + * INSERT SQL sorgusu için değerler girmemizi sağlar + */ + + public void insert_values(string field, string value) + { + + if (t == 0) + { + + this.field = field; + this.value = "'" + value + "'"; + + } + else { + + this.field = field + "," + this.field; + this.value = "'" + value + "'" + "," + this.value; + } + t++; + + } + + /* + * sql select query reader + * + * SELECT deyimi yardımıyla MySqlDataReader tipinde result değişkeni yardımıyla döndürür + */ + + public MySqlDataReader sql_query_select(string sql) + { + + if (this.conn) + { + try + { + command = new MySqlCommand(sql, connection); + reader = command.ExecuteReader(); + } + + catch (Exception e) + { + MessageBox.Show("Sorgunuzu kontrol Ediniz." + e.Message); + } + } + + return reader; + + } + + /* + * sql query + * + * insert_values() fonk. ile oluşturulan SQL cümleciğini sorgular. + */ + + public int sql_query(string sql) + { + + command = new MySqlCommand(sql, connection); + + try + { + return command.ExecuteNonQuery(); + } + + catch (Exception e) + { + + MessageBox.Show("Veritabanındaki alan ismini kontrol ediniz." + e.Message, "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error); + return 0; + } + + + } + + + /* + * sql insert_values + * + * insert_values() ile oluşturulan SQL cümleciğini oluşturur. + */ + + public string sql_insert(string tableName) + { + + this.t = 0; + sql = "INSERT INTO " + tableName + " (" + this.field + ") VALUES (" + this.value + ")"; + + this.value = ""; + this.field = ""; + + return sql; + + } + + /* + * sql update + * + * sql_update() fonksiyonu için gerekli olan UPDATE SQL cümleciğini oluşturur. + */ + + public void update_values(string field, string value) + { + + if (this.field == "") + { + this.field = this.field + field + "='" + value + "'"; + } + else + { + this.field = this.field + "," + field + "='" + value + "'"; + } + + } + + /* + * sql update_values + * + * update_values() fonk. ile oluşturulan SQL cümleciğini oluşturur. + */ + + public string sql_update(string tableName, string condition) + { + + sql = "UPDATE " + tableName + " SET " + this.field + " WHERE " + condition; + + this.value = ""; + this.field = ""; + + return sql; + } + + /* + * sql delete + * + * DELETE SQL sorgusunu oluşturmak için kullanılır + */ + + public string sql_delete(string tableName, string condition) + { + + sql = "DELETE FROM " + tableName + " WHERE " + condition; + + return sql; + + } + + + /* + * sql datagiridView + * + * Datagrid için kullanılan SQL sorgusuna uygun sonuçları gösterir. + */ + + + public void sql_adapter(string sql, DataGridView name) + { + + adapter = new MySqlDataAdapter(sql, connection); + table = new DataTable(); + + try + { + adapter.Fill(table); + } + + catch + { + + MessageBox.Show("Mysql Sunucunuzun çalışıp çalışmadıgını kontrol ediniz", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error); + + } + + name.DataSource = table; + } + + /* + * database connection close + * + * Açık olan bağlantının kapatılmasını sağlar + */ + + public void Close() + { + try + { + connection.Close(); + } + catch + { + // yok bişi + } + + } + + } +} diff --git a/hSMS/hSMS.csproj b/hSMS/hSMS.csproj new file mode 100644 index 0000000..0e08762 --- /dev/null +++ b/hSMS/hSMS.csproj @@ -0,0 +1,101 @@ + + + + + Debug + AnyCPU + {E8668B7D-8116-4418-B49D-766C0F31A454} + WinExe + Properties + hSMS + hSMS + 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 + + + + + + + + {5D082F88-4290-4049-9984-FCB126A7BD4E} + Owf.Controls.DigitalDisplayControl + + + + + \ No newline at end of file diff --git a/hSMS/mutlucell.cs b/hSMS/mutlucell.cs new file mode 100644 index 0000000..6dcc585 --- /dev/null +++ b/hSMS/mutlucell.cs @@ -0,0 +1,124 @@ +using System; +using System.Text; +using System.Windows.Forms; +using System.IO; +using System.Net; +using System.Net.Sockets; + + +namespace hSMS +{ + public class SMSPaketi + { + public SMSPaketi(String ka, String parola, String org) + { + start += ""; + + } + + public SMSPaketi(String ka, String parola, String org, DateTime tarih) + { + start += ""; + + } + + public void addSMS(String mesaj, String[] numaralar) + { + body += ""; + body += xmlEncode(mesaj); + body += ""; + foreach (String s in numaralar) + { + body += xmlEncode(s) + ","; + } + body += ""; + } + + public String xml() + { + if (body.Length == 0) + throw new ArgumentException("SMS paketinede sms yok!"); + return start + body + end; + } + + public String gonder() + { + WebClient wc = new WebClient(); + + string postData = xml(); + wc.Headers.Add("Content-Type", "text/xml; charset=UTF-8"); + // Apply ASCII Encoding to obtain the string as a byte array. + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + byte[] responseArray = wc.UploadData("https://smsgw.mutlucell.com/smsgw-ws/sndblkex", "POST", byteArray); + String response = Encoding.UTF8.GetString(responseArray); + return response; + } + + /** + * ka = kullanici adi + * parola + * id: gonderim sonucu donen paket ID + * + */ + public static String rapor(String ka, String parola, long id) + { + String xml = "" + + ""; + WebClient wc = new WebClient(); + MessageBox.Show(xml); + string postData = xml; + wc.Headers.Add("Content-Type", "text/xml; charset=UTF-8"); + // Apply ASCII Encoding to obtain the string as a byte array. + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + byte[] responseArray = wc.UploadData("https://smsgw.mutlucell.com/smsgw-ws/gtblkrprtex", "POST", byteArray); + String response = Encoding.UTF8.GetString(responseArray); + return response; + } + + + private static String tarihStr(DateTime d) + { + return xmlEncode(d.ToString("yyyy-MM-dd HH:mm")); + } + + private static String xmlEncode(String s) + { + s = s.Replace("&", "&"); + s = s.Replace("<", "<"); + s = s.Replace(">", ">"); + s = s.Replace("'", "'"); + s = s.Replace("\"", """); + return s; + } + + public static String Kackontur(String ka, String parola) + { + try + { + String xml = "" + + ""; + + WebClient wc = new WebClient(); + string postData = xml; + wc.Headers.Add("Content-Type", "text/xml; charset=UTF-8"); + // Apply ASCII Encoding to obtain the string as a byte array. + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + byte[] responseArray = wc.UploadData("https://smsgw.mutlucell.com/smsgw-ws/gtcrdtex", "POST", byteArray); + String response = Encoding.UTF8.GetString(responseArray); + return response; + } + catch (Exception ex) + { + string hataVar = "Bağlantınızı kontrol ediniz. " + ex.Message; + return hataVar; + } + } + + private String start = ""; + private String end = ""; + private String body = ""; + } + +} \ No newline at end of file diff --git a/hSMS/sms.cs b/hSMS/sms.cs new file mode 100644 index 0000000..01dae66 --- /dev/null +++ b/hSMS/sms.cs @@ -0,0 +1,217 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Net; + +namespace hSMSpaketi +{ + public partial class sms + { + private String start = ""; + private String end = ""; + private String body = ""; + + + public sms(String ka, String parola, String org) + { + start += "" + + "" + xmlEncode(ka) + "" + + "" + xmlEncode(parola) + "" + + "" + xmlEncode(org) + ""; + } + + public sms(String ka, String parola, String org, DateTime tarih) + { + start += "" + + "" + xmlEncode(ka) + "" + + "" + xmlEncode(parola) + "" + + "" + xmlEncode(org) + "" + + "" + tarihStr(tarih) + ""; + + } + + public void SMSEkle(String mesaj, String[] numaralar) + { + body += "1"; + body += ""; + foreach (String s in numaralar) + { + body += xmlEncode(s) + ","; + } + body += ""; + } + + public String xml() + { + if (body.Length == 0) + throw new ArgumentException("SMS paketinede sms yok!"); + return start + body + end; + } + + + public String Gonder() + { + try + { + WebClient wc = new WebClient(); + + string postData = xml(); + wc.Headers.Add("Content-Type", "text/xml; charset=UTF-8"); + // Apply ASCII Encoding to obtain the string as a byte array. + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + byte[] responseArray = wc.UploadData("http://gateway.3gmesaj.com/SendSmsMany.aspx", "POST", byteArray); + String response = Encoding.UTF8.GetString(responseArray); + return response; + } + catch (Exception ex) + { + string hataVar = "Bağlantınızı kontrol ediniz. " + ex.Message + "\n * " + HataKontrol(ex.Message); + return hataVar; + } + } + + public static String rapor(String ka, String parola, long id, int tip) + { + String response = ""; + try + { /* + 1 Bekleyen Numaralar(Kullanımda ancak kapsama alanı dışında yada telefon kapalı) + 2 İletilen Numaralar + 3 Sistem Hatası(bu numara kullanımda değil yada servis dışı) + 4 İletilememesinden dolayı zaman aşımı (Xml içinde SDATE ve EDATE değerleri verilmediği takdirde default 24 saattir.) + */ + String xml = "" + + "" + xmlEncode(ka) + "" + + "" + xmlEncode(parola) + "" + + "" + xmlEncode(id.ToString()) + "" + + "" + xmlEncode(id.ToString()) + "" + + "" + xmlEncode(tip.ToString()) +"" + + "|"; + + WebClient wc = new WebClient(); + //MessageBox.Show(xml); + string postData = xml; + wc.Headers.Add("Content-Type", "text/xml; charset=UTF-8"); + // Apply ASCII Encoding to obtain the string as a byte array. + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + byte[] responseArray = wc.UploadData("https://smsgw.mutlucell.com/smsgw-ws/gtblkrprtex", "POST", byteArray); + response = Encoding.UTF8.GetString(responseArray); + return response; + } + catch (Exception ex) + { + string hataVar = "Bağlantınızı kontrol ediniz. " + ex.Message + "\n Hata Kodu :" + HataKontrol(response); + return hataVar; + } + } + + + private static String tarihStr(DateTime d) + { + return xmlEncode(d.ToString("yyyy-MM-dd HH:mm")); + } + + private static String xmlEncode(String s) + { + s = s.Replace("&", "&"); + s = s.Replace("<", "<"); + s = s.Replace(">", ">"); + s = s.Replace("'", "'"); + s = s.Replace("\"", """); + return s; + } + + public static String Kackontur(String ka, String parola) + { + try + { + String xml = "" + + "
" + + "" + xmlEncode(ka) + "" + + "" + xmlEncode(parola) + "
"; + + WebClient wc = new WebClient(); + string postData = xml; + wc.Headers.Add("Content-Type", "text/xml; charset=UTF-8"); + // Apply ASCII Encoding to obtain the string as a byte array. + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + byte[] responseArray = wc.UploadData("http://gateway.3gmesaj.com/QueryCredit.aspx", "POST", byteArray); + String response = Encoding.UTF8.GetString(responseArray); + return response; + } + catch (Exception ex) + { + string hataVar = "Bağlantınızı kontrol ediniz. " + ex.Message; + return hataVar; + } + } + + public static String HataKontrol(String ghata) + { + String hata = ""; + switch (ghata) + { + case "00": + hata = "Kullanıcı Bilgileri Boş"; + break; + case "01": + hata = "Kullanıcı Bilgileri Hatalı"; + break; + case "02": + hata = "Hesap Kapalı"; + break; + case "03": + hata = "Kontör Hatası"; + break; + case "04": + hata = "Bayi Kodunuz Hatalı"; + break; + case "05": + hata = "Originator Bilginiz Hatalı"; + break; + case "06": + hata = "Yapılan İşlem İçin Yetkiniz Yok"; + break; + case "10": + hata = "Geçersiz IP Adresi"; + break; + case "14": + hata = "Mesaj Metni Girilmemiş"; + break; + case "15": + hata = "GSM Numarası Girilmemiş"; + break; + case "20": + hata = "Rapor Hazır Değil"; + break; + case "27": + hata = "Aylık Atım Limitiniz Yetersiz"; + break; + case "100": + hata = "XML Hatası"; + break; + + } + return hata; + /* + 00 Kullanıcı Bilgileri Boş + 01 Kullanıcı Bilgileri Hatalı + 02 Hesap Kapalı + 03 Kontör Hatası + 04 Bayi Kodunuz Hatalı + 05 Originator Bilginiz Hatalı + 06 Yapılan İşlem İçin Yetkiniz Yok + 10 Geçersiz IP Adresi + 14 Mesaj Metni Girilmemiş + 15 GSM Numarası Girilmemiş + 20 Rapor Hazır Değil + 27 Aylık Atım Limitiniz Yetersiz + 100 XML Hatası + */ + } + } +}