initial commit
This commit is contained in:
114
Project/_Management/fEquipment.cs
Normal file
114
Project/_Management/fEquipment.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Project._Management
|
||||
{
|
||||
public partial class fEquipment : Form
|
||||
{
|
||||
public fEquipment()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.dsMSSQL.Equipment.TableNewRow += Equipment_TableNewRow;
|
||||
}
|
||||
|
||||
private void equipmentBindingNavigatorSaveItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Validate();
|
||||
this.bs.EndEdit();
|
||||
this.tam.UpdateAll(this.dsMSSQL);
|
||||
|
||||
}
|
||||
|
||||
private void fEquipment_Load(object sender, EventArgs e)
|
||||
{
|
||||
//목록을 가져온다.
|
||||
var grpList = Manager.DatabaseManager.getEQGroupLiist("grp");
|
||||
var lcList = Manager.DatabaseManager.getEQGroupLiist("linecode");
|
||||
var manuList = Manager.DatabaseManager.getEQGroupLiist("manu");
|
||||
var typeList = Manager.DatabaseManager.getEQGroupLiist("type");
|
||||
|
||||
cmbGrp.Items.Add("-- All --");
|
||||
cmbLine.Items.Add("-- All --");
|
||||
cmbManu.Items.Add("-- All --");
|
||||
cmbType.Items.Add("-- All --");
|
||||
|
||||
foreach (var item in grpList) this.cmbGrp.Items.Add(item);
|
||||
foreach (var item in lcList) this.cmbLine.Items.Add(item);
|
||||
foreach (var item in manuList) this.cmbManu.Items.Add(item);
|
||||
foreach (var item in typeList) this.cmbType.Items.Add(item);
|
||||
|
||||
cmbGrp.SelectedIndex = 0;
|
||||
cmbLine.SelectedIndex = 0;
|
||||
cmbManu.SelectedIndex = 0;
|
||||
cmbType.SelectedIndex = 0;
|
||||
|
||||
}
|
||||
|
||||
void Equipment_TableNewRow(object sender, DataTableNewRowEventArgs e)
|
||||
{
|
||||
e.Row["wuid"] = Pub.Login.no;
|
||||
e.Row["wdate"] = DateTime.Now;
|
||||
}
|
||||
|
||||
private void btSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
//select command
|
||||
if (this.ta.Adapter.SelectCommand == null) this.ta.Adapter.SelectCommand = new System.Data.SqlClient.SqlCommand();
|
||||
|
||||
//select query
|
||||
string newSQL = "select * from Equipment";
|
||||
string newWhere = string.Empty;
|
||||
if(cmbGrp.SelectedIndex != 0 && !cmbGrp.Text.isEmpty())
|
||||
{
|
||||
if (!newWhere.isEmpty()) newWhere += " and ";
|
||||
newWhere += "grp='" + cmbGrp.Text + "'";
|
||||
}
|
||||
if (this.cmbManu.SelectedIndex != 0 && !cmbManu.Text.isEmpty())
|
||||
{
|
||||
if (!newWhere.isEmpty()) newWhere += " and ";
|
||||
newWhere += "manu='" + cmbManu.Text + "'";
|
||||
}
|
||||
if (this.cmbLine.SelectedIndex != 0 && !cmbLine.Text.isEmpty())
|
||||
{
|
||||
if (!newWhere.isEmpty()) newWhere += " and ";
|
||||
newWhere += "linecode='" + cmbLine.Text + "'";
|
||||
}
|
||||
if (this.cmbType.SelectedIndex != 0 && !cmbType.Text.isEmpty())
|
||||
{
|
||||
if (!newWhere.isEmpty()) newWhere += " and ";
|
||||
newWhere += "[type]='" + cmbType.Text + "'";
|
||||
}
|
||||
if(!this.tbSearch.Text.isEmpty())
|
||||
{
|
||||
if (!newWhere.isEmpty()) newWhere += " and ";
|
||||
newWhere += string.Format("(asset like '%{0}%' or model like '%{0}%' or serial like '%{0}%')",tbSearch.Text);
|
||||
}
|
||||
if(radexpn.Checked)
|
||||
{
|
||||
if (!newWhere.isEmpty()) newWhere += " and ";
|
||||
newWhere += string.Format("isnull([except],0) = 0");
|
||||
}
|
||||
if (radexpy.Checked)
|
||||
{
|
||||
if (!newWhere.isEmpty()) newWhere += " and ";
|
||||
newWhere += string.Format("isnull([except],0) = 1");
|
||||
}
|
||||
if (this.radprionly.Checked)
|
||||
{
|
||||
if (!newWhere.isEmpty()) newWhere += " and ";
|
||||
newWhere += string.Format("isnull([primary],0) = 1");
|
||||
}
|
||||
if (newWhere.isEmpty()) ta.Adapter.SelectCommand.CommandText = newSQL;
|
||||
else ta.Adapter.SelectCommand.CommandText = newSQL + " where " + newWhere;
|
||||
this.dsMSSQL.Equipment.Clear();
|
||||
ta.Fill(this.dsMSSQL.Equipment);
|
||||
this.dsMSSQL.Equipment.AcceptChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user