사용자 로그인 완료하여 테이블 연결 데이터 수정.

This commit is contained in:
chi
2021-03-25 11:28:08 +09:00
parent 43672fabed
commit 3a667f14b1
22 changed files with 3492 additions and 135 deletions

100
Project/Dialog/AccessDB.Designer.cs generated Normal file
View File

@@ -0,0 +1,100 @@

namespace Project.Dialog
{
partial class AccessDB
{
/// <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.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.button3 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(39, 22);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(170, 58);
this.button1.TabIndex = 0;
this.button1.Text = "부서명 업데이트";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(166, 318);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(749, 47);
this.button2.TabIndex = 1;
this.button2.Text = "인원 업데이트";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Font = new System.Drawing.Font("맑은 고딕", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(39, 86);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(925, 36);
this.comboBox1.TabIndex = 2;
//
// button3
//
this.button3.Location = new System.Drawing.Point(794, 22);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(170, 58);
this.button3.TabIndex = 3;
this.button3.Text = "등록";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// AccessDB
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(970, 470);
this.Controls.Add(this.button3);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "AccessDB";
this.Text = "AccessDB";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button button3;
}
}

107
Project/Dialog/AccessDB.cs Normal file
View File

@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Project.Dialog
{
public partial class AccessDB : Form
{
public AccessDB()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var dba = new dsAccessTableAdapters.GrpListTableAdapter();
var grplist = dba.GetData();
comboBox1.Items.Clear();
foreach (var item in grplist)
this.comboBox1.Items.Add(item.PersonUser2);
}
private void button3_Click(object sender, EventArgs e)
{
//부서등록
var ta = new dsMSSQLTableAdapters.UserGroupTableAdapter();
var usergrp = ta.GetData();
//이 부서에 속하지 않은 데이터는 추가한다.
var cnt = 0;
foreach (var item in comboBox1.Items)
{
var dept = item.ToString();
if (usergrp.Where(t => t.dept == dept).Any() == false)
{
var newdr = usergrp.NewUserGroupRow();
newdr.dept = dept;
newdr.permission = 511;
usergrp.AddUserGroupRow(newdr);
cnt += 1;
}
}
FCOMMON.Util.MsgI(cnt.ToString() + "건의 자료가 추가됨");
}
private void button2_Click(object sender, EventArgs e)
{
//인원업데이트
var dept = this.comboBox1.Text;
var tauser = new dsMSSQLTableAdapters.UsersTableAdapter();
var ta = new dsAccessTableAdapters.VIEW_CARD_PERSONTableAdapter();
var userlist = ta.GetData(dept);
var cnt = 0;
var cnte = 0;
foreach (dsAccess.VIEW_CARD_PERSONRow dr in userlist)
{
//이 사용자를 user 테이블에서 찾는다.
if (dr.IsSabunNull()) continue;
var dtUser = tauser.GetID(dr.Sabun);
if (dtUser.Rows.Count == 0)
{
//사라없음
var newdr = dtUser.NewUsersRow();
newdr.name = dr.Name;
if (dr.GradeName.Length > 5) newdr.grade = dr.GradeName.Substring(0, 5);
else newdr.grade = dr.GradeName;
newdr.dept = dr.PersonUser2;
newdr.hp = dr.Mobile;
if (dr.Tel.Length > 20) newdr.tel = dr.Tel.Substring(0, 15);
else newdr.tel = dr.Tel;
newdr.id = dr.Sabun;
newdr.password = "B6589FC6AB0DC82CF12099D1C2D40AB994E8410C";
newdr.wuid = "DEV";
newdr.wdate = DateTime.Now;
dtUser.AddUsersRow(newdr);
tauser.Update(dtUser);
cnt += 1;
}
else
{
//있으니 데이터 변경
foreach(dsMSSQL.UsersRow druser in dtUser.Rows)
{
druser.name = dr.Name;
druser.dept = dr.PersonUser2;
if (dr.GradeName.Length > 5) druser.grade = dr.GradeName.Substring(0, 5);
else druser.grade = dr.GradeName;
druser.EndEdit();
}
cnte += 1;
tauser.Update(dtUser);
}
}
FCOMMON.Util.MsgI($"A{cnt},I:{cnte}");
}
}
}

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>

View File

