private void dgvCellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } optrowid = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); if (!String.IsNullOrEmpty(optrowid)) { model = dal.GetModel(Int32.Parse(optrowid)); if (model != null) { txtOderNo.Text = model.o_no; txtkhid.Text = model.o_busy.ToString(); modelz = dalz.GetModel((int)model.o_busy); txtCustomer.Text = modelz.h_name; txtsum.Text = model.o_sum; txtdesc.Text = model.o_desc; txtuser.Text = model.o_user; txtnum.Text = model.o_num + ""; DataTable dt = dalt.GetList(" p_id='" + model.o_pid + "'").Tables[0]; if (dt.Rows.Count > 0) { txtname.Text = dt.Rows[0]["p_name"].ToString(); txtProdNo.Text = dt.Rows[0]["p_no"].ToString(); } } } }
private void getStr(string _no) { mode = der.GetModel(Convert.ToInt32(txtorder.SelectedValue)); String provider = Convert.ToString(mode.o_busy); string reStr = ""; if (!string.IsNullOrEmpty(_no)) { //DataTable dt = dalt.GetList(" p_no='" + _no + "' and p_rzfid=" + txtorder.SelectedValue).Tables[0]; DataTable dt = dalt.GetList(" p_no='" + _no + "' and p_rzfid=" + provider).Tables[0]; if (dt.Rows.Count == 0) { MessageBox.Show("该订单所属商家下无此商品"); return; } txttyid.Text = dt.Rows[0]["p_id"].ToString(); reStr = dt.Rows.Count > 0 ? dt.Rows[0]["p_name"].ToString() : ""; txtname.Text = reStr; } }