private void dataGridView4_CellClick(object sender, DataGridViewCellEventArgs e) { //if ( e . ColumnIndex < 0 || e . RowIndex < 0 ) // return; //if ( dataGridView4 . Columns [ e . ColumnIndex ] . Name . Equals ( "yftdh" ,StringComparison . OrdinalIgnoreCase ) == true ) //{ // FormBilloflading from = new FormBilloflading ( ); // DialogResult result = from . ShowDialog ( ); // if ( result == DialogResult . OK ) // { // dataGridView4 . Rows [ e . RowIndex ] . Cells [ "yftdh" ] . Value = from . bdh; // } //} if (e.ColumnIndex < 0 || e.RowIndex < 0) { return; } if (dataGridView4.Columns[e.ColumnIndex].Name.Equals("yftdh", StringComparison.OrdinalIgnoreCase) == true) { FormBilloftable form = new FormBilloftable(); DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { bool isOk = true; FishEntity.BillofladingEntity _model = form.bil; for (int i = 0; i < dataGridView4.Rows.Count - 1; i++) { if (!string.IsNullOrEmpty(dataGridView1.Rows[i].Cells["product_id"].Value.ToString()))// && dataGridView1.Rows[i].Cells["product_id"].Value.ToString() == _model.Code { if (i != e.RowIndex) { isOk = false; break; } } } if (isOk == false) { return; } dataGridView4.Rows[e.RowIndex].Cells["yfcm"].Value = _model.Ferryname; dataGridView4.Rows[e.RowIndex].Cells["yftdh"].Value = _model.Listname; } } }
private void BillOfLadingid_Click(object sender, EventArgs e) { FormBilloftable from = new FormBilloftable(); from.StartPosition = FormStartPosition.CenterParent; if (from.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } if (from.bil == null) { return; } txtshipno.Text = from.bil.Ferryname; BillOfLadingid.Text = from.bil.Listname; Pileangle.Text = from.bil.Cornerno; txtAddress.Text = from.bil.Warehouse; Sellers.Text = from.bil.Contactsunit; Quantity.Text = from.bil.Packagenumber.ToString(); }