[성현모] CPXV2 Init

This commit is contained in:
SHM
2024-06-26 10:30:00 +09:00
parent cdf12248c5
commit 5958993b6a
588 changed files with 698420 additions and 0 deletions

View File

@ -0,0 +1,340 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using SystemX.Net.Platform.Common.ExtensionMethods;
using static SystemX.Product.CP.TRA.Commons;
namespace SystemX.Product.CP.TRA
{
public class AccessLevelAlarm : EventArgs
{
public AccessLevelAlarm(LoginAccessLevel CurrentAccessLevel, bool bLoginState)
{
this.CurrentLevel = CurrentAccessLevel;
this.GetLoginState = bLoginState;
}
public LoginAccessLevel CurrentLevel { get; private set; }
public bool GetLoginState { get; private set; }
}
public static class Commons
{
static public bool DEBUG_MODE = false;
[Flags]
public enum LoginAccessLevel
{
None = 0x01,
Basic = 0x02,
Admin = 0x04
}
public enum eSelectDataView
{
DataDocumentViewC1 = 0,
DataDocumentViewC2
}
public enum eOverviewModelNameInfo
{
L = 0,
P1,
P2
}
public static bool isHasRow(DataSet ds)
{
return (ds != null) ? ds.Tables.Cast<DataTable>().Any(table => table.Rows.Count != 0) : false;
}
public static bool isHasRow(DataTable dt)
{
return (dt != null) ? dt.Rows.Count > 0 : false;
}
public static bool IsValidEmail(string email)
{
bool valid = Regex.IsMatch(email, @"[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?");
return valid;
}
public static bool CheckGateLetter(char letter)
{
Regex engRegex = new Regex(@"[A-Z]");
return engRegex.IsMatch(letter.ToString());
}
public static byte[] ConvertHexStringToByte(string convertString)
{
byte[] convertArr = new byte[convertString.Length / 2];
for (int i = 0; i < convertArr.Length; i++)
{
convertArr[i] = Convert.ToByte(convertString.Substring(i * 2, 2), 16);
}
return convertArr;
}
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int memcmp(byte[] b1, byte[] b2, long count);
public static bool ByteArrayCompare(byte[] b1, byte[] b2)
{
if (b1 == null || b2 == null)
return false;
// Validate buffers are the same length.
// This also ensures that the count does not exceed the length of either buffer.
return b1.Length == b2.Length && memcmp(b1, b2, b1.Length) == 0;
}
public static T ConvertTextToTryValue<T>(string strText, object objFailValue)
{
object obj;
obj = typeof(T);
int iGetValue = 0;
uint uiGetValue = 0;
double dGetValue = 0;
if (obj.ToString().IndexOf("Int") >= 0)
{
if (!int.TryParse(strText, out iGetValue))
obj = objFailValue;
else
obj = iGetValue;
}
if (obj.ToString().IndexOf("UInt") >= 0)
{
if (!uint.TryParse(strText, out uiGetValue))
obj = objFailValue;
else
obj = uiGetValue;
}
else if (obj.ToString().IndexOf("Double") >= 0)
{
if (!double.TryParse(strText, out dGetValue))
obj = objFailValue;
else
obj = dGetValue;
}
return (T)Convert.ChangeType(obj, typeof(T));
}
public class INICtrl
{
public static int MAX_INFORMATION = 10;
protected static int FILE_ATTRIBUTE_HIDDEN = 2;
[DllImport("kernel32")]
protected static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32")]
protected static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
[DllImport("kernel32")]
protected static extern int SetFileAttributes(string lpFileName, int dwFileAttributes);
public virtual void SetValue(string Section, string Key, string Value, string path = "")
{
WritePrivateProfileString(Section, Key, Value, path);
}
public virtual string GetValue(string Section, string Key, string Default, string path = "")
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, Default, temp, 255, path);
if (temp != null && temp.Length > 0) return temp.ToString();
else return Default;
}
}
public class ConnectInfoINICtrl : INICtrl
{
private static string ConnectHistoryINIPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\ConnectConfig_TRA_CPXV2.ini";
public ConnectInfoINICtrl()
{
if (File.Exists(ConnectHistoryINIPath) == false)
{
using (File.Create(ConnectHistoryINIPath)) { }
SetFileAttributes(ConnectHistoryINIPath, FILE_ATTRIBUTE_HIDDEN);
SetValue("LastestConnect", "Info", "");
}
}
public string GetUserTheme()
{
return GetValue("UserSelectTheme", "ThemeName", "Basic");
}
public void SetUserTheme(string strThemeName)
{
SetValue("UserSelectTheme", "ThemeName", strThemeName);
}
public void SetLastestConnectInfo(string strSuccessInfo1, string strSuccessInfo2, string strSuccessInfo3,
bool bCheckedInfo, int nOverInfoC1, int nOverInfoC2)
{
string strSetUpperText = strSuccessInfo1.ToUpper();
string[] strInfoSet = null;
int? findIdx = null;
if (strSuccessInfo1.CompareTo("") == 0 ||
strSuccessInfo1.CompareTo("127.0.0.1") == 0 ||
strSetUpperText.CompareTo("LOCALHOST") == 0 ||
strSuccessInfo1.IndexOf("If you do not enter the ip, will be connected to the local area.") >= 0)
{
;//
}
else
{
SetValue("LastestConnect", "Info1", strSuccessInfo1);
strInfoSet = new string[MAX_INFORMATION];
for (int i = 0; i < MAX_INFORMATION; i++)
strInfoSet[i] = GetValue("HistoryConnect" + i.ToString(), "Info1", "");
findIdx = strInfoSet.FindIndex(x => x == strSuccessInfo1);
if (findIdx == null)
{
for (int i = MAX_INFORMATION - 1; i > 0; i--)
{
if (i > 0)
strInfoSet[i] = strInfoSet[i - 1];
}
strInfoSet[0] = strSuccessInfo1;
for (int i = 0; i < MAX_INFORMATION; i++)
SetValue("HistoryConnect" + i.ToString(), "Info1", strInfoSet[i]);
}
}
//
strSetUpperText = strSuccessInfo2.ToUpper();
if (strSuccessInfo2.CompareTo("") == 0 ||
strSuccessInfo2.CompareTo("127.0.0.1") == 0 ||
strSetUpperText.CompareTo("LOCALHOST") == 0 ||
strSuccessInfo2.IndexOf("If you do not enter the ip, will be connected to the local area.") >= 0)
{
;//
}
else
{
SetValue("LastestConnect", "Info2", strSuccessInfo2);
strInfoSet = new string[MAX_INFORMATION];
for (int i = 0; i < MAX_INFORMATION; i++)
strInfoSet[i] = GetValue("HistoryConnect" + i.ToString(), "Info2", "");
findIdx = strInfoSet.FindIndex(x => x == strSuccessInfo2);
if (findIdx == null)
{
for (int i = MAX_INFORMATION - 1; i > 0; i--)
{
if (i > 0)
strInfoSet[i] = strInfoSet[i - 1];
}
strInfoSet[0] = strSuccessInfo2;
for (int i = 0; i < MAX_INFORMATION; i++)
SetValue("HistoryConnect" + i.ToString(), "Info2", strInfoSet[i]);
}
}
//
if (bCheckedInfo)
SetValue("LastestConnect", "UseDataServer2", "True");
else
SetValue("LastestConnect", "UseDataServer2", "False");
//
SetValue("LastestConnect", "OverviewModelInfoC1", nOverInfoC1.ToString());
SetValue("LastestConnect", "OverviewModelInfoC2", nOverInfoC2.ToString());
//
if (bCheckedInfo == false)
{
;//
}
else
{
strSetUpperText = strSuccessInfo3.ToUpper();
if (strSuccessInfo3.CompareTo("") == 0 ||
strSuccessInfo3.CompareTo("127.0.0.1") == 0 ||
strSetUpperText.CompareTo("LOCALHOST") == 0 ||
strSuccessInfo3.IndexOf("If you do not enter the ip, will be connected to the local area.") >= 0)
{
;//
}
else
{
SetValue("LastestConnect", "Info3", strSuccessInfo3);
strInfoSet = new string[MAX_INFORMATION];
for (int i = 0; i < MAX_INFORMATION; i++)
strInfoSet[i] = GetValue("HistoryConnect" + i.ToString(), "Info3", "");
findIdx = strInfoSet.FindIndex(x => x == strSuccessInfo3);
if (findIdx == null)
{
for (int i = MAX_INFORMATION - 1; i > 0; i--)
{
if (i > 0)
strInfoSet[i] = strInfoSet[i - 1];
}
strInfoSet[0] = strSuccessInfo3;
for (int i = 0; i < MAX_INFORMATION; i++)
SetValue("HistoryConnect" + i.ToString(), "Info3", strInfoSet[i]);
}
}
}
}
public override void SetValue(string Section, string Key, string Value, string path = "")
{
if (path.Length <= 0)
path = ConnectHistoryINIPath;
WritePrivateProfileString(Section, Key, Value, path);
}
public override string GetValue(string Section, string Key, string Default, string path = "")
{
if (path.Length <= 0)
path = ConnectHistoryINIPath;
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, Default, temp, 255, path);
if (temp != null && temp.Length > 0) return temp.ToString();
else return Default;
}
}
}
}

