You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjTanNum/FrmTankNum.cs

105 lines
3.2 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using Mesnac.Action.ChemicalWeighing.LjMaterial;
namespace Mesnac.Action.ChemicalWeighing.LjTanNum
{
public partial class FrmTankNum : Form
{
public FrmTankNum()
{
InitializeComponent();
}
private TankNumCodingView _tankNumCodingView;
public FrmTankNum(TankNumCodingView view) : this()
{
_tankNumCodingView = view;
1 year ago
var dataTable = TankNumCodingDbHelp.GetById(view.Id);
if (dataTable.Rows.Count == 1)
{
var da = dataTable.Rows[0];
_tankNumCodingView.MTypeId = Convert.ToInt32(da["MTypeId"]);
_tankNumCodingView.MId = Convert.ToInt32(da["MId"]);
_tankNumCodingView.DayBinName = da["DayBinName"].ToString();
this.DayBinName.Text = _tankNumCodingView.DayBinName;
this.DayBinName.Enabled = false;
}
Init();
}
private void Init()
{
1 year ago
var drpMtype = MaterialInfoTypeHelp.GetType();
DrpType.ValueMember = "Id";
DrpType.DisplayMember = "Name";
this.DrpType.DataSource = drpMtype;
foreach (MyNameValue combo in DrpType.Items)
{
if (combo.Id == _tankNumCodingView.MTypeId)
{
1 year ago
DrpType.SelectedItem = combo;
break;
}
}
1 year ago
//
// var nameValueCollection = MaterialInfoTypeHelp.GetALLByTypeId(Convert.ToInt32(DrpType.SelectedValue));
// this.comboBox1.DataSource = nameValueCollection;
// comboBox1.ValueMember = "Id";
// comboBox1.DisplayMember = "Name";
//
//
// foreach (MyNameValue combo in comboBox1.Items)
// {
// if (combo.Id == _tankNumCodingView.MId)
// {
// comboBox1.SelectedItem = combo;
// break;
// }
// }
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
1 year ago
private void btnOK_Click(object sender, EventArgs e)
{
1 year ago
_tankNumCodingView.MTypeId =Convert.ToInt32(DrpType.SelectedValue);
_tankNumCodingView.MId =Convert.ToInt32(comboBox1.SelectedValue);
_tankNumCodingView.MTypeName = DrpType.Text;
_tankNumCodingView.MName = comboBox1.Text;
1 year ago
TankNumCodingDbHelp.Update(_tankNumCodingView);
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
1 year ago
private void DrpType_SelectedIndexChanged(object sender, EventArgs e)
{
1 year ago
var nameValueCollection = MaterialInfoTypeHelp.GetALL();
1 year ago
this.comboBox1.DataSource = nameValueCollection;
comboBox1.ValueMember = "Id";
comboBox1.DisplayMember = "Name";
}
private void FrmTankNum_Load(object sender, EventArgs e)
{
}
}
}