private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (dataGridView1.CurrentRow == null) { return; } this._selectCompany = dataGridView1.CurrentRow.DataBoundItem as FishEntity.CompanyEntity; _model = new PurchaseApplicationEntity( ); Ware = new WarehouseReceiptEntity(); _model.supplier = txtfullname.Text; _model.supplierAbb = txtShortName.Text; _model.supplierUser = cmbTheperson.Text; _model.account = _selectCompany.account; _model.Bank = _selectCompany.bank; Ware.shipMent = Ware.Receive = Ware.SupCom = Ware.AnalysisUnit = _model.buyer = _selectCompany.fullname; _model.buyerAbb = _selectCompany.shortname; Ware.shipMentUser = _model.buyerUser = _selectCompany.linkman; _model.shipName = _selectCompany.shortname; this.DialogResult = System.Windows.Forms.DialogResult.OK; }
public FormSelfMakeDetail(int productId) { InitializeComponent(); ReadColumnConfig(dataGridView1, "Set_SelfMakeDetail"); dataGridView1.BackgroundColor = this.BackColor; _productId = productId; DataSet ds = _bll.GetSelfSaleDetail(_productId); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; dt.Columns.Add("linkman", typeof(string)); FishBll.Bll.CompanyBll companybll = new FishBll.Bll.CompanyBll(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string companycode = ds.Tables[0].Rows[i]["yifangcode"].ToString(); FishEntity.CompanyEntity company = companybll.GetModelByCode(companycode); if (company != null) { dt.Rows[i]["linkman"] = company.linkman; } } } dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = ds.Tables[0]; //SetContractDetail(list); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (dataGridView1.CurrentRow == null) { return; } this._selectCompany = dataGridView1.CurrentRow.DataBoundItem as FishEntity.CompanyEntity; _model = new PurchaseApplicationEntity( ); _model.supplier = txtfullname.Text; _model.supplierAbb = txtShortName.Text; _model.supplierUser = cmbTheperson.Text; _model.buyer = _selectCompany.fullname; _model.buyerAbb = _selectCompany.shortname; _model.buyerUser = _selectCompany.linkman; this.DialogResult = System.Windows.Forms.DialogResult.OK; }