public SpecificationView Translate(Specification spec) { SpecificationView view = new SpecificationView(spec); return view; }
private void btnAddSpec_Click(object sender, EventArgs e) { try { //IList<SpecificationView> list = (IList<SpecificationView>)SpecDataGridView.DataSource; List<SpecificationView> list = (List<SpecificationView>) this.ApSpecDataGridView .Tag; SpecificationView spec = new SpecificationView(); spec.SpecifiText = ApSpeciText.Text; if (string.IsNullOrEmpty(ApUnitPrice.Text)) { spec.UnitPrice = 0; } else { spec.UnitPrice = Convert.ToDouble(ApUnitPrice.Text); } spec.UnitId = ApUnit.SelectedValue.ToString(); spec.Barcode = ApBarcode.Text; //spec.SpecifiText = "11"; //spec.Barcode = "111"; //spec.UnitId = "37163f05-48c2-4a1f-88c4-347e05e0fb25"; list.Add(spec); DataGridViewManager.RebindListDataSource<SpecificationView>(ApSpecDataGridView, list); for (int i = 0; i < list.Count; i++) { ApSpecDataGridView.Rows[i].Cells["SLShowUnit"].Value = list[i].UnitId; } } catch (Exception ex) { Toast.Show(ex.Message); } }
public Specification Translate(SpecificationView view) { Specification spec = new Specification(); spec.Id = view.Id; spec.UnitPrice = view.UnitPrice; spec.SpecifiText = view.SpecifiText; spec.Barcode = view.Barcode; spec.Unit = UnitDao.Get(view.UnitId); spec.IsDel = view.IsDel; return spec; }
private void UpAddSpec_Click(object sender, EventArgs e) { try { List<SpecificationView> list = (List<SpecificationView>)this.UpSpecDataGridView.DataSource; SpecificationView spec = new SpecificationView(); list.Add(spec); DataGridViewManager.RebindListDataSource<SpecificationView>(UpSpecDataGridView, list); for (int i = 0; i < list.Count; i++) { UpSpecDataGridView.Rows[i].Cells["UpSlShowUnit"].Value = list[i].UnitId; } } catch (Exception ex) { Toast.Show(ex.Message); } }