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.

77 lines
1.9 KiB
C#

using Mesnac.Action.ChemicalWeighing.LjMaterial;
using Mesnac.Action.ChemicalWeighing.LjMixFormula;
using Mesnac.Action.ChemicalWeighing.LjPlanning;
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 Mesnac.Action.ChemicalWeighing.LjMixManager
{
public partial class FrmMixC : Form
{
public FrmMixC()
{
InitializeComponent();
}
private int _id = 0;
private LjMixManagerView _view;
public FrmMixC(int id) : this()
{
this._id = id;
var lsCMixList = MixDb.GetMyNameValueStrs(3);
DrpMixC.DataSource = lsCMixList;
FillComboBox(DrpMixC);
_view = LjMixManagerDb.GetById(_id);
if (_view != null)
{
Checked(DrpMixC, _view.MixCId);
}
}
private void FillComboBox(ComboBox combo)
{
combo.ValueMember = "Id";
combo.DisplayMember = "Name";
}
private void Checked(ComboBox alBox, string checkId)
{
foreach (MyNameValueStr combo in alBox.Items)
{
if (combo.Id == checkId)
{
alBox.SelectedItem = combo;
break;
}
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOK_Click(object sender, EventArgs e)
{
_view.Id = _id;
_view.MixCId = DrpMixC.SelectedValue.ToString();
_view.MixCName = DrpMixC.Text;
LjMixManagerDb.UpdateMixC(_view);
this.DialogResult = DialogResult.OK;
}
}
}