public void loadInputForm(DTO.DTO_Product product, bool isNew) { this.txt_product_id.Text = product.ProductID; this.txt_product_name.Text = product.ProductName; this.txt_product_price.Text = isNew ? "" : product.ProductPrice.ToString(); this.txt_product_unit.Text = product.ProductUnit; this.txt_product_amount.Text = isNew ? "" : product.ProductAmount.ToString(); }
private DTO.DTO_Product getProductInput() { DTO.DTO_Product product = new DTO.DTO_Product(); product.ProductID = this.txt_product_id.Text; product.ProductName = this.txt_product_name.Text; product.ProductAmount = int.Parse(this.txt_product_amount.Text.ToString()); product.ProductPrice = int.Parse(this.txt_product_price.Text.ToString()); product.ProductUnit = this.txt_product_unit.Text; return(product); }
private void grv_mat_hang_CellEnter(object sender, DataGridViewCellEventArgs e) { this.grv_mat_hang.Refresh(); if (e.RowIndex >= 0) { DTO.DTO_Product product = new DTO.DTO_Product(); product.ProductID = this.grv_mat_hang.Rows[e.RowIndex].Cells["MSMH"].Value.ToString(); product.ProductName = this.grv_mat_hang.Rows[e.RowIndex].Cells["TENMH"].Value.ToString(); product.ProductPrice = int.Parse(this.grv_mat_hang.Rows[e.RowIndex].Cells["DONGIA"].Value.ToString()); product.ProductAmount = int.Parse(this.grv_mat_hang.Rows[e.RowIndex].Cells["SL_TON"].Value.ToString()); product.ProductUnit = this.grv_mat_hang.Rows[e.RowIndex].Cells["DONVITINH"].Value.ToString(); this.loadInputForm(product, false); this.isDataInsert = true; } }