void tmiAddFish_Click(object sender, EventArgs e) { //OnClickFish(); FormNewFish form = new FormNewFish(); form.ShowDialog(); }
private void SeeFishDetail(int colidx, int rowidx) { if (colidx < 0 || rowidx < 0) { return; } if (dataGridView1.Columns[colidx].Name.Equals("code")) { string productidStr = dataGridView1.Rows[rowidx].Cells["code"].Value.ToString(); FormNewFish form = new FormNewFish(productidStr); form.MenuCode = "M007"; form.ShowDialog(); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 && e.RowIndex < 0) { this.DialogResult = DialogResult.Cancel; } if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("fishId", StringComparison.OrdinalIgnoreCase) == true) { if (dataGridView1.Rows[e.RowIndex].Cells["fishId"].Value.ToString() == "") { } FormNewFish from = new FormNewFish(dataGridView1.Rows[e.RowIndex].Cells["fishId"].Value.ToString()); from.ShowDialog(); } else if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("code", StringComparison.OrdinalIgnoreCase) == true) { FormQuotationPriceList from = new FormQuotationPriceList(dataGridView1.Rows[e.RowIndex].Cells["code"].Value.ToString()); from.ShowDialog(); } else if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("code", StringComparison.OrdinalIgnoreCase) != true && dataGridView1.Columns[e.ColumnIndex].Name.Equals("fishId", StringComparison.OrdinalIgnoreCase) != true) { _model = new FishEntity.QuotationPriceListEntity(); _model.fishId = dataGridView1.Rows[e.RowIndex].Cells["fishId"].Value.ToString(); if (_model.fishId == "") { _model.XNfishId = dataGridView1.Rows[e.RowIndex].Cells["XNfishId"].Value.ToString(); } if (dataGridView1.Rows[e.RowIndex].Cells["price"].Value != null && dataGridView1.Rows[e.RowIndex].Cells["price"].Value.ToString() != "") { _model.price = decimal.Parse(dataGridView1.Rows[e.RowIndex].Cells["price"].Value.ToString()); } _model.country = dataGridView1.Rows[e.RowIndex].Cells["country"].Value.ToString(); _model.brand = dataGridView1.Rows[e.RowIndex].Cells["brand"].Value.ToString(); _model.qualitySpe = dataGridView1.Rows[e.RowIndex].Cells["qualitySpe"].Value.ToString(); _model.protein = dataGridView1.Rows[e.RowIndex].Cells["protein"].Value.ToString(); _model.tvn = dataGridView1.Rows[e.RowIndex].Cells["tvn"].Value.ToString(); _model.histamine = dataGridView1.Rows[e.RowIndex].Cells["histamine"].Value.ToString(); _model.FFA = dataGridView1.Rows[e.RowIndex].Cells["ffa"].Value.ToString(); _model.acid = dataGridView1.Rows[e.RowIndex].Cells["acid"].Value.ToString(); _model.ash = dataGridView1.Rows[e.RowIndex].Cells["ash"].Value.ToString(); _model.salt = dataGridView1.Rows[e.RowIndex].Cells["salt"].Value.ToString(); _model.las = dataGridView1.Rows[e.RowIndex].Cells["las"].Value.ToString(); _model.das = dataGridView1.Rows[e.RowIndex].Cells["das"].Value.ToString(); _model.code = dataGridView1.Rows[e.RowIndex].Cells["code"].Value.ToString(); this.DialogResult = DialogResult.OK; } }