private void FrmAddEditRowMaterial_Load(object sender, EventArgs e) { receiver = new RowMaterialReciever(); ConfigureStyle(); var headers = GetRowHeaders(); var measurements = GetMeasurements(); // Fill Combo Helpers.DataHelper helper = new Helpers.DataHelper(); helper.FillCombo(cmbRowHeaderName, headers); helper.FillCombo(cmbMeasurement, measurements); if (_model != null) { txtRowMaterial.Text = _model.RowMaterialName; cmbRowHeaderName.SelectedIndex = headers.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.RowHedarId.ToString()).Select(x => x.index).FirstOrDefault(); cmbMeasurement.SelectedIndex = measurements.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.MeasurmentId.ToString()).Select(x => x.index).FirstOrDefault(); toggleActive.Checked = _model.IsActive; } else { _model = new RowMaterialModel(); cmbRowHeaderName.SelectedIndex = 0; cmbMeasurement.SelectedIndex = 0; } }
public void DatabaseOperation(RowMaterialModel model) { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("@RowMaterialId", model.RowMaterialId.ToString()); parameters.Add("@RowMaterialName", model.RowMaterialName.ToString()); parameters.Add("@RowMaterialFlag", ""); parameters.Add("@MeasurmentId", model.MeasurmentId.ToString()); parameters.Add("@RowHedarId", model.RowHedarId.ToString()); parameters.Add("@IsActive", model.IsActive.ToString()); parameters.Add("@flag", model.Flag.ToString()); repo.Save(parameters); }
public void Delete(RowMaterialModel model) { model.Flag = Constants.DbConstants.Delete; DatabaseOperation(model); }
public void Add(RowMaterialModel model) { model.Flag = Constants.DbConstants.Add; DatabaseOperation(model); }
public FrmAddEditRowMaterial(RowMaterialModel model) { _model = model; InitializeComponent(); }