View File

@ -0,0 +1,390 @@

namespace SystemX.Product.ALIS.UI.Subs
{
partial class ConnectForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConnectForm));
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.simpleButtonOK = new DevExpress.XtraEditors.SimpleButton();
this.panel1 = new System.Windows.Forms.Panel();
this.simpleButtonReset = new DevExpress.XtraEditors.SimpleButton();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.maskedTextBoxTLIP = new DevExpress.XtraEditors.ComboBoxEdit();
this.panel4 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.panel5 = new System.Windows.Forms.Panel();
this.maskedTextBoxDT1IP = new DevExpress.XtraEditors.ComboBoxEdit();
this.panel6 = new System.Windows.Forms.Panel();
this.comboBoxOverviewModel1 = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.panel7 = new System.Windows.Forms.Panel();
this.maskedTextBoxDT2IP = new DevExpress.XtraEditors.ComboBoxEdit();
this.panel8 = new System.Windows.Forms.Panel();
this.comboBoxOverviewModel2 = new System.Windows.Forms.ComboBox();
this.checkBoxUseDT2 = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.panel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.maskedTextBoxTLIP.Properties)).BeginInit();
this.panel4.SuspendLayout();
this.panel5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.maskedTextBoxDT1IP.Properties)).BeginInit();
this.panel6.SuspendLayout();
this.panel7.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.maskedTextBoxDT2IP.Properties)).BeginInit();
this.panel8.SuspendLayout();
this.SuspendLayout();
//
// labelControl1
//
this.labelControl1.Appearance.BackColor = System.Drawing.Color.Transparent;
this.labelControl1.Appearance.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelControl1.Appearance.ForeColor = System.Drawing.Color.Black;
this.labelControl1.Appearance.Options.UseBackColor = true;
this.labelControl1.Appearance.Options.UseFont = true;
this.labelControl1.Appearance.Options.UseForeColor = true;
this.labelControl1.AutoEllipsis = true;
this.labelControl1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.labelControl1.Dock = System.Windows.Forms.DockStyle.Top;
this.labelControl1.Location = new System.Drawing.Point(0, 0);
this.labelControl1.Name = "labelControl1";
this.labelControl1.Size = new System.Drawing.Size(366, 36);
this.labelControl1.TabIndex = 2;
this.labelControl1.Text = "Input - Access information";
//
// simpleButtonOK
//
this.simpleButtonOK.Appearance.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);
this.simpleButtonOK.Appearance.Options.UseFont = true;
this.simpleButtonOK.Dock = System.Windows.Forms.DockStyle.Right;
this.simpleButtonOK.Location = new System.Drawing.Point(1071, 0);
this.simpleButtonOK.Name = "simpleButtonOK";
this.simpleButtonOK.Size = new System.Drawing.Size(66, 64);
this.simpleButtonOK.TabIndex = 4;
this.simpleButtonOK.Text = "OK";
this.simpleButtonOK.Click += new System.EventHandler(this.simpleButtonOK_Click);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.simpleButtonReset);
this.panel1.Controls.Add(this.simpleButtonOK);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 396);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1137, 64);
this.panel1.TabIndex = 5;
//
// simpleButtonReset
//
this.simpleButtonReset.Appearance.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);
this.simpleButtonReset.Appearance.Options.UseFont = true;
this.simpleButtonReset.Dock = System.Windows.Forms.DockStyle.Left;
this.simpleButtonReset.Location = new System.Drawing.Point(0, 0);
this.simpleButtonReset.Name = "simpleButtonReset";
this.simpleButtonReset.Size = new System.Drawing.Size(66, 64);
this.simpleButtonReset.TabIndex = 5;
this.simpleButtonReset.Text = "Reset";
this.simpleButtonReset.Click += new System.EventHandler(this.simpleButtonReset_Click);
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 36);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1137, 3);
this.panel2.TabIndex = 6;
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.Transparent;
this.panel3.Controls.Add(this.maskedTextBoxTLIP);
this.panel3.Controls.Add(this.panel4);
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
this.panel3.Location = new System.Drawing.Point(0, 39);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(1137, 108);
this.panel3.TabIndex = 8;
//
// maskedTextBoxTLIP
//
this.maskedTextBoxTLIP.Dock = System.Windows.Forms.DockStyle.Fill;
this.maskedTextBoxTLIP.EditValue = "If you do not enter the ip, will be connected to the local area.";
this.maskedTextBoxTLIP.Location = new System.Drawing.Point(0, 65);
this.maskedTextBoxTLIP.Name = "maskedTextBoxTLIP";
this.maskedTextBoxTLIP.Properties.Appearance.BackColor = System.Drawing.Color.White;
this.maskedTextBoxTLIP.Properties.Appearance.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.maskedTextBoxTLIP.Properties.Appearance.ForeColor = System.Drawing.Color.Black;
this.maskedTextBoxTLIP.Properties.Appearance.Options.UseBackColor = true;
this.maskedTextBoxTLIP.Properties.Appearance.Options.UseFont = true;
this.maskedTextBoxTLIP.Properties.Appearance.Options.UseForeColor = true;
this.maskedTextBoxTLIP.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.maskedTextBoxTLIP.Size = new System.Drawing.Size(1137, 28);
this.maskedTextBoxTLIP.TabIndex = 8;
this.maskedTextBoxTLIP.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.maskedTextBoxIP_PreviewKeyDown);
//
// panel4
//
this.panel4.BackColor = System.Drawing.Color.Transparent;
this.panel4.Controls.Add(this.label2);
this.panel4.Dock = System.Windows.Forms.DockStyle.Top;
this.panel4.Location = new System.Drawing.Point(0, 0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(1137, 65);
this.panel4.TabIndex = 7;
//
// label2
//
this.label2.BackColor = System.Drawing.Color.WhiteSmoke;
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
this.label2.Font = new System.Drawing.Font("Times New Roman", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.Black;
this.label2.Location = new System.Drawing.Point(0, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(1137, 51);
this.label2.TabIndex = 9;
this.label2.Text = "TestList Server";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel5
//
this.panel5.BackColor = System.Drawing.Color.Transparent;
this.panel5.Controls.Add(this.maskedTextBoxDT1IP);
this.panel5.Controls.Add(this.panel6);
this.panel5.Dock = System.Windows.Forms.DockStyle.Top;
this.panel5.Location = new System.Drawing.Point(0, 147);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(1137, 129);
this.panel5.TabIndex = 9;
//
// maskedTextBoxDT1IP
//
this.maskedTextBoxDT1IP.Dock = System.Windows.Forms.DockStyle.Fill;
this.maskedTextBoxDT1IP.EditValue = "If you do not enter the ip, will be connected to the local area.";
this.maskedTextBoxDT1IP.Location = new System.Drawing.Point(0, 85);
this.maskedTextBoxDT1IP.Name = "maskedTextBoxDT1IP";
this.maskedTextBoxDT1IP.Properties.Appearance.BackColor = System.Drawing.Color.White;
this.maskedTextBoxDT1IP.Properties.Appearance.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.maskedTextBoxDT1IP.Properties.Appearance.ForeColor = System.Drawing.Color.Black;
this.maskedTextBoxDT1IP.Properties.Appearance.Options.UseBackColor = true;
this.maskedTextBoxDT1IP.Properties.Appearance.Options.UseFont = true;
this.maskedTextBoxDT1IP.Properties.Appearance.Options.UseForeColor = true;
this.maskedTextBoxDT1IP.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.maskedTextBoxDT1IP.Size = new System.Drawing.Size(1137, 28);
this.maskedTextBoxDT1IP.TabIndex = 8;
this.maskedTextBoxDT1IP.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.maskedTextBoxIP_PreviewKeyDown);
//
// panel6
//
this.panel6.BackColor = System.Drawing.Color.Transparent;
this.panel6.Controls.Add(this.comboBoxOverviewModel1);
this.panel6.Controls.Add(this.label1);
this.panel6.Dock = System.Windows.Forms.DockStyle.Top;
this.panel6.Location = new System.Drawing.Point(0, 0);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(1137, 85);
this.panel6.TabIndex = 7;
//
// comboBoxOverviewModel1
//
this.comboBoxOverviewModel1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxOverviewModel1.FormattingEnabled = true;
this.comboBoxOverviewModel1.Items.AddRange(new object[] {
"L",
"P1",
"P2"});
this.comboBoxOverviewModel1.Location = new System.Drawing.Point(280, 22);
this.comboBoxOverviewModel1.Name = "comboBoxOverviewModel1";
this.comboBoxOverviewModel1.Size = new System.Drawing.Size(106, 28);
this.comboBoxOverviewModel1.TabIndex = 10;
this.comboBoxOverviewModel1.Visible = false;
//
// label1
//
this.label1.BackColor = System.Drawing.Color.WhiteSmoke;
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Font = new System.Drawing.Font("Times New Roman", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.Black;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(1137, 70);
this.label1.TabIndex = 9;
this.label1.Text = "Log Server [1]";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label1.DoubleClick += new System.EventHandler(this.label1_DoubleClick);
//
// panel7
//
this.panel7.BackColor = System.Drawing.Color.Transparent;
this.panel7.Controls.Add(this.maskedTextBoxDT2IP);
this.panel7.Controls.Add(this.panel8);
this.panel7.Dock = System.Windows.Forms.DockStyle.Top;
this.panel7.Location = new System.Drawing.Point(0, 276);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(1137, 150);
this.panel7.TabIndex = 10;
//
// maskedTextBoxDT2IP
//
this.maskedTextBoxDT2IP.Dock = System.Windows.Forms.DockStyle.Fill;
this.maskedTextBoxDT2IP.EditValue = "If you do not enter the ip, will be connected to the local area.";
this.maskedTextBoxDT2IP.Location = new System.Drawing.Point(0, 83);
this.maskedTextBoxDT2IP.Name = "maskedTextBoxDT2IP";
this.maskedTextBoxDT2IP.Properties.Appearance.BackColor = System.Drawing.Color.White;
this.maskedTextBoxDT2IP.Properties.Appearance.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.maskedTextBoxDT2IP.Properties.Appearance.ForeColor = System.Drawing.Color.Black;
this.maskedTextBoxDT2IP.Properties.Appearance.Options.UseBackColor = true;
this.maskedTextBoxDT2IP.Properties.Appearance.Options.UseFont = true;
this.maskedTextBoxDT2IP.Properties.Appearance.Options.UseForeColor = true;
this.maskedTextBoxDT2IP.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.maskedTextBoxDT2IP.Size = new System.Drawing.Size(1137, 28);
this.maskedTextBoxDT2IP.TabIndex = 8;
this.maskedTextBoxDT2IP.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.maskedTextBoxIP_PreviewKeyDown);
//
// panel8
//
this.panel8.BackColor = System.Drawing.Color.Transparent;
this.panel8.Controls.Add(this.comboBoxOverviewModel2);
this.panel8.Controls.Add(this.checkBoxUseDT2);
this.panel8.Controls.Add(this.label3);
this.panel8.Dock = System.Windows.Forms.DockStyle.Top;
this.panel8.Location = new System.Drawing.Point(0, 0);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(1137, 83);
this.panel8.TabIndex = 7;
//
// comboBoxOverviewModel2
//
this.comboBoxOverviewModel2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxOverviewModel2.FormattingEnabled = true;
this.comboBoxOverviewModel2.Items.AddRange(new object[] {
"L",
"P1",
"P2"});
this.comboBoxOverviewModel2.Location = new System.Drawing.Point(280, 21);
this.comboBoxOverviewModel2.Name = "comboBoxOverviewModel2";
this.comboBoxOverviewModel2.Size = new System.Drawing.Size(106, 28);
this.comboBoxOverviewModel2.TabIndex = 13;
this.comboBoxOverviewModel2.Visible = false;
//
// checkBoxUseDT2
//
this.checkBoxUseDT2.AutoSize = true;
this.checkBoxUseDT2.BackColor = System.Drawing.Color.WhiteSmoke;
this.checkBoxUseDT2.ForeColor = System.Drawing.Color.Black;
this.checkBoxUseDT2.Location = new System.Drawing.Point(43, 23);
this.checkBoxUseDT2.Name = "checkBoxUseDT2";
this.checkBoxUseDT2.Size = new System.Drawing.Size(63, 24);
this.checkBoxUseDT2.TabIndex = 12;
this.checkBoxUseDT2.Text = "Use";
this.checkBoxUseDT2.UseVisualStyleBackColor = false;
//
// label3
//
this.label3.BackColor = System.Drawing.Color.WhiteSmoke;
this.label3.Dock = System.Windows.Forms.DockStyle.Top;
this.label3.Font = new System.Drawing.Font("Times New Roman", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.ForeColor = System.Drawing.Color.Black;
this.label3.Location = new System.Drawing.Point(0, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(1137, 69);
this.label3.TabIndex = 9;
this.label3.Text = "Log Server [2]";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label3.DoubleClick += new System.EventHandler(this.label3_DoubleClick);
//
// ConnectForm
//
this.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.Appearance.Options.UseBackColor = true;
this.Appearance.Options.UseFont = true;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackgroundImageLayoutStore = System.Windows.Forms.ImageLayout.Stretch;
this.BackgroundImageStore = global::SystemX.Product.TRA.Properties.Resources.IpAddress;
this.ClientSize = new System.Drawing.Size(1137, 460);
this.Controls.Add(this.panel1);
this.Controls.Add(this.panel7);
this.Controls.Add(this.panel5);
this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Controls.Add(this.labelControl1);
this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("Times New Roman", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.IconOptions.Icon = ((System.Drawing.Icon)(resources.GetObject("ConnectForm.IconOptions.Icon")));
this.IconOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("ConnectForm.IconOptions.SvgImage")));
this.Name = "ConnectForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Connect CP-ALIS";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ConnectForm_FormClosing);
this.panel1.ResumeLayout(false);
this.panel3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.maskedTextBoxTLIP.Properties)).EndInit();
this.panel4.ResumeLayout(false);
this.panel5.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.maskedTextBoxDT1IP.Properties)).EndInit();
this.panel6.ResumeLayout(false);
this.panel7.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.maskedTextBoxDT2IP.Properties)).EndInit();
this.panel8.ResumeLayout(false);
this.panel8.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private DevExpress.XtraEditors.LabelControl labelControl1;
private DevExpress.XtraEditors.SimpleButton simpleButtonOK;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private DevExpress.XtraEditors.ComboBoxEdit maskedTextBoxTLIP;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Panel panel5;
private DevExpress.XtraEditors.ComboBoxEdit maskedTextBoxDT1IP;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel7;
private DevExpress.XtraEditors.ComboBoxEdit maskedTextBoxDT2IP;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.Label label3;
private DevExpress.XtraEditors.SimpleButton simpleButtonReset;
private System.Windows.Forms.CheckBox checkBoxUseDT2;
private System.Windows.Forms.ComboBox comboBoxOverviewModel1;
private System.Windows.Forms.ComboBox comboBoxOverviewModel2;
}
}

