|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjMaterial;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjStock
|
|
|
|
|
{
|
|
|
|
|
public partial class FrmStock : Form
|
|
|
|
|
{
|
|
|
|
|
public FrmStock()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private StockView viewl;
|
|
|
|
|
public FrmStock(StockView view) : this()
|
|
|
|
|
{
|
|
|
|
|
this.viewl = view;
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Init()
|
|
|
|
|
{
|
|
|
|
|
var nameValueCollection = MaterialInfoTypeHelp.GetALL();
|
|
|
|
|
this.comboBox2.DataSource = nameValueCollection;
|
|
|
|
|
comboBox2.ValueMember = "Id";
|
|
|
|
|
comboBox2.DisplayMember = "Name";
|
|
|
|
|
var dataTable = StockDbHelp.GetById(viewl.Id);
|
|
|
|
|
if (dataTable.Rows.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
var dr = dataTable.Rows[0];
|
|
|
|
|
viewl.MTypeId = Convert.ToInt32(dr["MTypeId"]);
|
|
|
|
|
viewl.MId = Convert.ToInt32(dr["MId"]);
|
|
|
|
|
viewl.StockName = dr["StockName"].ToString();
|
|
|
|
|
this.TankName.Text = viewl.StockName;
|
|
|
|
|
this.TankName.Enabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (MyNameValue combo in comboBox2.Items)
|
|
|
|
|
{
|
|
|
|
|
if (combo.Id == viewl.MId)
|
|
|
|
|
{
|
|
|
|
|
comboBox2.SelectedItem = combo;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
viewl.MId = Convert.ToInt32(comboBox2.SelectedValue);
|
|
|
|
|
viewl.MName = comboBox2.Text;
|
|
|
|
|
|
|
|
|
|
StockDbHelp.Update(viewl);
|
|
|
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|