@@ -31,6 +31,8 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(fLogin));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panel1 = new System.Windows.Forms.Panel();
this.cmbDept = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.linkLabel2 = new System.Windows.Forms.LinkLabel();
this.tbID = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
@@ -38,8 +40,6 @@
this.tbPW = new System.Windows.Forms.TextBox();
this.panel2 = new System.Windows.Forms.Panel();
this.btLogin = new System.Windows.Forms.Button();
this.cmbDept = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
@@ -48,7 +48,7 @@
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(205, 26);
this.pictureBox1.Location = new System.Drawing.Point(295, 25);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(80, 80);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -69,9 +69,30 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(488, 377);
this.panel1.Size = new System.Drawing.Size(675, 377);
this.panel1.TabIndex = 0;
//
// cmbDept
//
this.cmbDept.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbDept.Font = new System.Drawing.Font("Calibri", 20.25F);
this.cmbDept.FormattingEnabled = true;
this.cmbDept.Location = new System.Drawing.Point(16, 136);
this.cmbDept.Name = "cmbDept";
this.cmbDept.Size = new System.Drawing.Size(645, 41);
this.cmbDept.TabIndex = 9;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("맑은 고딕", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.ForeColor = System.Drawing.Color.Gray;
this.label3.Location = new System.Drawing.Point(13, 119);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(31, 15);
this.label3.TabIndex = 8;
this.label3.Text = "부서";
//
// linkLabel2
//
this.linkLabel2.AutoSize = true;
@@ -92,7 +113,7 @@
this.tbID.FormattingEnabled = true;
this.tbID.Location = new System.Drawing.Point(16, 213);
this.tbID.Name = "tbID";
this.tbID.Size = new System.Drawing.Size(460, 41);
this.tbID.Size = new System.Drawing.Size(645, 41);
this.tbID.TabIndex = 3;
//
// label2
@@ -123,7 +144,7 @@
this.tbPW.Location = new System.Drawing.Point(16, 287);
this.tbPW.Name = "tbPW";
this.tbPW.PasswordChar = '●';
this.tbPW.Size = new System.Drawing.Size(460, 40);
this.tbPW.Size = new System.Drawing.Size(645, 40);
this.tbPW.TabIndex = 5;
this.tbPW.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
@@ -134,7 +155,7 @@
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(0, 377);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(488, 34);
this.panel2.Size = new System.Drawing.Size(675, 34);
this.panel2.TabIndex = 6;
//
// btLogin
@@ -142,38 +163,17 @@
this.btLogin.Dock = System.Windows.Forms.DockStyle.Fill;
this.btLogin.Location = new System.Drawing.Point(0, 0);
this.btLogin.Name = "btLogin";
this.btLogin.Size = new System.Drawing.Size(488, 34);
this.btLogin.Size = new System.Drawing.Size(675, 34);
this.btLogin.TabIndex = 0;
this.btLogin.Text = "접속";
this.btLogin.UseVisualStyleBackColor = true;
this.btLogin.Click += new System.EventHandler(this.button1_Click);
//
// cmbDept
//
this.cmbDept.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbDept.Font = new System.Drawing.Font("Calibri", 20.25F);
this.cmbDept.FormattingEnabled = true;
this.cmbDept.Location = new System.Drawing.Point(16, 136);
this.cmbDept.Name = "cmbDept";
this.cmbDept.Size = new System.Drawing.Size(460, 41);
this.cmbDept.TabIndex = 9;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("맑은 고딕", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.ForeColor = System.Drawing.Color.Gray;
this.label3.Location = new System.Drawing.Point(13, 119);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(31, 15);
this.label3.TabIndex = 8;
this.label3.Text = "부서";
//
// fLogin
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.OrangeRed;
this.ClientSize = new System.Drawing.Size(488, 411);
this.ClientSize = new System.Drawing.Size(675, 411);
this.Controls.Add(this.panel1);
this.Controls.Add(this.panel2);
this.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

View File

@@ -32,6 +32,19 @@ namespace Project.Dialog
if (item != "") tbID.Items.Add(item);
if (tbID.Items.Count > 0) tbID.SelectedIndex = 0;
//S1 사용자 그룹목록 확인
//var tas1 = new S1ACCESS300Entities();
//var deptlist = tas1.VIEW_CARD_PERSON
// .Where(t => t.CardStatusID == 0 && string.IsNullOrEmpty(t.CardUser2) == false)
// .GroupBy(t => t.PersonUser2)
// .OrderBy(t => t.Key)
// .ToList();
//this.cmbDept.Items.Clear();
//foreach (var dept in deptlist)
// cmbDept.Items.Add(dept);
//그룹목록가져오기
var tagrp = new dsMSSQLTableAdapters.UserGroupTableAdapter();
var grplist = tagrp.GetData();