View File

@ -0,0 +1,327 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DataBaseConnection.Control;
using DevExpress.XtraBars.Docking;
using DevExpress.XtraEditors;
using SystemX.Product.ALIS.Interface;
using static SystemX.Product.CP.TRA.Commons;
namespace SystemX.Product.ALIS.UI.Subs
{
public partial class ConnectForm : DevExpress.XtraEditors.XtraForm
{
private enum eCehckType
{
TestListServer = 1,
DataLogServer1 = 2,
DataLogServer2 = 3
}
private IDataController ctrlDB;
//TL Server
public string strInputTextTL;
private string strSetIPAddressTL;
public string strGetIPAddressTL { get { return strSetIPAddressTL; } private set { strSetIPAddressTL = value; } }
private int nSetConnPortTL;
public int nGetConnPortTL { get { return nSetConnPortTL; } private set { nSetConnPortTL = value; } }
//DT Server 1
public string strInputTextDT1;
private string strSetIPAddressDT1;
public string strGetIPAddressDT1 { get { return strSetIPAddressDT1; } private set { strSetIPAddressDT1 = value; } }
private int nSetConnPortDT1;
public int nGetConnPortDT1 { get { return nSetConnPortDT1; } private set { nSetConnPortDT1 = value; } }
//
//DT Server 2
public bool bSelectUseDataServer2;
public string strInputTextDT2;
private string strSetIPAddressDT2;
public string strGetIPAddressDT2 { get { return strSetIPAddressDT2; } private set { strSetIPAddressDT2 = value; } }
private int nSetConnPortDT2;
public int nGetConnPortDT2 { get { return nSetConnPortDT2; } private set { nSetConnPortDT2 = value; } }
//
public int nOverviewModelC1;
public int nOverviewModelC2;
public DialogResult TestListServerCheckResult;
public DialogResult DataServerCheckResult1;
public DialogResult DataServerCheckResult2;
public ConnectForm(IDataController ctrlDB)
{
InitializeComponent();
//this.MinimumSize = new Size(400, 250);
//this.MaximumSize = new Size(400, 250);
this.ctrlDB = ctrlDB;
//maskedTextBoxIP.Mask = "###.###.###.###";
//maskedTextBoxIP.ValidatingType = typeof(System.Net.IPAddress);
this.BringToFront();
this.Focus();
DialogResult = DialogResult.None;
comboBoxOverviewModel1.SelectedIndex = 0;
comboBoxOverviewModel2.SelectedIndex = 1;
ConnectInfoINICtrl CCtrl = new ConnectInfoINICtrl();
string strGetConnectInfo1 = CCtrl.GetValue("LastestConnect", "Info1", "");
string strGetConnectInfo2 = CCtrl.GetValue("LastestConnect", "Info2", "");
string strGetConnectInfo3 = CCtrl.GetValue("LastestConnect", "Info3", "");
string strGetConnectInfo4 = CCtrl.GetValue("LastestConnect", "UseDataServer2", "False");
string strGetConnectInfo5 = CCtrl.GetValue("LastestConnect", "OverviewModelInfoC1", "0");
string strGetConnectInfo6 = CCtrl.GetValue("LastestConnect", "OverviewModelInfoC2", "1");
int nOverInfoC1 = 0;
int nOverInfoC2 = 1;
if(int.TryParse(strGetConnectInfo5, out nOverInfoC1))
comboBoxOverviewModel1.SelectedIndex = nOverInfoC1;
if(int.TryParse(strGetConnectInfo6, out nOverInfoC2))
comboBoxOverviewModel2.SelectedIndex = nOverInfoC2;
if (strGetConnectInfo1.Length > 0)
maskedTextBoxTLIP.Text = strGetConnectInfo1;
if (strGetConnectInfo2.Length > 0)
maskedTextBoxDT1IP.Text = strGetConnectInfo2;
if (strGetConnectInfo3.Length > 0)
maskedTextBoxDT2IP.Text = strGetConnectInfo3;
if (strGetConnectInfo4.Length > 0)
{
bool bGetUseState = false;
if (bool.TryParse(strGetConnectInfo4, out bGetUseState))
checkBoxUseDT2.Checked = bGetUseState;
else
checkBoxUseDT2.Checked = false;
}
for (int i = 0; i < INICtrl.MAX_INFORMATION; i++)
{
string strGetInfo1 = CCtrl.GetValue("HistoryConnect" + i.ToString(), "Info1", "");
string strGetInfo2 = CCtrl.GetValue("HistoryConnect" + i.ToString(), "Info2", "");
string strGetInfo3 = CCtrl.GetValue("HistoryConnect" + i.ToString(), "Info3", "");
if (strGetInfo1.Length > 0)
maskedTextBoxTLIP.Properties.Items.Add(strGetInfo1);
if (strGetInfo2.Length > 0)
maskedTextBoxDT1IP.Properties.Items.Add(strGetInfo2);
if (strGetInfo3.Length > 0)
maskedTextBoxDT2IP.Properties.Items.Add(strGetInfo3);
}
}
private void InvaildIPAlarm()
{
MessageBox.Show("Invalid IP. Enter it in the normal format. (An empty string or [localhost] will attempt to connect to the local server.)", "[SystemX.Product.ALIS.UI]", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private DialogResult CheckInformation(eCehckType ChkTyp, object sender, string strText)
{
DialogResult CheckResult = DialogResult.None;
IPAddress getIPAddress = null;
string strGetText = strText;
string[] strGetSplitCommaText = strGetText.Split(',');
string[] strGetSplitDotText = strGetText.Split('.');
if (ChkTyp == eCehckType.TestListServer)
{
strGetIPAddressTL = string.Empty;
nGetConnPortTL = DatabaseConnControl.CatalogConnPort;
strInputTextTL = strText;
}
else if (ChkTyp == eCehckType.DataLogServer1)
{
strGetIPAddressDT1 = string.Empty;
nGetConnPortDT1 = DatabaseConnControl.CatalogConnPort;
strInputTextDT1 = strText;
}
else if (ChkTyp == eCehckType.DataLogServer2)
{
strGetIPAddressDT2 = string.Empty;
nGetConnPortDT2 = DatabaseConnControl.CatalogConnPort;
strInputTextDT2 = strText;
}
if (IPAddress.TryParse(strText, out getIPAddress) == false)
{
if (strGetSplitCommaText.Length == 2)
{
string strGetIP = strGetSplitCommaText[0];
string strGetPort = strGetSplitCommaText[1];
int nGetPort = int.MaxValue;
if (IPAddress.TryParse(strGetIP, out getIPAddress) &&
int.TryParse(strGetPort, out nGetPort))
{
if (ChkTyp == eCehckType.TestListServer)
{
strGetIPAddressTL = strGetIP;
nGetConnPortTL = nGetPort;
}
else if (ChkTyp == eCehckType.DataLogServer1)
{
strGetIPAddressDT1 = strGetIP;
nGetConnPortDT1 = nGetPort;
}
else if (ChkTyp == eCehckType.DataLogServer2)
{
strGetIPAddressDT2 = strGetIP;
nGetConnPortDT2 = nGetPort;
}
CheckResult = DialogResult.OK;
return CheckResult;
}
}
string strGetUpperText = strText.ToUpper();
if (strText.Length == 0)
CheckResult = DialogResult.Ignore;
else if (strGetUpperText.CompareTo("LOCALHOST") == 0)
CheckResult = DialogResult.Ignore;
else if (strText.CompareTo("If you do not enter the ip, will be connected to the local area.") == 0)
CheckResult = DialogResult.Ignore;
else
{
((ComboBoxEdit)sender).Text = "";
InvaildIPAlarm();
}
}
else
{
if (strGetSplitDotText.Length == 4)
{
if (ChkTyp == eCehckType.TestListServer)
strGetIPAddressTL = strText;
else if (ChkTyp == eCehckType.DataLogServer1)
strGetIPAddressDT1 = strText;
else if (ChkTyp == eCehckType.DataLogServer2)
strGetIPAddressDT2 = strText;
CheckResult = DialogResult.OK;
}
else
{
((ComboBoxEdit)sender).Text = "";
InvaildIPAlarm();
}
}
return CheckResult;
}
private void simpleButtonOK_Click(object sender, EventArgs e)
{
bSelectUseDataServer2 = checkBoxUseDT2.Checked;
//
nOverviewModelC1 = comboBoxOverviewModel1.SelectedIndex;
nOverviewModelC2 = comboBoxOverviewModel2.SelectedIndex;
TestListServerCheckResult = DialogResult.None;
DataServerCheckResult1 = DialogResult.None;
TestListServerCheckResult = CheckInformation(eCehckType.TestListServer, maskedTextBoxTLIP, maskedTextBoxTLIP.Text);
DataServerCheckResult1 = CheckInformation(eCehckType.DataLogServer1, maskedTextBoxDT1IP, maskedTextBoxDT1IP.Text);
if (bSelectUseDataServer2)
DataServerCheckResult2 = CheckInformation(eCehckType.DataLogServer2, maskedTextBoxDT2IP, maskedTextBoxDT2IP.Text);
else
DataServerCheckResult2 = DialogResult.Ignore;
if ((TestListServerCheckResult.HasFlag(DialogResult.OK) || TestListServerCheckResult.HasFlag(DialogResult.Ignore)) &&
(DataServerCheckResult1.HasFlag(DialogResult.OK) || DataServerCheckResult1.HasFlag(DialogResult.Ignore)) &&
(DataServerCheckResult2.HasFlag(DialogResult.OK) || DataServerCheckResult2.HasFlag(DialogResult.Ignore)))
DialogResult = DialogResult.OK;
}
private void ConnectForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (DialogResult == DialogResult.None)
DialogResult = DialogResult.Abort;
/*if (maskedTextBoxIP.Text.Length == 0)
DialogResult = DialogResult.Cancel;
else if (maskedTextBoxIP.Text.CompareTo("localhost") == 0)
DialogResult = DialogResult.Cancel;
else if (maskedTextBoxIP.Text.CompareTo("If you do not enter the ip, will be connected to the local area.") == 0)
DialogResult = DialogResult.Cancel;
else
{
e.Cancel = true;
if (IPAddress.TryParse(maskedTextBoxIP.Text, out IPAddress))
e.Cancel = false;
}*/
}
private void maskedTextBoxIP_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (((ComboBoxEdit)sender).Text.CompareTo("If you do not enter the ip, will be connected to the local area.") == 0)
((ComboBoxEdit)sender).Text = string.Empty;
}
private void simpleButtonReset_Click(object sender, EventArgs e)
{
maskedTextBoxTLIP.Text = "If you do not enter the ip, will be connected to the local area.";
maskedTextBoxDT1IP.Text = "If you do not enter the ip, will be connected to the local area.";
maskedTextBoxDT2IP.Text = "If you do not enter the ip, will be connected to the local area.";
checkBoxUseDT2.Checked = false;
}
private void label1_DoubleClick(object sender, EventArgs e)
{
comboBoxOverviewModel1.Visible = !comboBoxOverviewModel1.Visible;
}
private void label3_DoubleClick(object sender, EventArgs e)
{
comboBoxOverviewModel2.Visible = !comboBoxOverviewModel2.Visible;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,189 @@

namespace SystemX.Product.ALIS.UI.Subs
{
partial class LoginForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginForm));
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
this.btnLogin = new System.Windows.Forms.Button();
this.labelAlarm = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.txtUserId = new DevExpress.XtraEditors.TextEdit();
this.panel2 = new System.Windows.Forms.Panel();
this.txtPassword = new System.Windows.Forms.MaskedTextBox();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.txtUserId.Properties)).BeginInit();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// labelControl1
//
this.labelControl1.Appearance.BackColor = System.Drawing.Color.White;
this.labelControl1.Appearance.Font = new System.Drawing.Font("Arial Black", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelControl1.Appearance.ForeColor = System.Drawing.Color.MidnightBlue;
this.labelControl1.Appearance.Options.UseBackColor = true;
this.labelControl1.Appearance.Options.UseFont = true;
this.labelControl1.Appearance.Options.UseForeColor = true;
this.labelControl1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Style3D;
this.labelControl1.Dock = System.Windows.Forms.DockStyle.Left;
this.labelControl1.Location = new System.Drawing.Point(0, 0);
this.labelControl1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.labelControl1.Name = "labelControl1";
this.labelControl1.Size = new System.Drawing.Size(52, 21);
this.labelControl1.TabIndex = 2;
this.labelControl1.Text = "User ID";
//
// labelControl2
//
this.labelControl2.Appearance.BackColor = System.Drawing.Color.White;
this.labelControl2.Appearance.Font = new System.Drawing.Font("Arial Black", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelControl2.Appearance.ForeColor = System.Drawing.Color.MidnightBlue;
this.labelControl2.Appearance.Options.UseBackColor = true;
this.labelControl2.Appearance.Options.UseFont = true;
this.labelControl2.Appearance.Options.UseForeColor = true;
this.labelControl2.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Style3D;
this.labelControl2.Dock = System.Windows.Forms.DockStyle.Left;
this.labelControl2.Location = new System.Drawing.Point(0, 0);
this.labelControl2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.labelControl2.Name = "labelControl2";
this.labelControl2.Size = new System.Drawing.Size(67, 21);
this.labelControl2.TabIndex = 4;
this.labelControl2.Text = "Password";
//
// btnLogin
//
this.btnLogin.Dock = System.Windows.Forms.DockStyle.Bottom;
this.btnLogin.Font = new System.Drawing.Font("Arial Black", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnLogin.Location = new System.Drawing.Point(0, 86);
this.btnLogin.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(298, 32);
this.btnLogin.TabIndex = 5;
this.btnLogin.Text = "Login";
this.btnLogin.UseVisualStyleBackColor = true;
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
//
// labelAlarm
//
this.labelAlarm.BackColor = System.Drawing.Color.LightGray;
this.labelAlarm.Dock = System.Windows.Forms.DockStyle.Bottom;
this.labelAlarm.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelAlarm.Location = new System.Drawing.Point(0, 54);
this.labelAlarm.Name = "labelAlarm";
this.labelAlarm.Size = new System.Drawing.Size(298, 32);
this.labelAlarm.TabIndex = 6;
this.labelAlarm.Text = "-";
this.labelAlarm.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelAlarm.Visible = false;
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.txtUserId);
this.panel1.Controls.Add(this.labelControl1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(298, 25);
this.panel1.TabIndex = 7;
//
// txtUserId
//
this.txtUserId.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtUserId.Location = new System.Drawing.Point(52, 0);
this.txtUserId.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtUserId.Name = "txtUserId";
this.txtUserId.Size = new System.Drawing.Size(246, 20);
this.txtUserId.TabIndex = 3;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Controls.Add(this.txtPassword);
this.panel2.Controls.Add(this.labelControl2);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 25);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(298, 25);
this.panel2.TabIndex = 8;
//
// txtPassword
//
this.txtPassword.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtPassword.Location = new System.Drawing.Point(67, 0);
this.txtPassword.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(231, 21);
this.txtPassword.TabIndex = 5;
this.txtPassword.UseSystemPasswordChar = true;
//
// LoginForm
//
this.Appearance.Options.UseFont = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImageLayoutStore = System.Windows.Forms.ImageLayout.Stretch;
this.BackgroundImageStore = global::SystemX.Product.TRA.Properties.Resources.Password;
this.ClientSize = new System.Drawing.Size(298, 118);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Controls.Add(this.labelAlarm);
this.Controls.Add(this.btnLogin);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);
this.IconOptions.Icon = ((System.Drawing.Icon)(resources.GetObject("LoginForm.IconOptions.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.MaximumSize = new System.Drawing.Size(300, 150);
this.MinimumSize = new System.Drawing.Size(300, 130);
this.Name = "LoginForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Login";
this.TopMost = true;
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.txtUserId.Properties)).EndInit();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private DevExpress.XtraEditors.LabelControl labelControl1;
private DevExpress.XtraEditors.LabelControl labelControl2;
private System.Windows.Forms.Button btnLogin;
private System.Windows.Forms.Label labelAlarm;
private System.Windows.Forms.Panel panel1;
private DevExpress.XtraEditors.TextEdit txtUserId;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.MaskedTextBox txtPassword;
}
}

View File

@ -0,0 +1,90 @@
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SystemX.Product.ALIS.Interface;
namespace SystemX.Product.ALIS.UI.Subs
{
public partial class LoginForm : DevExpress.XtraEditors.XtraForm
{
private IDataController ctrlDB;
private DataSet ds = new DataSet();
private DataTable dt = new DataTable();
public string UserID { internal set; get; }
public string UserName { internal set; get; }
public string UserDept { internal set; get; }
public string UserEmail { internal set; get; }
public string UserComment { internal set; get; }
public string UserPassword { internal set; get; }
public LoginForm(IDataController ctrlDB)
{
InitializeComponent();
this.ctrlDB = ctrlDB;
}
private void btnLogin_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.None;
SqlDataReader dr = null;
try
{
ctrlDB.GetConnSqlCmd().CommandText = "SELECT * FROM STAT_User WHERE UserID = '" + txtUserId.Text + "' AND Password = '" + txtPassword.Text + "';";
dr = ctrlDB.GetConnSqlCmd().ExecuteReader();
if (dr != null)
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
int iFieldCnt = dr.FieldCount;
int iRecordsAffectedCnt = dr.RecordsAffected;
bool bHasRow = dr.HasRows;
dt.Load(dr);
ds.Tables.Add(dt);
if (dt.Rows.Count > 0)
{
UserID = dt.Rows[0]["UserID"].ToString();
UserName = dt.Rows[0]["Name"].ToString();
UserDept = dt.Rows[0]["Dept"].ToString();
UserEmail = dt.Rows[0]["Email"].ToString();
UserComment = dt.Rows[0]["Comment"].ToString();
UserPassword = dt.Rows[0]["Password"].ToString();
this.DialogResult = DialogResult.OK;
}
}
}
finally
{
if (dr != null)
dr.Close();
}
if (this.DialogResult == DialogResult.None)
{
this.MaximumSize = new Size(300, 180);
this.MinimumSize = new Size(300, 180);
this.Size = new Size(300, 180);
labelAlarm.Visible = true;
labelAlarm.Text = "User information does not match or\r\n the password is incorrect.";
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,296 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using SystemX.Net.Platform.Common.Util;
using static SystemX.Product.ALIS.UI.View.ViewCfg;
namespace SystemX.Product.ALIS.UI.View
{
public static class ViewCfg
{
public enum eOperationMode
{
ALL,
AUTO,
MANUAL
}
public enum eWorkMode
{
NORMAL,
RETEST,
REWORK
}
public enum eAppFunctionType
{
None = 0,
M_HostList,
M_UserList,
M_GroupList,
M_TestCodeList,
M_TestList,
M_TestListRel,
A_AnalysisPartID,
A_LogSearchTrend,
A_AnalysisProcessTrend
}
public enum eSelectType
{
None = 0,
HostList,
UserList,
GroupList,
TestCodeList,
TestList,
TestListRel
}
public enum eEditType
{
Insert = 0,
Modify
}
public enum eModelType
{
NONE,
IMAGE,
TEXT,
CPLOG,
PARTID_MAP
}
public enum eProcessTable
{
HIST_ProdLoad = 0,
HIST_CapDeassy,
HIST_PreHeating,
HIST_PreMeas,
HIST_Leak,
HIST_LaserTrim,
HIST_LaserTrimVision,
HIST_IsoRes,
HIST_CapAssy,
HIST_Function,
HIST_OutSealPress,
HIST_PinLVDT,
HIST_PinVision,
HIST_ProdUnload
}
private enum eProcessTableNumber
{
HIST_ProdLoad = 180,
HIST_CapDeassy = 180,
HIST_PreHeating = 190,
HIST_PreMeas = 190,
HIST_Leak = 200,
HIST_LaserTrim = 210,
HIST_LaserTrimVision = 220,
HIST_IsoRes = 220,
HIST_CapAssy = 230,
HIST_Function = 240,
HIST_OutSealPress = 250,
HIST_PinLVDT = 260,
HIST_PinVision = 260,
HIST_ProdUnload = 270
}
public static string GetTableProcessNumber(eProcessTable processTable)
{
string[] strSetProcessNumberList = new string[]
{ "180", "180", "190", "190", "200", "210", "220", "220", "230", "240", "250", "260", "260", "270" };
if (strSetProcessNumberList.Length > (int)processTable)
return strSetProcessNumberList[(int)processTable];
else
return "";
}
public enum eDataTable
{
HIST_TestResultData,
HIST_TestResultDatail
}
public const string SystemConfigPath = @"./Config/SystemConfig.xml";
public const string SaveLayoutPath = @"./Layout/Search/";
public enum eConfigElemList
{
Root,
RegisteredModels,
Model
}
public static XElement OpenSystemConfig()
{
var xElement = XMLControl.OpenXMLDocument(SystemConfigPath, eConfigElemList.Root.ToString());
if (xElement == null) return null;
return xElement;
}
public static XElement SaveSystemConfig(List<SysModelDef> registeredModels)
{
XDocument xmlDoc = new XDocument();
XElement xRoot = new XElement(eConfigElemList.Root.ToString());
XElement xRegModels = new XElement(eConfigElemList.RegisteredModels.ToString());
foreach (SysModelDef modeldef in registeredModels)
xRegModels.Add(modeldef.SaveXML());
xRoot.Add(xRegModels);
xmlDoc.Add(xRoot);
xmlDoc.Save(SystemConfigPath);
return xRoot;
}
public static List<SysModelDef> GetRegisteredModels(XElement xelemRoot)
{
XElement elemModelRoot = xelemRoot.Element(eConfigElemList.RegisteredModels.ToString());
List<SysModelDef> modeldef = new List<SysModelDef>();
foreach (XElement elemModel in elemModelRoot.Elements())
modeldef.Add(new SysModelDef(elemModel));
return modeldef;
}
public static Dictionary<string, string> GetProcessTableNameMap()
{
Dictionary<string, string> NameMap = new Dictionary<string, string>();
NameMap.Add(eProcessTable.HIST_ProdLoad.ToString(), "LX/LU-180:Loading");
NameMap.Add(eProcessTable.HIST_CapDeassy.ToString(), "LX/LU-180:Cap De-Ass'y");
NameMap.Add(eProcessTable.HIST_PreHeating.ToString(), "LX/LU-190:Pre-Heating");
NameMap.Add(eProcessTable.HIST_PreMeas.ToString(), "LX/LU-190:Pre-Measuring");
NameMap.Add(eProcessTable.HIST_Leak.ToString(), "LX/LU-200:Leak Test");
NameMap.Add(eProcessTable.HIST_LaserTrim.ToString(), "LX/LU-210:Laser Trimming");
NameMap.Add(eProcessTable.HIST_LaserTrimVision.ToString(), "LX/LU-220:Trimming Vision Inspection");
NameMap.Add(eProcessTable.HIST_IsoRes.ToString(), "LX/LU-220:Isolation Resistance Test");
NameMap.Add(eProcessTable.HIST_CapAssy.ToString(), "LX/LU-230:Cap Ass'y");
NameMap.Add(eProcessTable.HIST_Function.ToString(), "LX/LU-240:Function Test");
NameMap.Add(eProcessTable.HIST_OutSealPress.ToString(), "LX/LU-250:Outer Seal Press");
NameMap.Add(eProcessTable.HIST_PinLVDT.ToString(), "LX/LU-260:Pin Height Inspection");
NameMap.Add(eProcessTable.HIST_PinVision.ToString(), "LX/LU-260:Pin-Align Vision Inspection");
NameMap.Add(eProcessTable.HIST_ProdUnload.ToString(), "LX/LU-270:Unloading");
return NameMap;
}
public class NameMapItem
{
public string TableName { get; set; }
public string ProcName { get; set; }
}
}
public class SysModelDef
{
public string ID { get; set; }
public string Path { get; set; }
public string Type { get; set; }
public eModelType eType { get; set; } = eModelType.NONE;
public SysModelDef(XElement elem)
{
SetModelDef(elem);
SetType(Type);
}
public SysModelDef(string strPath)
{
Path = strPath;
}
public bool SetType(string strType)
{
eModelType eparsetype = eModelType.NONE;
if (!Enum.TryParse(strType.ToUpper(), out eparsetype))
return false;
eType = eparsetype;
return true;
}
public bool SetModelDef(XElement elem)
{
try
{
foreach (XAttribute regAttrb in elem.Attributes())
{
string strAttrbName = regAttrb.Name.LocalName;
if (CommonUtil.GetProperty(this, strAttrbName) == null)
continue;
CommonUtil.SetPropertyValue(this, strAttrbName, regAttrb.Value);
}
}
catch (Exception ex)
{
LogMessage.MessageOutput.ConsoleWrite("Error during Read Mdoel Definition in System Config.", ConsoleColor.Red, LogMessage.LogMessageLevel.FATAL);
LogMessage.MessageOutput.ConsoleWrite($" - Message: {ex.Message}", ConsoleColor.Red, LogMessage.LogMessageLevel.FATAL);
throw;
}
return true;
}
public XElement SaveXML()
{
XElement xelemSave = new XElement(eConfigElemList.Model.ToString());
xelemSave.SetAttributeValue("ID", ID);
xelemSave.SetAttributeValue("Path", Path);
xelemSave.SetAttributeValue("Type", Type);
return xelemSave;
}
}
public class LogInfo
{
public string LogAccKey { get; set; }
public string ProductID { get; set; }
public string PalletID { get; set; }
public string UpdateDT { get; set; }
public string ProcessNo { get; set; }
public string PalletNo { get; set; }
public string PalletIndex { get; set; }
public string Status { get; set; }
public string TestTime { get; set; }
public string Result { get; set; }
public Dictionary<int, string> TestResult { get; set; }
}
public class ChartLogInfo
{
public string TableName { get; set; }
public string StartDateTime { get; set; }
public string EndDateTime { get; set; }
public string ProductNo { get; set; }
public string PalletNo { get; set; }
public string PalletIndex { get; set; }
public string WorkMode { get; set; }
public string OperationMode { get; set; }
public string StepNo { get; set; }
public string MO { get; set; }
public string FuncName { get; set; }
public string Min { get; set; }
public string Max { get; set; }
public Dictionary<string, double> MeasuredData = new Dictionary<string, double>();
}
}

View File

@ -0,0 +1,94 @@

namespace SystemX.Product.ALIS.UI.Subs
{
partial class WaitProgressForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.progressPanel1 = new DevExpress.XtraWaitForm.ProgressPanel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// progressPanel1
//
this.progressPanel1.Appearance.BackColor = System.Drawing.Color.Transparent;
this.progressPanel1.Appearance.Font = new System.Drawing.Font("Arial Rounded MT", 9F);
this.progressPanel1.Appearance.Options.UseBackColor = true;
this.progressPanel1.Appearance.Options.UseFont = true;
this.progressPanel1.AppearanceCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
this.progressPanel1.AppearanceCaption.Options.UseFont = true;
this.progressPanel1.AppearanceDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.progressPanel1.AppearanceDescription.Options.UseFont = true;
this.progressPanel1.Description = "";
this.progressPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.progressPanel1.ImageHorzOffset = 20;
this.progressPanel1.Location = new System.Drawing.Point(0, 16);
this.progressPanel1.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.progressPanel1.Name = "progressPanel1";
this.progressPanel1.Size = new System.Drawing.Size(287, 35);
this.progressPanel1.TabIndex = 0;
this.progressPanel1.Text = "progressPanel1";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.AutoSize = true;
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.progressPanel1, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(0, 13, 0, 13);
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(287, 67);
this.tableLayoutPanel1.TabIndex = 1;
//
// WaitProgressForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(287, 67);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "WaitProgressForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private DevExpress.XtraWaitForm.ProgressPanel progressPanel1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
}
}

View File

@ -0,0 +1,52 @@
using DevExpress.XtraWaitForm;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SystemX.Product.ALIS.UI.Subs
{
public partial class WaitProgressForm : WaitForm
{
public WaitProgressForm()
{
InitializeComponent();
this.progressPanel1.AutoHeight = true;
}
#region Overrides
public override void SetCaption(string caption)
{
base.SetCaption(caption);
this.progressPanel1.Caption = caption;
}
public override void SetDescription(string description)
{
base.SetDescription(description);
this.progressPanel1.Description = description;
}
public override void ProcessCommand(Enum cmd, object arg)
{
base.ProcessCommand(cmd, arg);
}
#endregion
public void setDescription(string sText)
{
this.SetDescription(sText);
}
public enum WaitFormCommand
{
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>